diff --git a/.github/actions/cleanup-workspace/action.yml b/.github/actions/cleanup-workspace/action.yml new file mode 100644 index 0000000000..45f042703d --- /dev/null +++ b/.github/actions/cleanup-workspace/action.yml @@ -0,0 +1,14 @@ +name: Clean runner workspace +description: Removes all the files from the runner working directory + +runs: + using: composite + steps: + - name: Remove files and directories from working directory + shell: bash + run: | + rm -rf * + rm -rf ~/.cargo + rm -rf ~/.cache + echo "Running 'ls -al' on $(pwd)" + ls -al diff --git a/.github/actions/run-e2e-test/action.yml b/.github/actions/run-e2e-test/action.yml index 9fa577e213..751acaadc7 100644 --- a/.github/actions/run-e2e-test/action.yml +++ b/.github/actions/run-e2e-test/action.yml @@ -12,7 +12,7 @@ inputs: default: '4' test-case: description: 'Name of test to run.' - required: true + required: false randomized: description: 'Whether to use randomized test params.' required: false @@ -26,6 +26,26 @@ inputs: follow-up-finalization-check: description: 'Whether to run a follow-up finalization check.' required: false + deploy-adder: + description: 'Whether to deploy the adder sample contract to the node.' + required: false + default: 'false' + deploy-button: + description: 'Whether to deploy the button game contracts to the node.' + required: false + default: 'false' + image-path: + description: 'Custom path to docker image for aleph-node' + required: false + default: aleph-test-docker + node-image: + description: 'Custom name of aleph-node image' + required: false + default: aleph-node:latest + compose-file: + description: 'Custom docker-compose configuration' + required: false + default: '' runs: using: 'composite' @@ -34,7 +54,7 @@ runs: - name: Download artifact with docker image uses: actions/download-artifact@v2 with: - name: aleph-test-docker + name: ${{ inputs.image-path }} - name: Load node docker image shell: bash @@ -42,7 +62,7 @@ runs: - name: Run consensus party shell: bash - run: ./.github/scripts/run_consensus.sh -m ${{ inputs.min-validator-count }} -n ${{ inputs.node-count }} + run: NODE_IMAGE=${{ inputs.node-image }} DOCKER_COMPOSE=${{ inputs.compose-file }} ./.github/scripts/run_consensus.sh -m ${{ inputs.min-validator-count }} -n ${{ inputs.node-count }} - name: Sleep shell: bash @@ -53,15 +73,18 @@ runs: run: docker logs Node0 --follow & - name: Download artifact with the test suite image + if: inputs.test-case != '' uses: actions/download-artifact@v2 with: name: aleph-e2e-client - name: Load test suite docker image + if: inputs.test-case != '' shell: bash run: docker load -i aleph-e2e-client.tar - name: Run single e2e test + if: inputs.test-case != '' shell: bash run: | ARGS=( @@ -72,7 +95,7 @@ runs: RESERVED_SEATS="${{ inputs.reserved-seats }}" NON_RESERVED_SEATS="${{ inputs.non-reserved-seats }}" - + if [[ -n "${RANDOMIZED}" ]]; then ARGS+=(-r "${RANDOMIZED}") fi @@ -84,16 +107,25 @@ runs: ) fi + DEPLOY_ADDER="${{ inputs.deploy-adder }}" + + if [[ "${DEPLOY_ADDER}" = "true" ]]; then + pushd contracts/adder + export ADDER=$(./deploy.sh) + popd + fi + + DEPLOY_BUTTON="${{ inputs.deploy-button }}" + + if [[ "${DEPLOY_BUTTON}" = "true" ]]; then + source contracts/env/dev + contracts/scripts/deploy.sh + source contracts/scripts/test_env.sh + fi + ./.github/scripts/run_e2e_test.sh "${ARGS[@]}" - name: Run finalization e2e test if: inputs.follow-up-finalization-check == 'true' shell: bash - run: ./.github/scripts/run_e2e_test.sh -t finalization -m "${{ inputs.min-validator-count }}" - - - name: Print debug if failed - if: ${{ failure() }} - shell: bash - run: | - cd bin/cliain - cargo run -- --seed //Alice debug-storage + run: ./.github/scripts/run_e2e_test.sh -t finalization::finalization -m "${{ inputs.min-validator-count }}" diff --git a/.github/scripts/check_finalization.sh b/.github/scripts/check_finalization.sh index aa27fefe9d..1611056317 100755 --- a/.github/scripts/check_finalization.sh +++ b/.github/scripts/check_finalization.sh @@ -1,18 +1,12 @@ #!/bin/bash -## USAGE -## .github/scripts/check_finalization.sh -## if are empty default values will be used (127.0.0.1, 9933 and host) -## - -RPC_HOST=${1:-127.0.0.1} -RPC_PORT=${2:-9933} -NETWORK=${3:-host} - +RPC_HOST=${RPC_HOST:-127.0.0.1} +RPC_PORT=${RPC_PORT:-9933} LAST_FINALIZED="" +VALIDATOR=${VALIDATOR:-damian} while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do - block_hash=$(docker run --network $NETWORK appropriate/curl:latest \ + block_hash=$(docker run --rm --network container:$VALIDATOR appropriate/curl:latest \ -H "Content-Type: application/json" \ -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getFinalizedHead"}' http://$RPC_HOST:$RPC_PORT | jq '.result') ret_val=$? @@ -21,7 +15,7 @@ while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do continue fi - finalized_block=$(docker run --network $NETWORK appropriate/curl:latest \ + finalized_block=$(docker run --rm --network container:$VALIDATOR appropriate/curl:latest \ -H "Content-Type: application/json" \ -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock", "params": ['$block_hash']}' http://$RPC_HOST:$RPC_PORT | jq '.result.block.header.number') @@ -31,9 +25,9 @@ while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do continue else LAST_FINALIZED=$finalized_block - echo "Last finalized block number: $LAST_FINALIZED" fi done +echo "Last finalized block number: $LAST_FINALIZED" exit $? diff --git a/.github/scripts/run_consensus.sh b/.github/scripts/run_consensus.sh index e8ebae3372..d1e8092645 100755 --- a/.github/scripts/run_consensus.sh +++ b/.github/scripts/run_consensus.sh @@ -3,15 +3,19 @@ set -euo pipefail # default node count -# change when increasing the number of node containers NODE_COUNT=5 +# max node count that will not crash current GH machines +MAX_NODE_COUNT=6 +# default minimum validator count MIN_VALIDATOR_COUNT=4 +DOCKER_COMPOSE=${DOCKER_COMPOSE:-"docker/docker-compose.yml"} OVERRIDE_DOCKER_COMPOSE=${OVERRIDE_DOCKER_COMPOSE:-""} +NODE_IMAGE=${NODE_IMAGE:-aleph-node:latest} # default minimum validator count MIN_VALIDATOR_COUNT=4 -export NODE_IMAGE=aleph-node:latest +export NODE_IMAGE mkdir -p docker/data/ @@ -49,6 +53,11 @@ done export NODE_COUNT +if [[ ${NODE_COUNT} -gt ${MAX_NODE_COUNT} ]]; then + echo "Tried to run ${NODE_COUNT} nodes. Max node count allowed: ${MAX_NODE_COUNT}." + exit 1 +fi + function generate_authorities { local authorities_count="$1" @@ -83,19 +92,20 @@ function generate_bootnode_peer_id { function run_containers { local authorities_count="$1" - local override_file="$2" + local docker_compose_file="$2" + local override_file="$3" echo "Running ${authorities_count} containers..." if [[ -z ${override_file} ]]; then - docker-compose -f docker/docker-compose.yml up -d + docker-compose -f "${docker_compose_file}" up -d else - docker-compose -f docker/docker-compose.yml -f "${override_file}" up -d + docker-compose -f "${docker_compose_file}" -f "${override_file}" up -d fi } authorities=$(generate_authorities ${NODE_COUNT}) generate_chainspec "${authorities[@]}" "${MIN_VALIDATOR_COUNT}" generate_bootnode_peer_id ${authorities[0]} -run_containers ${NODE_COUNT} "${OVERRIDE_DOCKER_COMPOSE}" +run_containers ${NODE_COUNT} "${DOCKER_COMPOSE}" "${OVERRIDE_DOCKER_COMPOSE}" exit $? diff --git a/.github/scripts/run_e2e_test.sh b/.github/scripts/run_e2e_test.sh index a1a2fcbbe7..05538b5e68 100755 --- a/.github/scripts/run_e2e_test.sh +++ b/.github/scripts/run_e2e_test.sh @@ -59,7 +59,7 @@ function set_randomized_test_params { ARGS=( --network "container:Node0" - -e NODE_URL="127.0.0.1:9943" + -e NODE_URL="ws://127.0.0.1:9943" -e RUST_LOG=info ) @@ -111,6 +111,30 @@ if [[ -n "${ONLY_LEGACY:-}" ]]; then ARGS+=(-e ONLY_LEGACY) fi -docker run -v $(pwd)/docker/data:/data "${ARGS[@]}" aleph-e2e-client:latest +if [[ -n "${ADDER:-}" ]]; then + ARGS+=(-e "ADDER=${ADDER}") + ARGS+=(-e "ADDER_METADATA=/contracts/adder/target/ink/adder.json") +fi + +if [[ -n "${BUTTON_GAME_METADATA:-}" ]]; then + ARGS+=(-e "THE_PRESSIAH_COMETH=${THE_PRESSIAH_COMETH}") + ARGS+=(-e "EARLY_BIRD_SPECIAL=${EARLY_BIRD_SPECIAL}") + ARGS+=(-e "BACK_TO_THE_FUTURE=${BACK_TO_THE_FUTURE}") + ARGS+=(-e "SIMPLE_DEX=${SIMPLE_DEX}") + ARGS+=(-e "WRAPPED_AZERO=${WRAPPED_AZERO}") + ARGS+=(-e "RUST_LOG=${RUST_LOG}") + ARGS+=(-e "BUTTON_GAME_METADATA=/contracts/button/target/ink/button.json") + ARGS+=(-e "TICKET_TOKEN_METADATA=/contracts/ticket_token/target/ink/ticket_token.json") + ARGS+=(-e "REWARD_TOKEN_METADATA=/contracts/game_token/target/ink/game_token.json") + ARGS+=(-e "MARKETPLACE_METADATA=/contracts/marketplace/target/ink/marketplace.json") + ARGS+=(-e "SIMPLE_DEX_METADATA=/contracts/simple_dex/target/ink/simple_dex.json") + ARGS+=(-e "WRAPPED_AZERO_METADATA=/contracts/wrapped_azero/target/ink/wrapped_azero.json") +fi + +if [[ -n "${OUT_LATENCY:-}" ]]; then + ARGS+=(-e OUT_LATENCY) +fi + +docker run -v "$(pwd)/contracts:/contracts" -v "$(pwd)/docker/data:/data" "${ARGS[@]}" aleph-e2e-client:latest exit $? diff --git a/.github/scripts/run_smartnet.sh b/.github/scripts/run_smartnet.sh index 1a65cb68c0..d838711704 100755 --- a/.github/scripts/run_smartnet.sh +++ b/.github/scripts/run_smartnet.sh @@ -2,7 +2,7 @@ set -e -export NODE_IMAGE=public.ecr.aws/p6e8q1z1/feature-env-aleph-node:fe-benjamin_c643069 +export NODE_IMAGE=public.ecr.aws/p6e8q1z1/aleph-node:latest # key derived from "//0" export NODE_ID=5D34dL5prEUaGNQtPPZ3yN5Y6BnkfXunKXXz6fo7ZJbLwRRH diff --git a/.github/scripts/test_catch_up.sh b/.github/scripts/test_catch_up.sh index 02c939c1f3..5bf57537b1 100755 --- a/.github/scripts/test_catch_up.sh +++ b/.github/scripts/test_catch_up.sh @@ -15,4 +15,5 @@ chmod +x "$ALEPH_NODE_BINARY" pip install -r requirements.txt echo 'Running test' +export PYTHONUNBUFFERED=y exec ./test_catch_up.py diff --git a/.github/scripts/test_multiple_restarts.sh b/.github/scripts/test_multiple_restarts.sh index 2fac49d3e3..f7fbdf02bc 100755 --- a/.github/scripts/test_multiple_restarts.sh +++ b/.github/scripts/test_multiple_restarts.sh @@ -19,4 +19,5 @@ chmod +x "$ALEPH_NODE_BINARY" pip install -r requirements.txt echo 'Running test' +export PYTHONUNBUFFERED=y exec ./test_multiple_restarts.py diff --git a/.github/workflows/build-and-push-cliain.yaml b/.github/workflows/build-and-push-cliain.yaml index 6db5757121..5e05a604b3 100644 --- a/.github/workflows/build-and-push-cliain.yaml +++ b/.github/workflows/build-and-push-cliain.yaml @@ -9,7 +9,7 @@ on: jobs: build-image: name: Build binary - runs-on: ubuntu-20.04 + runs-on: self-hosted steps: - name: GIT | Checkout source code uses: actions/checkout@v2 @@ -17,6 +17,12 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.6.1' + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Cargo | Build release binary run: | cd ./bin/cliain && cargo build --release @@ -24,18 +30,20 @@ jobs: - name: GIT | Get branch name and commit SHA id: get_branch uses: ./.github/actions/get-branch - + - name: Login to ECR uses: docker/login-action@v1 with: registry: public.ecr.aws username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} - + - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@master - + uses: docker/setup-buildx-action@v2 + with: + version: v0.9.1 + - name: Build and push latest docker image id: build-image env: diff --git a/.github/workflows/build-docs.yaml b/.github/workflows/build-docs.yaml new file mode 100644 index 0000000000..af24cdbdef --- /dev/null +++ b/.github/workflows/build-docs.yaml @@ -0,0 +1,20 @@ +# this workflow builds rustdoc for aleph-node crates +name: build-docs + +on: + push: + +jobs: + build-aleph-client-docs: + name: Build docs + runs-on: self-hosted + steps: + - name: GIT | Checkout source code + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + + - name: rustdoc | Build aleph-client docs + run: | + cd aleph-client && cargo doc --no-deps diff --git a/.github/workflows/build-node-and-runtime.yml b/.github/workflows/build-node-and-runtime.yml index 2c18a059f7..52de31dd48 100644 --- a/.github/workflows/build-node-and-runtime.yml +++ b/.github/workflows/build-node-and-runtime.yml @@ -12,30 +12,33 @@ on: required: false type: string - jobs: build: name: Build binary artifacts - runs-on: ubuntu-20.04 + runs-on: self-hosted env: RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache + SECRETS_AWS_MAINNET_ACCESS_KEY_ID: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} + SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} + SECRETS_AWS_DEVNET_ACCESS_KEY_ID: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }} + SECRETS_AWS_DEVNET_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }} steps: - name: Checkout source code uses: actions/checkout@v2 with: ref: ${{ inputs.ref }} + - name: Get branch name and commit SHA + id: get_branch + uses: ./.github/actions/get-branch + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 - name: Install WASM target run: rustup target add wasm32-unknown-unknown - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: release - cache-version: v2 - name: Build binary and runtime run: cargo build --profile production -p aleph-node @@ -56,6 +59,46 @@ jobs: if-no-files-found: error retention-days: 7 + + - name: S3 CI MAINNET | Configure AWS credentials + if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != '' + uses: aws-actions/configure-aws-credentials@v1 + env: + AWS_ACCESS_KEY_ID: "" + AWS_SECRET_ACCESS_KEY: "" + AWS_SESSION_TOKEN: "" + AWS_DEFAULT_REGION: "" + AWS_REGION: us-east-1 + with: + aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: S3 CI MAINNET | Copy release binary to S3 bucket + if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != '' + shell: bash + env: + BINARY_DIR: target/production + BINARY_FILE: aleph-node + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-node + S3BUCKET_FILE: aleph-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz + run: | + tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }} + aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }} + + - name: S3 CI MAINNET | Copy release runtime to S3 bucket + if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != '' + shell: bash + env: + BINARY_DIR: target/production/wbuild/aleph-runtime + BINARY_FILE: aleph_runtime.compact.wasm + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime + S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz + run: | + tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }} + aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }} + + - name: Build test binary run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals only_legacy" @@ -75,5 +118,26 @@ jobs: if-no-files-found: error retention-days: 7 - - name: Cleanup cache - uses: ./.github/actions/post-cache + - name: S3 CI MAINNET | Copy test binary to S3 bucket + if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != '' + shell: bash + env: + BINARY_DIR: target/release + BINARY_FILE: aleph-node + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-node + S3BUCKET_FILE: aleph-test-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz + run: | + tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }} + aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }} + + - name: S3 CI MAINNET | Copy test runtime to S3 bucket + if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != '' + shell: bash + env: + BINARY_DIR: target/release/wbuild/aleph-runtime + BINARY_FILE: aleph_runtime.compact.wasm + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-runtime + S3BUCKET_FILE: aleph-test-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz + run: | + tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }} + aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }} diff --git a/.github/workflows/build-send-postsync-hook-runtime-image.yml b/.github/workflows/build-send-postsync-hook-runtime-image.yml index 8788e1a1bb..e2253bb80d 100644 --- a/.github/workflows/build-send-postsync-hook-runtime-image.yml +++ b/.github/workflows/build-send-postsync-hook-runtime-image.yml @@ -16,7 +16,7 @@ concurrency: jobs: build: name: Save cliain binary as an artifact - runs-on: ubuntu-20.04 + runs-on: self-hosted env: CARGO_INCREMENTAL: 0 steps: @@ -33,6 +33,12 @@ jobs: - name: Install rust toolchain uses: actions-rs/toolchain@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.6.1' + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build binary run: | pushd bin/cliain/ @@ -71,7 +77,7 @@ jobs: docker tag ${{ env.ECR_PUSH_IMAGE }} ${{ env.ECR_LATEST }} docker push ${{ env.ECR_LATEST }} - + - name: GIT | Checkout aleph-apps repo uses: actions/checkout@master with: @@ -84,8 +90,8 @@ jobs: with: kustomize-version: "3.8.6" - - name: Update postsync hook docker image - env: + - name: Update postsync hook docker image + env: RELEASE_IMAGE: public.ecr.aws/p6e8q1z1/runtime-update-hook:${{ steps.vars.outputs.sha_short }} REGIONS_AWS: 'eu-central-1' run: | diff --git a/.github/workflows/check-excluded-packages.yml b/.github/workflows/check-excluded-packages.yml index 05b161daa1..40de1f91c8 100644 --- a/.github/workflows/check-excluded-packages.yml +++ b/.github/workflows/check-excluded-packages.yml @@ -17,9 +17,29 @@ concurrency: jobs: build: name: Check excluded packages - runs-on: ubuntu-20.04 + runs-on: self-hosted + strategy: + matrix: + package: [ + flooder, + e2e-tests, + aleph-client, + fork-off, + benches/payout-stakers, + bin/cliain, + contracts/access_control, + contracts/button, + contracts/game_token, + contracts/marketplace, + contracts/simple_dex, + contracts/ticket_token, + contracts/wrapped_azero, + contracts/adder, + scripts/synthetic-network/synthetic-link, + ] env: CARGO_INCREMENTAL: 0 + RUSTC_WRAPPER: sccache steps: - name: Checkout source code uses: actions/checkout@v2 @@ -27,54 +47,14 @@ jobs: - name: Install rust toolchain uses: actions-rs/toolchain@v1 - - name: Install clippy and fmt - run: rustup component add clippy rustfmt - - - name: Install WASM target - run: rustup target add wasm32-unknown-unknown - - - name: Read excluded packages from Cargo.toml - id: read_excluded - uses: SebRollen/toml-action@v1.0.0 - with: - file: 'Cargo.toml' - field: 'workspace.exclude' - - - name: Format output - id: format_output + - name: Check excluded package run: | - packages="$(echo ${{ steps.read_excluded.outputs.value }} | sed 's/[][,]/ /g' | sed 's/\s\+/\n/g' | sed '/^$/d')" - targets="$(echo "$packages" | sed -r 's/[A-Za-z0-9_/-]+/&\/target\//g')" - - packages="${packages//$'\n'/'%0A'}" - targets="${targets//$'\n'/'%0A'}" - - echo "::set-output name=packages::$packages" - echo "::set-output name=targets::$targets" - - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: excluded - cargo-key: excluded - cache-version: v2 - cargo-targets: "${{ steps.format_output.outputs.targets }}" - - - name: Check excluded packages - env: - RUSTC_WRAPPER: "" - RUSTC_WORKSPACE_WRAPPER: sccache - run: | - packages="${{ steps.format_output.outputs.packages }}" - for p in ${packages[@]} - do - echo "Checking package $p..." - pushd "$p" - cargo fmt --all --check - cargo clippy --all-features -- --no-deps -D warnings + cd ${{ matrix.package }} + rustup component add clippy rustfmt + rustup target add wasm32-unknown-unknown + cargo fmt --all --check + cargo clippy --all-features -- --no-deps -D warnings + if [ ${{ matrix.package }} != "e2e-tests" ] + then cargo test - popd - done - - - name: Cleanup cache - uses: ./.github/actions/post-cache + fi diff --git a/.github/workflows/contracts-e2e-tests-and-deploy.yaml b/.github/workflows/contracts-deploy.yml similarity index 69% rename from .github/workflows/contracts-e2e-tests-and-deploy.yaml rename to .github/workflows/contracts-deploy.yml index 282b321c18..d43988de97 100644 --- a/.github/workflows/contracts-e2e-tests-and-deploy.yaml +++ b/.github/workflows/contracts-deploy.yml @@ -1,12 +1,7 @@ name: contracts-e2e-tests-and-deploy on: - pull_request: - types: - - labeled - - opened - - created - push: + workflow_call: # DO NOT TOUCH THIS: concurrency: @@ -16,128 +11,13 @@ concurrency: env: CACHE_KEY: fe-benjamin-button CONTRACTS_ENVFILE: fe-benjamin - CARGOCONTRACT_REV: 2b1758756de59bd81e7bed5f8429d364f281cb9a NODE_VERSION: 16 S3BUCKET_PATH: contracts/fe-benjamin-button jobs: - run-tests: - name: Run smart contracts test suite - runs-on: ubuntu-20.04 - env: - RUST_BACKTRACE: full - steps: - - - name: Checkout Source code - uses: actions/checkout@v3 - - - name: Install binaryen - run: | - wget https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz - tar xvzf binaryen-version_101-x86_64-linux.tar.gz - cd binaryen-version_101 - sudo cp -r bin/* /bin - sudo cp -r include/* /usr/include - sudo cp -r lib64/* /lib64 - - - name: Display binaryen version - shell: bash - run: wasm-opt --version - - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - - - name: Install WASM target - run: rustup target add wasm32-unknown-unknown - - - name: Install rust-src - run: rustup component add rust-src - - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: e2e-contracts - cargo-key: e2e-contracts - cache-version: v3 - cargo-targets: | - e2e-tests/target/ - contracts/access_control/target/ - contracts/button/target/ - contracts/game_token/target/ - contracts/marketplace/target/ - contracts/simple_dex/target/ - contracts/ticket_token/target/ - contracts/wrapped_azero/target/ - - # TODO : this should NOT be built every time - - name: Install cargo-contract - run: | - cargo install cargo-dylint@2.1.1 dylint-link@2.1.1 --force - # revision merging Hans's PR changes [fix for node URL parsing ] - cargo install --git https://github.com/paritytech/cargo-contract.git --rev ${{ env.CARGOCONTRACT_REV }} --force - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} - aws-region: eu-central-1 - - - name: Login to Private Amazon ECR - id: login-private-ecr - uses: docker/login-action@v1 - with: - registry: 573243519133.dkr.ecr.us-east-1.amazonaws.com - username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} - env: - AWS_REGION: us-east-1 - - - name: Run one-node smartnet - shell: bash - run: | - .github/scripts/run_smartnet.sh & - - - name: Display node logs - shell: bash - run: | - docker logs smartnode --follow & - - # wait some while docker pulls the image and starts the node - - name: Wait for finalization - shell: bash - run: | - .github/scripts/check_finalization.sh - timeout-minutes: 1 - - - name: Run e2e tests - shell: bash - run: | - source ./contracts/env/dev && ./contracts/scripts/deploy.sh && ./contracts/scripts/test.sh - - - name: Cleanup cache - uses: ./.github/actions/post-cache - - slack: - name: Slack notification - runs-on: ubuntu-latest - needs: [run-tests] - if: always() - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Send Slack message - uses: ./.github/actions/slack-notification - with: - notify-on: "failure" - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - build_and_deploy_contracts: name: Deploy contracts on feature environment if: (github.event_name == 'push' && github.ref_name == 'benjamin') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == '[AZERO] DEPLOY-CONTRACTS') - needs: [run-tests] runs-on: ubuntu-20.04 steps: - name: Checkout repo @@ -201,13 +81,11 @@ jobs: . "$HOME/.cargo/env" cargo install dylint-link cargo-dylint - # TODO : this should NOT be built every time - - name: Install cargo-contract with bug fixes around URL parsing - run: | - . "$HOME/.cargo/env" - cargo install --git https://github.com/paritytech/cargo-contract.git --rev ${{ env.CARGOCONTRACT_REV }} --force - - # TODO: Cache some files from contracts directory to fasten up builds, is that possible? + - name: Install cargo-contract + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-contract + version: "2.0.1" - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 diff --git a/.github/workflows/deploy-feature-envs.yaml b/.github/workflows/deploy-feature-envs.yaml index 1886dce81f..88248c76a3 100644 --- a/.github/workflows/deploy-feature-envs.yaml +++ b/.github/workflows/deploy-feature-envs.yaml @@ -11,9 +11,9 @@ env: LABEL_DESTROYED: 'DESTROYED' LABEL_DEPLOYED: 'DEPLOYED' LABEL_DEPLOYED_CONTRACTS: 'DEPLOYED-CONTRACTS' - REGISTRY_HOST: 573243519133.dkr.ecr.us-east-1.amazonaws.com - FE_ALEPHNODE_REGISTRY: 573243519133.dkr.ecr.us-east-1.amazonaws.com/feature-env-aleph-node - FE_ALEPHNODE_REGISTRY_ESCAPED: '573243519133.dkr.ecr.us-east-1.amazonaws.com\/feature-env-aleph-node' + REGISTRY_HOST: public.ecr.aws + FE_ALEPHNODE_REGISTRY: public.ecr.aws/p6e8q1z1/feature-env-aleph-node + FE_ALEPHNODE_REGISTRY_ESCAPED: 'public.ecr.aws\/p6e8q1z1\/feature-env-aleph-node' FE_IMAGETAG_PREFIX: 'fe-' FE_APP_PREFIX: 'fe-' PUBLIC_ALEPHNODE_REGISTRY: public.ecr.aws/p6e8q1z1/aleph-node @@ -31,6 +31,7 @@ jobs: if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV') name: Build runtime and aleph-node binary artefacts uses: ./.github/workflows/build-node-and-runtime.yml + secrets: inherit push_pr_image: if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV') @@ -67,7 +68,7 @@ jobs: username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} - - name: Push FE aleph-node image to the private feature-env-aleph-node registry + - name: Push FE aleph-node image to the feature-env-aleph-node registry env: IMAGE_TAG: ${{ env.FE_IMAGETAG_PREFIX }}${{ steps.get_branch.outputs.branch_imagetag_full }} run: | diff --git a/.github/workflows/deploy-mainnet.yml b/.github/workflows/deploy-mainnet.yml index fdff14f645..b984fb29d6 100644 --- a/.github/workflows/deploy-mainnet.yml +++ b/.github/workflows/deploy-mainnet.yml @@ -22,8 +22,8 @@ jobs: id: vars shell: bash run: | - echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT + echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -72,6 +72,30 @@ jobs: docker push ${{ env.DOCKERHUB_MAINNET_IMAGE }} docker push ${{ env.DOCKERHUB_MAINNET_LATEST_IMAGE }} + - name: S3 CI | Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + env: + AWS_REGION: us-east-1 + with: + aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: S3 CI | Download release runtime from S3 bucket + shell: bash + env: + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.vars.outputs.sha_short }}/aleph-runtime + S3BUCKET_FILE: aleph-runtime-${{ steps.vars.outputs.sha_short }}.tar.gz + run: | + aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }} + + - name: RELEASE ASSET | Add runtime to the release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + aleph-runtime-${{ steps.vars.outputs.sha_short }}.tar.gz + - name: GIT | Checkout aleph-apps repo uses: actions/checkout@master with: diff --git a/.github/workflows/deploy-testnet.yml b/.github/workflows/deploy-testnet.yml index d5e108431d..8c3a740c70 100644 --- a/.github/workflows/deploy-testnet.yml +++ b/.github/workflows/deploy-testnet.yml @@ -23,8 +23,8 @@ jobs: id: vars shell: bash run: | - echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT + echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -40,8 +40,6 @@ jobs: registry: public.ecr.aws username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} - env: - AWS_REGION: us-east-1 - name: Tag and push image for Testnet env: @@ -79,6 +77,21 @@ jobs: docker push ${{ env.DOCKERHUB_TESTNET_IMAGE }} docker push ${{ env.DOCKERHUB_TESTNET_LATEST_IMAGE }} + - name: S3 CI | Download release runtime from S3 bucket + shell: bash + env: + S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.vars.outputs.sha_short }}/aleph-runtime + S3BUCKET_FILE: aleph-runtime-${{ steps.vars.outputs.sha_short }}.tar.gz + run: | + aws s3 cp ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }} + + - name: RELEASE ASSET | Add runtime to the release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + aleph-runtime-${{ steps.vars.outputs.sha_short }}.tar.gz + - name: GIT | Checkout aleph-apps repo uses: actions/checkout@master with: diff --git a/.github/workflows/deploy-to-devnet.yml b/.github/workflows/deploy-to-devnet.yml index e7b430bd88..9687480835 100644 --- a/.github/workflows/deploy-to-devnet.yml +++ b/.github/workflows/deploy-to-devnet.yml @@ -1,5 +1,11 @@ name: Deploy to Devnet +# This workflow performs automatic deployment of aleph-node to the Devnet environment +# It does it from the scratch, ie it +# 1) syncs the validators keys from S3, +# 2) generates raw chainspec from the deployed aleph-node binary, +# 3) restart nodes with cleaned db + on: workflow_dispatch: @@ -22,8 +28,7 @@ jobs: id: vars shell: bash run: | - echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -49,58 +54,50 @@ jobs: with: version: 'v1.23.6' - - name: Run fork-off update - env: - RELEASE_TAG: ${{ steps.vars.outputs.sha_short }} - + - name: Sync all validator's keystores from S3 run: | #!/bin/bash - - COMMIT_ID=$(curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_version"}' https://rpc.test.azero.dev | jq -r '.result' | cut -d "-" -f 2 | head -c 7) - echo $COMMIT_ID - - # sync all validator's keystores from S3 aws s3 cp s3://alephzero-devnet-eu-central-1-keys-bucket/data data --recursive - # rename validator paths declare -A NAMES=([aleph-node-validator-0]=5D34dL5prEUaGNQtPPZ3yN5Y6BnkfXunKXXz6fo7ZJbLwRRH [aleph-node-validator-1]=5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o [aleph-node-validator-2]=5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9 [aleph-node-validator-3]=5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK [aleph-node-validator-4]=5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW [aleph-node-validator-5]=5EFb84yH9tpcFuiKUcsmdoF7xeeY3ajG1ZLQimxQoFt9HMKR [aleph-node-validator-6]=5DZLHESsfGrJ5YzT3HuRPXsSNb589xQ4Unubh1mYLodzKdVY [aleph-node-validator-7]=5GHJzqvG6tXnngCpG7B12qjUvbo5e4e9z8Xjidk3CQZHxTPZ [aleph-node-validator-8]=5CUnSsgAyLND3bxxnfNhgWXSe9Wn676JzLpGLgyJv858qhoX [aleph-node-validator-9]=5CVKn7HAZW1Ky4r7Vkgsr7VEW88C2sHgUNDiwHY9Ct2hjU8q) - for NAME in "${!NAMES[@]}"; do mv -v data/$NAME data/${NAMES[$NAME]} done - # generate chainspec, it will reuse keys from the synced keystore - docker run -i -v $(pwd)/data:/data --env RUST_BACKTRACE=1 --entrypoint "/usr/local/bin/aleph-node" public.ecr.aws/p6e8q1z1/aleph-node:${COMMIT_ID} bootstrap-chain --raw --base-path /data --chain-id a0dnet1 --account-ids 5D34dL5prEUaGNQtPPZ3yN5Y6BnkfXunKXXz6fo7ZJbLwRRH,5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o,5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9,5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK,5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW,5EFb84yH9tpcFuiKUcsmdoF7xeeY3ajG1ZLQimxQoFt9HMKR,5DZLHESsfGrJ5YzT3HuRPXsSNb589xQ4Unubh1mYLodzKdVY,5GHJzqvG6tXnngCpG7B12qjUvbo5e4e9z8Xjidk3CQZHxTPZ,5CUnSsgAyLND3bxxnfNhgWXSe9Wn676JzLpGLgyJv858qhoX,5CVKn7HAZW1Ky4r7Vkgsr7VEW88C2sHgUNDiwHY9Ct2hjU8q --sudo-account-id 5F4SvwaUEQubiqkPF8YnRfcN77cLsT2DfG4vFeQmSXNjR7hD > chainspec.skeleton.json - - docker run -i -v $(pwd):/app public.ecr.aws/p6e8q1z1/fork-off:latest --ws-rpc-endpoint=wss://ws.test.azero.dev --initial-spec-path=chainspec.skeleton.json --combined-spec-path=chainspec.json + - name: Generate chainspec + env: + RELEASE_TAG: ${{ steps.vars.outputs.sha_short }} + run: | + #!/bin/bash + aws s3 cp s3://alephzero-devnet-eu-central-1-keys-bucket/data data --recursive + docker run -i -v $(pwd)/data:/data --env RUST_BACKTRACE=1 --entrypoint "/usr/local/bin/aleph-node" public.ecr.aws/p6e8q1z1/aleph-node:${RELEASE_TAG} bootstrap-chain --raw --base-path /data --chain-id a0dnet1 --account-ids 5D34dL5prEUaGNQtPPZ3yN5Y6BnkfXunKXXz6fo7ZJbLwRRH,5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o,5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9,5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK,5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW,5EFb84yH9tpcFuiKUcsmdoF7xeeY3ajG1ZLQimxQoFt9HMKR,5DZLHESsfGrJ5YzT3HuRPXsSNb589xQ4Unubh1mYLodzKdVY,5GHJzqvG6tXnngCpG7B12qjUvbo5e4e9z8Xjidk3CQZHxTPZ,5CUnSsgAyLND3bxxnfNhgWXSe9Wn676JzLpGLgyJv858qhoX,5CVKn7HAZW1Ky4r7Vkgsr7VEW88C2sHgUNDiwHY9Ct2hjU8q --sudo-account-id 5F4SvwaUEQubiqkPF8YnRfcN77cLsT2DfG4vFeQmSXNjR7hD > chainspec.json aws s3 cp chainspec.json s3://alephzero-devnet-eu-central-1-keys-bucket/chainspec.json - # stop and clean devnet - + - name: Stop and purge db Devnet + run: | + #!/bin/bash aws eks --region eu-central-1 update-kubeconfig --name alephzero-devnet-eu-central-1-eks kubectl delete sts aleph-node-validator -n devnet --ignore-not-found=true kubectl delete pvc -l app=aleph-node-validator -n devnet --ignore-not-found=true - kubectl delete job send-runtime-hook -n devnet --ignore-not-found=true - - cd aleph-apps/aleph-node-validators/overlays/devnet/eu-central-1 - kustomize edit set image "aleph-node-validator-image-placeholder=public.ecr.aws/p6e8q1z1/aleph-node:${COMMIT_ID}" - kustomize edit remove resource send-runtime-hook.yaml - kustomize build . | kubectl apply -f - - sleep 2 - kubectl rollout status --watch --timeout=3600s statefulset/aleph-node-validator -n devnet - echo "Waiting 15 minutes" - sleep 900 + - name: Start Devnet + env: + RELEASE_TAG: ${{ steps.vars.outputs.sha_short }} + run: | + #!/bin/bash + cd aleph-apps/aleph-node-validators/overlays/devnet/eu-central-1 kustomize edit set image "aleph-node-validator-image-placeholder=public.ecr.aws/p6e8q1z1/aleph-node:${RELEASE_TAG}" kustomize build . | kubectl apply -f - sleep 2 kubectl rollout status --watch --timeout=3600s statefulset/aleph-node-validator -n devnet - kustomize edit add resource send-runtime-hook.yaml - kustomize build . | kubectl apply -f - + - name: Waiting 5 minutes for validators to boot + run: | + #!/bin/bash + sleep 300 - name: GIT | Commit changes to aleph-apps repository. uses: EndBug/add-and-commit@v5.1.0 diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index 94299ca870..10121bf32f 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -5,12 +5,14 @@ on: paths-ignore: - '*.md' branches: + - benjamin - main - "release-*" push: paths-ignore: - '*.md' branches: + - benjamin - main - "release-*" workflow_dispatch: @@ -23,11 +25,12 @@ jobs: build-new-node: name: Build node and runtime artifacts (PR version) uses: ./.github/workflows/build-node-and-runtime.yml + secrets: inherit build-test-docker: needs: [build-new-node] name: Build docker image with the test node artifact - runs-on: ubuntu-20.04 + runs-on: self-hosted steps: - name: Checkout Source code uses: actions/checkout@v2 @@ -53,13 +56,43 @@ jobs: if-no-files-found: error retention-days: 7 + build-cliain-image: + name: Build docker image for cliain + runs-on: self-hosted + env: + RUSTC_WRAPPER: sccache + steps: + - name: GIT | Checkout source code + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + + - name: Cargo | Build release binary + run: | + cd bin/cliain && cargo build --release + + - name: Build docker image + run: | + cd bin/cliain + docker build --tag cliain:latest -f ./Dockerfile . + docker save -o cliain.tar cliain:latest + + - name: Upload test docker image + uses: actions/upload-artifact@v2 + with: + name: cliain-docker + path: ./bin/cliain/cliain.tar + if-no-files-found: error + retention-days: 7 check-determinism: needs: [build-new-node] name: Verify runtime build determinism - runs-on: ubuntu-20.04 + runs-on: self-hosted env: RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache steps: - name: Checkout Source code uses: actions/checkout@v2 @@ -87,12 +120,12 @@ jobs: cargo build --profile production -p aleph-runtime sha256sum -c checksum.sha256 - build-test-client: name: Build e2e test client suite - runs-on: ubuntu-20.04 + runs-on: self-hosted env: RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache steps: - name: Checkout Source code uses: actions/checkout@v2 @@ -100,24 +133,14 @@ jobs: - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: e2e - cargo-key: e2e - cache-version: v2 - cargo-targets: e2e-tests/target/ - - name: Build binary and docker image run: | cd e2e-tests/ - cargo build --release + rm -f target/release/deps/aleph_e2e_client* + cp $(cargo test --no-run --release --message-format=json | jq -r .executable | grep aleph_e2e_client) target/release/aleph-e2e-client docker build --tag aleph-e2e-client:latest -f Dockerfile . docker save -o aleph-e2e-client.tar aleph-e2e-client:latest - - name: Stop cache - uses: ./.github/actions/post-cache - - name: Upload Artifact uses: actions/upload-artifact@v2 with: @@ -126,6 +149,28 @@ jobs: if-no-files-found: error retention-days: 7 + run-aleph-client-subxt-codegen-check: + needs: [build-test-docker] + name: Checks if runtime file in aleph-client is up-to-date + # disabling this check as it causes troubles + # this should be reworked to sth like https://github.com/paritytech/subxt/blob/master/examples/examples/metadata_compatibility.rs + if: false + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run one node in the background + uses: ./.github/actions/run-e2e-test + with: + node-count: 1 + min-validator-count: 1 + + - name: check if runtime metadata matches + run: | + cd aleph-client + docker pull public.ecr.aws/p6e8q1z1/subxt-client-integration:latest + docker run --rm --network host --mount type=bind,source="$(pwd)/..",target=/subxt/aleph-node public.ecr.aws/p6e8q1z1/subxt-client-integration:latest run-e2e-finalization-test: needs: [build-test-docker, build-test-client] @@ -138,7 +183,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: finalization + test-case: finalization::finalization timeout-minutes: 2 @@ -153,7 +198,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: rewards_disable_node + test-case: rewards::disable_node follow-up-finalization-check: true timeout-minutes: 15 @@ -264,21 +309,6 @@ jobs: follow-up-finalization-check: true timeout-minutes: 3 - - run-e2e-fee-calculation: - needs: [build-test-docker, build-test-client] - name: Run e2e fee calculation test - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: actions/checkout@v2 - - - name: Run e2e test - uses: ./.github/actions/run-e2e-test - with: - test-case: fee_calculation - timeout-minutes: 2 - run-e2e-validators-rotate: needs: [build-test-docker, build-test-client] name: Run validators rotation test @@ -305,7 +335,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: era_payout + test-case: era_payout::era_payout follow-up-finalization-check: true timeout-minutes: 10 @@ -335,7 +365,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: rewards_force_new_era + test-case: rewards::force_new_era follow-up-finalization-check: true timeout-minutes: 10 @@ -350,7 +380,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: rewards_stake_change + test-case: rewards::points_stake_change follow-up-finalization-check: true timeout-minutes: 10 @@ -365,7 +395,7 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: rewards_change_stake_and_force_new_era + test-case: rewards::change_stake_and_force_new_era follow-up-finalization-check: true timeout-minutes: 10 @@ -417,6 +447,21 @@ jobs: follow-up-finalization-check: true timeout-minutes: 15 + run-e2e-ban-manual: + needs: [build-test-docker, build-test-client] + name: Run ban manual test + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run e2e test + uses: ./.github/actions/run-e2e-test + with: + test-case: ban_manual + follow-up-finalization-check: true + timeout-minutes: 15 + run-e2e-ban-counter-clearing: needs: [build-test-docker, build-test-client] name: Run ban counter clearing test @@ -432,6 +477,36 @@ jobs: follow-up-finalization-check: true timeout-minutes: 15 + run-e2e-ban-threshold: + needs: [build-test-docker, build-test-client] + name: Run ban threshold test + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run e2e test + uses: ./.github/actions/run-e2e-test + with: + test-case: ban_threshold + follow-up-finalization-check: true + timeout-minutes: 15 + + run-e2e-permissionless-ban: + needs: [ build-test-docker, build-test-client ] + name: Run permissionless ban test + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run e2e test + uses: ./.github/actions/run-e2e-test + with: + test-case: permissionless_ban + follow-up-finalization-check: true + timeout-minutes: 15 + run-e2e-version-upgrade: needs: [build-test-docker, build-test-client] name: Run basic (positive) version-upgrade test @@ -443,17 +518,17 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: version_upgrade + test-case: finality_version::schedule_version_change env: UPGRADE_VERSION: 1 UPGRADE_SESSION: 3 UPGRADE_FINALIZATION_WAIT_SESSIONS: 2 timeout-minutes: 10 - run-e2e-failing-version-upgrade: + run-e2e-adder-contract-test: needs: [build-test-docker, build-test-client] - name: Run basic (failing) version-upgrade test - runs-on: ubuntu-20.04 + name: Run e2e adder contract test + runs-on: self-hosted steps: - name: Checkout source code uses: actions/checkout@v2 @@ -461,18 +536,109 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: doomed_version_upgrade - env: - OVERRIDE_DOCKER_COMPOSE: ./.github/scripts/docker-compose.no_quorum_without_old.override.yml - UPGRADE_VERSION: 1 - UPGRADE_SESSION: 3 - UPGRADE_FINALIZATION_WAIT_SESSIONS: 2 - ONLY_LEGACY: true + deploy-adder: true + test-case: adder timeout-minutes: 10 - run-e2e-ban-manual: + run-e2e-button-contract-tests: needs: [build-test-docker, build-test-client] - name: Run ban manual test + name: Run e2e button game contract tests + runs-on: self-hosted + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run e2e test + uses: ./.github/actions/run-e2e-test + with: + deploy-button: true + test-case: button + timeout-minutes: 60 + +# The tests below were written under the assumption that nonfinalized blocks are being produced, they need a rewrite before being reenabled. +# TODO(A0-1644): Reenable these tests. +# run-e2e-failing-version-upgrade: +# needs: [build-test-docker, build-test-client] +# name: Run basic (failing) version-upgrade test +# runs-on: ubuntu-20.04 +# steps: +# - name: Checkout source code +# uses: actions/checkout@v2 +# +# - name: Run e2e test +# uses: ./.github/actions/run-e2e-test +# with: +# test-case: doomed_version_upgrade +# env: +# OVERRIDE_DOCKER_COMPOSE: ./.github/scripts/docker-compose.no_quorum_without_old.override.yml +# UPGRADE_VERSION: 1 +# UPGRADE_SESSION: 3 +# UPGRADE_FINALIZATION_WAIT_SESSIONS: 2 +# ONLY_LEGACY: true +# timeout-minutes: 10 +# run-e2e-version-upgrade-catchup: +# needs: [build-test-docker, build-cliain-image] +# name: Run series of tests where some of the nodes need to do version-upgrade during catch-up +# runs-on: ubuntu-20.04 +# strategy: +# matrix: +# include: +# - nodes: "Node1" +# ports: "9934" +# ext_status: "finalized" +# upgrade_before_disable: "true" +# +# - nodes: "Node1" +# ports: "9934" +# ext_status: "finalized" +# upgrade_before_disable: "false" +# +# - nodes: "Node1:Node2" +# ports: "9934:9935" +# ext_status: "in-block" +# upgrade_before_disable: "true" +# +# - nodes: "Node1:Node2" +# ports: "9934:9935" +# ext_status: "in-block" +# upgrade_before_disable: "false" +# steps: +# - name: Checkout source code +# uses: actions/checkout@v2 +# +# - name: Download artifact with docker image for aleph-node +# uses: actions/download-artifact@v2 +# with: +# name: aleph-test-docker +# +# - name: Load node docker image +# shell: bash +# run: docker load -i aleph-node.tar +# +# - name: Download artifact with docker image for cliain +# uses: actions/download-artifact@v2 +# with: +# name: cliain-docker +# +# - name: Load cliain docker image +# shell: bash +# run: docker load -i cliain.tar +# +# - name: Call catchup_test.sh +# timeout-minutes: 10 +# env: +# UPGRADE_BLOCK: 31 +# NODES: ${{ matrix.nodes }} +# PORTS: ${{ matrix.ports }} +# EXT_STATUS: ${{ matrix.ext_status }} +# UPGRADE_BEFORE_DISABLE: ${{ matrix.upgrade_before_disable }} +# DOCKER_COMPOSE: docker/docker-compose.bridged.yml +# run: | +# ./scripts/catchup_version_upgrade_test.sh + + run-e2e-finality-version-change: + needs: [build-test-docker, build-test-client] + name: Run finality version change test runs-on: ubuntu-20.04 steps: - name: Checkout source code @@ -481,11 +647,20 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: ban_manual + test-case: finality_version::finality_version_change follow-up-finalization-check: true - timeout-minutes: 15 + timeout-minutes: 10 + + deploy-button: + name: Deploy button contracts + needs: run-e2e-button-contract-tests + uses: ./.github/workflows/contracts-deploy.yml + secrets: inherit check-e2e-test-suite-completion: +# run-e2e-authorities-are-staking, +# run-e2e-failing-version-upgrade, +# run-e2e-version-upgrade-catchup, needs: [ run-e2e-finalization-test, run-e2e-rewards-disable-node-test, @@ -496,7 +671,6 @@ jobs: run-e2e-staking-era-payouts-test, run-e2e-staking-new-validator-test, run-e2e-change-validators-test, - run-e2e-fee-calculation, run-e2e-validators-rotate, run-e2e-era-payout, run-e2e-era-validators, @@ -506,10 +680,14 @@ jobs: run-e2e-rewards-points-basic, run-e2e-authorities-are-staking, run-e2e-ban-automatic, - run-e2e-ban-counter-clearing, run-e2e-ban-manual, + run-e2e-ban-counter-clearing, + run-e2e-ban-threshold, run-e2e-version-upgrade, - run-e2e-failing-version-upgrade, + run-e2e-permissionless-ban, + run-e2e-adder-contract-test, + run-e2e-button-contract-tests, + run-e2e-finality-version-change, ] name: Check e2e test suite completion runs-on: ubuntu-20.04 @@ -517,7 +695,6 @@ jobs: - name: All e2e tests completed run: echo "All e2e tests completed." - push-image: needs: [check-e2e-test-suite-completion] name: Push node image to the ECR @@ -578,6 +755,9 @@ jobs: name: Test catching up runs-on: ubuntu-20.04 needs: build-new-node + strategy: + matrix: + pruning: ['', '--state-pruning 90'] steps: - name: Checkout source code uses: actions/checkout@v2 @@ -597,12 +777,15 @@ jobs: env: # Relative to local-tests/ directory ALEPH_NODE_BINARY: aleph-test-node/aleph-node - run: ./.github/scripts/test_catch_up.sh + run: ./.github/scripts/test_catch_up.sh ${{ matrix.pruning }} test-multiple-restarts: name: Test multiple restarts runs-on: ubuntu-20.04 needs: build-new-node + strategy: + matrix: + pruning: ['', '--state-pruning 2048'] steps: - name: Checkout source code uses: actions/checkout@v2 @@ -622,7 +805,7 @@ jobs: env: # Relative to local-tests/ directory ALEPH_NODE_BINARY: aleph-release-node/aleph-node - run: ./.github/scripts/test_multiple_restarts.sh + run: ./.github/scripts/test_multiple_restarts.sh ${{ matrix.pruning }} check-runtime-change: name: Inspect whether runtime version has been changed (compared with main) @@ -648,8 +831,12 @@ jobs: build-new-runtime-and-try_runtime: name: Build new runtime and try_runtime tool needs: [ check-runtime-change ] - if: ${{ needs.check-runtime-change.outputs.runtime-updated != 0 }} - runs-on: ubuntu-20.04 + # Disbled check, reenable once we fix the issue with try-runtime test + # if: ${{ needs.check-runtime-change.outputs.runtime-updated != 0 }} + if: ${{ false }} + runs-on: self-hosted + env: + RUSTC_WRAPPER: sccache steps: - name: Checkout source code uses: actions/checkout@v3 @@ -660,12 +847,6 @@ jobs: - name: Install WASM target run: rustup target add wasm32-unknown-unknown - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: try-runtime - cache-version: v2 - - name: Build try-runtime run: cargo build --release -p aleph-node --features "try-runtime" @@ -688,12 +869,9 @@ jobs: if-no-files-found: error retention-days: 7 - - name: Cleanup cache - uses: ./.github/actions/post-cache - test-runtime-update: name: Test runtime update with try-runtime tool - runs-on: ubuntu-20.04 + runs-on: self-hosted needs: [ build-new-runtime-and-try_runtime ] steps: - name: Checkout source code @@ -739,3 +917,4 @@ jobs: notify-on: "failure" env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + diff --git a/.github/workflows/nightly-pipeline.yaml b/.github/workflows/nightly-pipeline.yaml index 72b5a3df0a..5356c26b1c 100644 --- a/.github/workflows/nightly-pipeline.yaml +++ b/.github/workflows/nightly-pipeline.yaml @@ -12,6 +12,7 @@ jobs: build-new-node: name: Build node and runtime artifacts (PR version) uses: ./.github/workflows/build-node-and-runtime.yml + secrets: inherit build-test-docker: needs: [build-new-node] @@ -42,12 +43,44 @@ jobs: if-no-files-found: error retention-days: 7 + build-synthetic-network-docker: + needs: [build-test-docker] + name: Build docker image with the test node artifact and support for synthetic-network + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Download artifact with docker image for aleph-node + uses: actions/download-artifact@v2 + with: + name: aleph-test-docker + + - name: Load node docker image + shell: bash + run: docker load -i aleph-node.tar + + - name: Build test docker image + id: build-image + run: | + scripts/synthetic-network/build_synthetic-network.sh + docker save -o aleph-node.tar aleph-node:syntheticnet + + - name: Upload test docker image + uses: actions/upload-artifact@v2 + with: + name: aleph-test-synthetic-docker + path: aleph-node.tar + if-no-files-found: error + retention-days: 7 + check-determinism: needs: [build-new-node] name: Verify runtime build determinism runs-on: ubuntu-20.04 env: RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache steps: - name: Checkout source code uses: actions/checkout@v2 @@ -80,6 +113,7 @@ jobs: runs-on: ubuntu-20.04 env: RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache steps: - name: Checkout source code uses: actions/checkout@v2 @@ -87,24 +121,14 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: e2e - cargo-key: e2e - cache-version: v2 - cargo-targets: e2e-tests/target/ - - name: Build binary and docker image run: | cd e2e-tests/ - cargo build --release + rm -f target/release/deps/aleph_e2e_client* + cp $(cargo test --no-run --release --message-format=json | jq -r .executable | grep aleph_e2e_client) target/release/aleph-e2e-client docker build --tag aleph-e2e-client:latest -f Dockerfile . docker save -o aleph-e2e-client.tar aleph-e2e-client:latest - - name: Stop cache - uses: ./.github/actions/post-cache - - name: Upload artifact uses: actions/upload-artifact@v2 with: @@ -113,9 +137,26 @@ jobs: if-no-files-found: error retention-days: 7 - run-e2e-authorities-are-staking: - needs: [build-test-docker, build-test-client] - name: Run authorities are staking test + run-e2e-high-out-latency: + needs: [build-synthetic-network-docker, build-test-client] + name: Run high out-latency test + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Run e2e test + uses: ./.github/actions/run-e2e-test + with: + test-case: high_out_latency_for_all + image-path: aleph-test-synthetic-docker + node-image: aleph-node:syntheticnet + compose-file: docker/docker-compose.synthetic-network.yml + timeout-minutes: 30 + + run-e2e-no-quorum-without-high-out-latency: + needs: [build-synthetic-network-docker, build-test-client] + name: Run high out-latency for every quorum runs-on: ubuntu-20.04 steps: - name: Checkout source code @@ -124,13 +165,16 @@ jobs: - name: Run e2e test uses: ./.github/actions/run-e2e-test with: - test-case: authorities_are_staking - randomized: true - timeout-minutes: 60 + test-case: high_out_latency_for_each_quorum + image-path: aleph-test-synthetic-docker + node-image: aleph-node:syntheticnet + compose-file: docker/docker-compose.synthetic-network.yml + timeout-minutes: 15 check-e2e-test-suite-completion: needs: [ - run-e2e-authorities-are-staking, + run-e2e-high-out-latency, + run-e2e-no-quorum-without-high-out-latency, ] name: Check e2e test suite completion runs-on: ubuntu-20.04 diff --git a/.github/workflows/push-foundation-repo.yml b/.github/workflows/push-foundation-repo.yml index 5af41ef9ed..5632c8487e 100644 --- a/.github/workflows/push-foundation-repo.yml +++ b/.github/workflows/push-foundation-repo.yml @@ -2,16 +2,78 @@ name: Sync Cardinal-Cryptography repo with Aleph-Zero-Foundation repo on: push: - branches: [main] + branches: + - main + - release-** + tags: + - r-* jobs: - sync: + sync-main: runs-on: ubuntu-20.04 - if: ${{ github.repository == 'Cardinal-Cryptography/aleph-node'}} + if: github.repository == 'Cardinal-Cryptography/aleph-node' && startsWith(github.ref, 'refs/heads/') && github.ref_name == 'main' steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 token: ${{ secrets.SYNCAZF }} + - name: Push to Aleph-Zero-Foundation run: git push https://x-access-token:${{ secrets.SYNCAZF }}@github.com/aleph-zero-foundation/aleph-node.git + + + sync-release-branch: + runs-on: ubuntu-20.04 + if: github.repository == 'Cardinal-Cryptography/aleph-node' && startsWith(github.ref, 'refs/heads/') && startsWith(github.ref_name, 'release-') + steps: + - name: GIT | Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.SYNCAZF }} + + - name: Get branch name and commit SHA + id: get_branch + shell: bash + env: + HEAD_REF: ${{ github.ref }} + run: | + echo branch_name=$(echo ${HEAD_REF#refs/heads/}) >> $GITHUB_OUTPUT + echo sha_short=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + + - name: Push to Aleph-Zero-Foundation + run: | + git push 'https://x-access-token:${{ secrets.SYNCAZF }}@github.com/aleph-zero-foundation/aleph-node.git' ${{ steps.get_branch.outputs.branch_name }}:${{ steps.get_branch.outputs.branch_name }} + + + sync-release-tag: + runs-on: ubuntu-20.04 + if: github.repository == 'Cardinal-Cryptography/aleph-node' && startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get tag name and commit SHA + id: get_branch + shell: bash + env: + HEAD_REF: ${{ github.ref }} + run: | + echo tag_name=$(echo ${HEAD_REF#refs/tags/}) >> $GITHUB_OUTPUT + echo sha_short=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + + - name: Checkout Aleph-Zero-Foundation repository + uses: actions/checkout@v3 + with: + repository: aleph-zero-foundation/aleph-node + token: "${{ secrets.SYNCAZF }}" + path: aleph-zero-foundation-aleph-node + fetch-depth: 0 + + - name: Checkout commit SHA and add tag in Aleph-Zero-Foundation repository + run: | + cd aleph-zero-foundation-aleph-node/ + git checkout "${{ steps.get_branch.outputs.sha_short }}" + git tag "${{ steps.get_branch.outputs.tag_name }}" + git push origin "${{ steps.get_branch.outputs.tag_name }}" diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 028bf1018b..d84ae3b03d 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -17,9 +17,10 @@ concurrency: jobs: check-test-and-lint: name: Run check, test and lints - runs-on: ubuntu-20.04 + runs-on: self-hosted env: CARGO_INCREMENTAL: 0 + RUSTC_WRAPPER: sccache steps: - name: Checkout Source code uses: actions/checkout@v2 @@ -33,12 +34,6 @@ jobs: - name: Install WASM target run: rustup target add wasm32-unknown-unknown - - name: Restore cache - uses: ./.github/actions/restore-cache - with: - target-key: debug - cache-version: v2 - - name: Run Format Checks uses: actions-rs/cargo@v1 with: @@ -53,13 +48,10 @@ jobs: RUSTC_WORKSPACE_WRAPPER: sccache with: command: clippy - args: -- --no-deps -D warnings + args: --all-targets --all-features -- --no-deps -D warnings - name: Run Unit Test Suite uses: actions-rs/cargo@v1 with: command: test args: --lib --features "try-runtime" - - - name: Cleanup cache - uses: ./.github/actions/post-cache diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..2a602c4b2c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "scripts/synthetic-network/vendor/synthetic-network"] + path = scripts/synthetic-network/vendor/synthetic-network + url = https://github.com/daily-co/synthetic-network.git diff --git a/BUILD.md b/BUILD.md index e734364527..1356f56dd5 100644 --- a/BUILD.md +++ b/BUILD.md @@ -53,7 +53,7 @@ is stored at `/lib64/ld-linux-x86-64.so.2`, you can execute `patchelf --set-inte aleph-node>`. Alternatively, you can use our nix-build script (used by docker based approach), i.q. `nix/nix-build.sh`. Note: we recommend using `direnv` together with `nix-direnv` for setting up nix-shell. This way you can use your preferred shell, -instead of one provided by nix-shell. +instead of one provided by nix-shell. Example configuration for `direnv`. Copy it into `.envrc` file and then run `direnv-allow`: ``` # installs nix-direnv, https://github.com/nix-community/nix-direnv @@ -88,7 +88,7 @@ It might influence some of the build scripts of our build dependencies and it mi the environment flags related with the build process, like `CXXFLAGS` etc. Example build procedure using Ubuntu 20.04 LTS and bash shell: ``` -sudo apt install build-essential curl git clang libclang-dev pkg-config libssl-dev +sudo apt install build-essential curl git clang libclang-dev pkg-config libssl-dev protobuf-compiler curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" git clone https://github.com/Cardinal-Cryptography/aleph-node.git diff --git a/Cargo.lock b/Cargo.lock index 728c03f488..16918de76a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,16 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli", + "gimli 0.26.2", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.2", ] [[package]] @@ -27,6 +36,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "aead" version = "0.4.3" @@ -34,6 +52,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array 0.14.6", + "rand_core 0.6.4", +] + +[[package]] +name = "aead" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" +dependencies = [ + "crypto-common", + "generic-array 0.14.6", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", ] [[package]] @@ -48,27 +88,72 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "aes" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +dependencies = [ + "cfg-if", + "cipher 0.4.3", + "cpufeatures", +] + [[package]] name = "aes-gcm" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "aead", - "aes", + "aead 0.4.3", + "aes 0.7.5", "cipher 0.3.0", - "ctr", - "ghash", + "ctr 0.8.0", + "ghash 0.4.4", + "subtle", +] + +[[package]] +name = "aes-gcm" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" +dependencies = [ + "aead 0.5.1", + "aes 0.8.2", + "cipher 0.4.3", + "ctr 0.9.2", + "ghash 0.5.0", "subtle", ] +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + [[package]] name = "aggregator" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/aleph-node.git?tag=aggregator-v0.1.0#5e7e4300e92b2b4c6fd18acd2f430b83e6e28903" +version = "0.2.1" +source = "git+https://github.com/Cardinal-Cryptography/aleph-node.git?tag=aggregator-v0.2.1#95a6b02ccd2295f9d4c21ece2b0721a4b99e1ee5" dependencies = [ - "aleph-bft-rmc 0.4.0", - "aleph-bft-types 0.6.0", + "aleph-bft-rmc 0.5.2", + "aleph-bft-types 0.7.2", "async-trait", "futures", "log", @@ -78,10 +163,10 @@ dependencies = [ [[package]] name = "aggregator" -version = "0.2.0" +version = "0.3.0" dependencies = [ - "aleph-bft-rmc 0.5.1", - "aleph-bft-types 0.6.0", + "aleph-bft-rmc 0.6.1", + "aleph-bft-types 0.8.1", "async-trait", "futures", "log", @@ -100,23 +185,35 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph-bft" -version = "0.18.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d802f8bc4d40b1acf5c895a27463866eae7537fc30a5f5884cfde7a01464630c" +checksum = "9cc671f15e05082b6ae350d40d83964fa92e26ead5d1b739f83ce130bd733e2d" dependencies = [ - "aleph-bft-rmc 0.4.0", - "aleph-bft-types 0.6.0", + "aleph-bft-rmc 0.5.2", + "aleph-bft-types 0.7.2", "async-trait", "derivative", "futures", @@ -130,12 +227,13 @@ dependencies = [ [[package]] name = "aleph-bft" -version = "0.19.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cc671f15e05082b6ae350d40d83964fa92e26ead5d1b739f83ce130bd733e2d" +checksum = "a3e70117d5481f1194ceafcf71d027377717d6fc738fc10a1433f412bb5bdc4d" dependencies = [ - "aleph-bft-rmc 0.5.1", - "aleph-bft-types 0.7.2", + "aleph-bft-rmc 0.6.1", + "aleph-bft-types 0.8.1", + "anyhow", "async-trait", "derivative", "futures", @@ -145,13 +243,14 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "rand 0.8.5", + "thiserror", ] [[package]] name = "aleph-bft-crypto" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba414eaabb61c300a93267e7d07133a960fc417df394086da804b032ead6b715" +checksum = "fcc63efe80dacbfe53bc008aab6a24e864142198355b1a9a4f31543246e3d63f" dependencies = [ "async-trait", "bit-vec", @@ -162,9 +261,9 @@ dependencies = [ [[package]] name = "aleph-bft-crypto" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc63efe80dacbfe53bc008aab6a24e864142198355b1a9a4f31543246e3d63f" +checksum = "39ef65bb0b342d411e32789cdf722cbf163667e1656577ef356221c5aebf75c9" dependencies = [ "async-trait", "bit-vec", @@ -175,11 +274,11 @@ dependencies = [ [[package]] name = "aleph-bft-rmc" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14bb3b9c3729667084ae9c1257e785219e23e1d1ee246f73b18a9457aead6214" +checksum = "38c317cd1a7c5b9208fd02c8f33ea7a89b55be1181ccc42da45e12dbefb66209" dependencies = [ - "aleph-bft-crypto 0.4.0", + "aleph-bft-crypto 0.5.2", "async-trait", "futures", "futures-timer", @@ -189,11 +288,11 @@ dependencies = [ [[package]] name = "aleph-bft-rmc" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1190a7b2af2c25bd0f318a9a45c05603e5f93cd170be7da15a10c33f2c8153bc" +checksum = "e1a34546c3d75df640c0224294be256fd0c17ed3f7191367124ece4d93753061" dependencies = [ - "aleph-bft-crypto 0.5.2", + "aleph-bft-crypto 0.6.0", "async-trait", "futures", "futures-timer", @@ -203,11 +302,11 @@ dependencies = [ [[package]] name = "aleph-bft-types" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9f5b8526b63c76102ef1b36400cf62381f6900585a8258511580af917dd580" +checksum = "14c0995c7a6709cec7dc62ef8316426442ea4756b34182c21d6549a1c6bfb904" dependencies = [ - "aleph-bft-crypto 0.4.0", + "aleph-bft-crypto 0.5.2", "async-trait", "futures", "parity-scale-codec", @@ -215,11 +314,11 @@ dependencies = [ [[package]] name = "aleph-bft-types" -version = "0.7.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c0995c7a6709cec7dc62ef8316426442ea4756b34182c21d6549a1c6bfb904" +checksum = "4b39893b3cb3670ade7d8fe3cb807f9b032cd2a2937df88a64b53ad927fc1510" dependencies = [ - "aleph-bft-crypto 0.5.2", + "aleph-bft-crypto 0.6.0", "async-trait", "futures", "parity-scale-codec", @@ -227,18 +326,16 @@ dependencies = [ [[package]] name = "aleph-node" -version = "0.8.0" +version = "0.9.0" dependencies = [ "aleph-runtime", - "clap", "finality-aleph", "futures", "hex", "hex-literal", "jsonrpsee", - "libp2p 0.44.0", + "libp2p 0.49.0", "log", - "pallet-contracts-rpc", "pallet-staking", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -250,6 +347,7 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-consensus-aura", + "sc-consensus-slots", "sc-executor", "sc-keystore", "sc-network", @@ -263,12 +361,14 @@ dependencies = [ "serde_json", "sp-api", "sp-application-crypto", + "sp-arithmetic", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", "sp-core", "sp-inherents", + "sp-io", "sp-keystore", "sp-runtime", "sp-timestamp", @@ -281,7 +381,7 @@ dependencies = [ [[package]] name = "aleph-runtime" -version = "0.8.0" +version = "0.9.1" dependencies = [ "frame-executive", "frame-support", @@ -294,11 +394,11 @@ dependencies = [ "pallet-balances", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-elections", "pallet-identity", "pallet-multisig", "pallet-nomination-pools", + "pallet-nomination-pools-runtime-api", "pallet-randomness-collective-flip", "pallet-scheduler", "pallet-session", @@ -314,6 +414,7 @@ dependencies = [ "primitives", "scale-info", "serde", + "smallvec", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -350,9 +451,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -364,19 +465,22 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" +name = "arc-swap" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" @@ -391,151 +495,113 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - -[[package]] -name = "async-channel" -version = "1.7.1" +name = "asn1-rs" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", + "asn1-rs-derive 0.1.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.20", ] [[package]] -name = "async-executor" -version = "1.4.1" +name = "asn1-rs" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", + "asn1-rs-derive 0.4.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.20", ] [[package]] -name = "async-global-executor" -version = "2.3.0" +name = "asn1-rs-derive" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" +checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] -name = "async-io" -version = "1.9.0" +name = "asn1-rs-derive" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "autocfg", - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2", - "waker-fn", - "winapi", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] -name = "async-lock" -version = "2.5.0" +name = "asn1-rs-impl" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "event-listener", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "async-process" -version = "1.5.0" +name = "asn1_der" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" -dependencies = [ - "async-io", - "autocfg", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "libc", - "once_cell", - "signal-hook", - "winapi", -] +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" [[package]] -name = "async-std" +name = "async-io" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" dependencies = [ - "async-channel", - "async-global-executor", - "async-io", "async-lock", - "async-process", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", + "autocfg", + "concurrent-queue", "futures-lite", - "gloo-timers", - "kv-log-macro", + "libc", "log", - "memchr", - "once_cell", - "pin-project-lite 0.2.9", - "pin-utils", + "parking", + "polling", "slab", - "wasm-bindgen-futures", + "socket2", + "waker-fn", + "windows-sys 0.42.0", ] [[package]] -name = "async-std-resolver" -version = "0.21.2" +name = "async-lock" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" dependencies = [ - "async-std", - "async-trait", - "futures-io", - "futures-util", - "pin-utils", - "socket2", - "trust-dns-resolver", + "event-listener", + "futures-lite", ] -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" - [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -544,9 +610,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" dependencies = [ "bytes", "futures-sink", @@ -555,20 +621,11 @@ dependencies = [ "pin-project-lite 0.2.9", ] -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - [[package]] name = "atomic-waker" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" [[package]] name = "atty" @@ -576,7 +633,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -589,16 +646,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.29.0", + "object 0.30.3", "rustc-demangle", ] @@ -626,6 +683,18 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "beef" version = "0.5.2" @@ -638,32 +707,13 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "beefy-primitives", "sp-api", + "sp-beefy", + "sp-runtime", ] -[[package]] -name = "beefy-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - [[package]] name = "bincode" version = "1.3.3" @@ -675,9 +725,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.2" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ "bitflags", "cexpr", @@ -690,6 +740,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", + "syn", ] [[package]] @@ -718,28 +769,18 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] name = "blake2b_simd" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" +checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", "arrayvec 0.7.2", @@ -748,9 +789,9 @@ dependencies = [ [[package]] name = "blake2s_simd" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" +checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", "arrayvec 0.7.2", @@ -759,9 +800,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", "arrayvec 0.7.2", @@ -776,7 +817,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", "byteorder", "generic-array 0.12.4", @@ -800,6 +841,16 @@ dependencies = [ "generic-array 0.14.6", ] +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding 0.2.1", + "cipher 0.2.5", +] + [[package]] name = "block-padding" version = "0.1.5" @@ -810,18 +861,10 @@ dependencies = [ ] [[package]] -name = "blocking" -version = "1.2.0" +name = "block-padding" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "bs58" @@ -831,11 +874,12 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.17" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" dependencies = [ "memchr", + "serde", ] [[package]] @@ -849,15 +893,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -873,9 +917,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "bzip2-sys" @@ -888,17 +932,11 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "camino" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" +checksum = "6031a462f977dd38968b6f23378356512feeace69cef817e1a4475108093cec3" dependencies = [ "serde", ] @@ -920,20 +958,31 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", ] [[package]] name = "cc" -version = "1.0.73" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" dependencies = [ "jobserver", ] +[[package]] +name = "ccm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +dependencies = [ + "aead 0.3.2", + "cipher 0.2.5", + "subtle", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -943,12 +992,27 @@ dependencies = [ "nom", ] +[[package]] +name = "cfg-expr" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chacha20" version = "0.8.2" @@ -967,7 +1031,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead", + "aead 0.4.3", "chacha20", "cipher 0.3.0", "poly1305", @@ -976,15 +1040,15 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", "num-integer", "num-traits", - "time", + "time 0.1.45", "wasm-bindgen", "winapi", ] @@ -997,11 +1061,20 @@ checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase", - "multihash", + "multihash 0.16.3", "serde", "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "cipher" version = "0.3.0" @@ -1021,41 +1094,48 @@ dependencies = [ "inout", ] +[[package]] +name = "ckb-merkle-mountain-range" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ccb671c5921be8a84686e6212ca184cb1d7c51cadcdbfcbd1cc3f042f5dfb8" +dependencies = [ + "cfg-if", +] + [[package]] name = "clang-sys" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" dependencies = [ "glob", "libc", - "libloading 0.7.3", + "libloading", ] [[package]] name = "clap" -version = "3.2.21" +version = "4.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", + "is-terminal", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" dependencies = [ - "heck 0.4.0", + "heck", "proc-macro-error", "proc-macro2", "quote", @@ -1064,22 +1144,13 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" dependencies = [ "os_str_bytes", ] -[[package]] -name = "cmake" -version = "0.1.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" -dependencies = [ - "cc", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -1092,24 +1163,24 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" dependencies = [ - "cache-padded", + "crossbeam-utils", ] [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" [[package]] name = "convert_case" @@ -1162,25 +1233,27 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "749d0d6022c9038dccf480bdde2a38d435937335bf2bb0f14e815d94517cdce8" +checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94370cc7b37bf652ccd8bb8f09bd900997f7ccf97520edfc75554bb5c4abbea" +checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ + "arrayvec 0.7.2", + "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", "cranelift-isle", - "gimli", + "gimli 0.26.2", "log", "regalloc2", "smallvec", @@ -1189,33 +1262,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a3cea8fdab90e44018c5b9a1dfd460d8ee265ac354337150222a354628bdb6" +checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac72f76f2698598951ab26d8c96eaa854810e693e7dd52523958b5909fde6b2" +checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" [[package]] name = "cranelift-entity" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09eaeacfcd2356fe0e66b295e8f9d59fdd1ac3ace53ba50de14d628ec902f72d" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba69c9980d5ffd62c18a2bde927855fcd7c8dc92f29feaf8636052662cbd99c" +checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" dependencies = [ "cranelift-codegen", "log", @@ -1225,15 +1298,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2920dc1e05cac40304456ed3301fde2c09bd6a9b0210bcfa2f101398d628d5b" +checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" [[package]] name = "cranelift-native" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04dfa45f9b2a6f587c564d6b63388e00cd6589d2df6ea2758cf79e1a13285e6" +checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" dependencies = [ "cranelift-codegen", "libc", @@ -1242,9 +1315,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.85.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31a46513ae6f26f3f267d8d75b5373d555fbbd1e68681f348d99df43f747ec54" +checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1256,6 +1329,21 @@ dependencies = [ "wasmtime-types", ] +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + [[package]] name = "crc32fast" version = "1.3.2" @@ -1288,22 +1376,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -1316,9 +1404,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -1333,6 +1421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.6", + "rand_core 0.6.4", "typenum", ] @@ -1356,16 +1445,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "ctr" version = "0.8.0" @@ -1376,14 +1455,12 @@ dependencies = [ ] [[package]] -name = "cuckoofilter" -version = "0.5.0" +name = "ctr" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", + "cipher 0.4.3", ] [[package]] @@ -1414,22 +1491,23 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-pre.1" +version = "4.0.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" +checksum = "8da00a7a9a4eb92a0a0f8e75660926d48f0d0f3c537e455c457bcdaa1e16b1ac" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.6.4", + "cfg-if", + "fiat-crypto", + "packed_simd_2", + "platforms 3.0.2", "subtle", "zeroize", ] [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -1439,9 +1517,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -1454,26 +1532,61 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", "syn", ] [[package]] name = "data-encoding" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" [[package]] name = "data-encoding-macro" @@ -1497,11 +1610,41 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" +dependencies = [ + "asn1-rs 0.3.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der-parser" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +dependencies = [ + "asn1-rs 0.5.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", ] [[package]] @@ -1515,6 +1658,48 @@ dependencies = [ "syn", ] +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1528,6 +1713,12 @@ dependencies = [ "syn", ] +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.8.1" @@ -1548,9 +1739,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -1599,15 +1790,22 @@ dependencies = [ ] [[package]] -name = "dns-parser" -version = "0.8.0" +name = "displaydoc" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "byteorder", - "quick-error", + "proc-macro2", + "quote", + "syn", ] +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + [[package]] name = "downcast-rs" version = "1.2.0" @@ -1616,9 +1814,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" +checksum = "c00704156a7de8df8da0911424e30c2049957b0a714542a44e05fe693dd85313" [[package]] name = "dyn-clonable" @@ -1643,15 +1841,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -1661,9 +1859,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -1682,24 +1880,42 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", + "hkdf", + "pem-rfc7468", + "pkcs8", "rand_core 0.6.4", "sec1", "subtle", @@ -1708,11 +1924,11 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ - "heck 0.4.0", + "heck", "proc-macro2", "quote", "syn", @@ -1740,9 +1956,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -1752,13 +1968,26 @@ dependencies = [ ] [[package]] -name = "environmental" -version = "1.1.3" +name = "env_logger" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" - -[[package]] -name = "errno" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" @@ -1778,33 +2007,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ethbloom" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-rlp", - "impl-serde", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", - "impl-serde", - "primitive-types", - "uint", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -1834,9 +2036,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] @@ -1852,59 +2054,64 @@ dependencies = [ [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" + [[package]] name = "file-per-thread-logger" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" +checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger", + "env_logger 0.10.0", "log", ] [[package]] name = "filetime" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3" +checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "finality-aleph" -version = "0.5.0" +version = "0.6.1" dependencies = [ - "aggregator 0.1.0", - "aggregator 0.2.0", - "aleph-bft 0.18.2", + "aggregator 0.2.1", + "aggregator 0.3.0", "aleph-bft 0.19.3", - "aleph-bft-crypto 0.4.0", - "aleph-bft-rmc 0.4.0", - "aleph-bft-rmc 0.5.1", + "aleph-bft 0.20.5", + "aleph-bft-crypto 0.5.2", + "aleph-bft-rmc 0.5.2", + "aleph-bft-rmc 0.6.1", "async-trait", "bytes", "derive_more", - "env_logger", + "env_logger 0.9.3", "futures", "futures-timer", "hash-db", "ip_network", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "primitives", "rand 0.8.5", @@ -1930,15 +2137,15 @@ dependencies = [ "substrate-prometheus-endpoint", "substrate-test-runtime", "substrate-test-runtime-client", - "tiny-bip39 1.0.0", + "tiny-bip39", "tokio", ] [[package]] name = "finality-grandpa" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22349c6a11563a202d95772a68e0fcf56119e74ea8a2a19cf2301460fcd0df5" +checksum = "e24e6c429951433ccb7c87fd528c60084834dcd14763182c1f83291bcde24c34" dependencies = [ "either", "futures", @@ -1952,9 +2159,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -1970,15 +2177,24 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "libz-sys", "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1988,7 +2204,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", ] @@ -2002,12 +2218,19 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log", @@ -2017,17 +2240,19 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", "sp-std", "sp-storage", + "static_assertions", ] [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2038,7 +2263,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2046,6 +2271,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-arithmetic", + "sp-core", "sp-npos-elections", "sp-runtime", "sp-std", @@ -2054,10 +2280,11 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", + "frame-try-runtime", "parity-scale-codec", "scale-info", "sp-core", @@ -2079,10 +2306,26 @@ dependencies = [ "serde", ] +[[package]] +name = "frame-remote-externalities" +version = "0.10.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "futures", + "log", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "substrate-rpc-client", + "tokio", +] + [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "bitflags", "frame-metadata", @@ -2107,16 +2350,20 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-tracing", + "sp-weights", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -2125,7 +2372,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2137,7 +2384,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro2", "quote", @@ -2147,7 +2394,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "log", @@ -2159,12 +2406,13 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version", + "sp-weights", ] [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "sp-api", @@ -2173,26 +2421,15 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", + "parity-scale-codec", "sp-api", "sp-runtime", "sp-std", ] -[[package]] -name = "fs-swap" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" -dependencies = [ - "lazy_static", - "libc", - "libloading 0.5.2", - "winapi", -] - [[package]] name = "fs2" version = "0.4.3" @@ -2203,12 +2440,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fs_extra" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" - [[package]] name = "funty" version = "2.0.0" @@ -2217,9 +2448,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -2232,9 +2463,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -2242,15 +2473,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -2260,9 +2491,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-lite" @@ -2281,9 +2512,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -2297,21 +2528,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls", - "webpki", + "rustls 0.20.8", + "webpki 0.22.0", ] [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -2321,9 +2552,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -2372,10 +2603,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -2396,7 +2625,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug 0.3.0", - "polyval", + "polyval 0.5.3", +] + +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug 0.3.0", + "polyval 0.6.0", ] [[package]] @@ -2410,17 +2649,23 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" + [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ "aho-corasick", "bstr", @@ -2429,23 +2674,11 @@ dependencies = [ "regex", ] -[[package]] -name = "gloo-timers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", @@ -2454,9 +2687,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -2486,38 +2719,26 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] -name = "heck" -version = "0.3.3" +name = "hashbrown" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -2528,6 +2749,21 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -2541,10 +2777,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] -name = "hex_fmt" -version = "0.3.0" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] [[package]] name = "hmac" @@ -2572,7 +2811,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2599,9 +2838,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -2619,6 +2858,12 @@ dependencies = [ "pin-project-lite 0.2.9", ] +[[package]] +name = "http-range-header" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + [[package]] name = "httparse" version = "1.8.0" @@ -2639,9 +2884,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ "bytes", "futures-channel", @@ -2663,14 +2908,14 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", "log", - "rustls", + "rustls 0.20.8", "rustls-native-certs", "tokio", "tokio-rustls", @@ -2678,9 +2923,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2700,6 +2945,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -2733,9 +2984,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.1.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" +checksum = "ba7abdbb86e485125dad06c2691e1e393bf3b08c7b743b43aa162a00fd39062e" dependencies = [ "async-io", "core-foundation", @@ -2746,6 +2997,7 @@ dependencies = [ "log", "rtnetlink", "system-configuration", + "tokio", "windows", ] @@ -2758,20 +3010,11 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -2789,15 +3032,21 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown 0.12.3", "serde", ] +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + [[package]] name = "inout" version = "0.1.3" @@ -2825,17 +3074,40 @@ dependencies = [ "num-traits", ] +[[package]] +name = "interceptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand 0.8.5", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", +] + [[package]] name = "io-lifetimes" -version = "0.5.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "0.7.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] [[package]] name = "ip_network" @@ -2845,9 +3117,9 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" dependencies = [ "socket2", "widestring", @@ -2857,9 +3129,21 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + +[[package]] +name = "is-terminal" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes 1.0.5", + "rustix 0.36.8", + "windows-sys 0.45.0", +] [[package]] name = "itertools" @@ -2872,9 +3156,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -2887,39 +3171,38 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpsee" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", - "jsonrpsee-http-server", "jsonrpsee-proc-macros", + "jsonrpsee-server", "jsonrpsee-types", "jsonrpsee-ws-client", - "jsonrpsee-ws-server", "tracing", ] [[package]] name = "jsonrpsee-client-transport" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8752740ecd374bcbf8b69f3e80b0327942df76f793f8d4e60d3355650c31fb74" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" dependencies = [ "futures-util", "http", "jsonrpsee-core", "jsonrpsee-types", - "pin-project 1.0.12", + "pin-project", "rustls-native-certs", "soketto", "thiserror", @@ -2932,9 +3215,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", "arrayvec 0.7.2", @@ -2945,10 +3228,8 @@ dependencies = [ "futures-timer", "futures-util", "globset", - "http", "hyper", "jsonrpsee-types", - "lazy_static", "parking_lot 0.12.1", "rand 0.8.5", "rustc-hash", @@ -2958,45 +3239,48 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-futures", - "unicase", ] [[package]] -name = "jsonrpsee-http-server" -version = "0.15.1" +name = "jsonrpsee-proc-macros" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c" +dependencies = [ + "heck", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jsonrpsee-server" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117" +checksum = "1fb69dad85df79527c019659a992498d03f8495390496da2f07e6c24c2b356fc" dependencies = [ "futures-channel", "futures-util", + "http", "hyper", "jsonrpsee-core", "jsonrpsee-types", "serde", "serde_json", + "soketto", "tokio", + "tokio-stream", + "tokio-util", + "tower", "tracing", - "tracing-futures", -] - -[[package]] -name = "jsonrpsee-proc-macros" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", ] [[package]] name = "jsonrpsee-types" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" dependencies = [ "anyhow", "beef", @@ -3008,9 +3292,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee5feddd5188e62ac08fcf0e56478138e581509d4730f3f7be9b57dd402a4ff" +checksum = "0b83daeecfc6517cfe210df24e570fb06213533dfb990318fae781f4c7119dd9" dependencies = [ "http", "jsonrpsee-client-transport", @@ -3018,86 +3302,54 @@ dependencies = [ "jsonrpsee-types", ] -[[package]] -name = "jsonrpsee-ws-server" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325" -dependencies = [ - "futures-channel", - "futures-util", - "http", - "jsonrpsee-core", - "jsonrpsee-types", - "serde_json", - "soketto", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", - "tracing-futures", -] - [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kv-log-macro" -version = "1.0.7" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" dependencies = [ - "log", + "cpufeatures", ] [[package]] name = "kvdb" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +checksum = "e7d770dcb02bf6835887c3a979b5107a04ff4bbde97a5f0928d27404a155add9" dependencies = [ - "parity-util-mem", "smallvec", ] [[package]] name = "kvdb-memorydb" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" +checksum = "bf7a85fe66f9ff9cd74e169fdd2c94c6e1e74c412c99a73b4df3200b5d3760b2" dependencies = [ "kvdb", - "parity-util-mem", "parking_lot 0.12.1", ] [[package]] name = "kvdb-rocksdb" -version = "0.15.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" +checksum = "2182b8219fee6bd83aacaab7344e840179ae079d5216aa4e249b4d704646a844" dependencies = [ - "fs-swap", "kvdb", - "log", "num_cpus", - "owning_ref", - "parity-util-mem", "parking_lot 0.12.1", "regex", "rocksdb", @@ -3118,168 +3370,92 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" -version = "0.5.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "cc", + "cfg-if", "winapi", ] [[package]] -name = "libloading" -version = "0.7.3" +name = "libm" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" -dependencies = [ - "cfg-if", - "winapi", -] +checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" -version = "0.44.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475ce2ac4a9727e53a519f6ee05b38abfcba8f0d39c4d24f103d184e36fd5b0f" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ - "atomic", "bytes", "futures", "futures-timer", "getrandom 0.2.8", "instant", "lazy_static", - "libp2p-autonat 0.3.0", - "libp2p-core 0.32.1", - "libp2p-deflate 0.32.0", - "libp2p-dns 0.32.1", - "libp2p-floodsub 0.35.0", - "libp2p-gossipsub 0.37.0", - "libp2p-identify 0.35.0", - "libp2p-kad 0.36.0", - "libp2p-mdns 0.36.0", - "libp2p-metrics 0.5.0", - "libp2p-mplex 0.32.0", - "libp2p-noise 0.35.0", - "libp2p-ping 0.35.0", - "libp2p-plaintext 0.32.0", - "libp2p-pnet", - "libp2p-relay 0.8.0", - "libp2p-rendezvous 0.5.0", - "libp2p-request-response 0.17.0", - "libp2p-swarm 0.35.0", - "libp2p-swarm-derive 0.27.2", - "libp2p-tcp 0.32.0", - "libp2p-uds 0.32.0", - "libp2p-wasm-ext 0.32.0", - "libp2p-websocket 0.34.0", - "libp2p-yamux 0.36.0", - "multiaddr", + "libp2p-core 0.37.0", + "libp2p-swarm 0.40.1", + "libp2p-swarm-derive 0.30.1", + "multiaddr 0.14.0", "parking_lot 0.12.1", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", "smallvec", ] [[package]] name = "libp2p" -version = "0.46.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81327106887e42d004fbdab1fef93675be2e2e07c1b95fce45e2cc813485611d" +checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" dependencies = [ "bytes", "futures", "futures-timer", "getrandom 0.2.8", "instant", - "lazy_static", - "libp2p-autonat 0.5.0", - "libp2p-core 0.34.0", - "libp2p-deflate 0.34.0", - "libp2p-dns 0.34.0", - "libp2p-floodsub 0.37.0", - "libp2p-gossipsub 0.39.0", - "libp2p-identify 0.37.0", - "libp2p-kad 0.38.0", - "libp2p-mdns 0.38.0", - "libp2p-metrics 0.7.0", - "libp2p-mplex 0.34.0", - "libp2p-noise 0.37.0", - "libp2p-ping 0.37.0", - "libp2p-plaintext 0.34.0", - "libp2p-pnet", - "libp2p-relay 0.10.0", - "libp2p-rendezvous 0.7.0", - "libp2p-request-response 0.19.0", - "libp2p-swarm 0.37.0", - "libp2p-swarm-derive 0.28.0", - "libp2p-tcp 0.34.0", - "libp2p-uds 0.33.0", - "libp2p-wasm-ext 0.34.0", - "libp2p-websocket 0.36.0", - "libp2p-yamux 0.38.0", - "multiaddr", + "libp2p-core 0.38.0", + "libp2p-dns", + "libp2p-identify", + "libp2p-kad", + "libp2p-mdns", + "libp2p-metrics", + "libp2p-mplex", + "libp2p-noise 0.41.0", + "libp2p-ping", + "libp2p-quic", + "libp2p-request-response", + "libp2p-swarm 0.41.1", + "libp2p-tcp", + "libp2p-wasm-ext", + "libp2p-webrtc", + "libp2p-websocket", + "libp2p-yamux", + "multiaddr 0.16.0", "parking_lot 0.12.1", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", "smallvec", ] -[[package]] -name = "libp2p-autonat" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13b690e65046af6a09c0b27bd9508fa1cab0efce889de74b0b643b9d2a98f9a" -dependencies = [ - "async-trait", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.32.1", - "libp2p-request-response 0.17.0", - "libp2p-swarm 0.35.0", - "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.8.5", -] - -[[package]] -name = "libp2p-autonat" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4decc51f3573653a9f4ecacb31b1b922dd20c25a6322bb15318ec04287ec46f9" -dependencies = [ - "async-trait", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.34.0", - "libp2p-request-response 0.19.0", - "libp2p-swarm 0.37.0", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.8.5", -] - [[package]] name = "libp2p-core" -version = "0.32.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b02602099fb75cb2d16f9ea860a320d6eb82ce41e95ab680912c454805cd5" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -3290,18 +3466,16 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1", "log", - "multiaddr", - "multihash", + "multiaddr 0.14.0", + "multihash 0.16.3", "multistream-select", "parking_lot 0.12.1", - "pin-project 1.0.12", - "prost 0.9.0", - "prost-build 0.9.0", + "pin-project", + "prost", + "prost-build", "rand 0.8.5", - "ring", - "rw-stream-sink 0.2.1", + "rw-stream-sink", "sha2 0.10.6", "smallvec", "thiserror", @@ -3312,9 +3486,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.34.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf9b94cefab7599b2d3dff2f93bee218c6621d68590b23ede4485813cbcece6" +checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" dependencies = [ "asn1_der", "bs58", @@ -3324,19 +3498,18 @@ dependencies = [ "futures", "futures-timer", "instant", - "lazy_static", - "libsecp256k1", "log", - "multiaddr", - "multihash", + "multiaddr 0.16.0", + "multihash 0.16.3", "multistream-select", + "once_cell", "parking_lot 0.12.1", - "pin-project 1.0.12", - "prost 0.10.4", - "prost-build 0.10.4", + "pin-project", + "prost", + "prost-build", "rand 0.8.5", - "ring", - "rw-stream-sink 0.3.0", + "rw-stream-sink", + "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -3346,180 +3519,68 @@ dependencies = [ ] [[package]] -name = "libp2p-deflate" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1d37f042f748e224f04785d0e987ae09a2aa518d6401d82d412dad83e360ed" -dependencies = [ - "flate2", - "futures", - "libp2p-core 0.32.1", -] - -[[package]] -name = "libp2p-deflate" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0183dc2a3da1fbbf85e5b6cf51217f55b14f5daea0c455a9536eef646bfec71" -dependencies = [ - "flate2", - "futures", - "libp2p-core 0.34.0", -] - -[[package]] -name = "libp2p-dns" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066e33e854e10b5c93fc650458bf2179c7e0d143db260b0963e44a94859817f1" -dependencies = [ - "async-std-resolver", - "futures", - "libp2p-core 0.32.1", - "log", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-dns" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cbf54723250fa5d521383be789bf60efdabe6bacfb443f87da261019a49b4b5" -dependencies = [ - "async-std-resolver", - "futures", - "libp2p-core 0.34.0", - "log", - "parking_lot 0.12.1", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d3ea6ebe7a7a85df2bc86678b93f24b015fae5fe3b3acc4c400e795a55d2d" -dependencies = [ - "cuckoofilter", - "fnv", - "futures", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a4b6ffd53e355775d24b76f583fdda54b3284806f678499b57913adb94f231" -dependencies = [ - "cuckoofilter", - "fnv", - "futures", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90c989a7c0969c2ab63e898da9bc735e3be53fb4f376e9c045ce516bcc9f928" -dependencies = [ - "asynchronous-codec", - "base64", - "byteorder", - "bytes", - "fnv", - "futures", - "hex_fmt", - "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "prometheus-client 0.15.1", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.7.3", - "regex", - "sha2 0.10.6", - "smallvec", - "unsigned-varint", - "wasm-timer", -] - -[[package]] -name = "libp2p-gossipsub" +name = "libp2p-core" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0" +checksum = "881d9a54e97d97cdaa4125d48269d97ca8c40e5fefec6b85b30440dc60cc551f" dependencies = [ - "asynchronous-codec", - "base64", - "byteorder", - "bytes", + "asn1_der", + "bs58", + "ed25519-dalek", + "either", "fnv", "futures", - "hex_fmt", + "futures-timer", "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", "log", - "prometheus-client 0.16.0", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "regex", + "multiaddr 0.17.0", + "multihash 0.17.0", + "multistream-select", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "prost", + "prost-build", + "rand 0.8.5", + "rw-stream-sink", + "sec1", "sha2 0.10.6", "smallvec", + "thiserror", "unsigned-varint", - "wasm-timer", + "void", + "zeroize", ] [[package]] -name = "libp2p-identify" -version = "0.35.0" +name = "libp2p-dns" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ef5a5b57904c7c33d6713ef918d239dc6b7553458f3475d87f8a18e9c651c8" +checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" dependencies = [ "futures", - "futures-timer", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", + "libp2p-core 0.38.0", "log", - "lru", - "prost 0.9.0", - "prost-build 0.9.0", + "parking_lot 0.12.1", "smallvec", + "trust-dns-resolver", ] [[package]] name = "libp2p-identify" -version = "0.37.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50b585518f8efd06f93ac2f976bd672e17cdac794644b3117edd078e96bda06" +checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf" dependencies = [ "asynchronous-codec", "futures", "futures-timer", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", + "libp2p-core 0.38.0", + "libp2p-swarm 0.41.1", "log", - "lru", - "prost 0.10.4", - "prost-build 0.10.4", + "lru 0.8.1", + "prost", + "prost-build", "prost-codec", "smallvec", "thiserror", @@ -3528,37 +3589,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.36.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "564e6bd64d177446399ed835b9451a8825b07929d6daa6a94e6405592974725e" -dependencies = [ - "arrayvec 0.5.2", - "asynchronous-codec", - "bytes", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.7.3", - "sha2 0.10.6", - "smallvec", - "thiserror", - "uint", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-kad" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740862893bb5f06ac24acc9d49bdeadc3a5e52e51818a30a25c1f3519da2c851" +checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -3568,12 +3601,12 @@ dependencies = [ "futures", "futures-timer", "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", + "libp2p-core 0.38.0", + "libp2p-swarm 0.41.1", "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", + "prost", + "prost-build", + "rand 0.8.5", "sha2 0.10.6", "smallvec", "thiserror", @@ -3584,387 +3617,172 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611ae873c8e280ccfab0d57c7a13cac5644f364529e233114ff07863946058b0" -dependencies = [ - "async-io", - "data-encoding", - "dns-parser", - "futures", - "if-watch", - "lazy_static", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "rand 0.8.5", - "smallvec", - "socket2", - "void", -] - -[[package]] -name = "libp2p-mdns" -version = "0.38.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e5e5919509603281033fd16306c61df7a4428ce274b67af5e14b07de5cdcb2" +checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" dependencies = [ - "async-io", "data-encoding", - "dns-parser", "futures", "if-watch", - "lazy_static", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", + "libp2p-core 0.38.0", + "libp2p-swarm 0.41.1", "log", "rand 0.8.5", "smallvec", "socket2", + "tokio", + "trust-dns-proto", "void", ] [[package]] name = "libp2p-metrics" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985be799bb3796e0c136c768208c3c06604a38430571906a13dcfeda225a3b9d" -dependencies = [ - "libp2p-core 0.32.1", - "libp2p-gossipsub 0.37.0", - "libp2p-identify 0.35.0", - "libp2p-kad 0.36.0", - "libp2p-ping 0.35.0", - "libp2p-relay 0.8.0", - "libp2p-swarm 0.35.0", - "prometheus-client 0.15.1", -] - -[[package]] -name = "libp2p-metrics" -version = "0.7.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8aff4a1abef42328fbb30b17c853fff9be986dc39af17ee39f9c5f755c5e0c" +checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55" dependencies = [ - "libp2p-core 0.34.0", - "libp2p-gossipsub 0.39.0", - "libp2p-identify 0.37.0", - "libp2p-kad 0.38.0", - "libp2p-ping 0.37.0", - "libp2p-relay 0.10.0", - "libp2p-swarm 0.37.0", - "prometheus-client 0.16.0", + "libp2p-core 0.38.0", + "libp2p-identify", + "libp2p-kad", + "libp2p-ping", + "libp2p-swarm 0.41.1", + "prometheus-client", ] [[package]] name = "libp2p-mplex" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core 0.32.1", - "log", - "nohash-hasher", - "parking_lot 0.12.1", - "rand 0.7.3", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "libp2p-mplex" -version = "0.34.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fd1b20638ec209c5075dfb2e8ce6a7ea4ec3cd3ad7b77f7a477c06d53322e2" +checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.35.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" +checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "lazy_static", - "libp2p-core 0.32.1", + "libp2p-core 0.38.0", "log", - "prost 0.9.0", - "prost-build 0.9.0", + "once_cell", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "thiserror", + "x25519-dalek 1.1.1", "zeroize", ] [[package]] name = "libp2p-noise" -version = "0.37.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762408cb5d84b49a600422d7f9a42c18012d8da6ebcd570f9a4a4290ba41fb6f" +checksum = "1216f9ec823ac7a2289b954674c54cbce81c9e45920b4fcf173018ede4295246" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "lazy_static", - "libp2p-core 0.34.0", + "libp2p-core 0.39.0", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "once_cell", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "thiserror", + "x25519-dalek 1.1.1", "zeroize", ] [[package]] name = "libp2p-ping" -version = "0.35.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf57a3c2e821331dda9fe612d4654d676ab6e33d18d9434a18cced72630df6ad" +checksum = "929fcace45a112536e22b3dcfd4db538723ef9c3cb79f672b98be2cc8e25f37f" dependencies = [ "futures", "futures-timer", "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", + "libp2p-core 0.38.0", + "libp2p-swarm 0.41.1", "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-ping" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100a6934ae1dbf8a693a4e7dd1d730fd60b774dafc45688ed63b554497c6c925" -dependencies = [ - "futures", - "futures-timer", - "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", - "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core 0.32.1", - "log", - "prost 0.9.0", - "prost-build 0.9.0", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be27bf0820a6238a4e06365b096d428271cce85a129cf16f2fe9eb1610c4df86" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core 0.34.0", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5a702574223aa55d8878bdc8bf55c84a6086f87ddaddc28ce730b4caa81538" -dependencies = [ - "futures", - "log", - "pin-project 1.0.12", "rand 0.8.5", - "salsa20", - "sha3", -] - -[[package]] -name = "libp2p-relay" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aa754cb7bccef51ebc3c458c6bbcef89d83b578a9925438389be841527d408f" -dependencies = [ - "asynchronous-codec", - "bytes", - "either", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "pin-project 1.0.12", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "unsigned-varint", "void", ] [[package]] -name = "libp2p-relay" -version = "0.10.0" +name = "libp2p-quic" +version = "0.7.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4931547ee0cce03971ccc1733ff05bb0c4349fd89120a39e9861e2bbe18843c3" +checksum = "5971f629ff7519f4d4889a7c981f0dc09c6ad493423cd8a13ee442de241bc8c8" dependencies = [ - "asynchronous-codec", "bytes", - "either", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", - "log", - "pin-project 1.0.12", - "prost 0.10.4", - "prost-build 0.10.4", - "prost-codec", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd0baab894c5b84da510b915d53264d566c3c35889f09931fe9edbd2a773bee" -dependencies = [ - "asynchronous-codec", - "bimap", - "futures", - "futures-timer", - "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.8.5", - "sha2 0.10.6", - "thiserror", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9511c9672ba33284838e349623319c8cad2d18cfad243ae46c6b7e8a2982ea4e" -dependencies = [ - "asynchronous-codec", - "bimap", "futures", "futures-timer", - "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", + "if-watch", + "libp2p-core 0.39.0", + "libp2p-tls", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "parking_lot 0.12.1", + "quinn-proto", "rand 0.8.5", - "sha2 0.10.6", + "rustls 0.20.8", "thiserror", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-request-response" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6a6fc6c9ad95661f46989473b34bd2993d14a4de497ff3b2668a910d4b869" -dependencies = [ - "async-trait", - "bytes", - "futures", - "instant", - "libp2p-core 0.32.1", - "libp2p-swarm 0.35.0", - "log", - "rand 0.7.3", - "smallvec", - "unsigned-varint", + "tokio", ] [[package]] name = "libp2p-request-response" -version = "0.19.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508a189e2795d892c8f5c1fa1e9e0b1845d32d7b0b249dbf7b05b18811361843" +checksum = "3236168796727bfcf4927f766393415361e2c644b08bedb6a6b13d957c9a4884" dependencies = [ "async-trait", "bytes", "futures", "instant", - "libp2p-core 0.34.0", - "libp2p-swarm 0.37.0", + "libp2p-core 0.38.0", + "libp2p-swarm 0.41.1", "log", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.35.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0c69ad9e8f7c5fc50ad5ad9c7c8b57f33716532a2b623197f69f93e374d14c" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.32.1", + "libp2p-core 0.37.0", "log", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -3972,162 +3790,141 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.37.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ac5be6c2de2d1ff3f7693fda6faf8a827b1f3e808202277783fea9f527d114" +checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", + "libp2p-swarm-derive 0.31.0", "log", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "smallvec", "thiserror", + "tokio", "void", ] [[package]] name = "libp2p-swarm-derive" -version = "0.27.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f693c8c68213034d472cbb93a379c63f4f307d97c06f1c41e4985de481687a5" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-swarm-derive" -version = "0.28.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76" +checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" -dependencies = [ - "async-io", - "futures", - "futures-timer", - "if-watch", - "ipnet", - "libc", - "libp2p-core 0.32.1", - "log", - "socket2", -] - -[[package]] -name = "libp2p-tcp" -version = "0.34.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6771dc19aa3c65d6af9a8c65222bfc8fcd446630ddca487acd161fa6096f3b" +checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" dependencies = [ - "async-io", "futures", "futures-timer", "if-watch", - "ipnet", "libc", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", "log", "socket2", + "tokio", ] [[package]] -name = "libp2p-uds" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb" -dependencies = [ - "async-std", - "futures", - "libp2p-core 0.32.1", - "log", -] - -[[package]] -name = "libp2p-uds" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d125e3e5f0d58f3c6ac21815b20cf4b6a88b8db9dc26368ea821838f4161fd4d" -dependencies = [ - "async-std", - "futures", - "libp2p-core 0.34.0", - "log", -] - -[[package]] -name = "libp2p-wasm-ext" -version = "0.32.0" +name = "libp2p-tls" +version = "0.1.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6ea0f84a967ef59a16083f222c18115ae2e91db69809dce275df62e101b279" +checksum = "e9baf6f6292149e124ee737d9a79dbee783f29473fc368c7faad9d157841078a" dependencies = [ "futures", - "js-sys", - "libp2p-core 0.32.1", - "parity-send-wrapper", - "wasm-bindgen", - "wasm-bindgen-futures", + "futures-rustls", + "libp2p-core 0.39.0", + "rcgen 0.10.0", + "ring", + "rustls 0.20.8", + "thiserror", + "webpki 0.22.0", + "x509-parser 0.14.0", + "yasna", ] [[package]] name = "libp2p-wasm-ext" -version = "0.34.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec894790eec3c1608f8d1a8a0bdf0dbeb79ed4de2dce964222011c2896dfa05a" +checksum = "1bb1a35299860e0d4b3c02a3e74e3b293ad35ae0cee8a056363b0c862d082069" dependencies = [ "futures", "js-sys", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", "parity-send-wrapper", "wasm-bindgen", "wasm-bindgen-futures", ] [[package]] -name = "libp2p-websocket" -version = "0.34.0" +name = "libp2p-webrtc" +version = "0.4.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c932834c3754501c368d1bf3d0fb458487a642b90fc25df082a3a2f3d3b32e37" +checksum = "db4401ec550d36f413310ba5d4bf564bb21f89fb1601cadb32b2300f8bc1eb5b" dependencies = [ - "either", + "async-trait", + "asynchronous-codec", + "bytes", "futures", - "futures-rustls", - "libp2p-core 0.32.1", + "futures-timer", + "hex", + "if-watch", + "libp2p-core 0.39.0", + "libp2p-noise 0.42.0", "log", - "quicksink", - "rw-stream-sink 0.2.1", - "soketto", - "url", - "webpki-roots", + "multihash 0.17.0", + "prost", + "prost-build", + "prost-codec", + "rand 0.8.5", + "rcgen 0.9.3", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "webrtc", ] [[package]] name = "libp2p-websocket" -version = "0.36.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9808e57e81be76ff841c106b4c5974fb4d41a233a7bdd2afbf1687ac6def3818" +checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.3.0", + "rw-stream-sink", "soketto", "url", "webpki-roots", @@ -4135,25 +3932,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" -dependencies = [ - "futures", - "libp2p-core 0.32.1", - "parking_lot 0.12.1", - "thiserror", - "yamux", -] - -[[package]] -name = "libp2p-yamux" -version = "0.38.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6dea686217a06072033dc025631932810e2f6ad784e4fafa42e27d311c7a81c" +checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" dependencies = [ "futures", - "libp2p-core 0.34.0", + "libp2p-core 0.38.0", + "log", "parking_lot 0.12.1", "thiserror", "yamux", @@ -4161,9 +3946,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.6.1+6.28.2" +version = "0.8.3+7.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" +checksum = "557b255ff04123fcc176162f56ed0c9cd42d8f357cf55b3fabeb60f7413741b3" dependencies = [ "bindgen", "bzip2-sys", @@ -4181,7 +3966,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -4235,9 +4020,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -4269,15 +4054,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.0.42" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "linux-raw-sys" -version = "0.0.46" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -4296,7 +4081,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", - "value-bag", ] [[package]] @@ -4308,6 +4092,15 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -4363,9 +4156,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matrixmultiply" @@ -4376,6 +4169,15 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "memchr" version = "2.5.0" @@ -4384,18 +4186,18 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.4.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6627dc657574b49d6ad27105ed671822be56e0d2547d413bfbf3e8d8fa92e7a" +checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "libc", + "rustix 0.36.8", ] [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] @@ -4409,22 +4211,30 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ "hash-db", "hashbrown 0.12.3", - "parity-util-mem", ] [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -4446,30 +4256,51 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "windows-sys 0.45.0", ] [[package]] -name = "more-asserts" -version = "0.2.2" +name = "mockall" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" +checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "multiaddr" @@ -4481,7 +4312,43 @@ dependencies = [ "bs58", "byteorder", "data-encoding", - "multihash", + "multihash 0.16.3", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multiaddr" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "multibase", + "multihash 0.16.3", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multiaddr" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b53e0cc5907a5c216ba6584bf74be8ab47d6d6289f72793b2dddbf15dc3bf8c" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "multibase", + "multihash 0.17.0", "percent-encoding", "serde", "static_assertions", @@ -4510,18 +4377,31 @@ dependencies = [ "blake2s_simd", "blake3", "core2", - "digest 0.10.5", + "digest 0.10.6", "multihash-derive", "sha2 0.10.6", "sha3", "unsigned-varint", ] +[[package]] +name = "multihash" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +dependencies = [ + "core2", + "digest 0.10.6", + "multihash-derive", + "sha2 0.10.6", + "unsigned-varint", +] + [[package]] name = "multihash-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd" +checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" dependencies = [ "proc-macro-crate", "proc-macro-error", @@ -4539,14 +4419,14 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ "bytes", "futures", "log", - "pin-project 1.0.12", + "pin-project", "smallvec", "unsigned-varint", ] @@ -4561,7 +4441,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -4617,9 +4497,9 @@ dependencies = [ [[package]] name = "netlink-packet-utils" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" dependencies = [ "anyhow", "byteorder", @@ -4644,33 +4524,42 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" +checksum = "260e21fbb6f3d253a14df90eb0000a6066780a15dd901a7519ce02d77a94985b" dependencies = [ - "async-io", "bytes", "futures", "libc", "log", + "tokio", ] [[package]] name = "nix" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", "cfg-if", "libc", + "memoffset 0.6.5", ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nix" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", + "static_assertions", +] [[package]] name = "nohash-hasher" @@ -4680,19 +4569,25 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -4701,18 +4596,18 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -4728,18 +4623,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -4747,6 +4630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -4758,45 +4642,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", + "libm 0.2.6", ] [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "object" -version = "0.28.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "crc32fast", - "hashbrown 0.11.2", + "hashbrown 0.12.3", "indexmap", "memchr", ] [[package]] name = "object" -version = "0.29.0" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" +dependencies = [ + "asn1-rs 0.3.1", +] + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs 0.5.1", +] + [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -4818,22 +4720,45 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "p384" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] [[package]] -name = "owning_ref" -version = "0.4.1" +name = "packed_simd_2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" +checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" dependencies = [ - "stable_deref_trait", + "cfg-if", + "libm 0.1.4", ] [[package]] name = "pallet-aleph" -version = "0.5.0" +version = "0.5.5" dependencies = [ "frame-support", "frame-system", @@ -4854,7 +4779,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -4870,14 +4795,13 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", "sp-runtime", "sp-std", ] @@ -4885,7 +4809,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-benchmarking", "frame-support", @@ -4909,7 +4833,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-benchmarking", "frame-support", @@ -4924,7 +4848,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "bitflags", "frame-benchmarking", @@ -4939,73 +4863,41 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-core", "sp-io", "sp-runtime", - "sp-sandbox", "sp-std", - "wasm-instrument", - "wasmi-validation", + "wasm-instrument 0.4.0", + "wasmi 0.20.0", + "wasmparser-nostd", ] [[package]] name = "pallet-contracts-primitives" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "bitflags", "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-rpc", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "pallet-contracts-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "jsonrpsee", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "pallet-contracts-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "pallet-contracts-primitives", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-elections" -version = "0.5.0" +version = "0.5.4" dependencies = [ "frame-election-provider-support", "frame-support", @@ -5028,7 +4920,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5044,10 +4936,12 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", "sp-io", @@ -5058,7 +4952,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5072,10 +4966,20 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "1.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-std", +] + [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5089,7 +4993,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5099,12 +5003,13 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5125,8 +5030,9 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", @@ -5146,7 +5052,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5160,7 +5066,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-benchmarking", "frame-support", @@ -5169,6 +5075,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-inherents", + "sp-io", "sp-runtime", "sp-std", "sp-timestamp", @@ -5177,7 +5084,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-support", "frame-system", @@ -5193,7 +5100,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5203,24 +5110,27 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "sp-api", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", @@ -5235,8 +5145,9 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", @@ -5250,8 +5161,9 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", @@ -5263,18 +5175,19 @@ dependencies = [ [[package]] name = "pallets-support" -version = "0.1.0" +version = "0.1.4" dependencies = [ "frame-support", + "sp-std", ] [[package]] name = "parity-db" -version = "0.3.17" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" +checksum = "dd684a725651d9588ef21f140a328b6b4f64e646b2e931f3e6f14f75eedf9980" dependencies = [ - "blake2-rfc", + "blake2", "crc32fast", "fs2", "hex", @@ -5289,9 +5202,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -5304,9 +5217,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5320,49 +5233,11 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" -[[package]] -name = "parity-util-mem" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" -dependencies = [ - "cfg-if", - "ethereum-types", - "hashbrown 0.12.3", - "impl-trait-for-tuples", - "lru", - "parity-util-mem-derive", - "parking_lot 0.12.1", - "primitive-types", - "smallvec", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" @@ -5378,7 +5253,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -5388,14 +5263,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.7", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", @@ -5407,31 +5282,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" - -[[package]] -name = "pbkdf2" -version = "0.4.0" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -5448,7 +5314,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -5457,6 +5323,24 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "pem-rfc7468" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -5465,41 +5349,21 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", ] -[[package]] -name = "pin-project" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" -dependencies = [ - "pin-project-internal 0.4.30", -] - [[package]] name = "pin-project" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ - "pin-project-internal 1.0.12", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -5531,11 +5395,21 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "platforms" @@ -5543,18 +5417,24 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" +[[package]] +name = "platforms" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" + [[package]] name = "polling" -version = "2.4.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", "cfg-if", "libc", "log", "wepoll-ffi", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -5565,7 +5445,7 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.4.1", ] [[package]] @@ -5577,24 +5457,75 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.4.1", +] + +[[package]] +name = "polyval" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash 0.5.0", ] [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "predicates" +version = "2.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" +dependencies = [ + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" + +[[package]] +name = "predicates-tree" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettyplease" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" +dependencies = [ + "proc-macro2", + "syn", +] [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", - "impl-rlp", "impl-serde", "scale-info", "uint", @@ -5602,7 +5533,7 @@ dependencies = [ [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", @@ -5617,11 +5548,10 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ - "once_cell", "thiserror", "toml", ] @@ -5652,9 +5582,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -5675,33 +5605,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.15.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", "itoa", - "owning_ref", - "prometheus-client-derive-text-encode", -] - -[[package]] -name = "prometheus-client" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" -dependencies = [ - "dtoa", - "itoa", - "owning_ref", + "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] [[package]] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" dependencies = [ "proc-macro2", "quote", @@ -5710,97 +5628,54 @@ dependencies = [ [[package]] name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes", - "prost-derive 0.9.0", -] - -[[package]] -name = "prost" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" -dependencies = [ - "bytes", - "prost-derive 0.10.1", -] - -[[package]] -name = "prost-build" -version = "0.9.0" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" dependencies = [ "bytes", - "heck 0.3.3", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prost 0.9.0", - "prost-types 0.9.0", - "regex", - "tempfile", - "which", + "prost-derive", ] [[package]] name = "prost-build" -version = "0.10.4" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" +checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" dependencies = [ "bytes", - "cfg-if", - "cmake", - "heck 0.4.0", + "heck", "itertools", "lazy_static", "log", "multimap", "petgraph", - "prost 0.10.4", - "prost-types 0.10.1", + "prettyplease", + "prost", + "prost-types", "regex", + "syn", "tempfile", "which", ] [[package]] name = "prost-codec" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" +checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0" dependencies = [ "asynchronous-codec", "bytes", - "prost 0.10.4", + "prost", "thiserror", "unsigned-varint", ] [[package]] name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-derive" -version = "0.10.1" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" dependencies = [ "anyhow", "itertools", @@ -5811,22 +5686,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" -dependencies = [ - "bytes", - "prost 0.9.0", -] - -[[package]] -name = "prost-types" -version = "0.10.1" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" dependencies = [ - "bytes", - "prost 0.10.4", + "prost", ] [[package]] @@ -5855,11 +5719,29 @@ dependencies = [ "pin-project-lite 0.1.12", ] +[[package]] +name = "quinn-proto" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4ced82a24bb281af338b9e8f94429b6eca01b4e66d899f40031f074e74c9" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring", + "rustc-hash", + "rustls 0.20.8", + "slab", + "thiserror", + "tinyvec", + "tracing", + "webpki 0.22.0", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -5881,7 +5763,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", - "rand_pcg", ] [[package]] @@ -5954,11 +5835,11 @@ dependencies = [ [[package]] name = "rand_pcg" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.6.4", ] [[package]] @@ -5969,21 +5850,19 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -5991,6 +5870,31 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "rcgen" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" +dependencies = [ + "pem", + "ring", + "time 0.3.20", + "x509-parser 0.13.2", + "yasna", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time 0.3.20", + "yasna", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -6013,18 +5917,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -6033,9 +5937,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.2.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a8d23b35d7177df3b9d31ed8a9ab4bf625c668be77a319d4f5efd4a5257701c" +checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" dependencies = [ "fxhash", "log", @@ -6045,9 +5949,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -6065,47 +5969,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "remote-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "env_logger", - "jsonrpsee", - "log", - "parity-scale-codec", - "serde", - "serde_json", - "sp-core", - "sp-io", - "sp-runtime", - "sp-version", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "resolv-conf" @@ -6119,12 +5985,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] @@ -6137,27 +6003,17 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", ] -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rustc-hex", -] - [[package]] name = "rocksdb" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" +checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" dependencies = [ "libc", "librocksdb-sys", @@ -6165,27 +6021,63 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" dependencies = [ "libc", + "rtoolbox", "winapi", ] +[[package]] +name = "rtcp" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + [[package]] name = "rtnetlink" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ - "async-global-executor", "futures", "log", "netlink-packet-route", "netlink-proto", - "nix", + "nix 0.24.3", + "thiserror", + "tokio", +] + +[[package]] +name = "rtoolbox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "rtp" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" +dependencies = [ + "async-trait", + "bytes", + "rand 0.8.5", + "serde", "thiserror", + "webrtc-util", ] [[package]] @@ -6221,47 +6113,69 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", ] [[package]] name = "rustix" -version = "0.33.7" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.5.3", + "io-lifetimes 0.7.5", "libc", - "linux-raw-sys 0.0.42", - "winapi", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", ] [[package]] name = "rustix" -version = "0.35.12" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.7.4", + "io-lifetimes 1.0.5", "libc", - "linux-raw-sys 0.0.46", - "windows-sys 0.36.1", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", ] [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", - "sct", - "webpki", + "sct 0.7.0", + "webpki 0.22.0", ] [[package]] @@ -6278,29 +6192,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64", + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" - -[[package]] -name = "rw-stream-sink" -version = "0.2.1" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" -dependencies = [ - "futures", - "pin-project 0.4.30", - "static_assertions", -] +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "rw-stream-sink" @@ -6309,15 +6212,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ "futures", - "pin-project 1.0.12", + "pin-project", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "safe-mix" @@ -6328,15 +6231,6 @@ dependencies = [ "rustc_version 0.2.3", ] -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher 0.4.3", -] - [[package]] name = "same-file" version = "1.0.6" @@ -6349,7 +6243,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "log", "sp-core", @@ -6360,7 +6254,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", "futures-timer", @@ -6383,7 +6277,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6399,13 +6293,11 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "impl-trait-for-tuples", "memmap2", - "parity-scale-codec", "sc-chain-spec-derive", - "sc-network", + "sc-network-common", "sc-telemetry", "serde", "serde_json", @@ -6416,7 +6308,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6427,24 +6319,25 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "chrono", "clap", "fdlimit", "futures", - "hex", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", "names", "parity-scale-codec", - "rand 0.7.3", + "rand 0.8.5", "regex", "rpassword", "sc-client-api", "sc-client-db", "sc-keystore", "sc-network", + "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", @@ -6459,18 +6352,17 @@ dependencies = [ "sp-runtime", "sp-version", "thiserror", - "tiny-bip39 0.8.2", + "tiny-bip39", "tokio", ] [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "fnv", "futures", - "hash-db", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -6487,14 +6379,13 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-storage", - "sp-trie", "substrate-prometheus-endpoint", ] [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "hash-db", "kvdb", @@ -6507,6 +6398,7 @@ dependencies = [ "parking_lot 0.12.1", "sc-client-api", "sc-state-db", + "schnellru", "sp-arithmetic", "sp-blockchain", "sp-core", @@ -6519,13 +6411,14 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures", "futures-timer", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", + "mockall", "parking_lot 0.12.1", "sc-client-api", "sc-utils", @@ -6543,7 +6436,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures", @@ -6572,7 +6465,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures", @@ -6590,17 +6483,14 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-timestamp", - "thiserror", ] [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "lazy_static", - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -6608,66 +6498,56 @@ dependencies = [ "sc-executor-wasmtime", "sp-api", "sp-core", - "sp-core-hashing-proc-macro", "sp-externalities", "sp-io", "sp-panic-handler", "sp-runtime-interface", - "sp-tasks", "sp-trie", "sp-version", "sp-wasm-interface", "tracing", - "wasmi", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "environmental", - "parity-scale-codec", "sc-allocator", "sp-maybe-compressed-blob", - "sp-sandbox", "sp-wasm-interface", "thiserror", - "wasm-instrument", - "wasmi", + "wasm-instrument 0.3.0", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "log", - "parity-scale-codec", "sc-allocator", "sc-executor-common", "sp-runtime-interface", - "sp-sandbox", "sp-wasm-interface", - "wasmi", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "cfg-if", "libc", "log", "once_cell", - "parity-scale-codec", - "parity-wasm 0.42.2", - "rustix 0.35.12", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", - "sp-sandbox", "sp-wasm-interface", "wasmtime", ] @@ -6675,16 +6555,14 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "ansi_term", "futures", "futures-timer", "log", - "parity-util-mem", "sc-client-api", "sc-network-common", - "sc-transaction-pool-api", "sp-blockchain", "sp-runtime", ] @@ -6692,10 +6570,10 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "async-trait", - "hex", "parking_lot 0.12.1", "serde_json", "sp-application-crypto", @@ -6707,31 +6585,25 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "async-trait", "asynchronous-codec", - "bitflags", + "backtrace", "bytes", - "cid", "either", "fnv", - "fork-tree", "futures", "futures-timer", - "hex", "ip_network", - "libp2p 0.46.1", - "linked-hash-map", - "linked_hash_set", + "libp2p 0.50.0", "log", - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", - "pin-project 1.0.12", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "sc-block-builder", "sc-client-api", "sc-consensus", @@ -6749,43 +6621,66 @@ dependencies = [ "substrate-prometheus-endpoint", "thiserror", "unsigned-varint", - "void", "zeroize", ] +[[package]] +name = "sc-network-bitswap" +version = "0.10.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "cid", + "futures", + "libp2p 0.50.0", + "log", + "prost", + "prost-build", + "sc-client-api", + "sc-network-common", + "sp-blockchain", + "sp-runtime", + "thiserror", + "unsigned-varint", +] + [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "bitflags", "bytes", "futures", - "libp2p 0.46.1", + "futures-timer", + "libp2p 0.50.0", + "linked_hash_set", "parity-scale-codec", - "prost-build 0.10.4", + "prost-build", "sc-consensus", "sc-peerset", + "serde", "smallvec", + "sp-blockchain", "sp-consensus", "sp-finality-grandpa", "sp-runtime", + "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "futures", - "hex", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sc-peerset", @@ -6798,21 +6693,24 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", + "async-trait", "fork-tree", "futures", - "hex", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", - "lru", + "lru 0.8.1", + "mockall", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-consensus", "sc-network-common", "sc-peerset", + "sc-utils", "smallvec", "sp-arithmetic", "sp-blockchain", @@ -6820,29 +6718,50 @@ dependencies = [ "sp-core", "sp-finality-grandpa", "sp-runtime", + "substrate-prometheus-endpoint", "thiserror", ] +[[package]] +name = "sc-network-transactions" +version = "0.10.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "array-bytes", + "futures", + "libp2p 0.50.0", + "log", + "parity-scale-codec", + "pin-project", + "sc-network-common", + "sc-peerset", + "sc-utils", + "sp-consensus", + "sp-runtime", + "substrate-prometheus-endpoint", +] + [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "bytes", "fnv", "futures", "futures-timer", - "hex", "hyper", "hyper-rustls", + "libp2p 0.50.0", "num_cpus", "once_cell", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "sc-client-api", - "sc-network", "sc-network-common", + "sc-peerset", "sc-utils", "sp-api", "sp-core", @@ -6855,10 +6774,10 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", "sc-utils", "serde_json", @@ -6868,7 +6787,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6877,10 +6796,9 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", - "hash-db", "jsonrpsee", "log", "parity-scale-codec", @@ -6902,18 +6820,16 @@ dependencies = [ "sp-runtime", "sp-session", "sp-version", + "tokio", ] [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "futures", "jsonrpsee", - "log", "parity-scale-codec", - "parking_lot 0.12.1", "sc-chain-spec", "sc-transaction-pool-api", "scale-info", @@ -6922,7 +6838,6 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing", "sp-version", "thiserror", ] @@ -6930,34 +6845,60 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "futures", + "http", "jsonrpsee", "log", "serde_json", "substrate-prometheus-endpoint", "tokio", + "tower", + "tower-http", +] + +[[package]] +name = "sc-rpc-spec-v2" +version = "0.10.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "array-bytes", + "futures", + "futures-util", + "hex", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-chain-spec", + "sc-client-api", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "sp-version", + "thiserror", + "tokio-stream", ] [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "directories", "exit-future", "futures", "futures-timer", - "hash-db", "jsonrpsee", "log", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "sc-block-builder", "sc-chain-spec", "sc-client-api", @@ -6967,12 +6908,16 @@ dependencies = [ "sc-informant", "sc-keystore", "sc-network", + "sc-network-bitswap", "sc-network-common", "sc-network-light", "sc-network-sync", + "sc-network-transactions", "sc-offchain", "sc-rpc", "sc-rpc-server", + "sc-rpc-spec-v2", + "sc-storage-monitor", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -6982,23 +6927,20 @@ dependencies = [ "serde", "serde_json", "sp-api", - "sp-application-crypto", - "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-core", "sp-externalities", - "sp-inherents", "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", "sp-storage", - "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", + "static_init", "substrate-prometheus-endpoint", "tempfile", "thiserror", @@ -7010,26 +6952,39 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "log", "parity-scale-codec", - "parity-util-mem", - "parity-util-mem-derive", "parking_lot 0.12.1", - "sc-client-api", "sp-core", ] +[[package]] +name = "sc-storage-monitor" +version = "0.1.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "clap", + "futures", + "log", + "nix 0.26.2", + "sc-client-db", + "sc-utils", + "sp-core", + "thiserror", + "tokio", +] + [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", "libc", "log", - "rand 0.7.3", + "rand 0.8.5", "rand_pcg", "regex", "sc-telemetry", @@ -7043,15 +6998,16 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "chrono", "futures", - "libp2p 0.46.1", + "libp2p 0.50.0", "log", "parking_lot 0.12.1", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", + "sc-utils", "serde", "serde_json", "thiserror", @@ -7061,7 +7017,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "ansi_term", "atty", @@ -7092,7 +7048,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7103,14 +7059,15 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "async-trait", "futures", "futures-timer", "linked-hash-map", "log", + "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "sc-client-api", "sc-transaction-pool-api", @@ -7129,8 +7086,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "async-trait", "futures", "log", "serde", @@ -7142,8 +7100,9 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "backtrace", "futures", "futures-timer", "lazy_static", @@ -7154,9 +7113,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -7168,9 +7127,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7180,12 +7139,22 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", ] [[package]] @@ -7214,9 +7183,19 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sct" @@ -7228,23 +7207,37 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sdp" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" +dependencies = [ + "rand 0.8.5", + "substring", + "thiserror", + "url", +] + [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "secp256k1-sys", ] @@ -7269,9 +7262,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -7282,9 +7275,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -7310,9 +7303,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] @@ -7325,18 +7318,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -7345,9 +7338,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -7367,6 +7360,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + [[package]] name = "sha2" version = "0.8.2" @@ -7400,7 +7404,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -7409,7 +7413,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -7428,32 +7432,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" -[[package]] -name = "signal-hook" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] @@ -7471,9 +7465,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -7492,20 +7486,20 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" +checksum = "12ba5f4d4ff12bdb6a169ed51b7c48c0e0ac4b0b4b31012b2571e97d78d3201d" dependencies = [ - "aes-gcm", + "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-pre.1", + "curve25519-dalek 4.0.0-rc.0", "rand_core 0.6.4", "ring", "rustc_version 0.4.0", @@ -7529,10 +7523,11 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.1", "bytes", "flate2", "futures", + "http", "httparse", "log", "rand 0.8.5", @@ -7542,7 +7537,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "hash-db", "log", @@ -7552,6 +7547,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-version", "thiserror", ] @@ -7559,7 +7555,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "blake2", "proc-macro-crate", @@ -7570,8 +7566,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", @@ -7583,27 +7579,31 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive", "sp-std", "static_assertions", ] [[package]] -name = "sp-authorship" +name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "async-trait", "parity-scale-codec", - "sp-inherents", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-mmr-primitives", "sp-runtime", "sp-std", ] @@ -7611,7 +7611,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "sp-api", @@ -7623,11 +7623,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", "log", - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -7641,11 +7641,10 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures", - "futures-timer", "log", "parity-scale-codec", "sp-core", @@ -7660,7 +7659,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "parity-scale-codec", @@ -7678,7 +7677,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "merlin", @@ -7701,13 +7700,11 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-runtime", "sp-std", "sp-timestamp", ] @@ -7715,7 +7712,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", @@ -7727,30 +7724,27 @@ dependencies = [ [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", @@ -7766,19 +7760,18 @@ dependencies = [ "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39 0.8.2", - "wasmi", + "tiny-bip39", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", "sp-std", @@ -7788,7 +7781,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro2", "quote", @@ -7799,7 +7792,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -7807,8 +7800,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "proc-macro2", "quote", @@ -7817,8 +7810,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "environmental", "parity-scale-codec", @@ -7829,7 +7822,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "finality-grandpa", "log", @@ -7847,7 +7840,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -7860,16 +7853,16 @@ dependencies = [ [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot 0.12.1", "secp256k1", "sp-core", "sp-externalities", @@ -7879,15 +7872,14 @@ dependencies = [ "sp-std", "sp-tracing", "sp-trie", - "sp-wasm-interface", "tracing", "tracing-core", ] [[package]] name = "sp-keyring" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "lazy_static", "sp-core", @@ -7897,8 +7889,8 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures", @@ -7915,16 +7907,34 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "thiserror", "zstd", ] +[[package]] +name = "sp-mmr-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "ckb-merkle-mountain-range", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-debug-derive", + "sp-runtime", + "sp-std", + "thiserror", +] + [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", @@ -7938,7 +7948,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "sp-api", "sp-core", @@ -7947,8 +7957,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "backtrace", "lazy_static", @@ -7958,7 +7968,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "rustc-hash", "serde", @@ -7967,17 +7977,16 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", "sp-application-crypto", @@ -7985,12 +7994,13 @@ dependencies = [ "sp-core", "sp-io", "sp-std", + "sp-weights", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8007,8 +8017,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "Inflector", "proc-macro-crate", @@ -8017,24 +8027,10 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-sandbox" -version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "log", - "parity-scale-codec", - "sp-core", - "sp-io", - "sp-std", - "sp-wasm-interface", - "wasmi", -] - [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", @@ -8048,25 +8044,25 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "scale-info", + "sp-core", "sp-runtime", "sp-std", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "sp-core", "sp-externalities", @@ -8075,18 +8071,17 @@ dependencies = [ "sp-trie", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8096,29 +8091,15 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "log", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", -] - [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "futures-timer", "log", "parity-scale-codec", - "sp-api", "sp-inherents", "sp-runtime", "sp-std", @@ -8127,8 +8108,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "sp-std", @@ -8140,7 +8121,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "sp-api", "sp-runtime", @@ -8149,7 +8130,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "async-trait", "log", @@ -8164,16 +8145,23 @@ dependencies = [ [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "ahash 0.8.3", "hash-db", + "hashbrown 0.12.3", + "lazy_static", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot 0.12.1", "scale-info", + "schnellru", "sp-core", "sp-std", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -8181,11 +8169,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "impl-serde", "parity-scale-codec", - "parity-wasm 0.42.2", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -8198,7 +8186,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8208,28 +8196,59 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", "sp-std", - "wasmi", + "wasmi 0.13.2", "wasmtime", ] +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -8252,6 +8271,34 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_init" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" +dependencies = [ + "bitflags", + "cfg_aliases", + "libc", + "parking_lot 0.11.2", + "parking_lot_core 0.8.6", + "static_init_macro", + "winapi", +] + +[[package]] +name = "static_init_macro" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf" +dependencies = [ + "cfg_aliases", + "memchr", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "statrs" version = "0.15.0" @@ -8284,13 +8331,32 @@ dependencies = [ name = "strum_macros" version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "stun" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" dependencies = [ - "heck 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", + "base64 0.13.1", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", ] [[package]] @@ -8309,25 +8375,23 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "platforms", + "platforms 2.0.0", ] [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "frame-system-rpc-runtime-api", "futures", "jsonrpsee", "log", "parity-scale-codec", - "sc-client-api", "sc-rpc-api", "sc-transaction-pool-api", - "serde_json", "sp-api", "sp-block-builder", "sp-blockchain", @@ -8338,9 +8402,8 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ - "futures-util", "hyper", "log", "prometheus", @@ -8348,14 +8411,27 @@ dependencies = [ "tokio", ] +[[package]] +name = "substrate-rpc-client" +version = "0.10.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" +dependencies = [ + "async-trait", + "jsonrpsee", + "log", + "sc-rpc-api", + "serde", + "sp-runtime", +] + [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ + "array-bytes", "async-trait", "futures", - "hex", "parity-scale-codec", "sc-client-api", "sc-client-db", @@ -8377,10 +8453,9 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "beefy-merkle-tree", - "beefy-primitives", "cfg-if", "frame-support", "frame-system", @@ -8390,12 +8465,12 @@ dependencies = [ "pallet-babe", "pallet-timestamp", "parity-scale-codec", - "parity-util-mem", "sc-service", "scale-info", "serde", "sp-api", "sp-application-crypto", + "sp-beefy", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", @@ -8421,7 +8496,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "futures", "parity-scale-codec", @@ -8440,7 +8515,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "ansi_term", "build-helper", @@ -8451,7 +8526,16 @@ dependencies = [ "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", +] + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", ] [[package]] @@ -8462,9 +8546,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -8512,53 +8596,52 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "tempfile" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall", - "remove_dir_all", - "winapi", + "rustix 0.36.8", + "windows-sys 0.42.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] -name = "textwrap" -version = "0.15.0" +name = "termtree" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -8567,10 +8650,11 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] @@ -8585,20 +8669,19 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" +version = "0.5.3+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8" dependencies = [ "cc", - "fs_extra", "libc", ] [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -8606,22 +8689,30 @@ dependencies = [ ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "time" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +dependencies = [ + "time-core", ] [[package]] @@ -8644,12 +8735,13 @@ dependencies = [ ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "tinytemplate" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "crunchy", + "serde", + "serde_json", ] [[package]] @@ -8663,15 +8755,15 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.21.2" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -8684,14 +8776,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys 0.42.0", ] [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -8704,27 +8796,28 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls", + "rustls 0.20.8", "tokio", - "webpki", + "webpki 0.22.0", ] [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" dependencies = [ "futures-core", "pin-project-lite 0.2.9", "tokio", + "tokio-util", ] [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", @@ -8737,13 +8830,48 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite 0.2.9", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -8757,6 +8885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", @@ -8789,7 +8918,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.12", + "pin-project", "tracing", ] @@ -8839,9 +8968,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", "hashbrown 0.12.3", @@ -8861,9 +8990,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", "cfg-if", @@ -8875,69 +9004,97 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", + "socket2", "thiserror", "tinyvec", + "tokio", + "tracing", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ "cfg-if", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", + "tokio", + "tracing", "trust-dns-proto", ] [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#de36ffe0e37185243e3c2980f72f16f53a62e6ae" dependencies = [ "clap", - "jsonrpsee", + "frame-remote-externalities", + "frame-try-runtime", + "hex", "log", "parity-scale-codec", - "remote-externalities", - "sc-chain-spec", "sc-cli", "sc-executor", "sc-service", "serde", + "serde_json", + "sp-api", "sp-core", + "sp-debug-derive", "sp-externalities", "sp-io", "sp-keystore", + "sp-rpc", "sp-runtime", "sp-state-machine", "sp-version", + "sp-weights", + "substrate-rpc-client", "zstd", ] [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" + +[[package]] +name = "turn" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" +dependencies = [ + "async-trait", + "base64 0.13.1", + "futures", + "log", + "md-5", + "rand 0.8.5", + "ring", + "stun", + "thiserror", + "tokio", + "webrtc-util", +] [[package]] name = "twox-hash" @@ -8946,22 +9103,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "digest 0.10.5", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -8969,26 +9126,17 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -8999,12 +9147,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" - [[package]] name = "unicode-width" version = "0.1.10" @@ -9027,6 +9169,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "universal-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "unsigned-varint" version = "0.7.1" @@ -9057,20 +9209,19 @@ dependencies = [ ] [[package]] -name = "valuable" -version = "0.1.0" +name = "uuid" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +dependencies = [ + "getrandom 0.2.8", +] [[package]] -name = "value-bag" -version = "1.0.0-alpha.9" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vcpkg" @@ -9090,6 +9241,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waitgroup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" +dependencies = [ + "atomic-waker", +] + [[package]] name = "waker-fn" version = "1.1.0" @@ -9137,9 +9297,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -9147,9 +9307,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -9162,9 +9322,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -9174,9 +9334,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9184,9 +9344,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -9197,28 +9357,67 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] -name = "wasm-gc-api" -version = "0.1.11" +name = "wasm-instrument" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", + "parity-wasm", ] [[package]] name = "wasm-instrument" -version = "0.1.1" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasm-opt" +version = "0.111.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" +dependencies = [ + "anyhow", + "libc", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.111.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962e5b0401bbb6c887f54e69b8c496ea36f704df65db73e81fd5ff8dc3e63a9f" +checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" dependencies = [ - "parity-wasm 0.42.2", + "anyhow", + "cc", + "cxx", + "cxx-build", + "regex", ] [[package]] @@ -9238,58 +9437,101 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm", + "wasmi-validation", + "wasmi_core 0.2.1", +] + +[[package]] +name = "wasmi" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01bf50edb2ea9d922aa75a7bf3c15e26a6c9e2d18c56e862b49737a582901729" +dependencies = [ + "spin 0.9.5", + "wasmi_arena", + "wasmi_core 0.5.0", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_arena" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ea379cbb0b41f3a9f0bf7b47036d036aae7f43383d8cc487d4deccf40dee0a" + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ "downcast-rs", - "libc", - "libm", + "libm 0.2.6", "memory_units", - "num-rational 0.2.4", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmi_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5bf998ab792be85e20e771fe14182b4295571ad1d4f89d3da521c1bef5f597a" +dependencies = [ + "downcast-rs", + "libm 0.2.6", "num-traits", - "parity-wasm 0.42.2", - "wasmi-validation", ] [[package]] -name = "wasmi-validation" -version = "0.4.1" +name = "wasmparser" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" dependencies = [ - "parity-wasm 0.42.2", + "indexmap", ] [[package]] -name = "wasmparser" -version = "0.85.0" +name = "wasmparser-nostd" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570460c58b21e9150d2df0eaaedbb7816c34bcec009ae0dcc976e40ba81463e7" +checksum = "9c37f310b5a62bfd5ae7c0f1d8e6f98af16a5d6d84ba764e9c36439ec14e318b" dependencies = [ - "indexmap", + "indexmap-nostd", ] [[package]] name = "wasmtime" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f50eadf868ab6a04b7b511460233377d0bfbb92e417b2f6a98b98fef2e098f5" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" dependencies = [ "anyhow", - "backtrace", "bincode", "cfg-if", "indexmap", - "lazy_static", "libc", "log", - "object 0.28.4", + "object 0.29.0", "once_cell", "paste", "psm", "rayon", - "region", "serde", "target-lexicon", "wasmparser", @@ -9298,34 +9540,43 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "winapi", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1df23c642e1376892f3b72f311596976979cbf8b85469680cdd3a8a063d12a2" +checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" dependencies = [ "anyhow", - "base64", + "base64 0.13.1", "bincode", "directories-next", "file-per-thread-logger", "log", - "rustix 0.33.7", + "rustix 0.35.13", "serde", "sha2 0.9.9", "toml", - "winapi", + "windows-sys 0.36.1", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f264ff6b4df247d15584f2f53d009fbc90032cfdc2605b52b961bffc71b6eccd" +checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" dependencies = [ "anyhow", "cranelift-codegen", @@ -9333,10 +9584,9 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli", + "gimli 0.26.2", "log", - "more-asserts", - "object 0.28.4", + "object 0.29.0", "target-lexicon", "thiserror", "wasmparser", @@ -9345,17 +9595,16 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "839d2820e4b830f4b9e7aa08d4c0acabf4a5036105d639f6dfa1c6891c73bdc6" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", "cranelift-entity", - "gimli", + "gimli 0.26.2", "indexmap", "log", - "more-asserts", - "object 0.28.4", + "object 0.29.0", "serde", "target-lexicon", "thiserror", @@ -9365,49 +9614,47 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef0a0bcbfa18b946d890078ba0e1bc76bcc53eccfb40806c0020ec29dcd1bd49" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" dependencies = [ - "addr2line", + "addr2line 0.17.0", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli", + "gimli 0.26.2", "log", - "object 0.28.4", - "region", + "object 0.29.0", "rustc-demangle", - "rustix 0.33.7", + "rustix 0.35.13", "serde", "target-lexicon", "thiserror", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "winapi", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit-debug" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4779d976206c458edd643d1ac622b6c37e4a0800a8b1d25dfbf245ac2f2cac" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ - "lazy_static", - "object 0.28.4", - "rustix 0.33.7", + "object 0.29.0", + "once_cell", + "rustix 0.35.13", ] [[package]] name = "wasmtime-runtime" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7eb6ffa169eb5dcd18ac9473c817358cd57bc62c244622210566d473397954a" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" dependencies = [ "anyhow", - "backtrace", "cc", "cfg-if", "indexmap", @@ -9415,22 +9662,22 @@ dependencies = [ "log", "mach", "memfd", - "memoffset", - "more-asserts", + "memoffset 0.6.5", + "paste", "rand 0.8.5", - "region", - "rustix 0.33.7", + "rustix 0.35.13", "thiserror", + "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "winapi", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-types" -version = "0.38.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d932b0ac5336f7308d869703dd225610a6a3aeaa8e968c52b43eed96cefb1c2" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ "cranelift-entity", "serde", @@ -9440,14 +9687,24 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki" version = "0.22.0" @@ -9460,11 +9717,240 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki 0.22.0", +] + +[[package]] +name = "webrtc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "hex", + "interceptor", + "lazy_static", + "log", + "rand 0.8.5", + "rcgen 0.9.3", + "regex", + "ring", + "rtcp", + "rtp", + "rustls 0.19.1", + "sdp", + "serde", + "serde_json", + "sha2 0.10.6", + "stun", + "thiserror", + "time 0.3.20", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp 0.7.0", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "192aa07c846531ce89caa28ca2a6105735e026614c9fd1db838350d10e0fb9f5" +dependencies = [ + "bytes", + "derive_builder", + "log", + "thiserror", + "tokio", + "webrtc-sctp 0.8.0", + "webrtc-util", +] + +[[package]] +name = "webrtc-dtls" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" +dependencies = [ + "aes 0.6.0", + "aes-gcm 0.10.1", + "async-trait", + "bincode", + "block-modes", + "byteorder", + "ccm", + "curve25519-dalek 3.2.0", + "der-parser 8.1.0", + "elliptic-curve", + "hkdf", + "hmac 0.12.1", + "log", + "oid-registry 0.6.1", + "p256", + "p384", + "rand 0.8.5", + "rand_core 0.6.4", + "rcgen 0.9.3", + "ring", + "rustls 0.19.1", + "sec1", + "serde", + "sha1", + "sha2 0.10.6", + "signature", + "subtle", + "thiserror", + "tokio", + "webpki 0.21.4", + "webrtc-util", + "x25519-dalek 2.0.0-pre.1", + "x509-parser 0.13.2", +] + +[[package]] +name = "webrtc-ice" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand 0.8.5", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" +dependencies = [ + "log", + "socket2", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a3c157a040324e5049bcbd644ffc9079e6738fa2cfab2bcff64e5cc4c00d7" +dependencies = [ + "byteorder", + "bytes", + "derive_builder", + "displaydoc", + "rand 0.8.5", + "rtp", + "thiserror", + "webrtc-util", +] + +[[package]] +name = "webrtc-sctp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand 0.8.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-sctp" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df742d91cfbd982f6ab2bfd45a7c3ddfce5b2f55913b2f63877404d1b3259db" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand 0.8.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" +dependencies = [ + "aead 0.4.3", + "aes 0.7.5", + "aes-gcm 0.9.4", + "async-trait", + "byteorder", + "bytes", + "ctr 0.8.0", + "hmac 0.11.0", + "log", + "rtcp", + "rtp", + "sha-1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-util" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" dependencies = [ - "webpki", + "async-trait", + "bitflags", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix 0.24.3", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", ] [[package]] @@ -9478,9 +9964,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -9557,19 +10043,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" @@ -9585,9 +10095,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" @@ -9603,9 +10113,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" @@ -9621,9 +10131,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" @@ -9639,15 +10149,15 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" @@ -9663,24 +10173,24 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] @@ -9696,6 +10206,54 @@ dependencies = [ "zeroize", ] +[[package]] +name = "x25519-dalek" +version = "2.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +dependencies = [ + "asn1-rs 0.3.1", + "base64 0.13.1", + "data-encoding", + "der-parser 7.0.0", + "lazy_static", + "nom", + "oid-registry 0.4.0", + "ring", + "rusticata-macros", + "thiserror", + "time 0.3.20", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs 0.5.1", + "base64 0.13.1", + "data-encoding", + "der-parser 8.1.0", + "lazy_static", + "nom", + "oid-registry 0.6.1", + "rusticata-macros", + "thiserror", + "time 0.3.20", +] + [[package]] name = "yamux" version = "0.10.2" @@ -9710,6 +10268,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "yasna" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" +dependencies = [ + "time 0.3.20", +] + [[package]] name = "zeroize" version = "1.5.7" @@ -9721,9 +10288,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", @@ -9752,10 +10319,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.7+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 86e4580237..40ad032e97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,9 @@ exclude = [ "contracts/marketplace", "contracts/simple_dex", "contracts/ticket_token", - "contracts/wrapped_azero" + "contracts/wrapped_azero", + "contracts/adder", + "scripts/synthetic-network/synthetic-link", ] [profile.release] diff --git a/README.md b/README.md index bfa1accb6d..5d33833b44 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The code in this repository is licensed as follows: - all rest of the crates are licensed under the terms of Apache License 2.0. [aleph-homepage]: https://alephzero.org -[aleph-logo]: https://alephzero.org/wp-content/uploads/A0_logotype_dark-1.jpg +[aleph-logo]: https://assets.alephzero.org/branding/logo/digital/A0-horizontal-light-background.jpg [aleph-bft-link]: https://github.com/Cardinal-Cryptography/AlephBFT [aleph-bft-paper]: https://arxiv.org/abs/1908.05156 [aleph-polkadot-link]: https://github.com/Cardinal-Cryptography/apps diff --git a/aggregator/Cargo.toml b/aggregator/Cargo.toml index a6ac01c701..77b50b8fb7 100644 --- a/aggregator/Cargo.toml +++ b/aggregator/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "aggregator" -version = "0.2.0" +version = "0.3.0" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" [dependencies] -aleph-bft-rmc = "0.5.0" -aleph-bft-types = "0.6.0" +aleph-bft-rmc = "0.6" +aleph-bft-types = "0.8" async-trait = "0.1" futures = "0.3" diff --git a/aleph-client/.dockerignore b/aleph-client/.dockerignore new file mode 100644 index 0000000000..11e58e6c04 --- /dev/null +++ b/aleph-client/.dockerignore @@ -0,0 +1,2 @@ +** +!docker/subxt-integration-entrypoint.sh diff --git a/aleph-client/Cargo.lock b/aleph-client/Cargo.lock index cbf159bb0e..bec58962ad 100644 --- a/aleph-client/Cargo.lock +++ b/aleph-client/Cargo.lock @@ -13,61 +13,21 @@ dependencies = [ ] [[package]] -name = "ac-compose-macros" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "log", - "parity-scale-codec", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-node-api" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "derive_more", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-primitives" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "hex", - "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "gimli 0.26.2", ] [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.2", ] [[package]] @@ -87,43 +47,49 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph_client" -version = "1.11.0" +version = "2.13.0" dependencies = [ - "ac-node-api", - "ac-primitives", "anyhow", - "contract-metadata 1.5.0", + "async-trait", + "contract-metadata 2.0.1", "contract-transcode", "frame-support", + "futures", "hex", "ink_metadata", "log", - "pallet-aleph", - "pallet-balances", - "pallet-elections", - "pallet-multisig", - "pallet-staking", - "pallet-treasury", - "pallet-vesting", + "pallet-contracts-primitives", "parity-scale-codec", "primitives", - "rayon", + "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "subxt", "thiserror", + "tokio", ] [[package]] @@ -141,23 +107,20 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] -name = "approx" -version = "0.5.1" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "arrayref" @@ -165,15 +128,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -187,25 +141,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] -name = "async-trait" -version = "0.1.58" +name = "async-lock" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" dependencies = [ - "proc-macro2", - "quote", - "syn", + "event-listener", + "futures-lite", ] [[package]] -name = "atty" -version = "0.2.14" +name = "async-trait" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -216,16 +169,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -247,6 +200,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -267,21 +250,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -334,9 +307,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -358,31 +331,24 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.74" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -392,14 +358,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", "num-traits", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -414,22 +380,16 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "contract-metadata" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36318b44d658ee23a2daf66811822bdf6ac686aa534ea87eb9e16e7430ca6928" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -439,10 +399,11 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f25bdb57a728064a0e4909dfbb29957ebb06d205307e337d3b5596c7e67dd3a" +checksum = "f5997814dd5d45804757a616e938c28586875ac793ffc140e57e7ae9f421a066" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -452,35 +413,37 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa6db9d18dd5ef92d29c52d30c8503c857d390d9e4043e12466f1490c43c05e" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ "anyhow", - "contract-metadata 0.6.0", - "env_logger", + "contract-metadata 2.0.0-beta.1", "escape8259", "hex", "indexmap", "ink_env", "ink_metadata", "itertools", - "log", "nom", "nom-supreme", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "core-foundation" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation-sys" @@ -489,55 +452,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.6" +name = "cpp_demangle" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if", ] [[package]] -name = "crossbeam-deque" -version = "0.8.2" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "libc", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.11" +name = "cranelift-entity" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset", - "scopeguard", + "serde", ] [[package]] -name = "crossbeam-utils" -version = "0.8.12" +name = "crc32fast" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -548,9 +495,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -616,9 +563,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -628,9 +575,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -643,28 +590,86 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -673,10 +678,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", ] @@ -700,9 +703,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -738,15 +741,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -756,9 +759,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -771,27 +774,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -802,23 +818,31 @@ dependencies = [ ] [[package]] -name = "env_logger" -version = "0.9.2" +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae4f45fe23a1cad99d61617b3c9dbc19c905f2671b25d1e2714b4b221dc3605" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "errno-dragonfly", + "libc", + "winapi", ] [[package]] -name = "environmental" -version = "1.1.3" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "escape8259" @@ -829,17 +853,38 @@ dependencies = [ "rustversion", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -847,9 +892,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -858,19 +903,10 @@ dependencies = [ ] [[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" @@ -882,84 +918,24 @@ dependencies = [ ] [[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "frame-support", - "frame-system", - "linregress", - "log", + "cfg-if", "parity-scale-codec", - "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", ] [[package]] -name = "frame-election-provider-solution-type" +name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-election-provider-support" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-solution-type", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-npos-elections", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "git+https://github.com/integritee-network/frame-metadata#3b43da9821238681f9431276d55b92a079142083" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "bitflags", - "frame-metadata 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -970,27 +946,31 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-api", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core-hashing-proc-macro", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-inherents", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -999,7 +979,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1011,46 +991,13 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "2.0.0" @@ -1059,9 +1006,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1074,9 +1021,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1084,15 +1031,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1102,15 +1049,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-lite" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1119,15 +1081,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1137,9 +1099,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1178,7 +1140,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -1191,9 +1153,11 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1201,18 +1165,47 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1234,14 +1227,26 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] @@ -1272,6 +1277,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1283,6 +1297,28 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" @@ -1290,10 +1326,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] -name = "humantime" -version = "2.1.0" +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] [[package]] name = "iana-time-zone" @@ -1306,7 +1382,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1319,6 +1395,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1340,9 +1422,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -1366,60 +1448,61 @@ checksum = "0cfe9645a18782869361d9c8732246be7b410ad4e919d3609ebabdac00ba12c3" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] name = "ink_allocator" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9588a59a0e8997c0b2153cd11b5aaa77c06a0537a6b18f3811d1f1aa098b12" +checksum = "5323d4f43900266f2d5462cbe2a96d4182d634da0cfc1078d26c74d4117e0ce9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_engine" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487c3b390b7feb0620496b0cd38683433c7d7e6946b1caabda51e1f23eb24b30" +checksum = "de001b0907475ab10211093569d8b92726ef7a37d04b6e90c8a2864fbe14d050" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand 0.8.5", - "secp256k1 0.24.1", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", ] [[package]] name = "ink_env" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a891d34301a3dbb1c7b7424c49ae184282b163491c54f9acd17fcbe14a80447b" +checksum = "b0354567725e4f635a5c5694e4e4cac105e3e78cefd948ca5ab6cc92ea3d8231" dependencies = [ "arrayref", "blake2", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "ink_allocator", "ink_engine", "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.1", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", "static_assertions", @@ -1427,9 +1510,9 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74913aaed5751f5615af4631b7559328b8ed56c9cb821b89e14af0706176e849" +checksum = "9dfb4d5448446656ebf83d800c06effeffc063967ef5986d7d1a277e3e507dae" dependencies = [ "derive_more", "impl-serde", @@ -1441,23 +1524,47 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f031e6b8495594a7288b089bf4122e76c26b994959d1b2b693bdfe846b14c0e" +checksum = "c2626fb0c922f923965774cdd8cddeaaa204931d0ed19e0bf43702b033924173" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.4.0" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91066af898fe4c59b2ed0aca678238928b551dc75f5284bf1422e9f1bb6b2204" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage_traits" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12cf42dce81d060401c7cec95a392ad6d3c2f18661fa3083f619ce135133c33" +checksum = "da15ceaef6bdbece3e8b6338df899ef94e3921d03387fa941af8df3b38803523" dependencies = [ - "cfg-if 1.0.0", + "ink_metadata", "ink_prelude", + "ink_primitives", "parity-scale-codec", "scale-info", + "syn", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] @@ -1470,13 +1577,10 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "io-lifetimes" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "itertools" @@ -1489,9 +1593,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "joinery" @@ -1501,39 +1605,121 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "cpufeatures", ] [[package]] @@ -1542,23 +1728,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1567,7 +1747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1610,22 +1790,18 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] [[package]] -name = "linregress" -version = "0.4.4" +name = "linux-raw-sys" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" -dependencies = [ - "nalgebra", - "statrs", -] +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "lock_api" @@ -1643,25 +1819,34 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] -name = "matchers" -version = "0.0.1" +name = "lru" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "regex-automata", + "hashbrown 0.12.3", ] [[package]] -name = "matrixmultiply" +name = "mach" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "rawpointer", + "regex-automata", ] [[package]] @@ -1681,20 +1866,30 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown 0.12.3", +] + [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1716,107 +1911,36 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.6.23" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "nalgebra" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational 0.4.1", - "num-traits", - "rand 0.8.5", - "rand_distr", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "net2" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1836,30 +1960,30 @@ dependencies = [ ] [[package]] -name = "num-bigint" -version = "0.2.6" +name = "nom8" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "memchr", ] [[package]] -name = "num-complex" -version = "0.4.2" +name = "num-bigint" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ + "autocfg", + "num-integer", "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -1875,18 +1999,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -1894,6 +2006,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -1905,14 +2018,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", ] [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ "hermit-abi", "libc", @@ -1923,15 +2035,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -1946,249 +2070,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "openssl" -version = "0.10.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-sys" -version = "0.9.77" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "pallet-aleph" -version = "0.5.0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "pallet-session", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "serde", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-authorship", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-elections" -version = "0.5.0" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-balances", - "pallet-session", - "pallet-staking", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-session" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "log", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-session", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-staking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec", - "scale-info", - "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-timestamp", -] - -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "serde", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "pallet-contracts-primitives" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-support", - "frame-system", - "log", + "bitflags", "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallets-support" -version = "0.1.0" -dependencies = [ - "frame-support", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2196,9 +2104,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2208,17 +2116,17 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", - "hashbrown", + "cfg-if", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", "primitive-types", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2234,9 +2142,15 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -2250,22 +2164,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -2285,6 +2199,15 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -2292,22 +2215,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] -name = "pin-project-lite" -version = "0.2.9" +name = "pin-project" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] [[package]] -name = "pin-utils" -version = "0.1.0" +name = "pin-project-internal" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] -name = "pkg-config" -version = "0.3.26" +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] [[package]] name = "ppv-lite86" @@ -2317,9 +2264,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -2330,44 +2277,76 @@ dependencies = [ [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", ] [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2441,16 +2420,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -2469,36 +2438,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2510,18 +2449,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2530,9 +2469,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2556,15 +2495,30 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rlibc" version = "1.0.0" @@ -2590,34 +2544,95 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "semver", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] [[package]] name = "scale-info" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -2626,9 +2641,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2636,6 +2651,43 @@ dependencies = [ "syn", ] +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2662,54 +2714,66 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.6.1", ] [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "secp256k1-sys 0.6.1", + "secp256k1-sys 0.8.0", ] [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "642a62736682fdd8c71da0eb273e453c8ac74e33b9fb310e22ba5b03ec7651ff" dependencies = [ "cc", ] @@ -2723,29 +2787,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2754,9 +2841,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -2765,14 +2852,15 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2794,7 +2882,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -2806,9 +2894,9 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2817,7 +2905,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -2832,62 +2920,106 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] [[package]] -name = "simba" -version = "0.5.1" +name = "slab" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", + "autocfg", ] [[package]] -name = "slab" +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ - "autocfg", + "libc", + "winapi", ] [[package]] -name = "smallvec" -version = "1.10.0" +name = "soketto" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "hash-db", "log", "parity-scale-codec", - "sp-api-proc-macro", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "blake2", "proc-macro-crate", @@ -2898,90 +3030,104 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] -name = "sp-arithmetic" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +name = "sp-application-crypto" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", +] + +[[package]] +name = "sp-arithmetic" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] [[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-arithmetic" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", + "integer-sqrt", + "num-traits", "parity-scale-codec", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "scale-info", + "serde", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "static_assertions", ] [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -2989,120 +3135,183 @@ dependencies = [ "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core-hashing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", + "tiny-bip39 0.8.2", "wasmi", "zeroize", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.1", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", - "wasmi", + "tiny-bip39 1.0.0", + "zeroize", +] + +[[package]] +name = "sp-core" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "array-bytes", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1 0.24.3", + "secrecy", + "serde", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39 1.0.0", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ - "blake2-rfc", + "blake2", "byteorder", - "sha2 0.9.9", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "twox-hash", ] +[[package]] +name = "sp-core-hashing" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "syn", +] + [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "syn", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3111,8 +3320,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", @@ -3121,98 +3340,134 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-keystore 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-state-machine 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-state-machine 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "secp256k1 0.24.1", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-keystore 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes", + "ed25519", + "ed25519-dalek", + "futures", + "libsecp256k1", + "log", + "parity-scale-codec", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3220,15 +3475,15 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures", @@ -3236,30 +3491,32 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] -name = "sp-npos-elections" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-keystore" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ + "async-trait", + "futures", + "merlin", "parity-scale-codec", - "scale-info", - "serde", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "parking_lot", + "schnorrkel", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "thiserror", ] [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", @@ -3268,8 +3525,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", @@ -3277,20 +3534,20 @@ dependencies = [ ] [[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-panic-handler" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "rustc-hash", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "backtrace", + "lazy_static", + "regex", ] [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3302,76 +3559,118 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-application-crypto 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-runtime" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3382,8 +3681,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", "proc-macro-crate", @@ -3393,35 +3692,46 @@ dependencies = [ ] [[package]] -name = "sp-session" +name = "sp-runtime-interface-proc-macro" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3430,101 +3740,120 @@ dependencies = [ "parking_lot", "rand 0.7.3", "smallvec", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-panic-handler 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-panic-handler 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-panic-handler 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", +] + +[[package]] +name = "sp-state-machine" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand 0.8.5", + "smallvec", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] -name = "sp-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", - "futures-timer", - "log", + "impl-serde", "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "thiserror", + "ref-cast", + "serde", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", "tracing-subscriber", @@ -3532,44 +3861,94 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", "tracing-subscriber", ] [[package]] -name = "sp-trie" +name = "sp-tracing" version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash 0.7.6", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "lru", + "memory-db 0.30.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "ahash 0.8.3", + "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ + "ahash 0.8.3", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3577,24 +3956,52 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm", "scale-info", "serde", - "sp-core-hashing-proc-macro", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version-proc-macro", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3604,34 +4011,111 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3642,6 +4126,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3649,47 +4139,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "statrs" -version = "0.15.0" +name = "strsim" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "substrate-api-client" -version = "0.6.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-compose-macros", - "ac-node-api", - "ac-primitives", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "pallet-balances", - "pallet-staking", - "pallet-transaction-payment", - "parity-scale-codec", - "primitive-types", - "serde", - "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-rpc", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", - "thiserror", - "ws", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "substrate-bip39" @@ -3710,11 +4163,84 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subxt" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +dependencies = [ + "bitvec", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tracing", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +dependencies = [ + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3739,29 +4265,127 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] -name = "thiserror-impl" -version = "1.0.37" +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3769,65 +4393,53 @@ dependencies = [ ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "tokio-rustls" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "once_cell", + "rustls", + "tokio", + "webpki", ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "tokio-util" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" [[package]] -name = "tinyvec" -version = "1.6.0" +name = "toml_edit" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "tinyvec_macros", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "toml" -version = "0.5.9" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -3835,7 +4447,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3907,12 +4519,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -3927,11 +4539,17 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -3939,23 +4557,23 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", - "digest 0.10.5", + "cfg-if", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -3965,15 +4583,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -3996,6 +4614,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -4014,18 +4638,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4040,19 +4674,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -4065,9 +4699,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4075,9 +4709,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4088,39 +4722,202 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -4132,12 +4929,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4150,7 +4941,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4159,6 +4950,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4166,94 +4970,131 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" +name = "windows_x86_64_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" +name = "windows_x86_64_gnullvm" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] -name = "ws" -version = "0.9.2" +name = "windows_x86_64_msvc" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fe90c75f236a0a00247d5900226aea4f2d7b05ccc34da9e7a8880ff59b5848" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio", - "mio-extras", - "openssl", - "rand 0.7.3", - "sha-1", - "slab", - "url", -] +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "windows_x86_64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + [[package]] name = "zeroize" version = "1.5.7" @@ -4265,9 +5106,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/aleph-client/Cargo.toml b/aleph-client/Cargo.toml index 7f71b82ebe..2f796f3e2f 100644 --- a/aleph-client/Cargo.toml +++ b/aleph-client/Cargo.toml @@ -1,34 +1,29 @@ [package] name = "aleph_client" -version = "1.11.0" +# TODO bump major version when API stablize +version = "2.13.0" edition = "2021" license = "Apache 2.0" [dependencies] +async-trait = "0.1.58" anyhow = "1.0" codec = { package = 'parity-scale-codec', version = "3.0.0", features = ['derive'] } hex = { version = "0.4.3", features = ["alloc"] } log = "0.4" -rayon = "1.5" serde_json = { version = "1.0" } thiserror = "1.0" -contract-metadata = "1.5" -contract-transcode = "0.1" -ink_metadata = "3.3" +contract-metadata = "2.0.0-beta" +contract-transcode = { git = "https://github.com/paritytech/cargo-contract", rev = "7ca8c365fc1e157cd52901c54949b2faf1cd8899" } +ink_metadata = "4.0.0-beta" +subxt = "0.25.0" +futures = "0.3.25" +serde = { version = "1.0", features = ["derive"] } -ac-primitives = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28" } -substrate-api-client = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28", features = ["staking-xt"] } -ac-node-api = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28" } - -frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["full_crypto"] } -sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-multisig = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-treasury = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-balances = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-vesting = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } - -pallet-aleph = { path = "../pallets/aleph" } -pallet-elections = { path = "../pallets/elections" } +frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-contracts-primitives = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } primitives = { path = "../primitives" } + +[dev-dependencies] +tokio = "1.21" diff --git a/aleph-client/README.md b/aleph-client/README.md new file mode 100644 index 0000000000..3d0e225734 --- /dev/null +++ b/aleph-client/README.md @@ -0,0 +1,20 @@ +# API for [aleph-node](https://github.com/Cardinal-Cryptography/aleph-node) chain. + +This crate provides a Rust application interface for submitting transactions to `aleph-node` chain. +Most of the [pallets](https://docs.substrate.io/reference/frame-pallets/) are common to any +[Substrate](https://github.com/paritytech/substrate) chain, but there are some unique to `aleph-node`, +e.g. [`pallets::elections::ElectionsApi`](./src/pallets/elections.rs). + +## Build + +Just use `cargo build` or `cargo build --release`, depends on your usecase. + +## Contributions + +All contributions are welcome, e.g. adding new API for pallets in `aleph-node`. + +## Metadata + +`aleph-client` uses [`subxt`](https://github.com/paritytech/subxt) to communicate with a Substrate-based chain which +`aleph-node` is. In order to provide a strong type safety, it uses a manually generated file [`aleph_zero.rs`](src/aleph_zero.rs) +which refers to top of the `main` branch in `aleph-node` repository. See more info [here](docker/README.md). diff --git a/aleph-client/docker/README.md b/aleph-client/docker/README.md new file mode 100644 index 0000000000..207b432454 --- /dev/null +++ b/aleph-client/docker/README.md @@ -0,0 +1,18 @@ +This directory contains following files: +### `subxt-integration.Dockerfile` +This is not a main `aleph-client`, rather it is a helper Dockerfile to run on GH, which has `subxt` tool. + +It requires: +* an `aleph-node` chain to be run in the background (ie `127.0.0.1:9944` port must be opened), +* access to `rustfmt.toml`, +* access to current `aleph_zero.rs` file + +The docker checks whether a `subxt`-generated runtime metadata is the same as from the current commit. + +It needs to be run only from `aleph-client` directory and in network host mode: +```bash + docker run --network host --mount type=bind,source="$(pwd)/..",target=/subxt/aleph-node subxt:latest +``` + +### `subxt-integration-entrypoint.sh` +An entrypoint for above Dockerfile diff --git a/aleph-client/docker/subxt-integration-entrypoint.sh b/aleph-client/docker/subxt-integration-entrypoint.sh new file mode 100644 index 0000000000..a60bb03acd --- /dev/null +++ b/aleph-client/docker/subxt-integration-entrypoint.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +subxt codegen --derive Clone --derive Debug --derive Eq --derive PartialEq | rustfmt --edition=2021 --config-path aleph-node/rustfmt.toml > aleph_zero.rs + +diff -y -W 200 --suppress-common-lines aleph_zero.rs aleph-node/aleph-client/src/aleph_zero.rs +diff_exit_code=$? +if [[ ! $diff_exit_code -eq 0 ]]; then + echo "Current runtime metadata is different than versioned in git!" + echo "Run subxt codegen --derive Clone --derive Debug --derive Eq --derive PartialEq | rustfmt --edition=2021 >" \ +"src/aleph_zero.rs from aleph-client directory and commit to git." + exit 1 +fi +echo "Current runtime metadata and versioned in git matches." diff --git a/aleph-client/docker/subxt-integration.Dockerfile b/aleph-client/docker/subxt-integration.Dockerfile new file mode 100644 index 0000000000..54c2049df7 --- /dev/null +++ b/aleph-client/docker/subxt-integration.Dockerfile @@ -0,0 +1,13 @@ +FROM rustlang/rust:nightly-slim + +WORKDIR subxt + +RUN cargo install subxt-cli +RUN rustup component add rustfmt --toolchain nightly + +COPY docker/subxt-integration-entrypoint.sh /subxt/subxt-integration-entrypoint.sh + +RUN chmod +x /subxt/subxt-integration-entrypoint.sh +RUN rustc --version + +ENTRYPOINT ["./subxt-integration-entrypoint.sh"] diff --git a/aleph-client/rustfmt.toml b/aleph-client/rustfmt.toml new file mode 100644 index 0000000000..af85000b72 --- /dev/null +++ b/aleph-client/rustfmt.toml @@ -0,0 +1,7 @@ +edition = "2021" +use_field_init_shorthand = true +reorder_modules = true + +imports_granularity = "Crate" +group_imports = "StdExternalCrate" +reorder_imports = true diff --git a/aleph-client/src/account.rs b/aleph-client/src/account.rs deleted file mode 100644 index 5f5f42bad8..0000000000 --- a/aleph-client/src/account.rs +++ /dev/null @@ -1,61 +0,0 @@ -use codec::Decode; -use pallet_balances::BalanceLock; -use sp_core::{crypto::AccountId32, storage::StorageKey}; -use substrate_api_client::{AccountId, Balance}; - -use crate::{state_query_storage_at, AnyConnection}; - -pub fn get_free_balance(connection: &C, account: &AccountId) -> Balance { - match connection - .as_connection() - .get_account_data(account) - .expect("Should be able to access account data") - { - Some(account_data) => account_data.free, - // Account may have not been initialized yet or liquidated due to the lack of funds. - None => 0, - } -} - -pub fn locks( - connection: &C, - accounts: &[AccountId], -) -> Vec>> { - let storage_keys = create_storage_keys_from_accounts(connection, accounts); - get_locked_balances_from_storage(connection, storage_keys) -} - -fn create_storage_keys_from_accounts( - connection: &C, - accounts: &[AccountId32], -) -> Vec { - accounts - .iter() - .map(|account| { - connection - .as_connection() - .metadata - .storage_map_key("Balances", "Locks", account) - .unwrap_or_else(|_| panic!("Cannot create storage key for account {}!", account)) - }) - .collect() -} - -fn get_locked_balances_from_storage( - connection: &C, - storage_keys: Vec, -) -> Vec>> { - match state_query_storage_at(connection, storage_keys) { - Ok(storage_entries) => storage_entries - .into_iter() - .map(|storage_entry| { - let entry_bytes = storage_entry.expect("Storage entry is null!").0; - Decode::decode(&mut entry_bytes.as_slice()) - .expect("Failed to decode locked balances!") - }) - .collect(), - Err(err) => { - panic!("Failed to query storage, details: {}", &err[..]); - } - } -} diff --git a/aleph-client/src/aleph_zero.rs b/aleph-client/src/aleph_zero.rs new file mode 100644 index 0000000000..367c98531b --- /dev/null +++ b/aleph-client/src/aleph_zero.rs @@ -0,0 +1,19693 @@ +#[allow(dead_code, unused_imports, non_camel_case_types)] +pub mod api { + use super::api as root_mod; + pub static PALLETS: [&str; 21usize] = [ + "System", + "RandomnessCollectiveFlip", + "Scheduler", + "Aura", + "Timestamp", + "Balances", + "TransactionPayment", + "Authorship", + "Staking", + "History", + "Session", + "Aleph", + "Elections", + "Treasury", + "Vesting", + "Utility", + "Multisig", + "Sudo", + "Contracts", + "NominationPools", + "Identity", + ]; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Event { + #[codec(index = 0)] + System(system::Event), + #[codec(index = 2)] + Scheduler(scheduler::Event), + #[codec(index = 5)] + Balances(balances::Event), + #[codec(index = 6)] + TransactionPayment(transaction_payment::Event), + #[codec(index = 8)] + Staking(staking::Event), + #[codec(index = 10)] + Session(session::Event), + #[codec(index = 11)] + Aleph(aleph::Event), + #[codec(index = 12)] + Elections(elections::Event), + #[codec(index = 13)] + Treasury(treasury::Event), + #[codec(index = 14)] + Vesting(vesting::Event), + #[codec(index = 15)] + Utility(utility::Event), + #[codec(index = 16)] + Multisig(multisig::Event), + #[codec(index = 17)] + Sudo(sudo::Event), + #[codec(index = 18)] + Contracts(contracts::Event), + #[codec(index = 19)] + NominationPools(nomination_pools::Event), + #[codec(index = 20)] + Identity(identity::Event), + } + pub mod system { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Remark { + pub remark: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetHeapPages { + pub pages: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetCode { + pub code: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetCodeWithoutChecks { + pub code: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetStorage { + pub items: ::std::vec::Vec<( + ::std::vec::Vec<::core::primitive::u8>, + ::std::vec::Vec<::core::primitive::u8>, + )>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct KillStorage { + pub keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct KillPrefix { + pub prefix: ::std::vec::Vec<::core::primitive::u8>, + pub subkeys: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RemarkWithEvent { + pub remark: ::std::vec::Vec<::core::primitive::u8>, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Make some on-chain remark."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`"] + #[doc = "# "] + pub fn remark( + &self, + remark: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "remark", + Remark { remark }, + [ + 101u8, 80u8, 195u8, 226u8, 224u8, 247u8, 60u8, 128u8, 3u8, 101u8, 51u8, + 147u8, 96u8, 126u8, 76u8, 230u8, 194u8, 227u8, 191u8, 73u8, 160u8, + 146u8, 87u8, 147u8, 243u8, 28u8, 228u8, 116u8, 224u8, 181u8, 129u8, + 160u8, + ], + ) + } + #[doc = "Set the number of pages in the WebAssembly environment's heap."] + pub fn set_heap_pages( + &self, + pages: ::core::primitive::u64, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "set_heap_pages", + SetHeapPages { pages }, + [ + 43u8, 103u8, 128u8, 49u8, 156u8, 136u8, 11u8, 204u8, 80u8, 6u8, 244u8, + 86u8, 171u8, 44u8, 140u8, 225u8, 142u8, 198u8, 43u8, 87u8, 26u8, 45u8, + 125u8, 222u8, 165u8, 254u8, 172u8, 158u8, 39u8, 178u8, 86u8, 87u8, + ], + ) + } + #[doc = "Set the new runtime code."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`"] + #[doc = "- 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is"] + #[doc = " expensive)."] + #[doc = "- 1 storage write (codec `O(C)`)."] + #[doc = "- 1 digest item."] + #[doc = "- 1 event."] + #[doc = "The weight of this function is dependent on the runtime, but generally this is very"] + #[doc = "expensive. We will treat this as a full block."] + #[doc = "# "] + pub fn set_code( + &self, + code: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "set_code", + SetCode { code }, + [ + 27u8, 104u8, 244u8, 205u8, 188u8, 254u8, 121u8, 13u8, 106u8, 120u8, + 244u8, 108u8, 97u8, 84u8, 100u8, 68u8, 26u8, 69u8, 93u8, 128u8, 107u8, + 4u8, 3u8, 142u8, 13u8, 134u8, 196u8, 62u8, 113u8, 181u8, 14u8, 40u8, + ], + ) + } + #[doc = "Set the new runtime code without doing any checks of the given `code`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(C)` where `C` length of `code`"] + #[doc = "- 1 storage write (codec `O(C)`)."] + #[doc = "- 1 digest item."] + #[doc = "- 1 event."] + #[doc = "The weight of this function is dependent on the runtime. We will treat this as a full"] + #[doc = "block. # "] + pub fn set_code_without_checks( + &self, + code: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "set_code_without_checks", + SetCodeWithoutChecks { code }, + [ + 102u8, 160u8, 125u8, 235u8, 30u8, 23u8, 45u8, 239u8, 112u8, 148u8, + 159u8, 158u8, 42u8, 93u8, 206u8, 94u8, 80u8, 250u8, 66u8, 195u8, 60u8, + 40u8, 142u8, 169u8, 183u8, 80u8, 80u8, 96u8, 3u8, 231u8, 99u8, 216u8, + ], + ) + } + #[doc = "Set some items of storage."] + pub fn set_storage( + &self, + items: ::std::vec::Vec<( + ::std::vec::Vec<::core::primitive::u8>, + ::std::vec::Vec<::core::primitive::u8>, + )>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "set_storage", + SetStorage { items }, + [ + 74u8, 43u8, 106u8, 255u8, 50u8, 151u8, 192u8, 155u8, 14u8, 90u8, 19u8, + 45u8, 165u8, 16u8, 235u8, 242u8, 21u8, 131u8, 33u8, 172u8, 119u8, 78u8, + 140u8, 10u8, 107u8, 202u8, 122u8, 235u8, 181u8, 191u8, 22u8, 116u8, + ], + ) + } + #[doc = "Kill some items from storage."] + pub fn kill_storage( + &self, + keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "kill_storage", + KillStorage { keys }, + [ + 174u8, 174u8, 13u8, 174u8, 75u8, 138u8, 128u8, 235u8, 222u8, 216u8, + 85u8, 18u8, 198u8, 1u8, 138u8, 70u8, 19u8, 108u8, 209u8, 41u8, 228u8, + 67u8, 130u8, 230u8, 160u8, 207u8, 11u8, 180u8, 139u8, 242u8, 41u8, + 15u8, + ], + ) + } + #[doc = "Kill all storage items with a key that starts with the given prefix."] + #[doc = ""] + #[doc = "**NOTE:** We rely on the Root origin to provide us the number of subkeys under"] + #[doc = "the prefix we are removing to accurately calculate the weight of this function."] + pub fn kill_prefix( + &self, + prefix: ::std::vec::Vec<::core::primitive::u8>, + subkeys: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "kill_prefix", + KillPrefix { prefix, subkeys }, + [ + 203u8, 116u8, 217u8, 42u8, 154u8, 215u8, 77u8, 217u8, 13u8, 22u8, + 193u8, 2u8, 128u8, 115u8, 179u8, 115u8, 187u8, 218u8, 129u8, 34u8, + 80u8, 4u8, 173u8, 120u8, 92u8, 35u8, 237u8, 112u8, 201u8, 207u8, 200u8, + 48u8, + ], + ) + } + #[doc = "Make some on-chain remark and emit event."] + pub fn remark_with_event( + &self, + remark: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "System", + "remark_with_event", + RemarkWithEvent { remark }, + [ + 123u8, 225u8, 180u8, 179u8, 144u8, 74u8, 27u8, 85u8, 101u8, 75u8, + 134u8, 44u8, 181u8, 25u8, 183u8, 158u8, 14u8, 213u8, 56u8, 225u8, + 136u8, 88u8, 26u8, 114u8, 178u8, 43u8, 176u8, 43u8, 240u8, 84u8, 116u8, + 46u8, + ], + ) + } + } + } + #[doc = "Event for the System pallet."] + pub type Event = runtime_types::frame_system::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An extrinsic completed successfully."] + pub struct ExtrinsicSuccess { + pub dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + } + impl ::subxt::events::StaticEvent for ExtrinsicSuccess { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "ExtrinsicSuccess"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An extrinsic failed."] + pub struct ExtrinsicFailed { + pub dispatch_error: runtime_types::sp_runtime::DispatchError, + pub dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + } + impl ::subxt::events::StaticEvent for ExtrinsicFailed { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "ExtrinsicFailed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "`:code` was updated."] + pub struct CodeUpdated; + impl ::subxt::events::StaticEvent for CodeUpdated { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "CodeUpdated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A new account was created."] + pub struct NewAccount { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for NewAccount { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "NewAccount"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account was reaped."] + pub struct KilledAccount { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for KilledAccount { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "KilledAccount"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "On on-chain remark happened."] + pub struct Remarked { + pub sender: ::subxt::ext::sp_core::crypto::AccountId32, + pub hash: ::subxt::ext::sp_core::H256, + } + impl ::subxt::events::StaticEvent for Remarked { + const PALLET: &'static str = "System"; + const EVENT: &'static str = "Remarked"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The full account information for a particular account ID."] + pub fn account( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_system::AccountInfo< + ::core::primitive::u32, + runtime_types::pallet_balances::AccountData<::core::primitive::u128>, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "Account", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 176u8, 187u8, 21u8, 220u8, 159u8, 204u8, 127u8, 14u8, 21u8, 69u8, 77u8, + 114u8, 230u8, 141u8, 107u8, 79u8, 23u8, 16u8, 174u8, 243u8, 252u8, + 42u8, 65u8, 120u8, 229u8, 38u8, 210u8, 255u8, 22u8, 40u8, 109u8, 223u8, + ], + ) + } + #[doc = " The full account information for a particular account ID."] + pub fn account_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_system::AccountInfo< + ::core::primitive::u32, + runtime_types::pallet_balances::AccountData<::core::primitive::u128>, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "Account", + Vec::new(), + [ + 176u8, 187u8, 21u8, 220u8, 159u8, 204u8, 127u8, 14u8, 21u8, 69u8, 77u8, + 114u8, 230u8, 141u8, 107u8, 79u8, 23u8, 16u8, 174u8, 243u8, 252u8, + 42u8, 65u8, 120u8, 229u8, 38u8, 210u8, 255u8, 22u8, 40u8, 109u8, 223u8, + ], + ) + } + #[doc = " Total extrinsics count for the current block."] + pub fn extrinsic_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "ExtrinsicCount", + vec![], + [ + 223u8, 60u8, 201u8, 120u8, 36u8, 44u8, 180u8, 210u8, 242u8, 53u8, + 222u8, 154u8, 123u8, 176u8, 249u8, 8u8, 225u8, 28u8, 232u8, 4u8, 136u8, + 41u8, 151u8, 82u8, 189u8, 149u8, 49u8, 166u8, 139u8, 9u8, 163u8, 231u8, + ], + ) + } + #[doc = " The current weight for the block."] + pub fn block_weight( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_support::dispatch::PerDispatchClass< + runtime_types::sp_weights::weight_v2::Weight, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "BlockWeight", + vec![], + [ + 120u8, 67u8, 71u8, 163u8, 36u8, 202u8, 52u8, 106u8, 143u8, 155u8, + 144u8, 87u8, 142u8, 241u8, 232u8, 183u8, 56u8, 235u8, 27u8, 237u8, + 20u8, 202u8, 33u8, 85u8, 189u8, 0u8, 28u8, 52u8, 198u8, 40u8, 219u8, + 54u8, + ], + ) + } + #[doc = " Total length (in bytes) for all extrinsics put together, for the current block."] + pub fn all_extrinsics_len( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "AllExtrinsicsLen", + vec![], + [ + 202u8, 145u8, 209u8, 225u8, 40u8, 220u8, 174u8, 74u8, 93u8, 164u8, + 254u8, 248u8, 254u8, 192u8, 32u8, 117u8, 96u8, 149u8, 53u8, 145u8, + 219u8, 64u8, 234u8, 18u8, 217u8, 200u8, 203u8, 141u8, 145u8, 28u8, + 134u8, 60u8, + ], + ) + } + #[doc = " Map of block numbers to block hashes."] + pub fn block_hash( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "BlockHash", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 50u8, 112u8, 176u8, 239u8, 175u8, 18u8, 205u8, 20u8, 241u8, 195u8, + 21u8, 228u8, 186u8, 57u8, 200u8, 25u8, 38u8, 44u8, 106u8, 20u8, 168u8, + 80u8, 76u8, 235u8, 12u8, 51u8, 137u8, 149u8, 200u8, 4u8, 220u8, 237u8, + ], + ) + } + #[doc = " Map of block numbers to block hashes."] + pub fn block_hash_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "BlockHash", + Vec::new(), + [ + 50u8, 112u8, 176u8, 239u8, 175u8, 18u8, 205u8, 20u8, 241u8, 195u8, + 21u8, 228u8, 186u8, 57u8, 200u8, 25u8, 38u8, 44u8, 106u8, 20u8, 168u8, + 80u8, 76u8, 235u8, 12u8, 51u8, 137u8, 149u8, 200u8, 4u8, 220u8, 237u8, + ], + ) + } + #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] + pub fn extrinsic_data( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::std::vec::Vec<::core::primitive::u8>>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "ExtrinsicData", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 210u8, 224u8, 211u8, 186u8, 118u8, 210u8, 185u8, 194u8, 238u8, 211u8, + 254u8, 73u8, 67u8, 184u8, 31u8, 229u8, 168u8, 125u8, 98u8, 23u8, 241u8, + 59u8, 49u8, 86u8, 126u8, 9u8, 114u8, 163u8, 160u8, 62u8, 50u8, 67u8, + ], + ) + } + #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] + pub fn extrinsic_data_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::std::vec::Vec<::core::primitive::u8>>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "ExtrinsicData", + Vec::new(), + [ + 210u8, 224u8, 211u8, 186u8, 118u8, 210u8, 185u8, 194u8, 238u8, 211u8, + 254u8, 73u8, 67u8, 184u8, 31u8, 229u8, 168u8, 125u8, 98u8, 23u8, 241u8, + 59u8, 49u8, 86u8, 126u8, 9u8, 114u8, 163u8, 160u8, 62u8, 50u8, 67u8, + ], + ) + } + #[doc = " The current block number being processed. Set by `execute_block`."] + pub fn number( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "Number", + vec![], + [ + 228u8, 96u8, 102u8, 190u8, 252u8, 130u8, 239u8, 172u8, 126u8, 235u8, + 246u8, 139u8, 208u8, 15u8, 88u8, 245u8, 141u8, 232u8, 43u8, 204u8, + 36u8, 87u8, 211u8, 141u8, 187u8, 68u8, 236u8, 70u8, 193u8, 235u8, + 164u8, 191u8, + ], + ) + } + #[doc = " Hash of the previous block."] + pub fn parent_hash( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "ParentHash", + vec![], + [ + 232u8, 206u8, 177u8, 119u8, 38u8, 57u8, 233u8, 50u8, 225u8, 49u8, + 169u8, 176u8, 210u8, 51u8, 231u8, 176u8, 234u8, 186u8, 188u8, 112u8, + 15u8, 152u8, 195u8, 232u8, 201u8, 97u8, 208u8, 249u8, 9u8, 163u8, 69u8, + 36u8, + ], + ) + } + #[doc = " Digest of the current block, also part of the block header."] + pub fn digest( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_runtime::generic::digest::Digest, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "Digest", + vec![], + [ + 83u8, 141u8, 200u8, 132u8, 182u8, 55u8, 197u8, 122u8, 13u8, 159u8, + 31u8, 42u8, 60u8, 191u8, 89u8, 221u8, 242u8, 47u8, 199u8, 213u8, 48u8, + 216u8, 131u8, 168u8, 245u8, 82u8, 56u8, 190u8, 62u8, 69u8, 96u8, 37u8, + ], + ) + } + #[doc = " Events deposited for the current block."] + #[doc = ""] + #[doc = " NOTE: The item is unbound and should therefore never be read on chain."] + #[doc = " It could otherwise inflate the PoV size of a block."] + #[doc = ""] + #[doc = " Events have a large in-memory size. Box the events to not go out-of-memory"] + #[doc = " just in case someone still reads them from within the runtime."] + pub fn events( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec< + runtime_types::frame_system::EventRecord< + runtime_types::aleph_runtime::RuntimeEvent, + ::subxt::ext::sp_core::H256, + >, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "Events", + vec![], + [ + 100u8, 112u8, 231u8, 192u8, 184u8, 16u8, 59u8, 201u8, 45u8, 235u8, + 104u8, 44u8, 105u8, 65u8, 84u8, 78u8, 86u8, 161u8, 206u8, 209u8, 53u8, + 182u8, 73u8, 138u8, 118u8, 194u8, 88u8, 181u8, 76u8, 179u8, 207u8, + 180u8, + ], + ) + } + #[doc = " The number of events in the `Events` list."] + pub fn event_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "EventCount", + vec![], + [ + 236u8, 93u8, 90u8, 177u8, 250u8, 211u8, 138u8, 187u8, 26u8, 208u8, + 203u8, 113u8, 221u8, 233u8, 227u8, 9u8, 249u8, 25u8, 202u8, 185u8, + 161u8, 144u8, 167u8, 104u8, 127u8, 187u8, 38u8, 18u8, 52u8, 61u8, 66u8, + 112u8, + ], + ) + } + #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] + #[doc = " of events in the `>` list."] + #[doc = ""] + #[doc = " All topic vectors have deterministic storage locations depending on the topic. This"] + #[doc = " allows light-clients to leverage the changes trie storage tracking mechanism and"] + #[doc = " in case of changes fetch the list of events of interest."] + #[doc = ""] + #[doc = " The value has the type `(T::BlockNumber, EventIndex)` because if we used only just"] + #[doc = " the `EventIndex` then in case if the topic has the same contents on the next block"] + #[doc = " no notification will be triggered thus the event might be lost."] + pub fn event_topics( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "EventTopics", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 205u8, 90u8, 142u8, 190u8, 176u8, 37u8, 94u8, 82u8, 98u8, 1u8, 129u8, + 63u8, 246u8, 101u8, 130u8, 58u8, 216u8, 16u8, 139u8, 196u8, 154u8, + 111u8, 110u8, 178u8, 24u8, 44u8, 183u8, 176u8, 232u8, 82u8, 223u8, + 38u8, + ], + ) + } + #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] + #[doc = " of events in the `>` list."] + #[doc = ""] + #[doc = " All topic vectors have deterministic storage locations depending on the topic. This"] + #[doc = " allows light-clients to leverage the changes trie storage tracking mechanism and"] + #[doc = " in case of changes fetch the list of events of interest."] + #[doc = ""] + #[doc = " The value has the type `(T::BlockNumber, EventIndex)` because if we used only just"] + #[doc = " the `EventIndex` then in case if the topic has the same contents on the next block"] + #[doc = " no notification will be triggered thus the event might be lost."] + pub fn event_topics_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "EventTopics", + Vec::new(), + [ + 205u8, 90u8, 142u8, 190u8, 176u8, 37u8, 94u8, 82u8, 98u8, 1u8, 129u8, + 63u8, 246u8, 101u8, 130u8, 58u8, 216u8, 16u8, 139u8, 196u8, 154u8, + 111u8, 110u8, 178u8, 24u8, 44u8, 183u8, 176u8, 232u8, 82u8, 223u8, + 38u8, + ], + ) + } + #[doc = " Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened."] + pub fn last_runtime_upgrade( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_system::LastRuntimeUpgradeInfo, + >, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "LastRuntimeUpgrade", + vec![], + [ + 52u8, 37u8, 117u8, 111u8, 57u8, 130u8, 196u8, 14u8, 99u8, 77u8, 91u8, + 126u8, 178u8, 249u8, 78u8, 34u8, 9u8, 194u8, 92u8, 105u8, 113u8, 81u8, + 185u8, 127u8, 245u8, 184u8, 60u8, 29u8, 234u8, 182u8, 96u8, 196u8, + ], + ) + } + #[doc = " True if we have upgraded so that `type RefCount` is `u32`. False (default) if not."] + pub fn upgraded_to_u32_ref_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "UpgradedToU32RefCount", + vec![], + [ + 171u8, 88u8, 244u8, 92u8, 122u8, 67u8, 27u8, 18u8, 59u8, 175u8, 175u8, + 178u8, 20u8, 150u8, 213u8, 59u8, 222u8, 141u8, 32u8, 107u8, 3u8, 114u8, + 83u8, 250u8, 180u8, 233u8, 152u8, 54u8, 187u8, 99u8, 131u8, 204u8, + ], + ) + } + #[doc = " True if we have upgraded so that AccountInfo contains three types of `RefCount`. False"] + #[doc = " (default) if not."] + pub fn upgraded_to_triple_ref_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "UpgradedToTripleRefCount", + vec![], + [ + 90u8, 33u8, 56u8, 86u8, 90u8, 101u8, 89u8, 133u8, 203u8, 56u8, 201u8, + 210u8, 244u8, 232u8, 150u8, 18u8, 51u8, 105u8, 14u8, 230u8, 103u8, + 155u8, 246u8, 99u8, 53u8, 207u8, 225u8, 128u8, 186u8, 76u8, 40u8, + 185u8, + ], + ) + } + #[doc = " The execution phase of the block."] + pub fn execution_phase( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "System", + "ExecutionPhase", + vec![], + [ + 230u8, 183u8, 221u8, 135u8, 226u8, 223u8, 55u8, 104u8, 138u8, 224u8, + 103u8, 156u8, 222u8, 99u8, 203u8, 199u8, 164u8, 168u8, 193u8, 133u8, + 201u8, 155u8, 63u8, 95u8, 17u8, 206u8, 165u8, 123u8, 161u8, 33u8, + 172u8, 93u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Block & extrinsics weights: base values and limits."] + pub fn block_weights( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_system::limits::BlockWeights, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "BlockWeights", + [ + 118u8, 253u8, 239u8, 217u8, 145u8, 115u8, 85u8, 86u8, 172u8, 248u8, + 139u8, 32u8, 158u8, 126u8, 172u8, 188u8, 197u8, 105u8, 145u8, 235u8, + 171u8, 50u8, 31u8, 225u8, 167u8, 187u8, 241u8, 87u8, 6u8, 17u8, 234u8, + 185u8, + ], + ) + } + #[doc = " The maximum length of a block (in bytes)."] + pub fn block_length( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::frame_system::limits::BlockLength, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "BlockLength", + [ + 116u8, 184u8, 225u8, 228u8, 207u8, 203u8, 4u8, 220u8, 234u8, 198u8, + 150u8, 108u8, 205u8, 87u8, 194u8, 131u8, 229u8, 51u8, 140u8, 4u8, 47u8, + 12u8, 200u8, 144u8, 153u8, 62u8, 51u8, 39u8, 138u8, 205u8, 203u8, + 236u8, + ], + ) + } + #[doc = " Maximum number of block number to block hash mappings to keep (oldest pruned first)."] + pub fn block_hash_count( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "BlockHashCount", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The weight of runtime database operations the runtime can invoke."] + pub fn db_weight( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "DbWeight", + [ + 124u8, 162u8, 190u8, 149u8, 49u8, 177u8, 162u8, 231u8, 62u8, 167u8, + 199u8, 181u8, 43u8, 232u8, 185u8, 116u8, 195u8, 51u8, 233u8, 223u8, + 20u8, 129u8, 246u8, 13u8, 65u8, 180u8, 64u8, 9u8, 157u8, 59u8, 245u8, + 118u8, + ], + ) + } + #[doc = " Get the chain's current version."] + pub fn version( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "Version", + [ + 93u8, 98u8, 57u8, 243u8, 229u8, 8u8, 234u8, 231u8, 72u8, 230u8, 139u8, + 47u8, 63u8, 181u8, 17u8, 2u8, 220u8, 231u8, 104u8, 237u8, 185u8, 143u8, + 165u8, 253u8, 188u8, 76u8, 147u8, 12u8, 170u8, 26u8, 74u8, 200u8, + ], + ) + } + #[doc = " The designated SS58 prefix of this chain."] + #[doc = ""] + #[doc = " This replaces the \"ss58Format\" property declared in the chain spec. Reason is"] + #[doc = " that the runtime should know about the prefix in order to make use of it as"] + #[doc = " an identifier of the chain."] + pub fn ss58_prefix( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u16>, + > { + ::subxt::constants::StaticConstantAddress::new( + "System", + "SS58Prefix", + [ + 116u8, 33u8, 2u8, 170u8, 181u8, 147u8, 171u8, 169u8, 167u8, 227u8, + 41u8, 144u8, 11u8, 236u8, 82u8, 100u8, 74u8, 60u8, 184u8, 72u8, 169u8, + 90u8, 208u8, 135u8, 15u8, 117u8, 10u8, 123u8, 128u8, 193u8, 29u8, 70u8, + ], + ) + } + } + } + } + pub mod randomness_collective_flip { + use super::{root_mod, runtime_types}; + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Series of block headers from the last 81 blocks that acts as random seed material. This"] + #[doc = " is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of"] + #[doc = " the oldest hash."] + pub fn random_material( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::subxt::ext::sp_core::H256, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "RandomnessCollectiveFlip", + "RandomMaterial", + vec![], + [ + 152u8, 126u8, 73u8, 88u8, 54u8, 147u8, 6u8, 19u8, 214u8, 40u8, 159u8, + 30u8, 236u8, 61u8, 240u8, 65u8, 178u8, 94u8, 146u8, 152u8, 135u8, + 252u8, 160u8, 86u8, 123u8, 114u8, 251u8, 140u8, 98u8, 143u8, 217u8, + 242u8, + ], + ) + } + } + } + } + pub mod scheduler { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Schedule { + pub when: ::core::primitive::u32, + pub maybe_periodic: + ::core::option::Option<(::core::primitive::u32, ::core::primitive::u32)>, + pub priority: ::core::primitive::u8, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Cancel { + pub when: ::core::primitive::u32, + pub index: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScheduleNamed { + pub id: [::core::primitive::u8; 32usize], + pub when: ::core::primitive::u32, + pub maybe_periodic: + ::core::option::Option<(::core::primitive::u32, ::core::primitive::u32)>, + pub priority: ::core::primitive::u8, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CancelNamed { + pub id: [::core::primitive::u8; 32usize], + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScheduleAfter { + pub after: ::core::primitive::u32, + pub maybe_periodic: + ::core::option::Option<(::core::primitive::u32, ::core::primitive::u32)>, + pub priority: ::core::primitive::u8, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScheduleNamedAfter { + pub id: [::core::primitive::u8; 32usize], + pub after: ::core::primitive::u32, + pub maybe_periodic: + ::core::option::Option<(::core::primitive::u32, ::core::primitive::u32)>, + pub priority: ::core::primitive::u8, + pub call: ::std::boxed::Box, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Anonymously schedule a task."] + pub fn schedule( + &self, + when: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "schedule", + Schedule { + when, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }, + [ + 241u8, 199u8, 15u8, 208u8, 101u8, 207u8, 116u8, 231u8, 145u8, 101u8, + 182u8, 193u8, 52u8, 246u8, 230u8, 10u8, 238u8, 234u8, 131u8, 246u8, + 126u8, 123u8, 214u8, 187u8, 113u8, 138u8, 176u8, 161u8, 56u8, 208u8, + 119u8, 119u8, + ], + ) + } + #[doc = "Cancel an anonymously scheduled task."] + pub fn cancel( + &self, + when: ::core::primitive::u32, + index: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "cancel", + Cancel { when, index }, + [ + 81u8, 251u8, 234u8, 17u8, 214u8, 75u8, 19u8, 59u8, 19u8, 30u8, 89u8, + 74u8, 6u8, 216u8, 238u8, 165u8, 7u8, 19u8, 153u8, 253u8, 161u8, 103u8, + 178u8, 227u8, 152u8, 180u8, 80u8, 156u8, 82u8, 126u8, 132u8, 120u8, + ], + ) + } + #[doc = "Schedule a named task."] + pub fn schedule_named( + &self, + id: [::core::primitive::u8; 32usize], + when: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "schedule_named", + ScheduleNamed { + id, + when, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }, + [ + 175u8, 81u8, 2u8, 204u8, 241u8, 89u8, 189u8, 119u8, 222u8, 128u8, + 246u8, 58u8, 92u8, 75u8, 87u8, 15u8, 102u8, 143u8, 109u8, 32u8, 4u8, + 22u8, 209u8, 144u8, 58u8, 173u8, 6u8, 45u8, 93u8, 242u8, 18u8, 170u8, + ], + ) + } + #[doc = "Cancel a named scheduled task."] + pub fn cancel_named( + &self, + id: [::core::primitive::u8; 32usize], + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "cancel_named", + CancelNamed { id }, + [ + 51u8, 3u8, 140u8, 50u8, 214u8, 211u8, 50u8, 4u8, 19u8, 43u8, 230u8, + 114u8, 18u8, 108u8, 138u8, 67u8, 99u8, 24u8, 255u8, 11u8, 246u8, 37u8, + 192u8, 207u8, 90u8, 157u8, 171u8, 93u8, 233u8, 189u8, 64u8, 180u8, + ], + ) + } + #[doc = "Anonymously schedule a task after a delay."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`schedule`]."] + #[doc = "# "] + pub fn schedule_after( + &self, + after: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "schedule_after", + ScheduleAfter { + after, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }, + [ + 82u8, 60u8, 236u8, 221u8, 124u8, 178u8, 23u8, 207u8, 179u8, 59u8, + 206u8, 11u8, 132u8, 15u8, 153u8, 104u8, 203u8, 134u8, 201u8, 255u8, + 210u8, 193u8, 51u8, 196u8, 104u8, 134u8, 219u8, 117u8, 75u8, 120u8, + 23u8, 244u8, + ], + ) + } + #[doc = "Schedule a named task after a delay."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`schedule_named`](Self::schedule_named)."] + #[doc = "# "] + pub fn schedule_named_after( + &self, + id: [::core::primitive::u8; 32usize], + after: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Scheduler", + "schedule_named_after", + ScheduleNamedAfter { + id, + after, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }, + [ + 145u8, 124u8, 34u8, 62u8, 145u8, 204u8, 132u8, 210u8, 101u8, 75u8, + 171u8, 66u8, 165u8, 150u8, 233u8, 214u8, 1u8, 84u8, 85u8, 140u8, 47u8, + 97u8, 45u8, 118u8, 235u8, 240u8, 38u8, 145u8, 132u8, 183u8, 123u8, + 157u8, + ], + ) + } + } + } + #[doc = "Events type."] + pub type Event = runtime_types::pallet_scheduler::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Scheduled some task."] + pub struct Scheduled { + pub when: ::core::primitive::u32, + pub index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Scheduled { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "Scheduled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Canceled some task."] + pub struct Canceled { + pub when: ::core::primitive::u32, + pub index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Canceled { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "Canceled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Dispatched some task."] + pub struct Dispatched { + pub task: (::core::primitive::u32, ::core::primitive::u32), + pub id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + } + impl ::subxt::events::StaticEvent for Dispatched { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "Dispatched"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The call for the provided hash was not found so the task has been aborted."] + pub struct CallUnavailable { + pub task: (::core::primitive::u32, ::core::primitive::u32), + pub id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + } + impl ::subxt::events::StaticEvent for CallUnavailable { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "CallUnavailable"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The given task was unable to be renewed since the agenda is full at that block."] + pub struct PeriodicFailed { + pub task: (::core::primitive::u32, ::core::primitive::u32), + pub id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + } + impl ::subxt::events::StaticEvent for PeriodicFailed { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "PeriodicFailed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The given task can never be executed since it is overweight."] + pub struct PermanentlyOverweight { + pub task: (::core::primitive::u32, ::core::primitive::u32), + pub id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + } + impl ::subxt::events::StaticEvent for PermanentlyOverweight { + const PALLET: &'static str = "Scheduler"; + const EVENT: &'static str = "PermanentlyOverweight"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + pub fn incomplete_since( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Scheduler", + "IncompleteSince", + vec![], + [ + 149u8, 66u8, 239u8, 67u8, 235u8, 219u8, 101u8, 182u8, 145u8, 56u8, + 252u8, 150u8, 253u8, 221u8, 125u8, 57u8, 38u8, 152u8, 153u8, 31u8, + 92u8, 238u8, 66u8, 246u8, 104u8, 163u8, 94u8, 73u8, 222u8, 168u8, + 193u8, 227u8, + ], + ) + } + #[doc = " Items to be executed, indexed by the block number that they should be executed on."] + pub fn agenda( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::option::Option< + runtime_types::pallet_scheduler::Scheduled< + [::core::primitive::u8; 32usize], + runtime_types::frame_support::traits::preimages::Bounded< + runtime_types::aleph_runtime::RuntimeCall, + >, + ::core::primitive::u32, + runtime_types::aleph_runtime::OriginCaller, + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Scheduler", + "Agenda", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 48u8, 65u8, 163u8, 111u8, 82u8, 33u8, 246u8, 16u8, 83u8, 40u8, 138u8, + 172u8, 239u8, 30u8, 247u8, 235u8, 100u8, 240u8, 93u8, 50u8, 102u8, + 203u8, 118u8, 32u8, 174u8, 21u8, 223u8, 91u8, 10u8, 31u8, 75u8, 97u8, + ], + ) + } + #[doc = " Items to be executed, indexed by the block number that they should be executed on."] + pub fn agenda_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::option::Option< + runtime_types::pallet_scheduler::Scheduled< + [::core::primitive::u8; 32usize], + runtime_types::frame_support::traits::preimages::Bounded< + runtime_types::aleph_runtime::RuntimeCall, + >, + ::core::primitive::u32, + runtime_types::aleph_runtime::OriginCaller, + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Scheduler", + "Agenda", + Vec::new(), + [ + 48u8, 65u8, 163u8, 111u8, 82u8, 33u8, 246u8, 16u8, 83u8, 40u8, 138u8, + 172u8, 239u8, 30u8, 247u8, 235u8, 100u8, 240u8, 93u8, 50u8, 102u8, + 203u8, 118u8, 32u8, 174u8, 21u8, 223u8, 91u8, 10u8, 31u8, 75u8, 97u8, + ], + ) + } + #[doc = " Lookup from a name to the block number and index of the task."] + #[doc = ""] + #[doc = " For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4"] + #[doc = " identities."] + pub fn lookup( + &self, + _0: impl ::std::borrow::Borrow<[::core::primitive::u8; 32usize]>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Scheduler", + "Lookup", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 82u8, 20u8, 178u8, 101u8, 108u8, 198u8, 71u8, 99u8, 16u8, 175u8, 15u8, + 187u8, 229u8, 243u8, 140u8, 200u8, 99u8, 77u8, 248u8, 178u8, 45u8, + 121u8, 193u8, 67u8, 165u8, 43u8, 234u8, 211u8, 158u8, 250u8, 103u8, + 243u8, + ], + ) + } + #[doc = " Lookup from a name to the block number and index of the task."] + #[doc = ""] + #[doc = " For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4"] + #[doc = " identities."] + pub fn lookup_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Scheduler", + "Lookup", + Vec::new(), + [ + 82u8, 20u8, 178u8, 101u8, 108u8, 198u8, 71u8, 99u8, 16u8, 175u8, 15u8, + 187u8, 229u8, 243u8, 140u8, 200u8, 99u8, 77u8, 248u8, 178u8, 45u8, + 121u8, 193u8, 67u8, 165u8, 43u8, 234u8, 211u8, 158u8, 250u8, 103u8, + 243u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The maximum weight that may be scheduled per block for any dispatchables."] + pub fn maximum_weight( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_weights::weight_v2::Weight, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Scheduler", + "MaximumWeight", + [ + 206u8, 61u8, 253u8, 247u8, 163u8, 40u8, 161u8, 52u8, 134u8, 140u8, + 206u8, 83u8, 44u8, 166u8, 226u8, 115u8, 181u8, 14u8, 227u8, 130u8, + 210u8, 32u8, 85u8, 29u8, 230u8, 97u8, 130u8, 165u8, 147u8, 134u8, + 106u8, 76u8, + ], + ) + } + #[doc = " The maximum number of scheduled calls in the queue for a single block."] + pub fn max_scheduled_per_block( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Scheduler", + "MaxScheduledPerBlock", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod aura { + use super::{root_mod, runtime_types}; + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The current authority set."] + pub fn authorities( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aura", + "Authorities", + vec![], + [ + 199u8, 89u8, 94u8, 48u8, 249u8, 35u8, 105u8, 90u8, 15u8, 86u8, 218u8, + 85u8, 22u8, 236u8, 228u8, 36u8, 137u8, 64u8, 236u8, 171u8, 242u8, + 217u8, 91u8, 240u8, 205u8, 205u8, 226u8, 16u8, 147u8, 235u8, 181u8, + 41u8, + ], + ) + } + #[doc = " The current slot of this block."] + #[doc = ""] + #[doc = " This will be set in `on_initialize`."] + pub fn current_slot( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aura", + "CurrentSlot", + vec![], + [ + 139u8, 237u8, 185u8, 137u8, 251u8, 179u8, 69u8, 167u8, 133u8, 168u8, + 204u8, 64u8, 178u8, 123u8, 92u8, 250u8, 119u8, 190u8, 208u8, 178u8, + 208u8, 176u8, 124u8, 187u8, 74u8, 165u8, 33u8, 78u8, 161u8, 206u8, 8u8, + 108u8, + ], + ) + } + } + } + } + pub mod timestamp { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Set { + #[codec(compact)] + pub now: ::core::primitive::u64, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Set the current time."] + #[doc = ""] + #[doc = "This call should be invoked exactly once per block. It will panic at the finalization"] + #[doc = "phase, if this call hasn't been invoked by that time."] + #[doc = ""] + #[doc = "The timestamp should be greater than the previous one by the amount specified by"] + #[doc = "`MinimumPeriod`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `Inherent`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)"] + #[doc = "- 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in"] + #[doc = " `on_finalize`)"] + #[doc = "- 1 event handler `on_timestamp_set`. Must be `O(1)`."] + #[doc = "# "] + pub fn set( + &self, + now: ::core::primitive::u64, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Timestamp", + "set", + Set { now }, + [ + 6u8, 97u8, 172u8, 236u8, 118u8, 238u8, 228u8, 114u8, 15u8, 115u8, + 102u8, 85u8, 66u8, 151u8, 16u8, 33u8, 187u8, 17u8, 166u8, 88u8, 127u8, + 214u8, 182u8, 51u8, 168u8, 88u8, 43u8, 101u8, 185u8, 8u8, 1u8, 28u8, + ], + ) + } + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Current time for the current block."] + pub fn now( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u64>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Timestamp", + "Now", + vec![], + [ + 148u8, 53u8, 50u8, 54u8, 13u8, 161u8, 57u8, 150u8, 16u8, 83u8, 144u8, + 221u8, 59u8, 75u8, 158u8, 130u8, 39u8, 123u8, 106u8, 134u8, 202u8, + 185u8, 83u8, 85u8, 60u8, 41u8, 120u8, 96u8, 210u8, 34u8, 2u8, 250u8, + ], + ) + } + #[doc = " Did the timestamp get updated in this block?"] + pub fn did_update( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Timestamp", + "DidUpdate", + vec![], + [ + 70u8, 13u8, 92u8, 186u8, 80u8, 151u8, 167u8, 90u8, 158u8, 232u8, 175u8, + 13u8, 103u8, 135u8, 2u8, 78u8, 16u8, 6u8, 39u8, 158u8, 167u8, 85u8, + 27u8, 47u8, 122u8, 73u8, 127u8, 26u8, 35u8, 168u8, 72u8, 204u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The minimum period between blocks. Beware that this is different to the *expected*"] + #[doc = " period that the block production apparatus provides. Your chosen consensus system will"] + #[doc = " generally work with this to determine a sensible block time. e.g. For Aura, it will be"] + #[doc = " double this period on default settings."] + pub fn minimum_period( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u64>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Timestamp", + "MinimumPeriod", + [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, + 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, + 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, 42u8, 184u8, 239u8, 42u8, + 246u8, + ], + ) + } + } + } + } + pub mod balances { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Transfer { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetBalance { + pub who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub new_free: ::core::primitive::u128, + #[codec(compact)] + pub new_reserved: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceTransfer { + pub source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct TransferKeepAlive { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct TransferAll { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub keep_alive: ::core::primitive::bool, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceUnreserve { + pub who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub amount: ::core::primitive::u128, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Transfer some liquid free balance to another account."] + #[doc = ""] + #[doc = "`transfer` will set the `FreeBalance` of the sender and receiver."] + #[doc = "If the sender's account is below the existential deposit as a result"] + #[doc = "of the transfer, the account will be reaped."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `Signed` by the transactor."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Dependent on arguments but not critical, given proper implementations for input config"] + #[doc = " types. See related functions below."] + #[doc = "- It contains a limited number of reads and writes internally and no complex"] + #[doc = " computation."] + #[doc = ""] + #[doc = "Related functions:"] + #[doc = ""] + #[doc = " - `ensure_can_withdraw` is always called internally but has a bounded complexity."] + #[doc = " - Transferring balances to accounts that did not exist before will cause"] + #[doc = " `T::OnNewAccount::on_new_account` to be called."] + #[doc = " - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`."] + #[doc = " - `transfer_keep_alive` works the same way as `transfer`, but has an additional check"] + #[doc = " that the transfer will not kill the origin account."] + #[doc = "---------------------------------"] + #[doc = "- Origin account is already in memory, so no DB operations for them."] + #[doc = "# "] + pub fn transfer( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "transfer", + Transfer { dest, value }, + [ + 111u8, 222u8, 32u8, 56u8, 171u8, 77u8, 252u8, 29u8, 194u8, 155u8, + 200u8, 192u8, 198u8, 81u8, 23u8, 115u8, 236u8, 91u8, 218u8, 114u8, + 107u8, 141u8, 138u8, 100u8, 237u8, 21u8, 58u8, 172u8, 3u8, 20u8, 216u8, + 38u8, + ], + ) + } + #[doc = "Set the balances of a given account."] + #[doc = ""] + #[doc = "This will alter `FreeBalance` and `ReservedBalance` in storage. it will"] + #[doc = "also alter the total issuance of the system (`TotalIssuance`) appropriately."] + #[doc = "If the new free or reserved balance is below the existential deposit,"] + #[doc = "it will reset the account nonce (`frame_system::AccountNonce`)."] + #[doc = ""] + #[doc = "The dispatch origin for this call is `root`."] + pub fn set_balance( + &self, + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + new_free: ::core::primitive::u128, + new_reserved: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "set_balance", + SetBalance { + who, + new_free, + new_reserved, + }, + [ + 234u8, 215u8, 97u8, 98u8, 243u8, 199u8, 57u8, 76u8, 59u8, 161u8, 118u8, + 207u8, 34u8, 197u8, 198u8, 61u8, 231u8, 210u8, 169u8, 235u8, 150u8, + 137u8, 173u8, 49u8, 28u8, 77u8, 84u8, 149u8, 143u8, 210u8, 139u8, + 193u8, + ], + ) + } + #[doc = "Exactly as `transfer`, except the origin must be root and the source account may be"] + #[doc = "specified."] + #[doc = "# "] + #[doc = "- Same as transfer, but additional read and write because the source account is not"] + #[doc = " assumed to be in the overlay."] + #[doc = "# "] + pub fn force_transfer( + &self, + source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "force_transfer", + ForceTransfer { + source, + dest, + value, + }, + [ + 79u8, 174u8, 212u8, 108u8, 184u8, 33u8, 170u8, 29u8, 232u8, 254u8, + 195u8, 218u8, 221u8, 134u8, 57u8, 99u8, 6u8, 70u8, 181u8, 227u8, 56u8, + 239u8, 243u8, 158u8, 157u8, 245u8, 36u8, 162u8, 11u8, 237u8, 147u8, + 15u8, + ], + ) + } + #[doc = "Same as the [`transfer`] call, but with a check that the transfer will not kill the"] + #[doc = "origin account."] + #[doc = ""] + #[doc = "99% of the time you want [`transfer`] instead."] + #[doc = ""] + #[doc = "[`transfer`]: struct.Pallet.html#method.transfer"] + pub fn transfer_keep_alive( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "transfer_keep_alive", + TransferKeepAlive { dest, value }, + [ + 112u8, 179u8, 75u8, 168u8, 193u8, 221u8, 9u8, 82u8, 190u8, 113u8, + 253u8, 13u8, 130u8, 134u8, 170u8, 216u8, 136u8, 111u8, 242u8, 220u8, + 202u8, 112u8, 47u8, 79u8, 73u8, 244u8, 226u8, 59u8, 240u8, 188u8, + 210u8, 208u8, + ], + ) + } + #[doc = "Transfer the entire transferable balance from the caller account."] + #[doc = ""] + #[doc = "NOTE: This function only attempts to transfer _transferable_ balances. This means that"] + #[doc = "any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be"] + #[doc = "transferred by this function. To ensure that this function results in a killed account,"] + #[doc = "you might need to prepare the account by removing any reference counters, storage"] + #[doc = "deposits, etc..."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be Signed."] + #[doc = ""] + #[doc = "- `dest`: The recipient of the transfer."] + #[doc = "- `keep_alive`: A boolean to determine if the `transfer_all` operation should send all"] + #[doc = " of the funds the account has, causing the sender account to be killed (false), or"] + #[doc = " transfer everything except at least the existential deposit, which will guarantee to"] + #[doc = " keep the sender account alive (true). # "] + #[doc = "- O(1). Just like transfer, but reading the user's transferable balance first."] + #[doc = " #"] + pub fn transfer_all( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + keep_alive: ::core::primitive::bool, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "transfer_all", + TransferAll { dest, keep_alive }, + [ + 46u8, 129u8, 29u8, 177u8, 221u8, 107u8, 245u8, 69u8, 238u8, 126u8, + 145u8, 26u8, 219u8, 208u8, 14u8, 80u8, 149u8, 1u8, 214u8, 63u8, 67u8, + 201u8, 144u8, 45u8, 129u8, 145u8, 174u8, 71u8, 238u8, 113u8, 208u8, + 34u8, + ], + ) + } + #[doc = "Unreserve some balance from a user by force."] + #[doc = ""] + #[doc = "Can only be called by ROOT."] + pub fn force_unreserve( + &self, + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Balances", + "force_unreserve", + ForceUnreserve { who, amount }, + [ + 160u8, 146u8, 137u8, 76u8, 157u8, 187u8, 66u8, 148u8, 207u8, 76u8, + 32u8, 254u8, 82u8, 215u8, 35u8, 161u8, 213u8, 52u8, 32u8, 98u8, 102u8, + 106u8, 234u8, 123u8, 6u8, 175u8, 184u8, 188u8, 174u8, 106u8, 176u8, + 78u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_balances::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account was created with some free balance."] + pub struct Endowed { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub free_balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Endowed { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Endowed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] + #[doc = "resulting in an outright loss."] + pub struct DustLost { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for DustLost { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "DustLost"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Transfer succeeded."] + pub struct Transfer { + pub from: ::subxt::ext::sp_core::crypto::AccountId32, + pub to: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Transfer { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Transfer"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A balance was set by root."] + pub struct BalanceSet { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub free: ::core::primitive::u128, + pub reserved: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for BalanceSet { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "BalanceSet"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some balance was reserved (moved from free to reserved)."] + pub struct Reserved { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Reserved { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Reserved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some balance was unreserved (moved from reserved to free)."] + pub struct Unreserved { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Unreserved { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Unreserved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some balance was moved from the reserve of the first account to the second account."] + #[doc = "Final argument indicates the destination balance type."] + pub struct ReserveRepatriated { + pub from: ::subxt::ext::sp_core::crypto::AccountId32, + pub to: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + pub destination_status: + runtime_types::frame_support::traits::tokens::misc::BalanceStatus, + } + impl ::subxt::events::StaticEvent for ReserveRepatriated { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "ReserveRepatriated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some amount was deposited (e.g. for transaction fees)."] + pub struct Deposit { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Deposit { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Deposit"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] + pub struct Withdraw { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Withdraw { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Withdraw"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] + pub struct Slashed { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Slashed { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "Slashed"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The total units issued in the system."] + pub fn total_issuance( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "TotalIssuance", + vec![], + [ + 1u8, 206u8, 252u8, 237u8, 6u8, 30u8, 20u8, 232u8, 164u8, 115u8, 51u8, + 156u8, 156u8, 206u8, 241u8, 187u8, 44u8, 84u8, 25u8, 164u8, 235u8, + 20u8, 86u8, 242u8, 124u8, 23u8, 28u8, 140u8, 26u8, 73u8, 231u8, 51u8, + ], + ) + } + #[doc = " The total units of outstanding deactivated balance in the system."] + pub fn inactive_issuance( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "InactiveIssuance", + vec![], + [ + 74u8, 203u8, 111u8, 142u8, 225u8, 104u8, 173u8, 51u8, 226u8, 12u8, + 85u8, 135u8, 41u8, 206u8, 177u8, 238u8, 94u8, 246u8, 184u8, 250u8, + 140u8, 213u8, 91u8, 118u8, 163u8, 111u8, 211u8, 46u8, 204u8, 160u8, + 154u8, 21u8, + ], + ) + } + #[doc = " The Balances pallet example of storing the balance of an account."] + #[doc = ""] + #[doc = " # Example"] + #[doc = ""] + #[doc = " ```nocompile"] + #[doc = " impl pallet_balances::Config for Runtime {"] + #[doc = " type AccountStore = StorageMapShim, frame_system::Provider, AccountId, Self::AccountData>"] + #[doc = " }"] + #[doc = " ```"] + #[doc = ""] + #[doc = " You can also store the balance of an account in the `System` pallet."] + #[doc = ""] + #[doc = " # Example"] + #[doc = ""] + #[doc = " ```nocompile"] + #[doc = " impl pallet_balances::Config for Runtime {"] + #[doc = " type AccountStore = System"] + #[doc = " }"] + #[doc = " ```"] + #[doc = ""] + #[doc = " But this comes with tradeoffs, storing account balances in the system pallet stores"] + #[doc = " `frame_system` data alongside the account data contrary to storing account balances in the"] + #[doc = " `Balances` pallet, which uses a `StorageMap` to store balances data only."] + #[doc = " NOTE: This is only used in the case that this pallet is used to store balances."] + pub fn account( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_balances::AccountData<::core::primitive::u128>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Account", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 246u8, 154u8, 253u8, 71u8, 192u8, 192u8, 192u8, 236u8, 128u8, 80u8, + 40u8, 252u8, 201u8, 43u8, 3u8, 131u8, 19u8, 49u8, 141u8, 240u8, 172u8, + 217u8, 215u8, 109u8, 87u8, 135u8, 248u8, 57u8, 98u8, 185u8, 22u8, 4u8, + ], + ) + } + #[doc = " The Balances pallet example of storing the balance of an account."] + #[doc = ""] + #[doc = " # Example"] + #[doc = ""] + #[doc = " ```nocompile"] + #[doc = " impl pallet_balances::Config for Runtime {"] + #[doc = " type AccountStore = StorageMapShim, frame_system::Provider, AccountId, Self::AccountData>"] + #[doc = " }"] + #[doc = " ```"] + #[doc = ""] + #[doc = " You can also store the balance of an account in the `System` pallet."] + #[doc = ""] + #[doc = " # Example"] + #[doc = ""] + #[doc = " ```nocompile"] + #[doc = " impl pallet_balances::Config for Runtime {"] + #[doc = " type AccountStore = System"] + #[doc = " }"] + #[doc = " ```"] + #[doc = ""] + #[doc = " But this comes with tradeoffs, storing account balances in the system pallet stores"] + #[doc = " `frame_system` data alongside the account data contrary to storing account balances in the"] + #[doc = " `Balances` pallet, which uses a `StorageMap` to store balances data only."] + #[doc = " NOTE: This is only used in the case that this pallet is used to store balances."] + pub fn account_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_balances::AccountData<::core::primitive::u128>, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Account", + Vec::new(), + [ + 246u8, 154u8, 253u8, 71u8, 192u8, 192u8, 192u8, 236u8, 128u8, 80u8, + 40u8, 252u8, 201u8, 43u8, 3u8, 131u8, 19u8, 49u8, 141u8, 240u8, 172u8, + 217u8, 215u8, 109u8, 87u8, 135u8, 248u8, 57u8, 98u8, 185u8, 22u8, 4u8, + ], + ) + } + #[doc = " Any liquidity locks on some account balances."] + #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] + pub fn locks( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::weak_bounded_vec::WeakBoundedVec< + runtime_types::pallet_balances::BalanceLock<::core::primitive::u128>, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Locks", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 216u8, 253u8, 87u8, 73u8, 24u8, 218u8, 35u8, 0u8, 244u8, 134u8, 195u8, + 58u8, 255u8, 64u8, 153u8, 212u8, 210u8, 232u8, 4u8, 122u8, 90u8, 212u8, + 136u8, 14u8, 127u8, 232u8, 8u8, 192u8, 40u8, 233u8, 18u8, 250u8, + ], + ) + } + #[doc = " Any liquidity locks on some account balances."] + #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] + pub fn locks_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::weak_bounded_vec::WeakBoundedVec< + runtime_types::pallet_balances::BalanceLock<::core::primitive::u128>, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Locks", + Vec::new(), + [ + 216u8, 253u8, 87u8, 73u8, 24u8, 218u8, 35u8, 0u8, 244u8, 134u8, 195u8, + 58u8, 255u8, 64u8, 153u8, 212u8, 210u8, 232u8, 4u8, 122u8, 90u8, 212u8, + 136u8, 14u8, 127u8, 232u8, 8u8, 192u8, 40u8, 233u8, 18u8, 250u8, + ], + ) + } + #[doc = " Named reserves on some account balances."] + pub fn reserves( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_balances::ReserveData< + [::core::primitive::u8; 8usize], + ::core::primitive::u128, + >, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Reserves", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 17u8, 32u8, 191u8, 46u8, 76u8, 220u8, 101u8, 100u8, 42u8, 250u8, 128u8, + 167u8, 117u8, 44u8, 85u8, 96u8, 105u8, 216u8, 16u8, 147u8, 74u8, 55u8, + 183u8, 94u8, 160u8, 177u8, 26u8, 187u8, 71u8, 197u8, 187u8, 163u8, + ], + ) + } + #[doc = " Named reserves on some account balances."] + pub fn reserves_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_balances::ReserveData< + [::core::primitive::u8; 8usize], + ::core::primitive::u128, + >, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Balances", + "Reserves", + Vec::new(), + [ + 17u8, 32u8, 191u8, 46u8, 76u8, 220u8, 101u8, 100u8, 42u8, 250u8, 128u8, + 167u8, 117u8, 44u8, 85u8, 96u8, 105u8, 216u8, 16u8, 147u8, 74u8, 55u8, + 183u8, 94u8, 160u8, 177u8, 26u8, 187u8, 71u8, 197u8, 187u8, 163u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The minimum amount required to keep an account open."] + pub fn existential_deposit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Balances", + "ExistentialDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The maximum number of locks that should exist on an account."] + #[doc = " Not strictly enforced, but used for weight estimation."] + pub fn max_locks( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Balances", + "MaxLocks", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum number of named reserves that can exist on an account."] + pub fn max_reserves( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Balances", + "MaxReserves", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod transaction_payment { + use super::{root_mod, runtime_types}; + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_transaction_payment::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] + #[doc = "has been paid by `who`."] + pub struct TransactionFeePaid { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub actual_fee: ::core::primitive::u128, + pub tip: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for TransactionFeePaid { + const PALLET: &'static str = "TransactionPayment"; + const EVENT: &'static str = "TransactionFeePaid"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + pub fn next_fee_multiplier( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::fixed_point::FixedU128, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "TransactionPayment", + "NextFeeMultiplier", + vec![], + [ + 210u8, 0u8, 206u8, 165u8, 183u8, 10u8, 206u8, 52u8, 14u8, 90u8, 218u8, + 197u8, 189u8, 125u8, 113u8, 216u8, 52u8, 161u8, 45u8, 24u8, 245u8, + 237u8, 121u8, 41u8, 106u8, 29u8, 45u8, 129u8, 250u8, 203u8, 206u8, + 180u8, + ], + ) + } + pub fn storage_version( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_transaction_payment::Releases, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "TransactionPayment", + "StorageVersion", + vec![], + [ + 219u8, 243u8, 82u8, 176u8, 65u8, 5u8, 132u8, 114u8, 8u8, 82u8, 176u8, + 200u8, 97u8, 150u8, 177u8, 164u8, 166u8, 11u8, 34u8, 12u8, 12u8, 198u8, + 58u8, 191u8, 186u8, 221u8, 221u8, 119u8, 181u8, 253u8, 154u8, 228u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " A fee mulitplier for `Operational` extrinsics to compute \"virtual tip\" to boost their"] + #[doc = " `priority`"] + #[doc = ""] + #[doc = " This value is multipled by the `final_fee` to obtain a \"virtual tip\" that is later"] + #[doc = " added to a tip component in regular `priority` calculations."] + #[doc = " It means that a `Normal` transaction can front-run a similarly-sized `Operational`"] + #[doc = " extrinsic (with no tip), by including a tip value greater than the virtual tip."] + #[doc = ""] + #[doc = " ```rust,ignore"] + #[doc = " // For `Normal`"] + #[doc = " let priority = priority_calc(tip);"] + #[doc = ""] + #[doc = " // For `Operational`"] + #[doc = " let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;"] + #[doc = " let priority = priority_calc(tip + virtual_tip);"] + #[doc = " ```"] + #[doc = ""] + #[doc = " Note that since we use `final_fee` the multiplier applies also to the regular `tip`"] + #[doc = " sent with the transaction. So, not only does the transaction get a priority bump based"] + #[doc = " on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`"] + #[doc = " transactions."] + pub fn operational_fee_multiplier( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u8>, + > { + ::subxt::constants::StaticConstantAddress::new( + "TransactionPayment", + "OperationalFeeMultiplier", + [ + 141u8, 130u8, 11u8, 35u8, 226u8, 114u8, 92u8, 179u8, 168u8, 110u8, + 28u8, 91u8, 221u8, 64u8, 4u8, 148u8, 201u8, 193u8, 185u8, 66u8, 226u8, + 114u8, 97u8, 79u8, 62u8, 212u8, 202u8, 114u8, 237u8, 228u8, 183u8, + 165u8, + ], + ) + } + } + } + } + pub mod authorship { + use super::{root_mod, runtime_types}; + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Author of current block."] + pub fn author( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Authorship", + "Author", + vec![], + [ + 149u8, 42u8, 33u8, 147u8, 190u8, 207u8, 174u8, 227u8, 190u8, 110u8, + 25u8, 131u8, 5u8, 167u8, 237u8, 188u8, 188u8, 33u8, 177u8, 126u8, + 181u8, 49u8, 126u8, 118u8, 46u8, 128u8, 154u8, 95u8, 15u8, 91u8, 103u8, + 113u8, + ], + ) + } + } + } + } + pub mod staking { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Bond { + pub controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + pub payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BondExtra { + #[codec(compact)] + pub max_additional: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Unbond { + #[codec(compact)] + pub value: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct WithdrawUnbonded { + pub num_slashing_spans: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Validate { + pub prefs: runtime_types::pallet_staking::ValidatorPrefs, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Nominate { + pub targets: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Chill; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetPayee { + pub payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetController { + pub controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetValidatorCount { + #[codec(compact)] + pub new: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct IncreaseValidatorCount { + #[codec(compact)] + pub additional: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScaleValidatorCount { + pub factor: runtime_types::sp_arithmetic::per_things::Percent, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceNoEras; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceNewEra; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetInvulnerables { + pub invulnerables: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceUnstake { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub num_slashing_spans: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceNewEraAlways; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CancelDeferredSlash { + pub era: ::core::primitive::u32, + pub slash_indices: ::std::vec::Vec<::core::primitive::u32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PayoutStakers { + pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub era: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Rebond { + #[codec(compact)] + pub value: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ReapStash { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub num_slashing_spans: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Kick { + pub who: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetStakingConfigs { + pub min_nominator_bond: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + pub min_validator_bond: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + pub max_nominator_count: + runtime_types::pallet_staking::pallet::pallet::ConfigOp<::core::primitive::u32>, + pub max_validator_count: + runtime_types::pallet_staking::pallet::pallet::ConfigOp<::core::primitive::u32>, + pub chill_threshold: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Percent, + >, + pub min_commission: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ChillOther { + pub controller: ::subxt::ext::sp_core::crypto::AccountId32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceApplyMinCommission { + pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetMinCommission { + pub new: runtime_types::sp_arithmetic::per_things::Perbill, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Take the origin account as a stash and lock up `value` of its balance. `controller` will"] + #[doc = "be the account that controls it."] + #[doc = ""] + #[doc = "`value` must be more than the `minimum_balance` specified by `T::Currency`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash account."] + #[doc = ""] + #[doc = "Emits `Bonded`."] + #[doc = "# "] + #[doc = "- Independent of the arguments. Moderate complexity."] + #[doc = "- O(1)."] + #[doc = "- Three extra DB entries."] + #[doc = ""] + #[doc = "NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned"] + #[doc = "unless the `origin` falls below _existential deposit_ and gets removed as dust."] + #[doc = "------------------"] + #[doc = "# "] + pub fn bond( + &self, + controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "bond", + Bond { + controller, + value, + payee, + }, + [ + 215u8, 211u8, 69u8, 215u8, 33u8, 158u8, 62u8, 3u8, 31u8, 216u8, 213u8, + 188u8, 151u8, 43u8, 165u8, 154u8, 117u8, 163u8, 190u8, 227u8, 116u8, + 70u8, 155u8, 178u8, 64u8, 174u8, 203u8, 179u8, 214u8, 187u8, 176u8, + 10u8, + ], + ) + } + #[doc = "Add some extra amount that have appeared in the stash `free_balance` into the balance up"] + #[doc = "for staking."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash, not the controller."] + #[doc = ""] + #[doc = "Use this if there are additional funds in your stash account that you wish to bond."] + #[doc = "Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose"] + #[doc = "any limitation on the amount that can be added."] + #[doc = ""] + #[doc = "Emits `Bonded`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- O(1)."] + #[doc = "# "] + pub fn bond_extra( + &self, + max_additional: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "bond_extra", + BondExtra { max_additional }, + [ + 60u8, 45u8, 82u8, 223u8, 113u8, 95u8, 0u8, 71u8, 59u8, 108u8, 228u8, + 9u8, 95u8, 210u8, 113u8, 106u8, 252u8, 15u8, 19u8, 128u8, 11u8, 187u8, + 4u8, 151u8, 103u8, 143u8, 24u8, 33u8, 149u8, 82u8, 35u8, 192u8, + ], + ) + } + #[doc = "Schedule a portion of the stash to be unlocked ready for transfer out after the bond"] + #[doc = "period ends. If this leaves an amount actively bonded less than"] + #[doc = "T::Currency::minimum_balance(), then it is increased to the full amount."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "Once the unlock period is done, you can call `withdraw_unbonded` to actually move"] + #[doc = "the funds out of management ready for transfer."] + #[doc = ""] + #[doc = "No more than a limited number of unlocking chunks (see `MaxUnlockingChunks`)"] + #[doc = "can co-exists at the same time. If there are no unlocking chunks slots available"] + #[doc = "[`Call::withdraw_unbonded`] is called to remove some of the chunks (if possible)."] + #[doc = ""] + #[doc = "If a user encounters the `InsufficientBond` error when calling this extrinsic,"] + #[doc = "they should call `chill` first in order to free up their bonded funds."] + #[doc = ""] + #[doc = "Emits `Unbonded`."] + #[doc = ""] + #[doc = "See also [`Call::withdraw_unbonded`]."] + pub fn unbond( + &self, + value: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "unbond", + Unbond { value }, + [ + 85u8, 62u8, 34u8, 127u8, 60u8, 241u8, 134u8, 60u8, 125u8, 91u8, 31u8, + 193u8, 50u8, 230u8, 237u8, 42u8, 114u8, 230u8, 240u8, 146u8, 14u8, + 109u8, 185u8, 151u8, 148u8, 44u8, 147u8, 182u8, 192u8, 253u8, 51u8, + 87u8, + ], + ) + } + #[doc = "Remove any unlocked chunks from the `unlocking` queue from our management."] + #[doc = ""] + #[doc = "This essentially frees up that balance to be used by the stash account to do"] + #[doc = "whatever it wants."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller."] + #[doc = ""] + #[doc = "Emits `Withdrawn`."] + #[doc = ""] + #[doc = "See also [`Call::unbond`]."] + #[doc = ""] + #[doc = "# "] + #[doc = "Complexity O(S) where S is the number of slashing spans to remove"] + #[doc = "NOTE: Weight annotation is the kill scenario, we refund otherwise."] + #[doc = "# "] + pub fn withdraw_unbonded( + &self, + num_slashing_spans: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "withdraw_unbonded", + WithdrawUnbonded { num_slashing_spans }, + [ + 95u8, 223u8, 122u8, 217u8, 76u8, 208u8, 86u8, 129u8, 31u8, 104u8, 70u8, + 154u8, 23u8, 250u8, 165u8, 192u8, 149u8, 249u8, 158u8, 159u8, 194u8, + 224u8, 118u8, 134u8, 204u8, 157u8, 72u8, 136u8, 19u8, 193u8, 183u8, + 84u8, + ], + ) + } + #[doc = "Declare the desire to validate for the origin controller."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + pub fn validate( + &self, + prefs: runtime_types::pallet_staking::ValidatorPrefs, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "validate", + Validate { prefs }, + [ + 191u8, 116u8, 139u8, 35u8, 250u8, 211u8, 86u8, 240u8, 35u8, 9u8, 19u8, + 44u8, 148u8, 35u8, 91u8, 106u8, 200u8, 172u8, 108u8, 145u8, 194u8, + 146u8, 61u8, 145u8, 233u8, 168u8, 2u8, 26u8, 145u8, 101u8, 114u8, + 157u8, + ], + ) + } + #[doc = "Declare the desire to nominate `targets` for the origin controller."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- The transaction's complexity is proportional to the size of `targets` (N)"] + #[doc = "which is capped at CompactAssignments::LIMIT (T::MaxNominations)."] + #[doc = "- Both the reads and writes follow a similar pattern."] + #[doc = "# "] + pub fn nominate( + &self, + targets: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "nominate", + Nominate { targets }, + [ + 112u8, 162u8, 70u8, 26u8, 74u8, 7u8, 188u8, 193u8, 210u8, 247u8, 27u8, + 189u8, 133u8, 137u8, 33u8, 155u8, 255u8, 171u8, 122u8, 68u8, 175u8, + 247u8, 139u8, 253u8, 97u8, 187u8, 254u8, 201u8, 66u8, 166u8, 226u8, + 90u8, + ], + ) + } + #[doc = "Declare no desire to either validate or nominate."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains one read."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "# "] + pub fn chill(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "chill", + Chill {}, + [ + 94u8, 20u8, 196u8, 31u8, 220u8, 125u8, 115u8, 167u8, 140u8, 3u8, 20u8, + 132u8, 81u8, 120u8, 215u8, 166u8, 230u8, 56u8, 16u8, 222u8, 31u8, + 153u8, 120u8, 62u8, 153u8, 67u8, 220u8, 239u8, 11u8, 234u8, 127u8, + 122u8, + ], + ) + } + #[doc = "(Re-)set the payment target for a controller."] + #[doc = ""] + #[doc = "Effects will be felt instantly (as soon as this function is completed successfully)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains a limited number of reads."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "---------"] + #[doc = "- Weight: O(1)"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Ledger"] + #[doc = " - Write: Payee"] + #[doc = "# "] + pub fn set_payee( + &self, + payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_payee", + SetPayee { payee }, + [ + 96u8, 8u8, 254u8, 164u8, 87u8, 46u8, 120u8, 11u8, 197u8, 63u8, 20u8, + 178u8, 167u8, 236u8, 149u8, 245u8, 14u8, 171u8, 108u8, 195u8, 250u8, + 133u8, 0u8, 75u8, 192u8, 159u8, 84u8, 220u8, 242u8, 133u8, 60u8, 62u8, + ], + ) + } + #[doc = "(Re-)set the controller of a stash."] + #[doc = ""] + #[doc = "Effects will be felt instantly (as soon as this function is completed successfully)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash, not the controller."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains a limited number of reads."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "----------"] + #[doc = "Weight: O(1)"] + #[doc = "DB Weight:"] + #[doc = "- Read: Bonded, Ledger New Controller, Ledger Old Controller"] + #[doc = "- Write: Bonded, Ledger New Controller, Ledger Old Controller"] + #[doc = "# "] + pub fn set_controller( + &self, + controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_controller", + SetController { controller }, + [ + 165u8, 250u8, 213u8, 32u8, 179u8, 163u8, 15u8, 35u8, 14u8, 152u8, 56u8, + 171u8, 43u8, 101u8, 7u8, 167u8, 178u8, 60u8, 89u8, 186u8, 59u8, 28u8, + 82u8, 159u8, 13u8, 96u8, 168u8, 123u8, 194u8, 212u8, 205u8, 184u8, + ], + ) + } + #[doc = "Sets the ideal number of validators."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Weight: O(1)"] + #[doc = "Write: Validator Count"] + #[doc = "# "] + pub fn set_validator_count( + &self, + new: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_validator_count", + SetValidatorCount { new }, + [ + 55u8, 232u8, 95u8, 66u8, 228u8, 217u8, 11u8, 27u8, 3u8, 202u8, 199u8, + 242u8, 70u8, 160u8, 250u8, 187u8, 194u8, 91u8, 15u8, 36u8, 215u8, 36u8, + 160u8, 108u8, 251u8, 60u8, 240u8, 202u8, 249u8, 235u8, 28u8, 94u8, + ], + ) + } + #[doc = "Increments the ideal number of validators upto maximum of"] + #[doc = "`ElectionProviderBase::MaxWinners`."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`Self::set_validator_count`]."] + #[doc = "# "] + pub fn increase_validator_count( + &self, + additional: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "increase_validator_count", + IncreaseValidatorCount { additional }, + [ + 239u8, 184u8, 155u8, 213u8, 25u8, 22u8, 193u8, 13u8, 102u8, 192u8, + 82u8, 153u8, 249u8, 192u8, 60u8, 158u8, 8u8, 78u8, 175u8, 219u8, 46u8, + 51u8, 222u8, 193u8, 193u8, 201u8, 78u8, 90u8, 58u8, 86u8, 196u8, 17u8, + ], + ) + } + #[doc = "Scale up the ideal number of validators by a factor upto maximum of"] + #[doc = "`ElectionProviderBase::MaxWinners`."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`Self::set_validator_count`]."] + #[doc = "# "] + pub fn scale_validator_count( + &self, + factor: runtime_types::sp_arithmetic::per_things::Percent, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "scale_validator_count", + ScaleValidatorCount { factor }, + [ + 198u8, 68u8, 227u8, 94u8, 110u8, 157u8, 209u8, 217u8, 112u8, 37u8, + 78u8, 142u8, 12u8, 193u8, 219u8, 167u8, 149u8, 112u8, 49u8, 139u8, + 74u8, 81u8, 172u8, 72u8, 253u8, 224u8, 56u8, 194u8, 185u8, 90u8, 87u8, + 125u8, + ], + ) + } + #[doc = "Force there to be no new eras indefinitely."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "Thus the election process may be ongoing when this is called. In this case the"] + #[doc = "election will continue until the next era is triggered."] + #[doc = ""] + #[doc = "# "] + #[doc = "- No arguments."] + #[doc = "- Weight: O(1)"] + #[doc = "- Write: ForceEra"] + #[doc = "# "] + pub fn force_no_eras(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "force_no_eras", + ForceNoEras {}, + [ + 16u8, 81u8, 207u8, 168u8, 23u8, 236u8, 11u8, 75u8, 141u8, 107u8, 92u8, + 2u8, 53u8, 111u8, 252u8, 116u8, 91u8, 120u8, 75u8, 24u8, 125u8, 53u8, + 9u8, 28u8, 242u8, 87u8, 245u8, 55u8, 40u8, 103u8, 151u8, 178u8, + ], + ) + } + #[doc = "Force there to be a new era at the end of the next session. After this, it will be"] + #[doc = "reset to normal (non-forced) behaviour."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "If this is called just before a new era is triggered, the election process may not"] + #[doc = "have enough blocks to get a result."] + #[doc = ""] + #[doc = "# "] + #[doc = "- No arguments."] + #[doc = "- Weight: O(1)"] + #[doc = "- Write ForceEra"] + #[doc = "# "] + pub fn force_new_era(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "force_new_era", + ForceNewEra {}, + [ + 230u8, 242u8, 169u8, 196u8, 78u8, 145u8, 24u8, 191u8, 113u8, 68u8, 5u8, + 138u8, 48u8, 51u8, 109u8, 126u8, 73u8, 136u8, 162u8, 158u8, 174u8, + 201u8, 213u8, 230u8, 215u8, 44u8, 200u8, 32u8, 75u8, 27u8, 23u8, 254u8, + ], + ) + } + #[doc = "Set the validators who cannot be slashed (if any)."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + pub fn set_invulnerables( + &self, + invulnerables: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_invulnerables", + SetInvulnerables { invulnerables }, + [ + 2u8, 148u8, 221u8, 111u8, 153u8, 48u8, 222u8, 36u8, 228u8, 84u8, 18u8, + 35u8, 168u8, 239u8, 53u8, 245u8, 27u8, 76u8, 18u8, 203u8, 206u8, 9u8, + 8u8, 81u8, 35u8, 224u8, 22u8, 133u8, 58u8, 99u8, 103u8, 39u8, + ], + ) + } + #[doc = "Force a current staker to become completely unstaked, immediately."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + pub fn force_unstake( + &self, + stash: ::subxt::ext::sp_core::crypto::AccountId32, + num_slashing_spans: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "force_unstake", + ForceUnstake { + stash, + num_slashing_spans, + }, + [ + 94u8, 247u8, 238u8, 47u8, 250u8, 6u8, 96u8, 175u8, 173u8, 123u8, 161u8, + 187u8, 162u8, 214u8, 176u8, 233u8, 33u8, 33u8, 167u8, 239u8, 40u8, + 223u8, 19u8, 131u8, 230u8, 39u8, 175u8, 200u8, 36u8, 182u8, 76u8, + 207u8, + ], + ) + } + #[doc = "Force there to be a new era at the end of sessions indefinitely."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "If this is called just before a new era is triggered, the election process may not"] + #[doc = "have enough blocks to get a result."] + pub fn force_new_era_always( + &self, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "force_new_era_always", + ForceNewEraAlways {}, + [ + 179u8, 118u8, 189u8, 54u8, 248u8, 141u8, 207u8, 142u8, 80u8, 37u8, + 241u8, 185u8, 138u8, 254u8, 117u8, 147u8, 225u8, 118u8, 34u8, 177u8, + 197u8, 158u8, 8u8, 82u8, 202u8, 108u8, 208u8, 26u8, 64u8, 33u8, 74u8, + 43u8, + ], + ) + } + #[doc = "Cancel enactment of a deferred slash."] + #[doc = ""] + #[doc = "Can be called by the `T::AdminOrigin`."] + #[doc = ""] + #[doc = "Parameters: era and indices of the slashes for that era to kill."] + pub fn cancel_deferred_slash( + &self, + era: ::core::primitive::u32, + slash_indices: ::std::vec::Vec<::core::primitive::u32>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "cancel_deferred_slash", + CancelDeferredSlash { era, slash_indices }, + [ + 120u8, 57u8, 162u8, 105u8, 91u8, 250u8, 129u8, 240u8, 110u8, 234u8, + 170u8, 98u8, 164u8, 65u8, 106u8, 101u8, 19u8, 88u8, 146u8, 210u8, + 171u8, 44u8, 37u8, 50u8, 65u8, 178u8, 37u8, 223u8, 239u8, 197u8, 116u8, + 168u8, + ], + ) + } + #[doc = "Pay out all the stakers behind a single validator for a single era."] + #[doc = ""] + #[doc = "- `validator_stash` is the stash account of the validator. Their nominators, up to"] + #[doc = " `T::MaxNominatorRewardedPerValidator`, will also receive their rewards."] + #[doc = "- `era` may be any era between `[current_era - history_depth; current_era]`."] + #[doc = ""] + #[doc = "The origin of this call must be _Signed_. Any account can call this function, even if"] + #[doc = "it is not one of the stakers."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Time complexity: at most O(MaxNominatorRewardedPerValidator)."] + #[doc = "- Contains a limited number of reads and writes."] + #[doc = "-----------"] + #[doc = "N is the Number of payouts for the validator (including the validator)"] + #[doc = "Weight:"] + #[doc = "- Reward Destination Staked: O(N)"] + #[doc = "- Reward Destination Controller (Creating): O(N)"] + #[doc = ""] + #[doc = " NOTE: weights are assuming that payouts are made to alive stash account (Staked)."] + #[doc = " Paying even a dead controller is cheaper weight-wise. We don't do any refunds here."] + #[doc = "# "] + pub fn payout_stakers( + &self, + validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + era: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "payout_stakers", + PayoutStakers { + validator_stash, + era, + }, + [ + 184u8, 194u8, 33u8, 118u8, 7u8, 203u8, 89u8, 119u8, 214u8, 76u8, 178u8, + 20u8, 82u8, 111u8, 57u8, 132u8, 212u8, 43u8, 232u8, 91u8, 252u8, 49u8, + 42u8, 115u8, 1u8, 181u8, 154u8, 207u8, 144u8, 206u8, 205u8, 33u8, + ], + ) + } + #[doc = "Rebond a portion of the stash scheduled to be unlocked."] + #[doc = ""] + #[doc = "The dispatch origin must be signed by the controller."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Time complexity: O(L), where L is unlocking chunks"] + #[doc = "- Bounded by `MaxUnlockingChunks`."] + #[doc = "- Storage changes: Can't increase storage, only decrease it."] + #[doc = "# "] + pub fn rebond( + &self, + value: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "rebond", + Rebond { value }, + [ + 25u8, 22u8, 191u8, 172u8, 133u8, 101u8, 139u8, 102u8, 134u8, 16u8, + 136u8, 56u8, 137u8, 162u8, 4u8, 253u8, 196u8, 30u8, 234u8, 49u8, 102u8, + 68u8, 145u8, 96u8, 148u8, 219u8, 162u8, 17u8, 177u8, 184u8, 34u8, + 113u8, + ], + ) + } + #[doc = "Remove all data structures concerning a staker/stash once it is at a state where it can"] + #[doc = "be considered `dust` in the staking system. The requirements are:"] + #[doc = ""] + #[doc = "1. the `total_balance` of the stash is below existential deposit."] + #[doc = "2. or, the `ledger.total` of the stash is below existential deposit."] + #[doc = ""] + #[doc = "The former can happen in cases like a slash; the latter when a fully unbonded account"] + #[doc = "is still receiving staking rewards in `RewardDestination::Staked`."] + #[doc = ""] + #[doc = "It can be called by anyone, as long as `stash` meets the above requirements."] + #[doc = ""] + #[doc = "Refunds the transaction fees upon successful execution."] + pub fn reap_stash( + &self, + stash: ::subxt::ext::sp_core::crypto::AccountId32, + num_slashing_spans: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "reap_stash", + ReapStash { + stash, + num_slashing_spans, + }, + [ + 34u8, 168u8, 120u8, 161u8, 95u8, 199u8, 106u8, 233u8, 61u8, 240u8, + 166u8, 31u8, 183u8, 165u8, 158u8, 179u8, 32u8, 130u8, 27u8, 164u8, + 112u8, 44u8, 14u8, 125u8, 227u8, 87u8, 70u8, 203u8, 194u8, 24u8, 212u8, + 177u8, + ], + ) + } + #[doc = "Remove the given nominations from the calling validator."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "- `who`: A list of nominator stash accounts who are nominating this validator which"] + #[doc = " should no longer be nominating this validator."] + #[doc = ""] + #[doc = "Note: Making this call only makes sense if you first set the validator preferences to"] + #[doc = "block any further nominations."] + pub fn kick( + &self, + who: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "kick", + Kick { who }, + [ + 32u8, 26u8, 202u8, 6u8, 186u8, 180u8, 58u8, 121u8, 185u8, 208u8, 123u8, + 10u8, 53u8, 179u8, 167u8, 203u8, 96u8, 229u8, 7u8, 144u8, 231u8, 172u8, + 145u8, 141u8, 162u8, 180u8, 212u8, 42u8, 34u8, 5u8, 199u8, 82u8, + ], + ) + } + #[doc = "Update the various staking configurations ."] + #[doc = ""] + #[doc = "* `min_nominator_bond`: The minimum active bond needed to be a nominator."] + #[doc = "* `min_validator_bond`: The minimum active bond needed to be a validator."] + #[doc = "* `max_nominator_count`: The max number of users who can be a nominator at once. When"] + #[doc = " set to `None`, no limit is enforced."] + #[doc = "* `max_validator_count`: The max number of users who can be a validator at once. When"] + #[doc = " set to `None`, no limit is enforced."] + #[doc = "* `chill_threshold`: The ratio of `max_nominator_count` or `max_validator_count` which"] + #[doc = " should be filled in order for the `chill_other` transaction to work."] + #[doc = "* `min_commission`: The minimum amount of commission that each validators must maintain."] + #[doc = " This is checked only upon calling `validate`. Existing validators are not affected."] + #[doc = ""] + #[doc = "RuntimeOrigin must be Root to call this function."] + #[doc = ""] + #[doc = "NOTE: Existing nominators and validators will not be affected by this update."] + #[doc = "to kick people under the new limits, `chill_other` should be called."] + pub fn set_staking_configs( + &self, + min_nominator_bond: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + min_validator_bond: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + max_nominator_count: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u32, + >, + max_validator_count: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u32, + >, + chill_threshold: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Percent, + >, + min_commission: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_staking_configs", + SetStakingConfigs { + min_nominator_bond, + min_validator_bond, + max_nominator_count, + max_validator_count, + chill_threshold, + min_commission, + }, + [ + 176u8, 168u8, 155u8, 176u8, 27u8, 79u8, 223u8, 92u8, 88u8, 93u8, 223u8, + 69u8, 179u8, 250u8, 138u8, 138u8, 87u8, 220u8, 36u8, 3u8, 126u8, 213u8, + 16u8, 68u8, 3u8, 16u8, 218u8, 151u8, 98u8, 169u8, 217u8, 75u8, + ], + ) + } + #[doc = "Declare a `controller` to stop participating as either a validator or nominator."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_, but can be called by anyone."] + #[doc = ""] + #[doc = "If the caller is the same as the controller being targeted, then no further checks are"] + #[doc = "enforced, and this function behaves just like `chill`."] + #[doc = ""] + #[doc = "If the caller is different than the controller being targeted, the following conditions"] + #[doc = "must be met:"] + #[doc = ""] + #[doc = "* `controller` must belong to a nominator who has become non-decodable,"] + #[doc = ""] + #[doc = "Or:"] + #[doc = ""] + #[doc = "* A `ChillThreshold` must be set and checked which defines how close to the max"] + #[doc = " nominators or validators we must reach before users can start chilling one-another."] + #[doc = "* A `MaxNominatorCount` and `MaxValidatorCount` must be set which is used to determine"] + #[doc = " how close we are to the threshold."] + #[doc = "* A `MinNominatorBond` and `MinValidatorBond` must be set and checked, which determines"] + #[doc = " if this is a person that should be chilled because they have not met the threshold"] + #[doc = " bond required."] + #[doc = ""] + #[doc = "This can be helpful if bond requirements are updated, and we need to remove old users"] + #[doc = "who do not satisfy these requirements."] + pub fn chill_other( + &self, + controller: ::subxt::ext::sp_core::crypto::AccountId32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "chill_other", + ChillOther { controller }, + [ + 140u8, 98u8, 4u8, 203u8, 91u8, 131u8, 123u8, 119u8, 169u8, 47u8, 188u8, + 23u8, 205u8, 170u8, 82u8, 220u8, 166u8, 170u8, 135u8, 176u8, 68u8, + 228u8, 14u8, 67u8, 42u8, 52u8, 140u8, 231u8, 62u8, 167u8, 80u8, 173u8, + ], + ) + } + #[doc = "Force a validator to have at least the minimum commission. This will not affect a"] + #[doc = "validator who already has a commission greater than or equal to the minimum. Any account"] + #[doc = "can call this."] + pub fn force_apply_min_commission( + &self, + validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "force_apply_min_commission", + ForceApplyMinCommission { validator_stash }, + [ + 136u8, 163u8, 85u8, 134u8, 240u8, 247u8, 183u8, 227u8, 226u8, 202u8, + 102u8, 186u8, 138u8, 119u8, 78u8, 123u8, 229u8, 135u8, 129u8, 241u8, + 119u8, 106u8, 41u8, 182u8, 121u8, 181u8, 242u8, 175u8, 74u8, 207u8, + 64u8, 106u8, + ], + ) + } + #[doc = "Sets the minimum amount of commission that each validators must maintain."] + #[doc = ""] + #[doc = "This call has lower privilege requirements than `set_staking_config` and can be called"] + #[doc = "by the `T::AdminOrigin`. Root can always call this."] + pub fn set_min_commission( + &self, + new: runtime_types::sp_arithmetic::per_things::Perbill, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Staking", + "set_min_commission", + SetMinCommission { new }, + [ + 62u8, 139u8, 175u8, 245u8, 212u8, 113u8, 117u8, 130u8, 191u8, 173u8, + 78u8, 97u8, 19u8, 104u8, 185u8, 207u8, 201u8, 14u8, 200u8, 208u8, + 184u8, 195u8, 242u8, 175u8, 158u8, 156u8, 51u8, 58u8, 118u8, 154u8, + 68u8, 221u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_staking::pallet::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The era payout has been set; the first balance is the validator-payout; the second is"] + #[doc = "the remainder from the maximum amount of reward."] + pub struct EraPaid { + pub era_index: ::core::primitive::u32, + pub validator_payout: ::core::primitive::u128, + pub remainder: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for EraPaid { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "EraPaid"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The nominator has been rewarded by this amount."] + pub struct Rewarded { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Rewarded { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Rewarded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A staker (validator or nominator) has been slashed by the given amount."] + pub struct Slashed { + pub staker: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Slashed { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Slashed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A slash for the given validator, for the given percentage of their stake, at the given"] + #[doc = "era as been reported."] + pub struct SlashReported { + pub validator: ::subxt::ext::sp_core::crypto::AccountId32, + pub fraction: runtime_types::sp_arithmetic::per_things::Perbill, + pub slash_era: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for SlashReported { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "SlashReported"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An old slashing report from a prior era was discarded because it could"] + #[doc = "not be processed."] + pub struct OldSlashingReportDiscarded { + pub session_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for OldSlashingReportDiscarded { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "OldSlashingReportDiscarded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A new set of stakers was elected."] + pub struct StakersElected; + impl ::subxt::events::StaticEvent for StakersElected { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "StakersElected"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account has bonded this amount. \\[stash, amount\\]"] + #[doc = ""] + #[doc = "NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably,"] + #[doc = "it will not be emitted for staking rewards when they are added to stake."] + pub struct Bonded { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Bonded { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Bonded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account has unbonded this amount."] + pub struct Unbonded { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Unbonded { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Unbonded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`"] + #[doc = "from the unlocking queue."] + pub struct Withdrawn { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Withdrawn { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Withdrawn"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A nominator has been kicked from a validator."] + pub struct Kicked { + pub nominator: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Kicked { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Kicked"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The election failed. No new era is planned."] + pub struct StakingElectionFailed; + impl ::subxt::events::StaticEvent for StakingElectionFailed { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "StakingElectionFailed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An account has stopped participating as either a validator or nominator."] + pub struct Chilled { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Chilled { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "Chilled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The stakers' rewards are getting paid."] + pub struct PayoutStarted { + pub era_index: ::core::primitive::u32, + pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for PayoutStarted { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "PayoutStarted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A validator has set their preferences."] + pub struct ValidatorPrefsSet { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub prefs: runtime_types::pallet_staking::ValidatorPrefs, + } + impl ::subxt::events::StaticEvent for ValidatorPrefsSet { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "ValidatorPrefsSet"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A new force era mode was set."] + pub struct ForceEra { + pub mode: runtime_types::pallet_staking::Forcing, + } + impl ::subxt::events::StaticEvent for ForceEra { + const PALLET: &'static str = "Staking"; + const EVENT: &'static str = "ForceEra"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The ideal number of active validators."] + pub fn validator_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ValidatorCount", + vec![], + [ + 245u8, 75u8, 214u8, 110u8, 66u8, 164u8, 86u8, 206u8, 69u8, 89u8, 12u8, + 111u8, 117u8, 16u8, 228u8, 184u8, 207u8, 6u8, 0u8, 126u8, 221u8, 67u8, + 125u8, 218u8, 188u8, 245u8, 156u8, 188u8, 34u8, 85u8, 208u8, 197u8, + ], + ) + } + #[doc = " Minimum number of staking participants before emergency conditions are imposed."] + pub fn minimum_validator_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MinimumValidatorCount", + vec![], + [ + 82u8, 95u8, 128u8, 55u8, 136u8, 134u8, 71u8, 117u8, 135u8, 76u8, 44u8, + 46u8, 174u8, 34u8, 170u8, 228u8, 175u8, 1u8, 234u8, 162u8, 91u8, 252u8, + 127u8, 68u8, 243u8, 241u8, 13u8, 107u8, 214u8, 70u8, 87u8, 249u8, + ], + ) + } + #[doc = " Any validators that may never be slashed or forcibly kicked. It's a Vec since they're"] + #[doc = " easy to initialize and the performance hit is minimal (we expect no more than four"] + #[doc = " invulnerables) and restricted to testnets."] + pub fn invulnerables( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Invulnerables", + vec![], + [ + 77u8, 78u8, 63u8, 199u8, 150u8, 167u8, 135u8, 130u8, 192u8, 51u8, + 202u8, 119u8, 68u8, 49u8, 241u8, 68u8, 82u8, 90u8, 226u8, 201u8, 96u8, + 170u8, 21u8, 173u8, 236u8, 116u8, 148u8, 8u8, 174u8, 92u8, 7u8, 11u8, + ], + ) + } + #[doc = " Map from all locked \"stash\" accounts to the controller account."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn bonded( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Bonded", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 35u8, 197u8, 156u8, 60u8, 22u8, 59u8, 103u8, 83u8, 77u8, 15u8, 118u8, + 193u8, 155u8, 97u8, 229u8, 36u8, 119u8, 128u8, 224u8, 162u8, 21u8, + 46u8, 199u8, 221u8, 15u8, 74u8, 59u8, 70u8, 77u8, 218u8, 73u8, 165u8, + ], + ) + } + #[doc = " Map from all locked \"stash\" accounts to the controller account."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn bonded_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Bonded", + Vec::new(), + [ + 35u8, 197u8, 156u8, 60u8, 22u8, 59u8, 103u8, 83u8, 77u8, 15u8, 118u8, + 193u8, 155u8, 97u8, 229u8, 36u8, 119u8, 128u8, 224u8, 162u8, 21u8, + 46u8, 199u8, 221u8, 15u8, 74u8, 59u8, 70u8, 77u8, 218u8, 73u8, 165u8, + ], + ) + } + #[doc = " The minimum active bond to become and maintain the role of a nominator."] + pub fn min_nominator_bond( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MinNominatorBond", + vec![], + [ + 187u8, 66u8, 149u8, 226u8, 72u8, 219u8, 57u8, 246u8, 102u8, 47u8, 71u8, + 12u8, 219u8, 204u8, 127u8, 223u8, 58u8, 134u8, 81u8, 165u8, 200u8, + 142u8, 196u8, 158u8, 26u8, 38u8, 165u8, 19u8, 91u8, 251u8, 119u8, 84u8, + ], + ) + } + #[doc = " The minimum active bond to become and maintain the role of a validator."] + pub fn min_validator_bond( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MinValidatorBond", + vec![], + [ + 48u8, 105u8, 85u8, 178u8, 142u8, 208u8, 208u8, 19u8, 236u8, 130u8, + 129u8, 169u8, 35u8, 245u8, 66u8, 182u8, 92u8, 20u8, 22u8, 109u8, 155u8, + 174u8, 87u8, 118u8, 242u8, 216u8, 193u8, 154u8, 4u8, 5u8, 66u8, 56u8, + ], + ) + } + #[doc = " The minimum active nominator stake of the last successful election."] + pub fn minimum_active_stake( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MinimumActiveStake", + vec![], + [ + 172u8, 190u8, 228u8, 47u8, 47u8, 192u8, 182u8, 59u8, 9u8, 18u8, 103u8, + 46u8, 175u8, 54u8, 17u8, 79u8, 89u8, 107u8, 255u8, 200u8, 182u8, 107u8, + 89u8, 157u8, 55u8, 16u8, 77u8, 46u8, 154u8, 169u8, 103u8, 151u8, + ], + ) + } + #[doc = " The minimum amount of commission that validators can set."] + #[doc = ""] + #[doc = " If set to `0`, no limit exists."] + pub fn min_commission( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MinCommission", + vec![], + [ + 61u8, 101u8, 69u8, 27u8, 220u8, 179u8, 5u8, 71u8, 66u8, 227u8, 84u8, + 98u8, 18u8, 141u8, 183u8, 49u8, 98u8, 46u8, 123u8, 114u8, 198u8, 85u8, + 15u8, 175u8, 243u8, 239u8, 133u8, 129u8, 146u8, 174u8, 254u8, 158u8, + ], + ) + } + #[doc = " Map from all (unlocked) \"controller\" accounts to the info regarding the staking."] + pub fn ledger( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::StakingLedger, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Ledger", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 31u8, 205u8, 3u8, 165u8, 22u8, 22u8, 62u8, 92u8, 33u8, 189u8, 124u8, + 120u8, 177u8, 70u8, 27u8, 242u8, 188u8, 184u8, 204u8, 188u8, 242u8, + 140u8, 128u8, 230u8, 85u8, 99u8, 181u8, 173u8, 67u8, 252u8, 37u8, + 236u8, + ], + ) + } + #[doc = " Map from all (unlocked) \"controller\" accounts to the info regarding the staking."] + pub fn ledger_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::StakingLedger, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Ledger", + Vec::new(), + [ + 31u8, 205u8, 3u8, 165u8, 22u8, 22u8, 62u8, 92u8, 33u8, 189u8, 124u8, + 120u8, 177u8, 70u8, 27u8, 242u8, 188u8, 184u8, 204u8, 188u8, 242u8, + 140u8, 128u8, 230u8, 85u8, 99u8, 181u8, 173u8, 67u8, 252u8, 37u8, + 236u8, + ], + ) + } + #[doc = " Where the reward payment should be made. Keyed by stash."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn payee( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Payee", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 195u8, 125u8, 82u8, 213u8, 216u8, 64u8, 76u8, 63u8, 187u8, 163u8, 20u8, + 230u8, 153u8, 13u8, 189u8, 232u8, 119u8, 118u8, 107u8, 17u8, 102u8, + 245u8, 36u8, 42u8, 232u8, 137u8, 177u8, 165u8, 169u8, 246u8, 199u8, + 57u8, + ], + ) + } + #[doc = " Where the reward payment should be made. Keyed by stash."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn payee_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Payee", + Vec::new(), + [ + 195u8, 125u8, 82u8, 213u8, 216u8, 64u8, 76u8, 63u8, 187u8, 163u8, 20u8, + 230u8, 153u8, 13u8, 189u8, 232u8, 119u8, 118u8, 107u8, 17u8, 102u8, + 245u8, 36u8, 42u8, 232u8, 137u8, 177u8, 165u8, 169u8, 246u8, 199u8, + 57u8, + ], + ) + } + #[doc = " The map from (wannabe) validator stash key to the preferences of that validator."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn validators( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::ValidatorPrefs, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Validators", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 80u8, 77u8, 66u8, 18u8, 197u8, 250u8, 41u8, 185u8, 43u8, 24u8, 149u8, + 164u8, 208u8, 60u8, 144u8, 29u8, 251u8, 195u8, 236u8, 196u8, 108u8, + 58u8, 80u8, 115u8, 246u8, 66u8, 226u8, 241u8, 201u8, 172u8, 229u8, + 152u8, + ], + ) + } + #[doc = " The map from (wannabe) validator stash key to the preferences of that validator."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn validators_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::ValidatorPrefs, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Validators", + Vec::new(), + [ + 80u8, 77u8, 66u8, 18u8, 197u8, 250u8, 41u8, 185u8, 43u8, 24u8, 149u8, + 164u8, 208u8, 60u8, 144u8, 29u8, 251u8, 195u8, 236u8, 196u8, 108u8, + 58u8, 80u8, 115u8, 246u8, 66u8, 226u8, 241u8, 201u8, 172u8, 229u8, + 152u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "CounterForValidators", + vec![], + [ + 139u8, 25u8, 223u8, 6u8, 160u8, 239u8, 212u8, 85u8, 36u8, 185u8, 69u8, + 63u8, 21u8, 156u8, 144u8, 241u8, 112u8, 85u8, 49u8, 78u8, 88u8, 11u8, + 8u8, 48u8, 118u8, 34u8, 62u8, 159u8, 239u8, 122u8, 90u8, 45u8, + ], + ) + } + #[doc = " The maximum validator count before we stop allowing new validators to join."] + #[doc = ""] + #[doc = " When this value is not set, no limits are enforced."] + pub fn max_validators_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MaxValidatorsCount", + vec![], + [ + 250u8, 62u8, 16u8, 68u8, 192u8, 216u8, 236u8, 211u8, 217u8, 9u8, 213u8, + 49u8, 41u8, 37u8, 58u8, 62u8, 131u8, 112u8, 64u8, 26u8, 133u8, 7u8, + 130u8, 1u8, 71u8, 158u8, 14u8, 55u8, 169u8, 239u8, 223u8, 245u8, + ], + ) + } + #[doc = " The map from nominator stash key to their nomination preferences, namely the validators that"] + #[doc = " they wish to support."] + #[doc = ""] + #[doc = " Note that the keys of this storage map might become non-decodable in case the"] + #[doc = " [`Config::MaxNominations`] configuration is decreased. In this rare case, these nominators"] + #[doc = " are still existent in storage, their key is correct and retrievable (i.e. `contains_key`"] + #[doc = " indicates that they exist), but their value cannot be decoded. Therefore, the non-decodable"] + #[doc = " nominators will effectively not-exist, until they re-submit their preferences such that it"] + #[doc = " is within the bounds of the newly set `Config::MaxNominations`."] + #[doc = ""] + #[doc = " This implies that `::iter_keys().count()` and `::iter().count()` might return different"] + #[doc = " values for this map. Moreover, the main `::count()` is aligned with the former, namely the"] + #[doc = " number of keys that exist."] + #[doc = ""] + #[doc = " Lastly, if any of the nominators become non-decodable, they can be chilled immediately via"] + #[doc = " [`Call::chill_other`] dispatchable by anyone."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn nominators( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Nominators", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 1u8, 154u8, 55u8, 170u8, 215u8, 64u8, 56u8, 83u8, 254u8, 19u8, 152u8, + 85u8, 164u8, 171u8, 206u8, 129u8, 184u8, 45u8, 221u8, 181u8, 229u8, + 133u8, 200u8, 231u8, 16u8, 146u8, 247u8, 21u8, 77u8, 122u8, 165u8, + 134u8, + ], + ) + } + #[doc = " The map from nominator stash key to their nomination preferences, namely the validators that"] + #[doc = " they wish to support."] + #[doc = ""] + #[doc = " Note that the keys of this storage map might become non-decodable in case the"] + #[doc = " [`Config::MaxNominations`] configuration is decreased. In this rare case, these nominators"] + #[doc = " are still existent in storage, their key is correct and retrievable (i.e. `contains_key`"] + #[doc = " indicates that they exist), but their value cannot be decoded. Therefore, the non-decodable"] + #[doc = " nominators will effectively not-exist, until they re-submit their preferences such that it"] + #[doc = " is within the bounds of the newly set `Config::MaxNominations`."] + #[doc = ""] + #[doc = " This implies that `::iter_keys().count()` and `::iter().count()` might return different"] + #[doc = " values for this map. Moreover, the main `::count()` is aligned with the former, namely the"] + #[doc = " number of keys that exist."] + #[doc = ""] + #[doc = " Lastly, if any of the nominators become non-decodable, they can be chilled immediately via"] + #[doc = " [`Call::chill_other`] dispatchable by anyone."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn nominators_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "Nominators", + Vec::new(), + [ + 1u8, 154u8, 55u8, 170u8, 215u8, 64u8, 56u8, 83u8, 254u8, 19u8, 152u8, + 85u8, 164u8, 171u8, 206u8, 129u8, 184u8, 45u8, 221u8, 181u8, 229u8, + 133u8, 200u8, 231u8, 16u8, 146u8, 247u8, 21u8, 77u8, 122u8, 165u8, + 134u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_nominators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "CounterForNominators", + vec![], + [ + 31u8, 94u8, 130u8, 138u8, 75u8, 8u8, 38u8, 162u8, 181u8, 5u8, 125u8, + 116u8, 9u8, 51u8, 22u8, 234u8, 40u8, 117u8, 215u8, 46u8, 82u8, 117u8, + 225u8, 1u8, 9u8, 208u8, 83u8, 63u8, 39u8, 187u8, 207u8, 191u8, + ], + ) + } + #[doc = " The maximum nominator count before we stop allowing new validators to join."] + #[doc = ""] + #[doc = " When this value is not set, no limits are enforced."] + pub fn max_nominators_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "MaxNominatorsCount", + vec![], + [ + 180u8, 190u8, 180u8, 66u8, 235u8, 173u8, 76u8, 160u8, 197u8, 92u8, + 96u8, 165u8, 220u8, 188u8, 32u8, 119u8, 3u8, 73u8, 86u8, 49u8, 104u8, + 17u8, 186u8, 98u8, 221u8, 175u8, 109u8, 254u8, 207u8, 245u8, 125u8, + 179u8, + ], + ) + } + #[doc = " The current era index."] + #[doc = ""] + #[doc = " This is the latest planned era, depending on how the Session pallet queues the validator"] + #[doc = " set, it might be active or not."] + pub fn current_era( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "CurrentEra", + vec![], + [ + 105u8, 150u8, 49u8, 122u8, 4u8, 78u8, 8u8, 121u8, 34u8, 136u8, 157u8, + 227u8, 59u8, 139u8, 7u8, 253u8, 7u8, 10u8, 117u8, 71u8, 240u8, 74u8, + 86u8, 36u8, 198u8, 37u8, 153u8, 93u8, 196u8, 22u8, 192u8, 243u8, + ], + ) + } + #[doc = " The active era information, it holds index and start."] + #[doc = ""] + #[doc = " The active era is the era being currently rewarded. Validator set of this era must be"] + #[doc = " equal to [`SessionInterface::validators`]."] + pub fn active_era( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::ActiveEraInfo, + >, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ActiveEra", + vec![], + [ + 15u8, 112u8, 251u8, 183u8, 108u8, 61u8, 28u8, 71u8, 44u8, 150u8, 162u8, + 4u8, 143u8, 121u8, 11u8, 37u8, 83u8, 29u8, 193u8, 21u8, 210u8, 116u8, + 190u8, 236u8, 213u8, 235u8, 49u8, 97u8, 189u8, 142u8, 251u8, 124u8, + ], + ) + } + #[doc = " The session index at which the era start for the last `HISTORY_DEPTH` eras."] + #[doc = ""] + #[doc = " Note: This tracks the starting session (i.e. session index when era start being active)"] + #[doc = " for the eras in `[CurrentEra - HISTORY_DEPTH, CurrentEra]`."] + pub fn eras_start_session_index( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStartSessionIndex", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 92u8, 157u8, 168u8, 144u8, 132u8, 3u8, 212u8, 80u8, 230u8, 229u8, + 251u8, 218u8, 97u8, 55u8, 79u8, 100u8, 163u8, 91u8, 32u8, 246u8, 122u8, + 78u8, 149u8, 214u8, 103u8, 249u8, 119u8, 20u8, 101u8, 116u8, 110u8, + 185u8, + ], + ) + } + #[doc = " The session index at which the era start for the last `HISTORY_DEPTH` eras."] + #[doc = ""] + #[doc = " Note: This tracks the starting session (i.e. session index when era start being active)"] + #[doc = " for the eras in `[CurrentEra - HISTORY_DEPTH, CurrentEra]`."] + pub fn eras_start_session_index_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStartSessionIndex", + Vec::new(), + [ + 92u8, 157u8, 168u8, 144u8, 132u8, 3u8, 212u8, 80u8, 230u8, 229u8, + 251u8, 218u8, 97u8, 55u8, 79u8, 100u8, 163u8, 91u8, 32u8, 246u8, 122u8, + 78u8, 149u8, 214u8, 103u8, 249u8, 119u8, 20u8, 101u8, 116u8, 110u8, + 185u8, + ], + ) + } + #[doc = " Exposure of validator at era."] + #[doc = ""] + #[doc = " This is keyed first by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] + pub fn eras_stakers( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::Exposure< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStakers", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ], + [ + 192u8, 50u8, 152u8, 151u8, 92u8, 180u8, 206u8, 15u8, 139u8, 210u8, + 128u8, 65u8, 92u8, 253u8, 43u8, 35u8, 139u8, 171u8, 73u8, 185u8, 32u8, + 78u8, 20u8, 197u8, 154u8, 90u8, 233u8, 231u8, 23u8, 22u8, 187u8, 156u8, + ], + ) + } + #[doc = " Exposure of validator at era."] + #[doc = ""] + #[doc = " This is keyed first by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] + pub fn eras_stakers_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::Exposure< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStakers", + Vec::new(), + [ + 192u8, 50u8, 152u8, 151u8, 92u8, 180u8, 206u8, 15u8, 139u8, 210u8, + 128u8, 65u8, 92u8, 253u8, 43u8, 35u8, 139u8, 171u8, 73u8, 185u8, 32u8, + 78u8, 20u8, 197u8, 154u8, 90u8, 233u8, 231u8, 23u8, 22u8, 187u8, 156u8, + ], + ) + } + #[doc = " Clipped Exposure of validator at era."] + #[doc = ""] + #[doc = " This is similar to [`ErasStakers`] but number of nominators exposed is reduced to the"] + #[doc = " `T::MaxNominatorRewardedPerValidator` biggest stakers."] + #[doc = " (Note: the field `total` and `own` of the exposure remains unchanged)."] + #[doc = " This is used to limit the i/o cost for the nominator payout."] + #[doc = ""] + #[doc = " This is keyed fist by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] + pub fn eras_stakers_clipped( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::Exposure< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStakersClipped", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ], + [ + 43u8, 159u8, 113u8, 223u8, 122u8, 169u8, 98u8, 153u8, 26u8, 55u8, 71u8, + 119u8, 174u8, 48u8, 158u8, 45u8, 214u8, 26u8, 136u8, 215u8, 46u8, + 161u8, 185u8, 17u8, 174u8, 204u8, 206u8, 246u8, 49u8, 87u8, 134u8, + 169u8, + ], + ) + } + #[doc = " Clipped Exposure of validator at era."] + #[doc = ""] + #[doc = " This is similar to [`ErasStakers`] but number of nominators exposed is reduced to the"] + #[doc = " `T::MaxNominatorRewardedPerValidator` biggest stakers."] + #[doc = " (Note: the field `total` and `own` of the exposure remains unchanged)."] + #[doc = " This is used to limit the i/o cost for the nominator payout."] + #[doc = ""] + #[doc = " This is keyed fist by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] + pub fn eras_stakers_clipped_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::Exposure< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasStakersClipped", + Vec::new(), + [ + 43u8, 159u8, 113u8, 223u8, 122u8, 169u8, 98u8, 153u8, 26u8, 55u8, 71u8, + 119u8, 174u8, 48u8, 158u8, 45u8, 214u8, 26u8, 136u8, 215u8, 46u8, + 161u8, 185u8, 17u8, 174u8, 204u8, 206u8, 246u8, 49u8, 87u8, 134u8, + 169u8, + ], + ) + } + #[doc = " Similar to `ErasStakers`, this holds the preferences of validators."] + #[doc = ""] + #[doc = " This is keyed first by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + pub fn eras_validator_prefs( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::ValidatorPrefs, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasValidatorPrefs", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ], + [ + 6u8, 196u8, 209u8, 138u8, 252u8, 18u8, 203u8, 86u8, 129u8, 62u8, 4u8, + 56u8, 234u8, 114u8, 141u8, 136u8, 127u8, 224u8, 142u8, 89u8, 150u8, + 33u8, 31u8, 50u8, 140u8, 108u8, 124u8, 77u8, 188u8, 102u8, 230u8, + 174u8, + ], + ) + } + #[doc = " Similar to `ErasStakers`, this holds the preferences of validators."] + #[doc = ""] + #[doc = " This is keyed first by the era index to allow bulk deletion and then the stash account."] + #[doc = ""] + #[doc = " Is it removed after `HISTORY_DEPTH` eras."] + pub fn eras_validator_prefs_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::ValidatorPrefs, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasValidatorPrefs", + Vec::new(), + [ + 6u8, 196u8, 209u8, 138u8, 252u8, 18u8, 203u8, 86u8, 129u8, 62u8, 4u8, + 56u8, 234u8, 114u8, 141u8, 136u8, 127u8, 224u8, 142u8, 89u8, 150u8, + 33u8, 31u8, 50u8, 140u8, 108u8, 124u8, 77u8, 188u8, 102u8, 230u8, + 174u8, + ], + ) + } + #[doc = " The total validator era payout for the last `HISTORY_DEPTH` eras."] + #[doc = ""] + #[doc = " Eras that haven't finished yet or has been removed doesn't have reward."] + pub fn eras_validator_reward( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasValidatorReward", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 87u8, 80u8, 156u8, 123u8, 107u8, 77u8, 203u8, 37u8, 231u8, 84u8, 124u8, + 155u8, 227u8, 212u8, 212u8, 179u8, 84u8, 161u8, 223u8, 255u8, 254u8, + 107u8, 52u8, 89u8, 98u8, 169u8, 136u8, 241u8, 104u8, 3u8, 244u8, 161u8, + ], + ) + } + #[doc = " The total validator era payout for the last `HISTORY_DEPTH` eras."] + #[doc = ""] + #[doc = " Eras that haven't finished yet or has been removed doesn't have reward."] + pub fn eras_validator_reward_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasValidatorReward", + Vec::new(), + [ + 87u8, 80u8, 156u8, 123u8, 107u8, 77u8, 203u8, 37u8, 231u8, 84u8, 124u8, + 155u8, 227u8, 212u8, 212u8, 179u8, 84u8, 161u8, 223u8, 255u8, 254u8, + 107u8, 52u8, 89u8, 98u8, 169u8, 136u8, 241u8, 104u8, 3u8, 244u8, 161u8, + ], + ) + } + #[doc = " Rewards for the last `HISTORY_DEPTH` eras."] + #[doc = " If reward hasn't been set or has been removed then 0 reward is returned."] + pub fn eras_reward_points( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::EraRewardPoints< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasRewardPoints", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 194u8, 29u8, 20u8, 83u8, 200u8, 47u8, 158u8, 102u8, 88u8, 65u8, 24u8, + 255u8, 120u8, 178u8, 23u8, 232u8, 15u8, 64u8, 206u8, 0u8, 170u8, 40u8, + 18u8, 149u8, 45u8, 90u8, 179u8, 127u8, 52u8, 59u8, 37u8, 192u8, + ], + ) + } + #[doc = " Rewards for the last `HISTORY_DEPTH` eras."] + #[doc = " If reward hasn't been set or has been removed then 0 reward is returned."] + pub fn eras_reward_points_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::EraRewardPoints< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasRewardPoints", + Vec::new(), + [ + 194u8, 29u8, 20u8, 83u8, 200u8, 47u8, 158u8, 102u8, 88u8, 65u8, 24u8, + 255u8, 120u8, 178u8, 23u8, 232u8, 15u8, 64u8, 206u8, 0u8, 170u8, 40u8, + 18u8, 149u8, 45u8, 90u8, 179u8, 127u8, 52u8, 59u8, 37u8, 192u8, + ], + ) + } + #[doc = " The total amount staked for the last `HISTORY_DEPTH` eras."] + #[doc = " If total hasn't been set or has been removed then 0 stake is returned."] + pub fn eras_total_stake( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasTotalStake", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 224u8, 240u8, 168u8, 69u8, 148u8, 140u8, 249u8, 240u8, 4u8, 46u8, 77u8, + 11u8, 224u8, 65u8, 26u8, 239u8, 1u8, 110u8, 53u8, 11u8, 247u8, 235u8, + 142u8, 234u8, 22u8, 43u8, 24u8, 36u8, 37u8, 43u8, 170u8, 40u8, + ], + ) + } + #[doc = " The total amount staked for the last `HISTORY_DEPTH` eras."] + #[doc = " If total hasn't been set or has been removed then 0 stake is returned."] + pub fn eras_total_stake_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ErasTotalStake", + Vec::new(), + [ + 224u8, 240u8, 168u8, 69u8, 148u8, 140u8, 249u8, 240u8, 4u8, 46u8, 77u8, + 11u8, 224u8, 65u8, 26u8, 239u8, 1u8, 110u8, 53u8, 11u8, 247u8, 235u8, + 142u8, 234u8, 22u8, 43u8, 24u8, 36u8, 37u8, 43u8, 170u8, 40u8, + ], + ) + } + #[doc = " Mode of era forcing."] + pub fn force_era( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ForceEra", + vec![], + [ + 221u8, 41u8, 71u8, 21u8, 28u8, 193u8, 65u8, 97u8, 103u8, 37u8, 145u8, + 146u8, 183u8, 194u8, 57u8, 131u8, 214u8, 136u8, 68u8, 156u8, 140u8, + 194u8, 69u8, 151u8, 115u8, 177u8, 92u8, 147u8, 29u8, 40u8, 41u8, 31u8, + ], + ) + } + #[doc = " The percentage of the slash that is distributed to reporters."] + #[doc = ""] + #[doc = " The rest of the slashed value is handled by the `Slash`."] + pub fn slash_reward_fraction( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "SlashRewardFraction", + vec![], + [ + 167u8, 79u8, 143u8, 202u8, 199u8, 100u8, 129u8, 162u8, 23u8, 165u8, + 106u8, 170u8, 244u8, 86u8, 144u8, 242u8, 65u8, 207u8, 115u8, 224u8, + 231u8, 155u8, 55u8, 139u8, 101u8, 129u8, 242u8, 196u8, 130u8, 50u8, + 3u8, 117u8, + ], + ) + } + #[doc = " The amount of currency given to reporters of a slash event which was"] + #[doc = " canceled by extraordinary circumstances (e.g. governance)."] + pub fn canceled_slash_payout( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "CanceledSlashPayout", + vec![], + [ + 126u8, 218u8, 66u8, 92u8, 82u8, 124u8, 145u8, 161u8, 40u8, 176u8, 14u8, + 211u8, 178u8, 216u8, 8u8, 156u8, 83u8, 14u8, 91u8, 15u8, 200u8, 170u8, + 3u8, 127u8, 141u8, 139u8, 151u8, 98u8, 74u8, 96u8, 238u8, 29u8, + ], + ) + } + #[doc = " All unapplied slashes that are queued for later."] + pub fn unapplied_slashes( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec< + runtime_types::pallet_staking::UnappliedSlash< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "UnappliedSlashes", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 130u8, 4u8, 163u8, 163u8, 28u8, 85u8, 34u8, 156u8, 47u8, 125u8, 57u8, + 0u8, 133u8, 176u8, 130u8, 2u8, 175u8, 180u8, 167u8, 203u8, 230u8, 82u8, + 198u8, 183u8, 55u8, 82u8, 221u8, 248u8, 100u8, 173u8, 206u8, 151u8, + ], + ) + } + #[doc = " All unapplied slashes that are queued for later."] + pub fn unapplied_slashes_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec< + runtime_types::pallet_staking::UnappliedSlash< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "UnappliedSlashes", + Vec::new(), + [ + 130u8, 4u8, 163u8, 163u8, 28u8, 85u8, 34u8, 156u8, 47u8, 125u8, 57u8, + 0u8, 133u8, 176u8, 130u8, 2u8, 175u8, 180u8, 167u8, 203u8, 230u8, 82u8, + 198u8, 183u8, 55u8, 82u8, 221u8, 248u8, 100u8, 173u8, 206u8, 151u8, + ], + ) + } + #[doc = " A mapping from still-bonded eras to the first session index of that era."] + #[doc = ""] + #[doc = " Must contains information for eras for the range:"] + #[doc = " `[active_era - bounding_duration; active_era]`"] + pub fn bonded_eras( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "BondedEras", + vec![], + [ + 243u8, 162u8, 236u8, 198u8, 122u8, 182u8, 37u8, 55u8, 171u8, 156u8, + 235u8, 223u8, 226u8, 129u8, 89u8, 206u8, 2u8, 155u8, 222u8, 154u8, + 116u8, 124u8, 4u8, 119u8, 155u8, 94u8, 248u8, 30u8, 171u8, 51u8, 78u8, + 106u8, + ], + ) + } + #[doc = " All slashing events on validators, mapped by era to the highest slash proportion"] + #[doc = " and slash value of the era."] + pub fn validator_slash_in_era( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + runtime_types::sp_arithmetic::per_things::Perbill, + ::core::primitive::u128, + )>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ValidatorSlashInEra", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ], + [ + 237u8, 80u8, 3u8, 237u8, 9u8, 40u8, 212u8, 15u8, 251u8, 196u8, 85u8, + 29u8, 27u8, 151u8, 98u8, 122u8, 189u8, 147u8, 205u8, 40u8, 202u8, + 194u8, 158u8, 96u8, 138u8, 16u8, 116u8, 71u8, 140u8, 163u8, 121u8, + 197u8, + ], + ) + } + #[doc = " All slashing events on validators, mapped by era to the highest slash proportion"] + #[doc = " and slash value of the era."] + pub fn validator_slash_in_era_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + runtime_types::sp_arithmetic::per_things::Perbill, + ::core::primitive::u128, + )>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ValidatorSlashInEra", + Vec::new(), + [ + 237u8, 80u8, 3u8, 237u8, 9u8, 40u8, 212u8, 15u8, 251u8, 196u8, 85u8, + 29u8, 27u8, 151u8, 98u8, 122u8, 189u8, 147u8, 205u8, 40u8, 202u8, + 194u8, 158u8, 96u8, 138u8, 16u8, 116u8, 71u8, 140u8, 163u8, 121u8, + 197u8, + ], + ) + } + #[doc = " All slashing events on nominators, mapped by era to the highest slash value of the era."] + pub fn nominator_slash_in_era( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "NominatorSlashInEra", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ], + [ + 249u8, 85u8, 170u8, 41u8, 179u8, 194u8, 180u8, 12u8, 53u8, 101u8, 80u8, + 96u8, 166u8, 71u8, 239u8, 23u8, 153u8, 19u8, 152u8, 38u8, 138u8, 136u8, + 221u8, 200u8, 18u8, 165u8, 26u8, 228u8, 195u8, 199u8, 62u8, 4u8, + ], + ) + } + #[doc = " All slashing events on nominators, mapped by era to the highest slash value of the era."] + pub fn nominator_slash_in_era_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "NominatorSlashInEra", + Vec::new(), + [ + 249u8, 85u8, 170u8, 41u8, 179u8, 194u8, 180u8, 12u8, 53u8, 101u8, 80u8, + 96u8, 166u8, 71u8, 239u8, 23u8, 153u8, 19u8, 152u8, 38u8, 138u8, 136u8, + 221u8, 200u8, 18u8, 165u8, 26u8, 228u8, 195u8, 199u8, 62u8, 4u8, + ], + ) + } + #[doc = " Slashing spans for stash accounts."] + pub fn slashing_spans( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::slashing::SlashingSpans, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "SlashingSpans", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 106u8, 115u8, 118u8, 52u8, 89u8, 77u8, 246u8, 5u8, 255u8, 204u8, 44u8, + 5u8, 66u8, 36u8, 227u8, 252u8, 86u8, 159u8, 186u8, 152u8, 196u8, 21u8, + 74u8, 201u8, 133u8, 93u8, 142u8, 191u8, 20u8, 27u8, 218u8, 157u8, + ], + ) + } + #[doc = " Slashing spans for stash accounts."] + pub fn slashing_spans_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::slashing::SlashingSpans, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "SlashingSpans", + Vec::new(), + [ + 106u8, 115u8, 118u8, 52u8, 89u8, 77u8, 246u8, 5u8, 255u8, 204u8, 44u8, + 5u8, 66u8, 36u8, 227u8, 252u8, 86u8, 159u8, 186u8, 152u8, 196u8, 21u8, + 74u8, 201u8, 133u8, 93u8, 142u8, 191u8, 20u8, 27u8, 218u8, 157u8, + ], + ) + } + #[doc = " Records information about the maximum slash of a stash within a slashing span,"] + #[doc = " as well as how much reward has been paid out."] + pub fn span_slash( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::slashing::SpanRecord< + ::core::primitive::u128, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "SpanSlash", + vec![::subxt::storage::address::StorageMapKey::new( + &(_0.borrow(), _1.borrow()), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 160u8, 63u8, 115u8, 190u8, 233u8, 148u8, 75u8, 3u8, 11u8, 59u8, 184u8, + 220u8, 205u8, 64u8, 28u8, 190u8, 116u8, 210u8, 225u8, 230u8, 224u8, + 163u8, 103u8, 157u8, 100u8, 29u8, 86u8, 167u8, 84u8, 217u8, 109u8, + 200u8, + ], + ) + } + #[doc = " Records information about the maximum slash of a stash within a slashing span,"] + #[doc = " as well as how much reward has been paid out."] + pub fn span_slash_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_staking::slashing::SpanRecord< + ::core::primitive::u128, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "SpanSlash", + Vec::new(), + [ + 160u8, 63u8, 115u8, 190u8, 233u8, 148u8, 75u8, 3u8, 11u8, 59u8, 184u8, + 220u8, 205u8, 64u8, 28u8, 190u8, 116u8, 210u8, 225u8, 230u8, 224u8, + 163u8, 103u8, 157u8, 100u8, 29u8, 86u8, 167u8, 84u8, 217u8, 109u8, + 200u8, + ], + ) + } + #[doc = " The last planned session scheduled by the session pallet."] + #[doc = ""] + #[doc = " This is basically in sync with the call to [`pallet_session::SessionManager::new_session`]."] + pub fn current_planned_session( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "CurrentPlannedSession", + vec![], + [ + 38u8, 22u8, 56u8, 250u8, 17u8, 154u8, 99u8, 37u8, 155u8, 253u8, 100u8, + 117u8, 5u8, 239u8, 31u8, 190u8, 53u8, 241u8, 11u8, 185u8, 163u8, 227u8, + 10u8, 77u8, 210u8, 64u8, 156u8, 218u8, 105u8, 16u8, 1u8, 57u8, + ], + ) + } + #[doc = " Indices of validators that have offended in the active era and whether they are currently"] + #[doc = " disabled."] + #[doc = ""] + #[doc = " This value should be a superset of disabled validators since not all offences lead to the"] + #[doc = " validator being disabled (if there was no slash). This is needed to track the percentage of"] + #[doc = " validators that have offended in the current era, ensuring a new era is forced if"] + #[doc = " `OffendingValidatorsThreshold` is reached. The vec is always kept sorted so that we can find"] + #[doc = " whether a given validator has previously offended using binary search. It gets cleared when"] + #[doc = " the era ends."] + pub fn offending_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::bool)>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "OffendingValidators", + vec![], + [ + 94u8, 254u8, 0u8, 50u8, 76u8, 232u8, 51u8, 153u8, 118u8, 14u8, 70u8, + 101u8, 112u8, 215u8, 173u8, 82u8, 182u8, 104u8, 167u8, 103u8, 187u8, + 168u8, 86u8, 16u8, 51u8, 235u8, 51u8, 119u8, 38u8, 154u8, 42u8, 113u8, + ], + ) + } + #[doc = " The threshold for when users can start calling `chill_other` for other validators /"] + #[doc = " nominators. The threshold is compared to the actual number of validators / nominators"] + #[doc = " (`CountFor*`) in the system compared to the configured max (`Max*Count`)."] + pub fn chill_threshold( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::per_things::Percent, + >, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Staking", + "ChillThreshold", + vec![], + [ + 174u8, 165u8, 249u8, 105u8, 24u8, 151u8, 115u8, 166u8, 199u8, 251u8, + 28u8, 5u8, 50u8, 95u8, 144u8, 110u8, 220u8, 76u8, 14u8, 23u8, 179u8, + 41u8, 11u8, 248u8, 28u8, 154u8, 159u8, 255u8, 156u8, 109u8, 98u8, 92u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Maximum number of nominations per nominator."] + pub fn max_nominations( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "MaxNominations", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Number of eras to keep in history."] + #[doc = ""] + #[doc = " Following information is kept for eras in `[current_era -"] + #[doc = " HistoryDepth, current_era]`: `ErasStakers`, `ErasStakersClipped`,"] + #[doc = " `ErasValidatorPrefs`, `ErasValidatorReward`, `ErasRewardPoints`,"] + #[doc = " `ErasTotalStake`, `ErasStartSessionIndex`,"] + #[doc = " `StakingLedger.claimed_rewards`."] + #[doc = ""] + #[doc = " Must be more than the number of eras delayed by session."] + #[doc = " I.e. active era must always be in history. I.e. `active_era >"] + #[doc = " current_era - history_depth` must be guaranteed."] + #[doc = ""] + #[doc = " If migrating an existing pallet from storage value to config value,"] + #[doc = " this should be set to same value or greater as in storage."] + #[doc = ""] + #[doc = " Note: `HistoryDepth` is used as the upper bound for the `BoundedVec`"] + #[doc = " item `StakingLedger.claimed_rewards`. Setting this value lower than"] + #[doc = " the existing value can lead to inconsistencies in the"] + #[doc = " `StakingLedger` and will need to be handled properly in a migration."] + #[doc = " The test `reducing_history_depth_abrupt` shows this effect."] + pub fn history_depth( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "HistoryDepth", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Number of sessions per era."] + pub fn sessions_per_era( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "SessionsPerEra", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Number of eras that staked funds must remain bonded for."] + pub fn bonding_duration( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "BondingDuration", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Number of eras that slashes are deferred by, after computation."] + #[doc = ""] + #[doc = " This should be less than the bonding duration. Set to 0 if slashes"] + #[doc = " should be applied immediately, without opportunity for intervention."] + pub fn slash_defer_duration( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "SlashDeferDuration", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum number of nominators rewarded for each validator."] + #[doc = ""] + #[doc = " For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can"] + #[doc = " claim their reward. This used to limit the i/o cost for the nominator payout."] + pub fn max_nominator_rewarded_per_validator( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "MaxNominatorRewardedPerValidator", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum number of `unlocking` chunks a [`StakingLedger`] can"] + #[doc = " have. Effectively determines how many unique eras a staker may be"] + #[doc = " unbonding in."] + #[doc = ""] + #[doc = " Note: `MaxUnlockingChunks` is used as the upper bound for the"] + #[doc = " `BoundedVec` item `StakingLedger.unlocking`. Setting this value"] + #[doc = " lower than the existing value can lead to inconsistencies in the"] + #[doc = " `StakingLedger` and will need to be handled properly in a runtime"] + #[doc = " migration. The test `reducing_max_unlocking_chunks_abrupt` shows"] + #[doc = " this effect."] + pub fn max_unlocking_chunks( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Staking", + "MaxUnlockingChunks", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod history { + use super::{root_mod, runtime_types}; + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Mapping from historical session indices to session-data root hash and validator count."] + pub fn historical_sessions( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::subxt::ext::sp_core::H256, + ::core::primitive::u32, + )>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "History", + "HistoricalSessions", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 94u8, 72u8, 245u8, 151u8, 214u8, 10u8, 12u8, 113u8, 13u8, 141u8, 176u8, + 178u8, 115u8, 238u8, 224u8, 181u8, 18u8, 5u8, 71u8, 65u8, 189u8, 148u8, + 161u8, 106u8, 24u8, 211u8, 72u8, 66u8, 221u8, 244u8, 117u8, 184u8, + ], + ) + } + #[doc = " Mapping from historical session indices to session-data root hash and validator count."] + pub fn historical_sessions_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::subxt::ext::sp_core::H256, + ::core::primitive::u32, + )>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "History", + "HistoricalSessions", + Vec::new(), + [ + 94u8, 72u8, 245u8, 151u8, 214u8, 10u8, 12u8, 113u8, 13u8, 141u8, 176u8, + 178u8, 115u8, 238u8, 224u8, 181u8, 18u8, 5u8, 71u8, 65u8, 189u8, 148u8, + 161u8, 106u8, 24u8, 211u8, 72u8, 66u8, 221u8, 244u8, 117u8, 184u8, + ], + ) + } + #[doc = " The range of historical sessions we store. [first, last)"] + pub fn stored_range( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "History", + "StoredRange", + vec![], + [ + 89u8, 239u8, 197u8, 93u8, 135u8, 62u8, 142u8, 237u8, 64u8, 200u8, + 164u8, 4u8, 130u8, 233u8, 16u8, 238u8, 166u8, 206u8, 71u8, 42u8, 171u8, + 84u8, 8u8, 245u8, 183u8, 216u8, 212u8, 16u8, 190u8, 3u8, 167u8, 189u8, + ], + ) + } + } + } + } + pub mod session { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetKeys { + pub keys: runtime_types::aleph_runtime::SessionKeys, + pub proof: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PurgeKeys; + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Sets the session key(s) of the function caller to `keys`."] + #[doc = "Allows an account to set its session key prior to becoming a validator."] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be signed."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: `O(1)`. Actual cost depends on the number of length of"] + #[doc = " `T::Keys::key_ids()` which is fixed."] + #[doc = "- DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`"] + #[doc = "- DbWrites: `origin account`, `NextKeys`"] + #[doc = "- DbReads per key id: `KeyOwner`"] + #[doc = "- DbWrites per key id: `KeyOwner`"] + #[doc = "# "] + pub fn set_keys( + &self, + keys: runtime_types::aleph_runtime::SessionKeys, + proof: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Session", + "set_keys", + SetKeys { keys, proof }, + [ + 104u8, 12u8, 102u8, 88u8, 135u8, 226u8, 42u8, 162u8, 217u8, 56u8, + 227u8, 24u8, 190u8, 82u8, 1u8, 41u8, 49u8, 50u8, 146u8, 96u8, 21u8, + 56u8, 131u8, 32u8, 244u8, 189u8, 95u8, 22u8, 219u8, 106u8, 236u8, + 206u8, + ], + ) + } + #[doc = "Removes any session key(s) of the function caller."] + #[doc = ""] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be Signed and the account must be either be"] + #[doc = "convertible to a validator ID using the chain's typical addressing system (this usually"] + #[doc = "means being a controller account) or directly convertible into a validator ID (which"] + #[doc = "usually means being a stash account)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: `O(1)` in number of key types. Actual cost depends on the number of length"] + #[doc = " of `T::Keys::key_ids()` which is fixed."] + #[doc = "- DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`"] + #[doc = "- DbWrites: `NextKeys`, `origin account`"] + #[doc = "- DbWrites per key id: `KeyOwner`"] + #[doc = "# "] + pub fn purge_keys(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Session", + "purge_keys", + PurgeKeys {}, + [ + 200u8, 255u8, 4u8, 213u8, 188u8, 92u8, 99u8, 116u8, 163u8, 152u8, 29u8, + 35u8, 133u8, 119u8, 246u8, 44u8, 91u8, 31u8, 145u8, 23u8, 213u8, 64u8, + 71u8, 242u8, 207u8, 239u8, 231u8, 37u8, 61u8, 63u8, 190u8, 35u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_session::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "New session has happened. Note that the argument is the session index, not the"] + #[doc = "block number as the type might suggest."] + pub struct NewSession { + pub session_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for NewSession { + const PALLET: &'static str = "Session"; + const EVENT: &'static str = "NewSession"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The current set of validators."] + pub fn validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "Validators", + vec![], + [ + 144u8, 235u8, 200u8, 43u8, 151u8, 57u8, 147u8, 172u8, 201u8, 202u8, + 242u8, 96u8, 57u8, 76u8, 124u8, 77u8, 42u8, 113u8, 218u8, 220u8, 230u8, + 32u8, 151u8, 152u8, 172u8, 106u8, 60u8, 227u8, 122u8, 118u8, 137u8, + 68u8, + ], + ) + } + #[doc = " Current index of the session."] + pub fn current_index( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "CurrentIndex", + vec![], + [ + 148u8, 179u8, 159u8, 15u8, 197u8, 95u8, 214u8, 30u8, 209u8, 251u8, + 183u8, 231u8, 91u8, 25u8, 181u8, 191u8, 143u8, 252u8, 227u8, 80u8, + 159u8, 66u8, 194u8, 67u8, 113u8, 74u8, 111u8, 91u8, 218u8, 187u8, + 130u8, 40u8, + ], + ) + } + #[doc = " True if the underlying economic identities or weighting behind the validators"] + #[doc = " has changed in the queued validator set."] + pub fn queued_changed( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "QueuedChanged", + vec![], + [ + 105u8, 140u8, 235u8, 218u8, 96u8, 100u8, 252u8, 10u8, 58u8, 221u8, + 244u8, 251u8, 67u8, 91u8, 80u8, 202u8, 152u8, 42u8, 50u8, 113u8, 200u8, + 247u8, 59u8, 213u8, 77u8, 195u8, 1u8, 150u8, 220u8, 18u8, 245u8, 46u8, + ], + ) + } + #[doc = " The queued keys for the next session. When the next session begins, these keys"] + #[doc = " will be used to determine the validator's session keys."] + pub fn queued_keys( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::aleph_runtime::SessionKeys, + )>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "QueuedKeys", + vec![], + [ + 225u8, 184u8, 241u8, 120u8, 191u8, 179u8, 152u8, 85u8, 19u8, 139u8, + 177u8, 231u8, 102u8, 210u8, 125u8, 68u8, 196u8, 242u8, 40u8, 39u8, + 70u8, 16u8, 6u8, 167u8, 81u8, 190u8, 61u8, 91u8, 246u8, 206u8, 249u8, + 78u8, + ], + ) + } + #[doc = " Indices of disabled validators."] + #[doc = ""] + #[doc = " The vec is always kept sorted so that we can find whether a given validator is"] + #[doc = " disabled using binary search. It gets cleared when `on_session_ending` returns"] + #[doc = " a new set of identities."] + pub fn disabled_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::std::vec::Vec<::core::primitive::u32>>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "DisabledValidators", + vec![], + [ + 135u8, 22u8, 22u8, 97u8, 82u8, 217u8, 144u8, 141u8, 121u8, 240u8, + 189u8, 16u8, 176u8, 88u8, 177u8, 31u8, 20u8, 242u8, 73u8, 104u8, 11u8, + 110u8, 214u8, 34u8, 52u8, 217u8, 106u8, 33u8, 174u8, 174u8, 198u8, + 84u8, + ], + ) + } + #[doc = " The next session keys for a validator."] + pub fn next_keys( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "NextKeys", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 18u8, 209u8, 31u8, 20u8, 131u8, 9u8, 97u8, 157u8, 63u8, 9u8, 233u8, + 216u8, 40u8, 240u8, 66u8, 111u8, 60u8, 87u8, 83u8, 178u8, 17u8, 105u8, + 214u8, 169u8, 171u8, 220u8, 7u8, 121u8, 35u8, 229u8, 253u8, 40u8, + ], + ) + } + #[doc = " The next session keys for a validator."] + pub fn next_keys_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "NextKeys", + Vec::new(), + [ + 18u8, 209u8, 31u8, 20u8, 131u8, 9u8, 97u8, 157u8, 63u8, 9u8, 233u8, + 216u8, 40u8, 240u8, 66u8, 111u8, 60u8, 87u8, 83u8, 178u8, 17u8, 105u8, + 214u8, 169u8, 171u8, 220u8, 7u8, 121u8, 35u8, 229u8, 253u8, 40u8, + ], + ) + } + #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] + pub fn key_owner( + &self, + _0: impl ::std::borrow::Borrow, + _1: impl ::std::borrow::Borrow<[::core::primitive::u8]>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "KeyOwner", + vec![::subxt::storage::address::StorageMapKey::new( + &(_0.borrow(), _1.borrow()), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 4u8, 91u8, 25u8, 84u8, 250u8, 201u8, 174u8, 129u8, 201u8, 58u8, 197u8, + 199u8, 137u8, 240u8, 118u8, 33u8, 99u8, 2u8, 195u8, 57u8, 53u8, 172u8, + 0u8, 148u8, 203u8, 144u8, 149u8, 64u8, 135u8, 254u8, 242u8, 215u8, + ], + ) + } + #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] + pub fn key_owner_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Session", + "KeyOwner", + Vec::new(), + [ + 4u8, 91u8, 25u8, 84u8, 250u8, 201u8, 174u8, 129u8, 201u8, 58u8, 197u8, + 199u8, 137u8, 240u8, 118u8, 33u8, 99u8, 2u8, 195u8, 57u8, 53u8, 172u8, + 0u8, 148u8, 203u8, 144u8, 149u8, 64u8, 135u8, 254u8, 242u8, 215u8, + ], + ) + } + } + } + } + pub mod aleph { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetEmergencyFinalizer { + pub emergency_finalizer: runtime_types::primitives::app::Public, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScheduleFinalityVersionChange { + pub version_incoming: ::core::primitive::u32, + pub session: ::core::primitive::u32, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Sets the emergency finalization key. If called in session `N` the key can be used to"] + #[doc = "finalize blocks from session `N+2` onwards, until it gets overridden."] + pub fn set_emergency_finalizer( + &self, + emergency_finalizer: runtime_types::primitives::app::Public, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Aleph", + "set_emergency_finalizer", + SetEmergencyFinalizer { + emergency_finalizer, + }, + [ + 13u8, 25u8, 102u8, 60u8, 64u8, 83u8, 158u8, 113u8, 177u8, 194u8, 79u8, + 66u8, 171u8, 98u8, 169u8, 52u8, 69u8, 194u8, 54u8, 131u8, 190u8, 83u8, + 21u8, 64u8, 119u8, 90u8, 53u8, 125u8, 52u8, 155u8, 222u8, 76u8, + ], + ) + } + #[doc = "Schedules a finality version change for a future session. If such a scheduled future"] + #[doc = "version is already set, it is replaced with the provided one."] + #[doc = "Any rescheduling of a future version change needs to occur at least 2 sessions in"] + #[doc = "advance of the provided session of the version change."] + #[doc = "In order to cancel a scheduled version change, a new version change should be scheduled"] + #[doc = "with the same version as the current one."] + pub fn schedule_finality_version_change( + &self, + version_incoming: ::core::primitive::u32, + session: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Aleph", + "schedule_finality_version_change", + ScheduleFinalityVersionChange { + version_incoming, + session, + }, + [ + 27u8, 162u8, 238u8, 141u8, 132u8, 87u8, 69u8, 115u8, 243u8, 197u8, + 38u8, 37u8, 243u8, 86u8, 45u8, 137u8, 73u8, 181u8, 108u8, 200u8, 168u8, + 141u8, 130u8, 244u8, 85u8, 128u8, 145u8, 34u8, 233u8, 87u8, 38u8, + 198u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_aleph::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ChangeEmergencyFinalizer(pub runtime_types::primitives::app::Public); + impl ::subxt::events::StaticEvent for ChangeEmergencyFinalizer { + const PALLET: &'static str = "Aleph"; + const EVENT: &'static str = "ChangeEmergencyFinalizer"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ScheduleFinalityVersionChange(pub runtime_types::primitives::VersionChange); + impl ::subxt::events::StaticEvent for ScheduleFinalityVersionChange { + const PALLET: &'static str = "Aleph"; + const EVENT: &'static str = "ScheduleFinalityVersionChange"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct FinalityVersionChange(pub runtime_types::primitives::VersionChange); + impl ::subxt::events::StaticEvent for FinalityVersionChange { + const PALLET: &'static str = "Aleph"; + const EVENT: &'static str = "FinalityVersionChange"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + pub fn authorities( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "Authorities", + vec![], + [ + 5u8, 88u8, 222u8, 150u8, 141u8, 89u8, 69u8, 47u8, 152u8, 80u8, 80u8, + 1u8, 20u8, 132u8, 5u8, 152u8, 175u8, 14u8, 99u8, 198u8, 102u8, 229u8, + 159u8, 198u8, 138u8, 149u8, 68u8, 195u8, 243u8, 50u8, 249u8, 170u8, + ], + ) + } + pub fn next_authorities( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "NextAuthorities", + vec![], + [ + 120u8, 66u8, 194u8, 154u8, 194u8, 127u8, 75u8, 106u8, 59u8, 172u8, + 86u8, 242u8, 209u8, 110u8, 207u8, 132u8, 69u8, 73u8, 186u8, 235u8, + 95u8, 97u8, 117u8, 132u8, 76u8, 96u8, 86u8, 87u8, 74u8, 232u8, 91u8, + 120u8, + ], + ) + } + pub fn emergency_finalizer( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "EmergencyFinalizer", + vec![], + [ + 254u8, 68u8, 214u8, 192u8, 214u8, 1u8, 48u8, 167u8, 1u8, 55u8, 148u8, + 124u8, 72u8, 123u8, 148u8, 50u8, 131u8, 17u8, 48u8, 14u8, 48u8, 92u8, + 3u8, 56u8, 60u8, 224u8, 97u8, 60u8, 208u8, 53u8, 164u8, 88u8, + ], + ) + } + pub fn queued_emergency_finalizer( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "QueuedEmergencyFinalizer", + vec![], + [ + 156u8, 104u8, 166u8, 24u8, 170u8, 246u8, 39u8, 246u8, 130u8, 169u8, + 222u8, 196u8, 137u8, 216u8, 190u8, 64u8, 28u8, 50u8, 6u8, 194u8, 164u8, + 91u8, 85u8, 78u8, 212u8, 61u8, 126u8, 242u8, 207u8, 76u8, 227u8, 115u8, + ], + ) + } + pub fn next_emergency_finalizer( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "NextEmergencyFinalizer", + vec![], + [ + 84u8, 79u8, 27u8, 15u8, 74u8, 189u8, 24u8, 17u8, 157u8, 91u8, 245u8, + 30u8, 129u8, 11u8, 226u8, 87u8, 50u8, 182u8, 60u8, 73u8, 214u8, 46u8, + 132u8, 0u8, 53u8, 14u8, 228u8, 115u8, 240u8, 64u8, 158u8, 165u8, + ], + ) + } + #[doc = " Current finality version."] + pub fn finality_version( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "FinalityVersion", + vec![], + [ + 134u8, 19u8, 94u8, 247u8, 125u8, 18u8, 148u8, 160u8, 167u8, 235u8, + 174u8, 4u8, 107u8, 69u8, 55u8, 187u8, 249u8, 13u8, 129u8, 99u8, 116u8, + 158u8, 38u8, 29u8, 239u8, 112u8, 150u8, 92u8, 151u8, 197u8, 223u8, + 30u8, + ], + ) + } + #[doc = " Scheduled finality version change."] + pub fn finality_scheduled_version_change( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Aleph", + "FinalityScheduledVersionChange", + vec![], + [ + 195u8, 203u8, 203u8, 240u8, 214u8, 227u8, 177u8, 99u8, 82u8, 86u8, + 201u8, 237u8, 47u8, 32u8, 111u8, 219u8, 184u8, 107u8, 211u8, 83u8, + 25u8, 59u8, 170u8, 29u8, 24u8, 149u8, 85u8, 63u8, 37u8, 203u8, 129u8, + 97u8, + ], + ) + } + } + } + } + pub mod elections { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ChangeValidators { + pub reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + pub non_reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + pub committee_size: + ::core::option::Option, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetBanConfig { + pub minimal_expected_performance: ::core::option::Option<::core::primitive::u8>, + pub underperformed_session_count_threshold: + ::core::option::Option<::core::primitive::u32>, + pub clean_session_counter_delay: ::core::option::Option<::core::primitive::u32>, + pub ban_period: ::core::option::Option<::core::primitive::u32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BanFromCommittee { + pub banned: ::subxt::ext::sp_core::crypto::AccountId32, + pub ban_reason: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CancelBan { + pub banned: ::subxt::ext::sp_core::crypto::AccountId32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetElectionsOpenness { + pub openness: runtime_types::primitives::ElectionOpenness, + } + pub struct TransactionApi; + impl TransactionApi { + pub fn change_validators( + &self, + reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + non_reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + committee_size: ::core::option::Option< + runtime_types::primitives::CommitteeSeats, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Elections", + "change_validators", + ChangeValidators { + reserved_validators, + non_reserved_validators, + committee_size, + }, + [ + 88u8, 2u8, 255u8, 219u8, 50u8, 103u8, 169u8, 150u8, 249u8, 161u8, 57u8, + 39u8, 6u8, 241u8, 94u8, 139u8, 206u8, 236u8, 160u8, 92u8, 163u8, 170u8, + 222u8, 99u8, 50u8, 91u8, 194u8, 192u8, 99u8, 123u8, 41u8, 136u8, + ], + ) + } + #[doc = "Sets ban config, it has an immediate effect"] + pub fn set_ban_config( + &self, + minimal_expected_performance: ::core::option::Option<::core::primitive::u8>, + underperformed_session_count_threshold: ::core::option::Option< + ::core::primitive::u32, + >, + clean_session_counter_delay: ::core::option::Option<::core::primitive::u32>, + ban_period: ::core::option::Option<::core::primitive::u32>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Elections", + "set_ban_config", + SetBanConfig { + minimal_expected_performance, + underperformed_session_count_threshold, + clean_session_counter_delay, + ban_period, + }, + [ + 228u8, 199u8, 170u8, 155u8, 208u8, 190u8, 211u8, 218u8, 105u8, 213u8, + 240u8, 152u8, 92u8, 19u8, 164u8, 28u8, 215u8, 145u8, 47u8, 248u8, + 219u8, 75u8, 234u8, 78u8, 29u8, 189u8, 35u8, 106u8, 165u8, 76u8, 27u8, + 50u8, + ], + ) + } + #[doc = "Schedule a non-reserved node to be banned out from the committee at the end of the era"] + pub fn ban_from_committee( + &self, + banned: ::subxt::ext::sp_core::crypto::AccountId32, + ban_reason: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Elections", + "ban_from_committee", + BanFromCommittee { banned, ban_reason }, + [ + 60u8, 254u8, 80u8, 201u8, 64u8, 189u8, 255u8, 111u8, 14u8, 9u8, 68u8, + 177u8, 196u8, 107u8, 10u8, 177u8, 78u8, 134u8, 98u8, 21u8, 179u8, 9u8, + 111u8, 185u8, 155u8, 39u8, 148u8, 88u8, 239u8, 16u8, 24u8, 171u8, + ], + ) + } + #[doc = "Schedule a non-reserved node to be banned out from the committee at the end of the era"] + pub fn cancel_ban( + &self, + banned: ::subxt::ext::sp_core::crypto::AccountId32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Elections", + "cancel_ban", + CancelBan { banned }, + [ + 103u8, 192u8, 40u8, 246u8, 206u8, 52u8, 222u8, 51u8, 39u8, 247u8, + 220u8, 175u8, 232u8, 31u8, 168u8, 99u8, 206u8, 45u8, 191u8, 161u8, + 107u8, 12u8, 112u8, 54u8, 163u8, 170u8, 221u8, 220u8, 122u8, 177u8, + 178u8, 246u8, + ], + ) + } + #[doc = "Set openness of the elections"] + pub fn set_elections_openness( + &self, + openness: runtime_types::primitives::ElectionOpenness, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Elections", + "set_elections_openness", + SetElectionsOpenness { openness }, + [ + 207u8, 20u8, 183u8, 25u8, 206u8, 225u8, 242u8, 167u8, 164u8, 54u8, + 111u8, 134u8, 139u8, 4u8, 7u8, 89u8, 119u8, 165u8, 53u8, 3u8, 96u8, + 107u8, 188u8, 196u8, 113u8, 35u8, 128u8, 240u8, 222u8, 23u8, 221u8, + 105u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_elections::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Committee for the next era has changed"] + pub struct ChangeValidators( + pub ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub runtime_types::primitives::CommitteeSeats, + ); + impl ::subxt::events::StaticEvent for ChangeValidators { + const PALLET: &'static str = "Elections"; + const EVENT: &'static str = "ChangeValidators"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Ban thresholds for the next era has changed"] + pub struct SetBanConfig(pub runtime_types::primitives::BanConfig); + impl ::subxt::events::StaticEvent for SetBanConfig { + const PALLET: &'static str = "Elections"; + const EVENT: &'static str = "SetBanConfig"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Validators have been banned from the committee"] + pub struct BanValidators( + pub ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::primitives::BanInfo, + )>, + ); + impl ::subxt::events::StaticEvent for BanValidators { + const PALLET: &'static str = "Elections"; + const EVENT: &'static str = "BanValidators"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Desirable size of a committee, see [`CommitteeSeats`]."] + pub fn committee_size( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "CommitteeSize", + vec![], + [ + 138u8, 114u8, 93u8, 183u8, 35u8, 215u8, 48u8, 195u8, 127u8, 157u8, + 38u8, 169u8, 255u8, 246u8, 178u8, 219u8, 221u8, 247u8, 35u8, 45u8, + 94u8, 195u8, 84u8, 36u8, 30u8, 252u8, 145u8, 90u8, 67u8, 254u8, 39u8, + 199u8, + ], + ) + } + #[doc = " Desired size of a committee in effect from a new era."] + pub fn next_era_committee_size( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "NextEraCommitteeSize", + vec![], + [ + 1u8, 114u8, 197u8, 86u8, 178u8, 92u8, 167u8, 99u8, 96u8, 98u8, 65u8, + 149u8, 222u8, 39u8, 119u8, 24u8, 251u8, 65u8, 171u8, 126u8, 100u8, + 137u8, 50u8, 72u8, 108u8, 47u8, 95u8, 63u8, 202u8, 64u8, 120u8, 120u8, + ], + ) + } + #[doc = " Next era's list of reserved validators."] + pub fn next_era_reserved_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "NextEraReservedValidators", + vec![], + [ + 6u8, 123u8, 0u8, 238u8, 248u8, 8u8, 50u8, 48u8, 77u8, 152u8, 162u8, + 53u8, 221u8, 121u8, 176u8, 84u8, 158u8, 169u8, 185u8, 96u8, 85u8, + 252u8, 56u8, 116u8, 7u8, 46u8, 147u8, 75u8, 194u8, 177u8, 0u8, 252u8, + ], + ) + } + #[doc = " Current era's list of reserved validators."] + pub fn current_era_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::primitives::EraValidators< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "CurrentEraValidators", + vec![], + [ + 120u8, 47u8, 38u8, 117u8, 185u8, 231u8, 146u8, 226u8, 139u8, 21u8, + 230u8, 120u8, 147u8, 157u8, 64u8, 50u8, 153u8, 160u8, 186u8, 53u8, + 215u8, 8u8, 39u8, 146u8, 195u8, 151u8, 191u8, 0u8, 105u8, 241u8, 152u8, + 97u8, + ], + ) + } + #[doc = " Next era's list of non reserved validators."] + pub fn next_era_non_reserved_validators( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "NextEraNonReservedValidators", + vec![], + [ + 118u8, 139u8, 183u8, 59u8, 75u8, 3u8, 245u8, 47u8, 30u8, 15u8, 23u8, + 237u8, 0u8, 153u8, 31u8, 251u8, 122u8, 172u8, 215u8, 255u8, 199u8, + 145u8, 242u8, 3u8, 132u8, 27u8, 20u8, 138u8, 252u8, 235u8, 215u8, 86u8, + ], + ) + } + #[doc = " A lookup how many blocks a validator produced."] + pub fn session_validator_block_count( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "SessionValidatorBlockCount", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 186u8, 91u8, 185u8, 144u8, 216u8, 179u8, 157u8, 132u8, 17u8, 247u8, + 241u8, 172u8, 32u8, 7u8, 28u8, 60u8, 188u8, 192u8, 64u8, 29u8, 153u8, + 100u8, 130u8, 245u8, 189u8, 251u8, 68u8, 161u8, 202u8, 29u8, 153u8, + 131u8, + ], + ) + } + #[doc = " A lookup how many blocks a validator produced."] + pub fn session_validator_block_count_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "SessionValidatorBlockCount", + Vec::new(), + [ + 186u8, 91u8, 185u8, 144u8, 216u8, 179u8, 157u8, 132u8, 17u8, 247u8, + 241u8, 172u8, 32u8, 7u8, 28u8, 60u8, 188u8, 192u8, 64u8, 29u8, 153u8, + 100u8, 130u8, 245u8, 189u8, 251u8, 68u8, 161u8, 202u8, 29u8, 153u8, + 131u8, + ], + ) + } + #[doc = " Total possible reward per validator for the current era."] + pub fn validator_era_total_reward( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_elections::ValidatorTotalRewards< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "ValidatorEraTotalReward", + vec![], + [ + 111u8, 103u8, 48u8, 14u8, 23u8, 139u8, 162u8, 122u8, 212u8, 85u8, 64u8, + 188u8, 36u8, 142u8, 80u8, 224u8, 89u8, 63u8, 104u8, 86u8, 51u8, 111u8, + 166u8, 53u8, 189u8, 181u8, 240u8, 250u8, 160u8, 128u8, 179u8, 9u8, + ], + ) + } + #[doc = " Current era config for ban functionality, see [`BanConfig`]"] + pub fn ban_config( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "BanConfig", + vec![], + [ + 115u8, 228u8, 135u8, 32u8, 85u8, 156u8, 44u8, 195u8, 215u8, 11u8, 27u8, + 26u8, 231u8, 59u8, 249u8, 78u8, 172u8, 66u8, 81u8, 17u8, 99u8, 221u8, + 38u8, 253u8, 62u8, 54u8, 104u8, 161u8, 129u8, 92u8, 218u8, 193u8, + ], + ) + } + #[doc = " A lookup for a number of underperformance sessions for a given validator"] + pub fn underperformed_validator_session_count( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "UnderperformedValidatorSessionCount", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 46u8, 74u8, 46u8, 159u8, 162u8, 118u8, 159u8, 155u8, 233u8, 63u8, + 101u8, 201u8, 56u8, 204u8, 126u8, 242u8, 131u8, 5u8, 29u8, 132u8, 43u8, + 205u8, 168u8, 157u8, 29u8, 183u8, 127u8, 202u8, 25u8, 245u8, 137u8, + 67u8, + ], + ) + } + #[doc = " A lookup for a number of underperformance sessions for a given validator"] + pub fn underperformed_validator_session_count_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "UnderperformedValidatorSessionCount", + Vec::new(), + [ + 46u8, 74u8, 46u8, 159u8, 162u8, 118u8, 159u8, 155u8, 233u8, 63u8, + 101u8, 201u8, 56u8, 204u8, 126u8, 242u8, 131u8, 5u8, 29u8, 132u8, 43u8, + 205u8, 168u8, 157u8, 29u8, 183u8, 127u8, 202u8, 25u8, 245u8, 137u8, + 67u8, + ], + ) + } + #[doc = " Validators to be removed from non reserved list in the next era"] + pub fn banned( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "Banned", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 202u8, 38u8, 165u8, 35u8, 95u8, 207u8, 116u8, 43u8, 148u8, 73u8, 193u8, + 187u8, 1u8, 88u8, 209u8, 13u8, 128u8, 168u8, 121u8, 62u8, 227u8, 172u8, + 87u8, 106u8, 15u8, 43u8, 136u8, 240u8, 249u8, 210u8, 25u8, 215u8, + ], + ) + } + #[doc = " Validators to be removed from non reserved list in the next era"] + pub fn banned_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "Banned", + Vec::new(), + [ + 202u8, 38u8, 165u8, 35u8, 95u8, 207u8, 116u8, 43u8, 148u8, 73u8, 193u8, + 187u8, 1u8, 88u8, 209u8, 13u8, 128u8, 168u8, 121u8, 62u8, 227u8, 172u8, + 87u8, 106u8, 15u8, 43u8, 136u8, 240u8, 249u8, 210u8, 25u8, 215u8, + ], + ) + } + #[doc = " Openness of the elections, whether we allow all candidates that bonded enough tokens or"] + #[doc = " the validators list is managed by sudo"] + pub fn openness( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::primitives::ElectionOpenness, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Elections", + "Openness", + vec![], + [ + 128u8, 231u8, 144u8, 215u8, 195u8, 90u8, 89u8, 180u8, 151u8, 233u8, + 229u8, 205u8, 40u8, 26u8, 23u8, 134u8, 171u8, 172u8, 140u8, 248u8, + 172u8, 111u8, 92u8, 51u8, 189u8, 94u8, 91u8, 151u8, 129u8, 248u8, 78u8, + 12u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Nr of blocks in the session."] + pub fn session_period( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Elections", + "SessionPeriod", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Maximum acceptable ban reason length."] + pub fn maximum_ban_reason_length( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Elections", + "MaximumBanReasonLength", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum number of winners that can be elected by this `ElectionProvider`"] + #[doc = " implementation."] + #[doc = ""] + #[doc = " Note: This must always be greater or equal to `T::DataProvider::desired_targets()`."] + pub fn max_winners( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Elections", + "MaxWinners", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod treasury { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ProposeSpend { + #[codec(compact)] + pub value: ::core::primitive::u128, + pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RejectProposal { + #[codec(compact)] + pub proposal_id: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ApproveProposal { + #[codec(compact)] + pub proposal_id: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Spend { + #[codec(compact)] + pub amount: ::core::primitive::u128, + pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RemoveApproval { + #[codec(compact)] + pub proposal_id: ::core::primitive::u32, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Put forward a suggestion for spending. A deposit proportional to the value"] + #[doc = "is reserved and slashed if the proposal is rejected. It is returned once the"] + #[doc = "proposal is awarded."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)"] + #[doc = "- DbReads: `ProposalCount`, `origin account`"] + #[doc = "- DbWrites: `ProposalCount`, `Proposals`, `origin account`"] + #[doc = "# "] + pub fn propose_spend( + &self, + value: ::core::primitive::u128, + beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Treasury", + "propose_spend", + ProposeSpend { value, beneficiary }, + [ + 109u8, 46u8, 8u8, 159u8, 127u8, 79u8, 27u8, 100u8, 92u8, 244u8, 78u8, + 46u8, 105u8, 246u8, 169u8, 210u8, 149u8, 7u8, 108u8, 153u8, 203u8, + 223u8, 8u8, 117u8, 126u8, 250u8, 255u8, 52u8, 245u8, 69u8, 45u8, 136u8, + ], + ) + } + #[doc = "Reject a proposed spend. The original deposit will be slashed."] + #[doc = ""] + #[doc = "May only be called from `T::RejectOrigin`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)"] + #[doc = "- DbReads: `Proposals`, `rejected proposer account`"] + #[doc = "- DbWrites: `Proposals`, `rejected proposer account`"] + #[doc = "# "] + pub fn reject_proposal( + &self, + proposal_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Treasury", + "reject_proposal", + RejectProposal { proposal_id }, + [ + 106u8, 223u8, 97u8, 22u8, 111u8, 208u8, 128u8, 26u8, 198u8, 140u8, + 118u8, 126u8, 187u8, 51u8, 193u8, 50u8, 193u8, 68u8, 143u8, 144u8, + 34u8, 132u8, 44u8, 244u8, 105u8, 186u8, 223u8, 234u8, 17u8, 145u8, + 209u8, 145u8, + ], + ) + } + #[doc = "Approve a proposal. At a later time, the proposal will be allocated to the beneficiary"] + #[doc = "and the original deposit will be returned."] + #[doc = ""] + #[doc = "May only be called from `T::ApproveOrigin`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)."] + #[doc = "- DbReads: `Proposals`, `Approvals`"] + #[doc = "- DbWrite: `Approvals`"] + #[doc = "# "] + pub fn approve_proposal( + &self, + proposal_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Treasury", + "approve_proposal", + ApproveProposal { proposal_id }, + [ + 164u8, 229u8, 172u8, 98u8, 129u8, 62u8, 84u8, 128u8, 47u8, 108u8, 33u8, + 120u8, 89u8, 79u8, 57u8, 121u8, 4u8, 197u8, 170u8, 153u8, 156u8, 17u8, + 59u8, 164u8, 123u8, 227u8, 175u8, 195u8, 220u8, 160u8, 60u8, 186u8, + ], + ) + } + #[doc = "Propose and approve a spend of treasury funds."] + #[doc = ""] + #[doc = "- `origin`: Must be `SpendOrigin` with the `Success` value being at least `amount`."] + #[doc = "- `amount`: The amount to be transferred from the treasury to the `beneficiary`."] + #[doc = "- `beneficiary`: The destination account for the transfer."] + #[doc = ""] + #[doc = "NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the"] + #[doc = "beneficiary."] + pub fn spend( + &self, + amount: ::core::primitive::u128, + beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Treasury", + "spend", + Spend { + amount, + beneficiary, + }, + [ + 177u8, 178u8, 242u8, 136u8, 135u8, 237u8, 114u8, 71u8, 233u8, 239u8, + 7u8, 84u8, 14u8, 228u8, 58u8, 31u8, 158u8, 185u8, 25u8, 91u8, 70u8, + 33u8, 19u8, 92u8, 100u8, 162u8, 5u8, 48u8, 20u8, 120u8, 9u8, 109u8, + ], + ) + } + #[doc = "Force a previously approved proposal to be removed from the approval queue."] + #[doc = "The original deposit will no longer be returned."] + #[doc = ""] + #[doc = "May only be called from `T::RejectOrigin`."] + #[doc = "- `proposal_id`: The index of a proposal"] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(A) where `A` is the number of approvals"] + #[doc = "- Db reads and writes: `Approvals`"] + #[doc = "# "] + #[doc = ""] + #[doc = "Errors:"] + #[doc = "- `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,"] + #[doc = "i.e., the proposal has not been approved. This could also mean the proposal does not"] + #[doc = "exist altogether, thus there is no way it would have been approved in the first place."] + pub fn remove_approval( + &self, + proposal_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Treasury", + "remove_approval", + RemoveApproval { proposal_id }, + [ + 133u8, 126u8, 181u8, 47u8, 196u8, 243u8, 7u8, 46u8, 25u8, 251u8, 154u8, + 125u8, 217u8, 77u8, 54u8, 245u8, 240u8, 180u8, 97u8, 34u8, 186u8, 53u8, + 225u8, 144u8, 155u8, 107u8, 172u8, 54u8, 250u8, 184u8, 178u8, 86u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_treasury::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "New proposal."] + pub struct Proposed { + pub proposal_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Proposed { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Proposed"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "We have ended a spend period and will now allocate funds."] + pub struct Spending { + pub budget_remaining: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Spending { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Spending"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some funds have been allocated."] + pub struct Awarded { + pub proposal_index: ::core::primitive::u32, + pub award: ::core::primitive::u128, + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Awarded { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Awarded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A proposal was rejected; funds were slashed."] + pub struct Rejected { + pub proposal_index: ::core::primitive::u32, + pub slashed: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Rejected { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Rejected"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some of our funds have been burnt."] + pub struct Burnt { + pub burnt_funds: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Burnt { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Burnt"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Spending has finished; this is the amount that rolls over until next spend."] + pub struct Rollover { + pub rollover_balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Rollover { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Rollover"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Some funds have been deposited."] + pub struct Deposit { + pub value: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Deposit { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "Deposit"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A new spend proposal has been approved."] + pub struct SpendApproved { + pub proposal_index: ::core::primitive::u32, + pub amount: ::core::primitive::u128, + pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for SpendApproved { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "SpendApproved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The inactive funds of the pallet have been updated."] + pub struct UpdatedInactive { + pub reactivated: ::core::primitive::u128, + pub deactivated: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for UpdatedInactive { + const PALLET: &'static str = "Treasury"; + const EVENT: &'static str = "UpdatedInactive"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Number of proposals that have been made."] + pub fn proposal_count( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Treasury", + "ProposalCount", + vec![], + [ + 132u8, 145u8, 78u8, 218u8, 51u8, 189u8, 55u8, 172u8, 143u8, 33u8, + 140u8, 99u8, 124u8, 208u8, 57u8, 232u8, 154u8, 110u8, 32u8, 142u8, + 24u8, 149u8, 109u8, 105u8, 30u8, 83u8, 39u8, 177u8, 127u8, 160u8, 34u8, + 70u8, + ], + ) + } + #[doc = " Proposals that have been made."] + pub fn proposals( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_treasury::Proposal< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Treasury", + "Proposals", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 62u8, 223u8, 55u8, 209u8, 151u8, 134u8, 122u8, 65u8, 207u8, 38u8, + 113u8, 213u8, 237u8, 48u8, 129u8, 32u8, 91u8, 228u8, 108u8, 91u8, 37u8, + 49u8, 94u8, 4u8, 75u8, 122u8, 25u8, 34u8, 198u8, 224u8, 246u8, 160u8, + ], + ) + } + #[doc = " Proposals that have been made."] + pub fn proposals_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_treasury::Proposal< + ::subxt::ext::sp_core::crypto::AccountId32, + ::core::primitive::u128, + >, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Treasury", + "Proposals", + Vec::new(), + [ + 62u8, 223u8, 55u8, 209u8, 151u8, 134u8, 122u8, 65u8, 207u8, 38u8, + 113u8, 213u8, 237u8, 48u8, 129u8, 32u8, 91u8, 228u8, 108u8, 91u8, 37u8, + 49u8, 94u8, 4u8, 75u8, 122u8, 25u8, 34u8, 198u8, 224u8, 246u8, 160u8, + ], + ) + } + #[doc = " The amount which has been reported as inactive to Currency."] + pub fn deactivated( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Treasury", + "Deactivated", + vec![], + [ + 159u8, 57u8, 5u8, 85u8, 136u8, 128u8, 70u8, 43u8, 67u8, 76u8, 123u8, + 206u8, 48u8, 253u8, 51u8, 40u8, 14u8, 35u8, 162u8, 173u8, 127u8, 79u8, + 38u8, 235u8, 9u8, 141u8, 201u8, 37u8, 211u8, 176u8, 119u8, 106u8, + ], + ) + } + #[doc = " Proposal indices that have been approved but not yet awarded."] + pub fn approvals( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u32, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Treasury", + "Approvals", + vec![], + [ + 202u8, 106u8, 189u8, 40u8, 127u8, 172u8, 108u8, 50u8, 193u8, 4u8, + 248u8, 226u8, 176u8, 101u8, 212u8, 222u8, 64u8, 206u8, 244u8, 175u8, + 111u8, 106u8, 86u8, 96u8, 19u8, 109u8, 218u8, 152u8, 30u8, 59u8, 96u8, + 1u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Fraction of a proposal's value that should be bonded in order to place the proposal."] + #[doc = " An accepted proposal gets these back. A rejected proposal does not."] + pub fn proposal_bond( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::per_things::Permill, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "ProposalBond", + [ + 225u8, 236u8, 95u8, 157u8, 90u8, 94u8, 106u8, 192u8, 254u8, 19u8, 87u8, + 80u8, 16u8, 62u8, 42u8, 204u8, 136u8, 106u8, 225u8, 53u8, 212u8, 52u8, + 177u8, 79u8, 4u8, 116u8, 201u8, 104u8, 222u8, 75u8, 86u8, 227u8, + ], + ) + } + #[doc = " Minimum amount of funds that should be placed in a deposit for making a proposal."] + pub fn proposal_bond_minimum( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "ProposalBondMinimum", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " Maximum amount of funds that should be placed in a deposit for making a proposal."] + pub fn proposal_bond_maximum( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + ::core::option::Option<::core::primitive::u128>, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "ProposalBondMaximum", + [ + 84u8, 154u8, 218u8, 83u8, 84u8, 189u8, 32u8, 20u8, 120u8, 194u8, 88u8, + 205u8, 109u8, 216u8, 114u8, 193u8, 120u8, 198u8, 154u8, 237u8, 134u8, + 204u8, 102u8, 247u8, 52u8, 103u8, 231u8, 43u8, 243u8, 122u8, 60u8, + 216u8, + ], + ) + } + #[doc = " Period between successive spends."] + pub fn spend_period( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "SpendPeriod", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Percentage of spare funds (if any) that are burnt per spend period."] + pub fn burn( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_arithmetic::per_things::Permill, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "Burn", + [ + 225u8, 236u8, 95u8, 157u8, 90u8, 94u8, 106u8, 192u8, 254u8, 19u8, 87u8, + 80u8, 16u8, 62u8, 42u8, 204u8, 136u8, 106u8, 225u8, 53u8, 212u8, 52u8, + 177u8, 79u8, 4u8, 116u8, 201u8, 104u8, 222u8, 75u8, 86u8, 227u8, + ], + ) + } + #[doc = " The treasury's pallet id, used for deriving its sovereign account ID."] + pub fn pallet_id( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "PalletId", + [ + 139u8, 109u8, 228u8, 151u8, 252u8, 32u8, 130u8, 69u8, 112u8, 154u8, + 174u8, 45u8, 83u8, 245u8, 51u8, 132u8, 173u8, 5u8, 186u8, 24u8, 243u8, + 9u8, 12u8, 214u8, 80u8, 74u8, 69u8, 189u8, 30u8, 94u8, 22u8, 39u8, + ], + ) + } + #[doc = " The maximum number of approvals that can wait in the spending queue."] + #[doc = ""] + #[doc = " NOTE: This parameter is also used within the Bounties Pallet extension if enabled."] + pub fn max_approvals( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Treasury", + "MaxApprovals", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod vesting { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Vest; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct VestOther { + pub target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct VestedTransfer { + pub target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceVestedTransfer { + pub source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct MergeSchedules { + pub schedule1_index: ::core::primitive::u32, + pub schedule2_index: ::core::primitive::u32, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Unlock any vested funds of the sender account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have funds still"] + #[doc = "locked under this pallet."] + #[doc = ""] + #[doc = "Emits either `VestingCompleted` or `VestingUpdated`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 2 Reads, 2 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, [Sender Account]"] + #[doc = " - Writes: Vesting Storage, Balances Locks, [Sender Account]"] + #[doc = "# "] + pub fn vest(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Vesting", + "vest", + Vest {}, + [ + 123u8, 54u8, 10u8, 208u8, 154u8, 24u8, 39u8, 166u8, 64u8, 27u8, 74u8, + 29u8, 243u8, 97u8, 155u8, 5u8, 130u8, 155u8, 65u8, 181u8, 196u8, 125u8, + 45u8, 133u8, 25u8, 33u8, 3u8, 34u8, 21u8, 167u8, 172u8, 54u8, + ], + ) + } + #[doc = "Unlock any vested funds of a `target` account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `target`: The account whose vested funds should be unlocked. Must have funds still"] + #[doc = "locked under this pallet."] + #[doc = ""] + #[doc = "Emits either `VestingCompleted` or `VestingUpdated`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 3 Reads, 3 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account"] + #[doc = "# "] + pub fn vest_other( + &self, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Vesting", + "vest_other", + VestOther { target }, + [ + 164u8, 19u8, 93u8, 81u8, 235u8, 101u8, 18u8, 52u8, 187u8, 81u8, 243u8, + 216u8, 116u8, 84u8, 188u8, 135u8, 1u8, 241u8, 128u8, 90u8, 117u8, + 164u8, 111u8, 0u8, 251u8, 148u8, 250u8, 248u8, 102u8, 79u8, 165u8, + 175u8, + ], + ) + } + #[doc = "Create a vested transfer."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `target`: The account receiving the vested funds."] + #[doc = "- `schedule`: The vesting schedule attached to the transfer."] + #[doc = ""] + #[doc = "Emits `VestingCreated`."] + #[doc = ""] + #[doc = "NOTE: This will unlock all schedules through the current block."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 3 Reads, 3 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]"] + #[doc = "# "] + pub fn vested_transfer( + &self, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Vesting", + "vested_transfer", + VestedTransfer { target, schedule }, + [ + 135u8, 172u8, 56u8, 97u8, 45u8, 141u8, 93u8, 173u8, 111u8, 252u8, 75u8, + 246u8, 92u8, 181u8, 138u8, 87u8, 145u8, 174u8, 71u8, 108u8, 126u8, + 118u8, 49u8, 122u8, 249u8, 132u8, 19u8, 2u8, 132u8, 160u8, 247u8, + 195u8, + ], + ) + } + #[doc = "Force a vested transfer."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + #[doc = ""] + #[doc = "- `source`: The account whose funds should be transferred."] + #[doc = "- `target`: The account that should be transferred the vested funds."] + #[doc = "- `schedule`: The vesting schedule attached to the transfer."] + #[doc = ""] + #[doc = "Emits `VestingCreated`."] + #[doc = ""] + #[doc = "NOTE: This will unlock all schedules through the current block."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 4 Reads, 4 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account, Source Account"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, Source Account"] + #[doc = "# "] + pub fn force_vested_transfer( + &self, + source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Vesting", + "force_vested_transfer", + ForceVestedTransfer { + source, + target, + schedule, + }, + [ + 110u8, 142u8, 63u8, 148u8, 90u8, 229u8, 237u8, 183u8, 240u8, 237u8, + 242u8, 32u8, 88u8, 48u8, 220u8, 101u8, 210u8, 212u8, 27u8, 7u8, 186u8, + 98u8, 28u8, 197u8, 148u8, 140u8, 77u8, 59u8, 202u8, 166u8, 63u8, 97u8, + ], + ) + } + #[doc = "Merge two vesting schedules together, creating a new vesting schedule that unlocks over"] + #[doc = "the highest possible start and end blocks. If both schedules have already started the"] + #[doc = "current block will be used as the schedule start; with the caveat that if one schedule"] + #[doc = "is finished by the current block, the other will be treated as the new merged schedule,"] + #[doc = "unmodified."] + #[doc = ""] + #[doc = "NOTE: If `schedule1_index == schedule2_index` this is a no-op."] + #[doc = "NOTE: This will unlock all schedules through the current block prior to merging."] + #[doc = "NOTE: If both schedules have ended by the current block, no new schedule will be created"] + #[doc = "and both will be removed."] + #[doc = ""] + #[doc = "Merged schedule attributes:"] + #[doc = "- `starting_block`: `MAX(schedule1.starting_block, scheduled2.starting_block,"] + #[doc = " current_block)`."] + #[doc = "- `ending_block`: `MAX(schedule1.ending_block, schedule2.ending_block)`."] + #[doc = "- `locked`: `schedule1.locked_at(current_block) + schedule2.locked_at(current_block)`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `schedule1_index`: index of the first schedule to merge."] + #[doc = "- `schedule2_index`: index of the second schedule to merge."] + pub fn merge_schedules( + &self, + schedule1_index: ::core::primitive::u32, + schedule2_index: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Vesting", + "merge_schedules", + MergeSchedules { + schedule1_index, + schedule2_index, + }, + [ + 95u8, 255u8, 147u8, 12u8, 49u8, 25u8, 70u8, 112u8, 55u8, 154u8, 183u8, + 97u8, 56u8, 244u8, 148u8, 61u8, 107u8, 163u8, 220u8, 31u8, 153u8, 25u8, + 193u8, 251u8, 131u8, 26u8, 166u8, 157u8, 75u8, 4u8, 110u8, 125u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_vesting::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The amount vested has been updated. This could indicate a change in funds available."] + #[doc = "The balance given is the amount which is left unvested (and thus locked)."] + pub struct VestingUpdated { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub unvested: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for VestingUpdated { + const PALLET: &'static str = "Vesting"; + const EVENT: &'static str = "VestingUpdated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "An \\[account\\] has become fully vested."] + pub struct VestingCompleted { + pub account: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for VestingCompleted { + const PALLET: &'static str = "Vesting"; + const EVENT: &'static str = "VestingCompleted"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Information regarding the vesting of a given account."] + pub fn vesting( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + >, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Vesting", + "Vesting", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 23u8, 209u8, 233u8, 126u8, 89u8, 156u8, 193u8, 204u8, 100u8, 90u8, + 14u8, 120u8, 36u8, 167u8, 148u8, 239u8, 179u8, 74u8, 207u8, 83u8, 54u8, + 77u8, 27u8, 135u8, 74u8, 31u8, 33u8, 11u8, 168u8, 239u8, 212u8, 36u8, + ], + ) + } + #[doc = " Information regarding the vesting of a given account."] + pub fn vesting_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + >, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Vesting", + "Vesting", + Vec::new(), + [ + 23u8, 209u8, 233u8, 126u8, 89u8, 156u8, 193u8, 204u8, 100u8, 90u8, + 14u8, 120u8, 36u8, 167u8, 148u8, 239u8, 179u8, 74u8, 207u8, 83u8, 54u8, + 77u8, 27u8, 135u8, 74u8, 31u8, 33u8, 11u8, 168u8, 239u8, 212u8, 36u8, + ], + ) + } + #[doc = " Storage version of the pallet."] + #[doc = ""] + #[doc = " New networks start with latest version, as determined by the genesis build."] + pub fn storage_version( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Vesting", + "StorageVersion", + vec![], + [ + 50u8, 143u8, 26u8, 88u8, 129u8, 31u8, 61u8, 118u8, 19u8, 202u8, 119u8, + 160u8, 34u8, 219u8, 60u8, 57u8, 189u8, 66u8, 93u8, 239u8, 121u8, 114u8, + 241u8, 116u8, 0u8, 122u8, 232u8, 94u8, 189u8, 23u8, 45u8, 191u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The minimum amount transferred to call `vested_transfer`."] + pub fn min_vested_transfer( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Vesting", + "MinVestedTransfer", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + pub fn max_vesting_schedules( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Vesting", + "MaxVestingSchedules", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod utility { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Batch { + pub calls: ::std::vec::Vec, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AsDerivative { + pub index: ::core::primitive::u16, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BatchAll { + pub calls: ::std::vec::Vec, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct DispatchAs { + pub as_origin: ::std::boxed::Box, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ForceBatch { + pub calls: ::std::vec::Vec, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct WithWeight { + pub call: ::std::boxed::Box, + pub weight: runtime_types::sp_weights::weight_v2::Weight, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Send a batch of dispatch calls."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatched without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + #[doc = ""] + #[doc = "This will return `Ok` in all circumstances. To determine the success of the batch, an"] + #[doc = "event is deposited. If a call failed and the batch was interrupted, then the"] + #[doc = "`BatchInterrupted` event is deposited, along with the number of successful calls made"] + #[doc = "and the error of the failed call. If all were successful, then the `BatchCompleted`"] + #[doc = "event is deposited."] + pub fn batch( + &self, + calls: ::std::vec::Vec, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "batch", + Batch { calls }, + [ + 108u8, 189u8, 67u8, 60u8, 83u8, 95u8, 185u8, 30u8, 130u8, 154u8, 187u8, + 99u8, 143u8, 45u8, 132u8, 116u8, 211u8, 119u8, 58u8, 200u8, 4u8, 23u8, + 20u8, 193u8, 255u8, 12u8, 3u8, 158u8, 2u8, 45u8, 136u8, 36u8, + ], + ) + } + #[doc = "Send a call through an indexed pseudonym of the sender."] + #[doc = ""] + #[doc = "Filter from origin are passed along. The call will be dispatched with an origin which"] + #[doc = "use the same filter as the origin of this call."] + #[doc = ""] + #[doc = "NOTE: If you need to ensure that any account-based filtering is not honored (i.e."] + #[doc = "because you expect `proxy` to have been used prior in the call stack and you do not want"] + #[doc = "the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1`"] + #[doc = "in the Multisig pallet instead."] + #[doc = ""] + #[doc = "NOTE: Prior to version *12, this was called `as_limited_sub`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + pub fn as_derivative( + &self, + index: ::core::primitive::u16, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "as_derivative", + AsDerivative { + index, + call: ::std::boxed::Box::new(call), + }, + [ + 254u8, 23u8, 88u8, 162u8, 231u8, 17u8, 237u8, 30u8, 157u8, 211u8, + 148u8, 103u8, 39u8, 87u8, 225u8, 93u8, 120u8, 34u8, 118u8, 248u8, + 128u8, 188u8, 223u8, 110u8, 184u8, 178u8, 138u8, 81u8, 133u8, 75u8, + 7u8, 167u8, + ], + ) + } + #[doc = "Send a batch of dispatch calls and atomically execute them."] + #[doc = "The whole transaction will rollback and fail if any of the calls failed."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatched without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + pub fn batch_all( + &self, + calls: ::std::vec::Vec, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "batch_all", + BatchAll { calls }, + [ + 138u8, 66u8, 189u8, 225u8, 195u8, 103u8, 222u8, 116u8, 132u8, 62u8, + 15u8, 128u8, 68u8, 12u8, 89u8, 62u8, 57u8, 34u8, 168u8, 22u8, 3u8, 1u8, + 209u8, 68u8, 53u8, 167u8, 184u8, 104u8, 233u8, 233u8, 235u8, 57u8, + ], + ) + } + #[doc = "Dispatches a function call with a provided origin."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + T::WeightInfo::dispatch_as()."] + #[doc = "# "] + pub fn dispatch_as( + &self, + as_origin: runtime_types::aleph_runtime::OriginCaller, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "dispatch_as", + DispatchAs { + as_origin: ::std::boxed::Box::new(as_origin), + call: ::std::boxed::Box::new(call), + }, + [ + 109u8, 167u8, 115u8, 62u8, 36u8, 236u8, 215u8, 173u8, 158u8, 114u8, + 152u8, 35u8, 233u8, 229u8, 91u8, 220u8, 120u8, 133u8, 134u8, 14u8, + 129u8, 195u8, 194u8, 188u8, 238u8, 182u8, 45u8, 124u8, 22u8, 2u8, 36u8, + 247u8, + ], + ) + } + #[doc = "Send a batch of dispatch calls."] + #[doc = "Unlike `batch`, it allows errors and won't interrupt."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatch without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + pub fn force_batch( + &self, + calls: ::std::vec::Vec, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "force_batch", + ForceBatch { calls }, + [ + 93u8, 121u8, 5u8, 140u8, 218u8, 192u8, 35u8, 201u8, 135u8, 37u8, 53u8, + 43u8, 241u8, 135u8, 231u8, 121u8, 143u8, 93u8, 15u8, 181u8, 170u8, + 19u8, 47u8, 17u8, 64u8, 207u8, 153u8, 211u8, 220u8, 55u8, 70u8, 2u8, + ], + ) + } + #[doc = "Dispatch a function call with a specified weight."] + #[doc = ""] + #[doc = "This function does not check the weight of the call, and instead allows the"] + #[doc = "Root origin to specify the weight of the call."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + pub fn with_weight( + &self, + call: runtime_types::aleph_runtime::RuntimeCall, + weight: runtime_types::sp_weights::weight_v2::Weight, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Utility", + "with_weight", + WithWeight { + call: ::std::boxed::Box::new(call), + weight, + }, + [ + 62u8, 12u8, 150u8, 112u8, 62u8, 64u8, 240u8, 151u8, 177u8, 30u8, 175u8, + 55u8, 59u8, 2u8, 193u8, 42u8, 161u8, 7u8, 164u8, 83u8, 92u8, 233u8, + 223u8, 225u8, 54u8, 84u8, 159u8, 156u8, 13u8, 251u8, 196u8, 232u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_utility::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Batch of dispatches did not complete fully. Index of first failing dispatch given, as"] + #[doc = "well as the error."] + pub struct BatchInterrupted { + pub index: ::core::primitive::u32, + pub error: runtime_types::sp_runtime::DispatchError, + } + impl ::subxt::events::StaticEvent for BatchInterrupted { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "BatchInterrupted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Batch of dispatches completed fully with no error."] + pub struct BatchCompleted; + impl ::subxt::events::StaticEvent for BatchCompleted { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "BatchCompleted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Batch of dispatches completed but has errors."] + pub struct BatchCompletedWithErrors; + impl ::subxt::events::StaticEvent for BatchCompletedWithErrors { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "BatchCompletedWithErrors"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A single item within a Batch of dispatches has completed with no error."] + pub struct ItemCompleted; + impl ::subxt::events::StaticEvent for ItemCompleted { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "ItemCompleted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A single item within a Batch of dispatches has completed with error."] + pub struct ItemFailed { + pub error: runtime_types::sp_runtime::DispatchError, + } + impl ::subxt::events::StaticEvent for ItemFailed { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "ItemFailed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A call was dispatched."] + pub struct DispatchedAs { + pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + } + impl ::subxt::events::StaticEvent for DispatchedAs { + const PALLET: &'static str = "Utility"; + const EVENT: &'static str = "DispatchedAs"; + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The limit on the number of batched calls."] + pub fn batched_calls_limit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Utility", + "batched_calls_limit", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod multisig { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AsMultiThreshold1 { + pub other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AsMulti { + pub threshold: ::core::primitive::u16, + pub other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + pub call: ::std::boxed::Box, + pub max_weight: runtime_types::sp_weights::weight_v2::Weight, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ApproveAsMulti { + pub threshold: ::core::primitive::u16, + pub other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + pub call_hash: [::core::primitive::u8; 32usize], + pub max_weight: runtime_types::sp_weights::weight_v2::Weight, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CancelAsMulti { + pub threshold: ::core::primitive::u16, + pub other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + pub call_hash: [::core::primitive::u8; 32usize], + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Immediately dispatch a multi-signature call using a single approval from the caller."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `other_signatories`: The accounts (other than the sender) who are part of the"] + #[doc = "multi-signature, but do not participate in the approval process."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result."] + #[doc = ""] + #[doc = "# "] + #[doc = "O(Z + C) where Z is the length of the call and C its execution weight."] + #[doc = "-------------------------------"] + #[doc = "- DB Weight: None"] + #[doc = "- Plus Call Weight"] + #[doc = "# "] + pub fn as_multi_threshold_1( + &self, + other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Multisig", + "as_multi_threshold_1", + AsMultiThreshold1 { + other_signatories, + call: ::std::boxed::Box::new(call), + }, + [ + 44u8, 232u8, 219u8, 245u8, 174u8, 148u8, 89u8, 42u8, 231u8, 7u8, 47u8, + 131u8, 203u8, 79u8, 194u8, 27u8, 241u8, 122u8, 110u8, 84u8, 70u8, 63u8, + 153u8, 24u8, 250u8, 71u8, 141u8, 132u8, 249u8, 93u8, 68u8, 174u8, + ], + ) + } + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "If there are enough, then dispatch the call."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "NOTE: Unless this is the final approval, you will generally want to use"] + #[doc = "`approve_as_multi` instead, since it only requires a hash of the call."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise"] + #[doc = "on success, result is `Ok` and the result from the interior call, if it was executed,"] + #[doc = "may be found in the deposited `MultisigExecuted` event."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S + Z + Call)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- The weight of the `call`."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + #[doc = "-------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Reads: Multisig Storage, [Caller Account]"] + #[doc = " - Writes: Multisig Storage, [Caller Account]"] + #[doc = "- Plus Call Weight"] + #[doc = "# "] + pub fn as_multi( + &self, + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call: runtime_types::aleph_runtime::RuntimeCall, + max_weight: runtime_types::sp_weights::weight_v2::Weight, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Multisig", + "as_multi", + AsMulti { + threshold, + other_signatories, + maybe_timepoint, + call: ::std::boxed::Box::new(call), + max_weight, + }, + [ + 181u8, 14u8, 83u8, 157u8, 20u8, 12u8, 156u8, 53u8, 15u8, 77u8, 62u8, + 232u8, 226u8, 154u8, 187u8, 9u8, 68u8, 200u8, 197u8, 176u8, 227u8, + 12u8, 32u8, 180u8, 153u8, 31u8, 236u8, 169u8, 156u8, 131u8, 65u8, 69u8, + ], + ) + } + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "NOTE: If this is the final approval, you will want to use `as_multi` instead."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + #[doc = "----------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Multisig Storage, [Caller Account]"] + #[doc = " - Write: Multisig Storage, [Caller Account]"] + #[doc = "# "] + pub fn approve_as_multi( + &self, + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call_hash: [::core::primitive::u8; 32usize], + max_weight: runtime_types::sp_weights::weight_v2::Weight, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Multisig", + "approve_as_multi", + ApproveAsMulti { + threshold, + other_signatories, + maybe_timepoint, + call_hash, + max_weight, + }, + [ + 133u8, 113u8, 121u8, 66u8, 218u8, 219u8, 48u8, 64u8, 211u8, 114u8, + 163u8, 193u8, 164u8, 21u8, 140u8, 218u8, 253u8, 237u8, 240u8, 126u8, + 200u8, 213u8, 184u8, 50u8, 187u8, 182u8, 30u8, 52u8, 142u8, 72u8, + 210u8, 101u8, + ], + ) + } + #[doc = "Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously"] + #[doc = "for this operation will be unreserved on success."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `timepoint`: The timepoint (block number and transaction index) of the first approval"] + #[doc = "transaction for this dispatch."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- One event."] + #[doc = "- I/O: 1 read `O(S)`, one remove."] + #[doc = "- Storage: removes one item."] + #[doc = "----------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Multisig Storage, [Caller Account], Refund Account"] + #[doc = " - Write: Multisig Storage, [Caller Account], Refund Account"] + #[doc = "# "] + pub fn cancel_as_multi( + &self, + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + call_hash: [::core::primitive::u8; 32usize], + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Multisig", + "cancel_as_multi", + CancelAsMulti { + threshold, + other_signatories, + timepoint, + call_hash, + }, + [ + 30u8, 25u8, 186u8, 142u8, 168u8, 81u8, 235u8, 164u8, 82u8, 209u8, 66u8, + 129u8, 209u8, 78u8, 172u8, 9u8, 163u8, 222u8, 125u8, 57u8, 2u8, 43u8, + 169u8, 174u8, 159u8, 167u8, 25u8, 226u8, 254u8, 110u8, 80u8, 216u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_multisig::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A new multisig operation has begun."] + pub struct NewMultisig { + pub approving: ::subxt::ext::sp_core::crypto::AccountId32, + pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub call_hash: [::core::primitive::u8; 32usize], + } + impl ::subxt::events::StaticEvent for NewMultisig { + const PALLET: &'static str = "Multisig"; + const EVENT: &'static str = "NewMultisig"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A multisig operation has been approved by someone."] + pub struct MultisigApproval { + pub approving: ::subxt::ext::sp_core::crypto::AccountId32, + pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub call_hash: [::core::primitive::u8; 32usize], + } + impl ::subxt::events::StaticEvent for MultisigApproval { + const PALLET: &'static str = "Multisig"; + const EVENT: &'static str = "MultisigApproval"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A multisig operation has been executed."] + pub struct MultisigExecuted { + pub approving: ::subxt::ext::sp_core::crypto::AccountId32, + pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub call_hash: [::core::primitive::u8; 32usize], + pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + } + impl ::subxt::events::StaticEvent for MultisigExecuted { + const PALLET: &'static str = "Multisig"; + const EVENT: &'static str = "MultisigExecuted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A multisig operation has been cancelled."] + pub struct MultisigCancelled { + pub cancelling: ::subxt::ext::sp_core::crypto::AccountId32, + pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub call_hash: [::core::primitive::u8; 32usize], + } + impl ::subxt::events::StaticEvent for MultisigCancelled { + const PALLET: &'static str = "Multisig"; + const EVENT: &'static str = "MultisigCancelled"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The set of open multisig operations."] + pub fn multisigs( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<[::core::primitive::u8; 32usize]>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_multisig::Multisig< + ::core::primitive::u32, + ::core::primitive::u128, + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Multisig", + "Multisigs", + vec![ + ::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + ), + ::subxt::storage::address::StorageMapKey::new( + _1.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + ), + ], + [ + 69u8, 153u8, 186u8, 204u8, 117u8, 95u8, 119u8, 182u8, 220u8, 87u8, 8u8, + 15u8, 123u8, 83u8, 5u8, 188u8, 115u8, 121u8, 163u8, 96u8, 218u8, 3u8, + 106u8, 44u8, 44u8, 187u8, 46u8, 238u8, 80u8, 203u8, 175u8, 155u8, + ], + ) + } + #[doc = " The set of open multisig operations."] + pub fn multisigs_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_multisig::Multisig< + ::core::primitive::u32, + ::core::primitive::u128, + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Multisig", + "Multisigs", + Vec::new(), + [ + 69u8, 153u8, 186u8, 204u8, 117u8, 95u8, 119u8, 182u8, 220u8, 87u8, 8u8, + 15u8, 123u8, 83u8, 5u8, 188u8, 115u8, 121u8, 163u8, 96u8, 218u8, 3u8, + 106u8, 44u8, 44u8, 187u8, 46u8, 238u8, 80u8, 203u8, 175u8, 155u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The base amount of currency needed to reserve for creating a multisig execution or to"] + #[doc = " store a dispatch call for later."] + #[doc = ""] + #[doc = " This is held for an additional storage item whose value size is"] + #[doc = " `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is"] + #[doc = " `32 + sizeof(AccountId)` bytes."] + pub fn deposit_base( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Multisig", + "DepositBase", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount of currency needed per unit threshold when creating a multisig execution."] + #[doc = ""] + #[doc = " This is held for adding 32 bytes more into a pre-existing storage value."] + pub fn deposit_factor( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Multisig", + "DepositFactor", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The maximum amount of signatories allowed in the multisig."] + pub fn max_signatories( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Multisig", + "MaxSignatories", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod sudo { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Sudo { + pub call: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SudoUncheckedWeight { + pub call: ::std::boxed::Box, + pub weight: runtime_types::sp_weights::weight_v2::Weight, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetKey { + pub new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SudoAs { + pub who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub call: ::std::boxed::Box, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Authenticates the sudo key and dispatches a function call with `Root` origin."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + 10,000."] + #[doc = "# "] + pub fn sudo( + &self, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Sudo", + "sudo", + Sudo { + call: ::std::boxed::Box::new(call), + }, + [ + 239u8, 228u8, 136u8, 20u8, 82u8, 135u8, 234u8, 100u8, 176u8, 109u8, + 25u8, 209u8, 86u8, 79u8, 108u8, 187u8, 90u8, 171u8, 158u8, 161u8, + 143u8, 104u8, 2u8, 219u8, 249u8, 132u8, 147u8, 114u8, 218u8, 229u8, + 155u8, 179u8, + ], + ) + } + #[doc = "Authenticates the sudo key and dispatches a function call with `Root` origin."] + #[doc = "This function does not check the weight of the call, and instead allows the"] + #[doc = "Sudo user to specify the weight of the call."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- The weight of this call is defined by the caller."] + #[doc = "# "] + pub fn sudo_unchecked_weight( + &self, + call: runtime_types::aleph_runtime::RuntimeCall, + weight: runtime_types::sp_weights::weight_v2::Weight, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Sudo", + "sudo_unchecked_weight", + SudoUncheckedWeight { + call: ::std::boxed::Box::new(call), + weight, + }, + [ + 204u8, 109u8, 231u8, 144u8, 219u8, 116u8, 191u8, 123u8, 199u8, 219u8, + 220u8, 47u8, 76u8, 102u8, 122u8, 142u8, 68u8, 156u8, 222u8, 200u8, + 193u8, 220u8, 205u8, 85u8, 179u8, 22u8, 1u8, 76u8, 46u8, 246u8, 13u8, + 243u8, + ], + ) + } + #[doc = "Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo"] + #[doc = "key."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB change."] + #[doc = "# "] + pub fn set_key( + &self, + new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Sudo", + "set_key", + SetKey { new }, + [ + 23u8, 224u8, 218u8, 169u8, 8u8, 28u8, 111u8, 199u8, 26u8, 88u8, 225u8, + 105u8, 17u8, 19u8, 87u8, 156u8, 97u8, 67u8, 89u8, 173u8, 70u8, 0u8, + 5u8, 246u8, 198u8, 135u8, 182u8, 180u8, 44u8, 9u8, 212u8, 95u8, + ], + ) + } + #[doc = "Authenticates the sudo key and dispatches a function call with `Signed` origin from"] + #[doc = "a given account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + 10,000."] + #[doc = "# "] + pub fn sudo_as( + &self, + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + call: runtime_types::aleph_runtime::RuntimeCall, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Sudo", + "sudo_as", + SudoAs { + who, + call: ::std::boxed::Box::new(call), + }, + [ + 79u8, 135u8, 29u8, 144u8, 82u8, 118u8, 47u8, 40u8, 226u8, 63u8, 151u8, + 248u8, 68u8, 62u8, 138u8, 238u8, 6u8, 176u8, 175u8, 12u8, 244u8, 100u8, + 176u8, 119u8, 48u8, 45u8, 158u8, 208u8, 78u8, 62u8, 204u8, 130u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_sudo::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A sudo just took place. \\[result\\]"] + pub struct Sudid { + pub sudo_result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + } + impl ::subxt::events::StaticEvent for Sudid { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "Sudid"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The \\[sudoer\\] just switched identity; the old key is supplied if one existed."] + pub struct KeyChanged { + pub old_sudoer: ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + } + impl ::subxt::events::StaticEvent for KeyChanged { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "KeyChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A sudo just took place. \\[result\\]"] + pub struct SudoAsDone { + pub sudo_result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + } + impl ::subxt::events::StaticEvent for SudoAsDone { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "SudoAsDone"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The `AccountId` of the sudo key."] + pub fn key( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::crypto::AccountId32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Sudo", + "Key", + vec![], + [ + 244u8, 73u8, 188u8, 136u8, 218u8, 163u8, 68u8, 179u8, 122u8, 173u8, + 34u8, 108u8, 137u8, 28u8, 182u8, 16u8, 196u8, 92u8, 138u8, 34u8, 102u8, + 80u8, 199u8, 88u8, 107u8, 207u8, 36u8, 22u8, 168u8, 167u8, 20u8, 142u8, + ], + ) + } + } + } + } + pub mod contracts { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CallOldWeight { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + #[codec(compact)] + pub gas_limit: runtime_types::sp_weights::OldWeight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub data: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct InstantiateWithCodeOldWeight { + #[codec(compact)] + pub value: ::core::primitive::u128, + #[codec(compact)] + pub gas_limit: runtime_types::sp_weights::OldWeight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub code: ::std::vec::Vec<::core::primitive::u8>, + pub data: ::std::vec::Vec<::core::primitive::u8>, + pub salt: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct InstantiateOldWeight { + #[codec(compact)] + pub value: ::core::primitive::u128, + #[codec(compact)] + pub gas_limit: runtime_types::sp_weights::OldWeight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub code_hash: ::subxt::ext::sp_core::H256, + pub data: ::std::vec::Vec<::core::primitive::u8>, + pub salt: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UploadCode { + pub code: ::std::vec::Vec<::core::primitive::u8>, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub determinism: runtime_types::pallet_contracts::wasm::Determinism, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RemoveCode { + pub code_hash: ::subxt::ext::sp_core::H256, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetCode { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub code_hash: ::subxt::ext::sp_core::H256, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Call { + pub dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub value: ::core::primitive::u128, + pub gas_limit: runtime_types::sp_weights::weight_v2::Weight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub data: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct InstantiateWithCode { + #[codec(compact)] + pub value: ::core::primitive::u128, + pub gas_limit: runtime_types::sp_weights::weight_v2::Weight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub code: ::std::vec::Vec<::core::primitive::u8>, + pub data: ::std::vec::Vec<::core::primitive::u8>, + pub salt: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Instantiate { + #[codec(compact)] + pub value: ::core::primitive::u128, + pub gas_limit: runtime_types::sp_weights::weight_v2::Weight, + pub storage_deposit_limit: + ::core::option::Option<::subxt::ext::codec::Compact<::core::primitive::u128>>, + pub code_hash: ::subxt::ext::sp_core::H256, + pub data: ::std::vec::Vec<::core::primitive::u8>, + pub salt: ::std::vec::Vec<::core::primitive::u8>, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Deprecated version if [`Self::call`] for use in an in-storage `Call`."] + pub fn call_old_weight( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + data: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "call_old_weight", + CallOldWeight { + dest, + value, + gas_limit, + storage_deposit_limit, + data, + }, + [ + 181u8, 255u8, 119u8, 227u8, 10u8, 39u8, 128u8, 22u8, 223u8, 250u8, + 247u8, 253u8, 118u8, 113u8, 192u8, 65u8, 224u8, 0u8, 93u8, 16u8, 41u8, + 177u8, 150u8, 70u8, 151u8, 216u8, 76u8, 97u8, 27u8, 127u8, 75u8, 67u8, + ], + ) + } + #[doc = "Deprecated version if [`Self::instantiate_with_code`] for use in an in-storage `Call`."] + pub fn instantiate_with_code_old_weight( + &self, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code: ::std::vec::Vec<::core::primitive::u8>, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "instantiate_with_code_old_weight", + InstantiateWithCodeOldWeight { + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + }, + [ + 93u8, 124u8, 100u8, 101u8, 7u8, 110u8, 92u8, 199u8, 162u8, 126u8, 35u8, + 47u8, 190u8, 42u8, 237u8, 152u8, 169u8, 130u8, 21u8, 33u8, 136u8, + 220u8, 110u8, 106u8, 57u8, 211u8, 158u8, 130u8, 112u8, 37u8, 41u8, + 39u8, + ], + ) + } + #[doc = "Deprecated version if [`Self::instantiate`] for use in an in-storage `Call`."] + pub fn instantiate_old_weight( + &self, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code_hash: ::subxt::ext::sp_core::H256, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "instantiate_old_weight", + InstantiateOldWeight { + value, + gas_limit, + storage_deposit_limit, + code_hash, + data, + salt, + }, + [ + 243u8, 56u8, 93u8, 198u8, 169u8, 134u8, 6u8, 135u8, 19u8, 1u8, 20u8, + 138u8, 202u8, 59u8, 59u8, 99u8, 58u8, 22u8, 33u8, 94u8, 253u8, 215u8, + 203u8, 159u8, 58u8, 21u8, 24u8, 235u8, 30u8, 215u8, 173u8, 23u8, + ], + ) + } + #[doc = "Upload new `code` without instantiating a contract from it."] + #[doc = ""] + #[doc = "If the code does not already exist a deposit is reserved from the caller"] + #[doc = "and unreserved only when [`Self::remove_code`] is called. The size of the reserve"] + #[doc = "depends on the instrumented size of the the supplied `code`."] + #[doc = ""] + #[doc = "If the code already exists in storage it will still return `Ok` and upgrades"] + #[doc = "the in storage version to the current"] + #[doc = "[`InstructionWeights::version`](InstructionWeights)."] + #[doc = ""] + #[doc = "- `determinism`: If this is set to any other value but [`Determinism::Deterministic`]"] + #[doc = " then the only way to use this code is to delegate call into it from an offchain"] + #[doc = " execution. Set to [`Determinism::Deterministic`] if in doubt."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Anyone can instantiate a contract from any uploaded code and thus prevent its removal."] + #[doc = "To avoid this situation a constructor could employ access control so that it can"] + #[doc = "only be instantiated by permissioned entities. The same is true when uploading"] + #[doc = "through [`Self::instantiate_with_code`]."] + pub fn upload_code( + &self, + code: ::std::vec::Vec<::core::primitive::u8>, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + determinism: runtime_types::pallet_contracts::wasm::Determinism, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "upload_code", + UploadCode { + code, + storage_deposit_limit, + determinism, + }, + [ + 233u8, 137u8, 54u8, 111u8, 132u8, 124u8, 80u8, 213u8, 182u8, 224u8, + 144u8, 240u8, 6u8, 235u8, 148u8, 26u8, 65u8, 39u8, 91u8, 151u8, 131u8, + 10u8, 216u8, 101u8, 89u8, 115u8, 160u8, 154u8, 44u8, 239u8, 142u8, + 116u8, + ], + ) + } + #[doc = "Remove the code stored under `code_hash` and refund the deposit to its owner."] + #[doc = ""] + #[doc = "A code can only be removed by its original uploader (its owner) and only if it is"] + #[doc = "not used by any contract."] + pub fn remove_code( + &self, + code_hash: ::subxt::ext::sp_core::H256, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "remove_code", + RemoveCode { code_hash }, + [ + 43u8, 192u8, 198u8, 182u8, 108u8, 76u8, 21u8, 42u8, 169u8, 41u8, 195u8, + 73u8, 31u8, 179u8, 162u8, 56u8, 91u8, 5u8, 64u8, 7u8, 252u8, 194u8, + 255u8, 170u8, 67u8, 137u8, 143u8, 192u8, 2u8, 149u8, 38u8, 180u8, + ], + ) + } + #[doc = "Privileged function that changes the code of an existing contract."] + #[doc = ""] + #[doc = "This takes care of updating refcounts and all other necessary operations. Returns"] + #[doc = "an error if either the `code_hash` or `dest` do not exist."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "This does **not** change the address of the contract in question. This means"] + #[doc = "that the contract address is no longer derived from its code hash after calling"] + #[doc = "this dispatchable."] + pub fn set_code( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + code_hash: ::subxt::ext::sp_core::H256, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "set_code", + SetCode { dest, code_hash }, + [ + 106u8, 141u8, 239u8, 113u8, 99u8, 74u8, 14u8, 171u8, 80u8, 115u8, + 214u8, 203u8, 232u8, 142u8, 48u8, 207u8, 214u8, 59u8, 204u8, 157u8, + 101u8, 142u8, 12u8, 69u8, 230u8, 188u8, 60u8, 197u8, 238u8, 146u8, + 17u8, 190u8, + ], + ) + } + #[doc = "Makes a call to an account, optionally transferring some balance."] + #[doc = ""] + #[doc = "# Parameters"] + #[doc = ""] + #[doc = "* `dest`: Address of the contract to call."] + #[doc = "* `value`: The balance to transfer from the `origin` to `dest`."] + #[doc = "* `gas_limit`: The gas limit enforced when executing the constructor."] + #[doc = "* `storage_deposit_limit`: The maximum amount of balance that can be charged from the"] + #[doc = " caller to pay for the storage consumed."] + #[doc = "* `data`: The input data to pass to the contract."] + #[doc = ""] + #[doc = "* If the account is a smart-contract account, the associated code will be"] + #[doc = "executed and any value will be transferred."] + #[doc = "* If the account is a regular account, any value will be transferred."] + #[doc = "* If no account exists and the call value is not less than `existential_deposit`,"] + #[doc = "a regular account will be created and any value will be transferred."] + pub fn call( + &self, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + data: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "call", + Call { + dest, + value, + gas_limit, + storage_deposit_limit, + data, + }, + [ + 226u8, 219u8, 120u8, 119u8, 106u8, 251u8, 205u8, 112u8, 148u8, 215u8, + 196u8, 50u8, 116u8, 75u8, 40u8, 41u8, 224u8, 35u8, 186u8, 29u8, 49u8, + 112u8, 51u8, 117u8, 142u8, 69u8, 214u8, 208u8, 241u8, 71u8, 149u8, + 163u8, + ], + ) + } + #[doc = "Instantiates a new contract from the supplied `code` optionally transferring"] + #[doc = "some balance."] + #[doc = ""] + #[doc = "This dispatchable has the same effect as calling [`Self::upload_code`] +"] + #[doc = "[`Self::instantiate`]. Bundling them together provides efficiency gains. Please"] + #[doc = "also check the documentation of [`Self::upload_code`]."] + #[doc = ""] + #[doc = "# Parameters"] + #[doc = ""] + #[doc = "* `value`: The balance to transfer from the `origin` to the newly created contract."] + #[doc = "* `gas_limit`: The gas limit enforced when executing the constructor."] + #[doc = "* `storage_deposit_limit`: The maximum amount of balance that can be charged/reserved"] + #[doc = " from the caller to pay for the storage consumed."] + #[doc = "* `code`: The contract code to deploy in raw bytes."] + #[doc = "* `data`: The input data to pass to the contract constructor."] + #[doc = "* `salt`: Used for the address derivation. See [`Pallet::contract_address`]."] + #[doc = ""] + #[doc = "Instantiation is executed as follows:"] + #[doc = ""] + #[doc = "- The supplied `code` is instrumented, deployed, and a `code_hash` is created for that"] + #[doc = " code."] + #[doc = "- If the `code_hash` already exists on the chain the underlying `code` will be shared."] + #[doc = "- The destination address is computed based on the sender, code_hash and the salt."] + #[doc = "- The smart-contract account is created at the computed address."] + #[doc = "- The `value` is transferred to the new account."] + #[doc = "- The `deploy` function is executed in the context of the newly-created account."] + pub fn instantiate_with_code( + &self, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code: ::std::vec::Vec<::core::primitive::u8>, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "instantiate_with_code", + InstantiateWithCode { + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + }, + [ + 94u8, 238u8, 175u8, 86u8, 230u8, 186u8, 94u8, 60u8, 201u8, 35u8, 117u8, + 236u8, 221u8, 10u8, 180u8, 191u8, 140u8, 79u8, 203u8, 134u8, 240u8, + 21u8, 31u8, 63u8, 9u8, 17u8, 134u8, 30u8, 244u8, 95u8, 171u8, 164u8, + ], + ) + } + #[doc = "Instantiates a contract from a previously deployed wasm binary."] + #[doc = ""] + #[doc = "This function is identical to [`Self::instantiate_with_code`] but without the"] + #[doc = "code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary"] + #[doc = "must be supplied."] + pub fn instantiate( + &self, + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code_hash: ::subxt::ext::sp_core::H256, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Contracts", + "instantiate", + Instantiate { + value, + gas_limit, + storage_deposit_limit, + code_hash, + data, + salt, + }, + [ + 251u8, 49u8, 158u8, 1u8, 138u8, 29u8, 106u8, 187u8, 68u8, 135u8, 44u8, + 196u8, 230u8, 237u8, 88u8, 244u8, 170u8, 168u8, 11u8, 91u8, 185u8, + 11u8, 45u8, 86u8, 113u8, 79u8, 92u8, 248u8, 113u8, 47u8, 141u8, 10u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_contracts::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contract deployed by address at the specified address."] + pub struct Instantiated { + pub deployer: ::subxt::ext::sp_core::crypto::AccountId32, + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Instantiated { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "Instantiated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contract has been removed."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "The only way for a contract to be removed and emitting this event is by calling"] + #[doc = "`seal_terminate`."] + pub struct Terminated { + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Terminated { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "Terminated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Code with the specified hash has been stored."] + pub struct CodeStored { + pub code_hash: ::subxt::ext::sp_core::H256, + } + impl ::subxt::events::StaticEvent for CodeStored { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "CodeStored"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A custom event emitted by the contract."] + pub struct ContractEmitted { + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + pub data: ::std::vec::Vec<::core::primitive::u8>, + } + impl ::subxt::events::StaticEvent for ContractEmitted { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "ContractEmitted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A code with the specified hash was removed."] + pub struct CodeRemoved { + pub code_hash: ::subxt::ext::sp_core::H256, + } + impl ::subxt::events::StaticEvent for CodeRemoved { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "CodeRemoved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A contract's code was updated."] + pub struct ContractCodeUpdated { + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + pub new_code_hash: ::subxt::ext::sp_core::H256, + pub old_code_hash: ::subxt::ext::sp_core::H256, + } + impl ::subxt::events::StaticEvent for ContractCodeUpdated { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "ContractCodeUpdated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A contract was called either by a plain account or another contract."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Please keep in mind that like all events this is only emitted for successful"] + #[doc = "calls. This is because on failure all storage changes including events are"] + #[doc = "rolled back."] + pub struct Called { + pub caller: ::subxt::ext::sp_core::crypto::AccountId32, + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for Called { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "Called"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A contract delegate called a code hash."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Please keep in mind that like all events this is only emitted for successful"] + #[doc = "calls. This is because on failure all storage changes including events are"] + #[doc = "rolled back."] + pub struct DelegateCalled { + pub contract: ::subxt::ext::sp_core::crypto::AccountId32, + pub code_hash: ::subxt::ext::sp_core::H256, + } + impl ::subxt::events::StaticEvent for DelegateCalled { + const PALLET: &'static str = "Contracts"; + const EVENT: &'static str = "DelegateCalled"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " A mapping from an original code hash to the original code, untouched by instrumentation."] + pub fn pristine_code( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "PristineCode", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Identity, + )], + [ + 244u8, 169u8, 220u8, 235u8, 62u8, 153u8, 226u8, 187u8, 220u8, 141u8, + 149u8, 75u8, 224u8, 117u8, 181u8, 147u8, 140u8, 84u8, 9u8, 109u8, + 230u8, 25u8, 186u8, 26u8, 171u8, 147u8, 19u8, 78u8, 62u8, 170u8, 27u8, + 105u8, + ], + ) + } + #[doc = " A mapping from an original code hash to the original code, untouched by instrumentation."] + pub fn pristine_code_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "PristineCode", + Vec::new(), + [ + 244u8, 169u8, 220u8, 235u8, 62u8, 153u8, 226u8, 187u8, 220u8, 141u8, + 149u8, 75u8, 224u8, 117u8, 181u8, 147u8, 140u8, 84u8, 9u8, 109u8, + 230u8, 25u8, 186u8, 26u8, 171u8, 147u8, 19u8, 78u8, 62u8, 170u8, 27u8, + 105u8, + ], + ) + } + #[doc = " A mapping between an original code hash and instrumented wasm code, ready for execution."] + pub fn code_storage( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::wasm::PrefabWasmModule, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "CodeStorage", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Identity, + )], + [ + 57u8, 55u8, 36u8, 82u8, 39u8, 194u8, 172u8, 147u8, 144u8, 63u8, 101u8, + 240u8, 179u8, 25u8, 177u8, 68u8, 253u8, 230u8, 156u8, 228u8, 181u8, + 194u8, 48u8, 99u8, 188u8, 117u8, 44u8, 80u8, 121u8, 46u8, 149u8, 48u8, + ], + ) + } + #[doc = " A mapping between an original code hash and instrumented wasm code, ready for execution."] + pub fn code_storage_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::wasm::PrefabWasmModule, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "CodeStorage", + Vec::new(), + [ + 57u8, 55u8, 36u8, 82u8, 39u8, 194u8, 172u8, 147u8, 144u8, 63u8, 101u8, + 240u8, 179u8, 25u8, 177u8, 68u8, 253u8, 230u8, 156u8, 228u8, 181u8, + 194u8, 48u8, 99u8, 188u8, 117u8, 44u8, 80u8, 121u8, 46u8, 149u8, 48u8, + ], + ) + } + #[doc = " A mapping between an original code hash and its owner information."] + pub fn owner_info_of( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::wasm::OwnerInfo, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "OwnerInfoOf", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Identity, + )], + [ + 147u8, 6u8, 225u8, 62u8, 211u8, 236u8, 61u8, 116u8, 152u8, 219u8, + 220u8, 17u8, 82u8, 221u8, 156u8, 88u8, 63u8, 204u8, 16u8, 11u8, 184u8, + 236u8, 181u8, 189u8, 170u8, 160u8, 60u8, 64u8, 71u8, 250u8, 202u8, + 186u8, + ], + ) + } + #[doc = " A mapping between an original code hash and its owner information."] + pub fn owner_info_of_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::wasm::OwnerInfo, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "OwnerInfoOf", + Vec::new(), + [ + 147u8, 6u8, 225u8, 62u8, 211u8, 236u8, 61u8, 116u8, 152u8, 219u8, + 220u8, 17u8, 82u8, 221u8, 156u8, 88u8, 63u8, 204u8, 16u8, 11u8, 184u8, + 236u8, 181u8, 189u8, 170u8, 160u8, 60u8, 64u8, 71u8, 250u8, 202u8, + 186u8, + ], + ) + } + #[doc = " This is a **monotonic** counter incremented on contract instantiation."] + #[doc = ""] + #[doc = " This is used in order to generate unique trie ids for contracts."] + #[doc = " The trie id of a new contract is calculated from hash(account_id, nonce)."] + #[doc = " The nonce is required because otherwise the following sequence would lead to"] + #[doc = " a possible collision of storage:"] + #[doc = ""] + #[doc = " 1. Create a new contract."] + #[doc = " 2. Terminate the contract."] + #[doc = " 3. Immediately recreate the contract with the same account_id."] + #[doc = ""] + #[doc = " This is bad because the contents of a trie are deleted lazily and there might be"] + #[doc = " storage of the old instantiation still in it when the new contract is created. Please"] + #[doc = " note that we can't replace the counter by the block number because the sequence above"] + #[doc = " can happen in the same block. We also can't keep the account counter in memory only"] + #[doc = " because storage is the only way to communicate across different extrinsics in the"] + #[doc = " same block."] + #[doc = ""] + #[doc = " # Note"] + #[doc = ""] + #[doc = " Do not use it to determine the number of contracts. It won't be decremented if"] + #[doc = " a contract is destroyed."] + pub fn nonce( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u64>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "Nonce", + vec![], + [ + 122u8, 169u8, 95u8, 131u8, 85u8, 32u8, 154u8, 114u8, 143u8, 56u8, 12u8, + 182u8, 64u8, 150u8, 241u8, 249u8, 254u8, 251u8, 160u8, 235u8, 192u8, + 41u8, 101u8, 232u8, 186u8, 108u8, 187u8, 149u8, 210u8, 91u8, 179u8, + 98u8, + ], + ) + } + #[doc = " The code associated with a given account."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn contract_info_of( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::storage::ContractInfo, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "ContractInfoOf", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 176u8, 73u8, 209u8, 119u8, 242u8, 147u8, 64u8, 203u8, 253u8, 178u8, + 8u8, 239u8, 64u8, 68u8, 106u8, 153u8, 28u8, 124u8, 52u8, 226u8, 67u8, + 54u8, 177u8, 206u8, 238u8, 179u8, 222u8, 225u8, 242u8, 0u8, 171u8, + 184u8, + ], + ) + } + #[doc = " The code associated with a given account."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn contract_info_of_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::storage::ContractInfo, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "ContractInfoOf", + Vec::new(), + [ + 176u8, 73u8, 209u8, 119u8, 242u8, 147u8, 64u8, 203u8, 253u8, 178u8, + 8u8, 239u8, 64u8, 68u8, 106u8, 153u8, 28u8, 124u8, 52u8, 226u8, 67u8, + 54u8, 177u8, 206u8, 238u8, 179u8, 222u8, 225u8, 242u8, 0u8, 171u8, + 184u8, + ], + ) + } + #[doc = " Evicted contracts that await child trie deletion."] + #[doc = ""] + #[doc = " Child trie deletion is a heavy operation depending on the amount of storage items"] + #[doc = " stored in said trie. Therefore this operation is performed lazily in `on_initialize`."] + pub fn deletion_queue( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_contracts::storage::DeletedContract, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Contracts", + "DeletionQueue", + vec![], + [ + 119u8, 169u8, 146u8, 210u8, 21u8, 216u8, 51u8, 225u8, 107u8, 61u8, + 42u8, 155u8, 169u8, 127u8, 140u8, 106u8, 255u8, 137u8, 163u8, 199u8, + 91u8, 137u8, 73u8, 61u8, 9u8, 167u8, 16u8, 157u8, 183u8, 212u8, 35u8, + 88u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Cost schedule and limits."] + pub fn schedule( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_contracts::schedule::Schedule, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "Schedule", + [ + 102u8, 52u8, 108u8, 178u8, 197u8, 144u8, 39u8, 115u8, 254u8, 23u8, + 38u8, 120u8, 11u8, 166u8, 178u8, 210u8, 91u8, 139u8, 214u8, 231u8, + 110u8, 188u8, 37u8, 149u8, 195u8, 73u8, 166u8, 90u8, 55u8, 73u8, 88u8, + 111u8, + ], + ) + } + #[doc = " The maximum number of contracts that can be pending for deletion."] + #[doc = ""] + #[doc = " When a contract is deleted by calling `seal_terminate` it becomes inaccessible"] + #[doc = " immediately, but the deletion of the storage items it has accumulated is performed"] + #[doc = " later. The contract is put into the deletion queue. This defines how many"] + #[doc = " contracts can be queued up at the same time. If that limit is reached `seal_terminate`"] + #[doc = " will fail. The action must be retried in a later block in that case."] + #[doc = ""] + #[doc = " The reasons for limiting the queue depth are:"] + #[doc = ""] + #[doc = " 1. The queue is in storage in order to be persistent between blocks. We want to limit"] + #[doc = " \tthe amount of storage that can be consumed."] + #[doc = " 2. The queue is stored in a vector and needs to be decoded as a whole when reading"] + #[doc = "\t\tit at the end of each block. Longer queues take more weight to decode and hence"] + #[doc = "\t\tlimit the amount of items that can be deleted per block."] + pub fn deletion_queue_depth( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "DeletionQueueDepth", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum amount of weight that can be consumed per block for lazy trie removal."] + #[doc = ""] + #[doc = " The amount of weight that is dedicated per block to work on the deletion queue. Larger"] + #[doc = " values allow more trie keys to be deleted in each block but reduce the amount of"] + #[doc = " weight that is left for transactions. See [`Self::DeletionQueueDepth`] for more"] + #[doc = " information about the deletion queue."] + pub fn deletion_weight_limit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_weights::weight_v2::Weight, + >, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "DeletionWeightLimit", + [ + 206u8, 61u8, 253u8, 247u8, 163u8, 40u8, 161u8, 52u8, 134u8, 140u8, + 206u8, 83u8, 44u8, 166u8, 226u8, 115u8, 181u8, 14u8, 227u8, 130u8, + 210u8, 32u8, 85u8, 29u8, 230u8, 97u8, 130u8, 165u8, 147u8, 134u8, + 106u8, 76u8, + ], + ) + } + #[doc = " The amount of balance a caller has to pay for each byte of storage."] + #[doc = ""] + #[doc = " # Note"] + #[doc = ""] + #[doc = " Changing this value for an existing chain might need a storage migration."] + pub fn deposit_per_byte( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "DepositPerByte", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount of balance a caller has to pay for each storage item."] + #[doc = ""] + #[doc = " # Note"] + #[doc = ""] + #[doc = " Changing this value for an existing chain might need a storage migration."] + pub fn deposit_per_item( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "DepositPerItem", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The maximum length of a contract code in bytes. This limit applies to the instrumented"] + #[doc = " version of the code. Therefore `instantiate_with_code` can fail even when supplying"] + #[doc = " a wasm binary below this maximum size."] + #[doc = ""] + #[doc = " The value should be chosen carefully taking into the account the overall memory limit"] + #[doc = " your runtime has, as well as the [maximum allowed callstack"] + #[doc = " depth](#associatedtype.CallStack). Look into the `integrity_test()` for some insights."] + pub fn max_code_len( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "MaxCodeLen", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum allowable length in bytes for storage keys."] + pub fn max_storage_key_len( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "MaxStorageKeyLen", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Make contract callable functions marked as `#[unstable]` available."] + #[doc = ""] + #[doc = " Contracts that use `#[unstable]` functions won't be able to be uploaded unless"] + #[doc = " this is set to `true`. This is only meant for testnets and dev nodes in order to"] + #[doc = " experiment with new features."] + #[doc = ""] + #[doc = " # Warning"] + #[doc = ""] + #[doc = " Do **not** set to `true` on productions chains."] + pub fn unsafe_unstable_interface( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "UnsafeUnstableInterface", + [ + 165u8, 28u8, 112u8, 190u8, 18u8, 129u8, 182u8, 206u8, 237u8, 1u8, 68u8, + 252u8, 125u8, 234u8, 185u8, 50u8, 149u8, 164u8, 47u8, 126u8, 134u8, + 100u8, 14u8, 86u8, 209u8, 39u8, 20u8, 4u8, 233u8, 115u8, 102u8, 131u8, + ], + ) + } + #[doc = " The maximum length of the debug buffer in bytes."] + pub fn max_debug_buffer_len( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Contracts", + "MaxDebugBufferLen", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod nomination_pools { + use super::{root_mod, runtime_types}; + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Join { + #[codec(compact)] + pub amount: ::core::primitive::u128, + pub pool_id: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BondExtra { + pub extra: + runtime_types::pallet_nomination_pools::BondExtra<::core::primitive::u128>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ClaimPayout; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Unbond { + pub member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + pub unbonding_points: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PoolWithdrawUnbonded { + pub pool_id: ::core::primitive::u32, + pub num_slashing_spans: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct WithdrawUnbonded { + pub member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub num_slashing_spans: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Create { + #[codec(compact)] + pub amount: ::core::primitive::u128, + pub root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CreateWithPoolId { + #[codec(compact)] + pub amount: ::core::primitive::u128, + pub root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub pool_id: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Nominate { + pub pool_id: ::core::primitive::u32, + pub validators: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetState { + pub pool_id: ::core::primitive::u32, + pub state: runtime_types::pallet_nomination_pools::PoolState, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetMetadata { + pub pool_id: ::core::primitive::u32, + pub metadata: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetConfigs { + pub min_join_bond: + runtime_types::pallet_nomination_pools::ConfigOp<::core::primitive::u128>, + pub min_create_bond: + runtime_types::pallet_nomination_pools::ConfigOp<::core::primitive::u128>, + pub max_pools: + runtime_types::pallet_nomination_pools::ConfigOp<::core::primitive::u32>, + pub max_members: + runtime_types::pallet_nomination_pools::ConfigOp<::core::primitive::u32>, + pub max_members_per_pool: + runtime_types::pallet_nomination_pools::ConfigOp<::core::primitive::u32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UpdateRoles { + pub pool_id: ::core::primitive::u32, + pub new_root: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + pub new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + pub new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Chill { + pub pool_id: ::core::primitive::u32, + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Stake funds with a pool. The amount to bond is transferred from the member to the"] + #[doc = "pools account and immediately increases the pools bond."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "* An account can only be a member of a single pool."] + #[doc = "* An account cannot join the same pool multiple times."] + #[doc = "* This call will *not* dust the member account, so the member must have at least"] + #[doc = " `existential deposit + amount` in their account."] + #[doc = "* Only a pool with [`PoolState::Open`] can be joined"] + pub fn join( + &self, + amount: ::core::primitive::u128, + pool_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "join", + Join { amount, pool_id }, + [ + 205u8, 66u8, 42u8, 72u8, 146u8, 148u8, 119u8, 162u8, 101u8, 183u8, + 46u8, 176u8, 221u8, 204u8, 197u8, 20u8, 75u8, 226u8, 29u8, 118u8, + 208u8, 60u8, 192u8, 247u8, 222u8, 100u8, 69u8, 80u8, 172u8, 13u8, 69u8, + 250u8, + ], + ) + } + #[doc = "Bond `extra` more funds from `origin` into the pool to which they already belong."] + #[doc = ""] + #[doc = "Additional funds can come from either the free balance of the account, of from the"] + #[doc = "accumulated rewards, see [`BondExtra`]."] + #[doc = ""] + #[doc = "Bonding extra funds implies an automatic payout of all pending rewards as well."] + pub fn bond_extra( + &self, + extra: runtime_types::pallet_nomination_pools::BondExtra< + ::core::primitive::u128, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "bond_extra", + BondExtra { extra }, + [ + 50u8, 72u8, 181u8, 216u8, 249u8, 27u8, 250u8, 177u8, 253u8, 22u8, + 240u8, 100u8, 184u8, 202u8, 197u8, 34u8, 21u8, 188u8, 248u8, 191u8, + 11u8, 10u8, 236u8, 161u8, 168u8, 37u8, 38u8, 238u8, 61u8, 183u8, 86u8, + 55u8, + ], + ) + } + #[doc = "A bonded member can use this to claim their payout based on the rewards that the pool"] + #[doc = "has accumulated since their last claimed payout (OR since joining if this is there first"] + #[doc = "time claiming rewards). The payout will be transferred to the member's account."] + #[doc = ""] + #[doc = "The member will earn rewards pro rata based on the members stake vs the sum of the"] + #[doc = "members in the pools stake. Rewards do not \"expire\"."] + pub fn claim_payout(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "claim_payout", + ClaimPayout {}, + [ + 128u8, 58u8, 138u8, 55u8, 64u8, 16u8, 129u8, 25u8, 211u8, 229u8, 193u8, + 115u8, 47u8, 45u8, 155u8, 221u8, 218u8, 1u8, 222u8, 5u8, 236u8, 32u8, + 88u8, 0u8, 198u8, 72u8, 196u8, 181u8, 104u8, 16u8, 212u8, 29u8, + ], + ) + } + #[doc = "Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It"] + #[doc = "implicitly collects the rewards one last time, since not doing so would mean some"] + #[doc = "rewards would be forfeited."] + #[doc = ""] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] + #[doc = ""] + #[doc = "# Conditions for a permissionless dispatch."] + #[doc = ""] + #[doc = "* The pool is blocked and the caller is either the root or state-toggler. This is"] + #[doc = " refereed to as a kick."] + #[doc = "* The pool is destroying and the member is not the depositor."] + #[doc = "* The pool is destroying, the member is the depositor and no other members are in the"] + #[doc = " pool."] + #[doc = ""] + #[doc = "## Conditions for permissioned dispatch (i.e. the caller is also the"] + #[doc = "`member_account`):"] + #[doc = ""] + #[doc = "* The caller is not the depositor."] + #[doc = "* The caller is the depositor, the pool is destroying and no other members are in the"] + #[doc = " pool."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If there are too many unlocking chunks to unbond with the pool account,"] + #[doc = "[`Call::pool_withdraw_unbonded`] can be called to try and minimize unlocking chunks."] + #[doc = "The [`StakingInterface::unbond`] will implicitly call [`Call::pool_withdraw_unbonded`]"] + #[doc = "to try to free chunks if necessary (ie. if unbound was called and no unlocking chunks"] + #[doc = "are available). However, it may not be possible to release the current unlocking chunks,"] + #[doc = "in which case, the result of this call will likely be the `NoMoreChunks` error from the"] + #[doc = "staking system."] + pub fn unbond( + &self, + member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + unbonding_points: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "unbond", + Unbond { + member_account, + unbonding_points, + }, + [ + 78u8, 15u8, 37u8, 18u8, 129u8, 63u8, 31u8, 3u8, 68u8, 10u8, 12u8, 12u8, + 166u8, 179u8, 38u8, 232u8, 97u8, 1u8, 83u8, 53u8, 26u8, 59u8, 42u8, + 219u8, 176u8, 246u8, 169u8, 28u8, 35u8, 67u8, 139u8, 81u8, + ], + ) + } + #[doc = "Call `withdraw_unbonded` for the pools account. This call can be made by any account."] + #[doc = ""] + #[doc = "This is useful if their are too many unlocking chunks to call `unbond`, and some"] + #[doc = "can be cleared by withdrawing. In the case there are too many unlocking chunks, the user"] + #[doc = "would probably see an error like `NoMoreChunks` emitted from the staking system when"] + #[doc = "they attempt to unbond."] + pub fn pool_withdraw_unbonded( + &self, + pool_id: ::core::primitive::u32, + num_slashing_spans: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "pool_withdraw_unbonded", + PoolWithdrawUnbonded { + pool_id, + num_slashing_spans, + }, + [ + 152u8, 245u8, 131u8, 247u8, 106u8, 214u8, 154u8, 8u8, 7u8, 210u8, + 149u8, 218u8, 118u8, 46u8, 242u8, 182u8, 191u8, 119u8, 28u8, 199u8, + 36u8, 49u8, 219u8, 123u8, 58u8, 203u8, 211u8, 226u8, 217u8, 36u8, 56u8, + 0u8, + ], + ) + } + #[doc = "Withdraw unbonded funds from `member_account`. If no bonded funds can be unbonded, an"] + #[doc = "error is returned."] + #[doc = ""] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] + #[doc = ""] + #[doc = "# Conditions for a permissionless dispatch"] + #[doc = ""] + #[doc = "* The pool is in destroy mode and the target is not the depositor."] + #[doc = "* The target is the depositor and they are the only member in the sub pools."] + #[doc = "* The pool is blocked and the caller is either the root or state-toggler."] + #[doc = ""] + #[doc = "# Conditions for permissioned dispatch"] + #[doc = ""] + #[doc = "* The caller is the target and they are not the depositor."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If the target is the depositor, the pool will be destroyed."] + pub fn withdraw_unbonded( + &self, + member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + num_slashing_spans: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "withdraw_unbonded", + WithdrawUnbonded { + member_account, + num_slashing_spans, + }, + [ + 61u8, 216u8, 214u8, 166u8, 59u8, 42u8, 186u8, 141u8, 47u8, 50u8, 135u8, + 236u8, 166u8, 88u8, 90u8, 244u8, 57u8, 106u8, 193u8, 211u8, 215u8, + 131u8, 203u8, 33u8, 195u8, 120u8, 213u8, 94u8, 213u8, 66u8, 79u8, + 140u8, + ], + ) + } + #[doc = "Create a new delegation pool."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `amount` - The amount of funds to delegate to the pool. This also acts of a sort of"] + #[doc = " deposit since the pools creator cannot fully unbond funds until the pool is being"] + #[doc = " destroyed."] + #[doc = "* `index` - A disambiguation index for creating the account. Likely only useful when"] + #[doc = " creating multiple pools in the same extrinsic."] + #[doc = "* `root` - The account to set as [`PoolRoles::root`]."] + #[doc = "* `nominator` - The account to set as the [`PoolRoles::nominator`]."] + #[doc = "* `state_toggler` - The account to set as the [`PoolRoles::state_toggler`]."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "In addition to `amount`, the caller will transfer the existential deposit; so the caller"] + #[doc = "needs at have at least `amount + existential_deposit` transferrable."] + pub fn create( + &self, + amount: ::core::primitive::u128, + root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "create", + Create { + amount, + root, + nominator, + state_toggler, + }, + [ + 176u8, 210u8, 154u8, 87u8, 218u8, 250u8, 117u8, 90u8, 80u8, 191u8, + 252u8, 146u8, 29u8, 228u8, 36u8, 15u8, 125u8, 102u8, 87u8, 50u8, 146u8, + 108u8, 96u8, 145u8, 135u8, 189u8, 18u8, 159u8, 21u8, 74u8, 165u8, 33u8, + ], + ) + } + #[doc = "Create a new delegation pool with a previously used pool id"] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "same as `create` with the inclusion of"] + #[doc = "* `pool_id` - `A valid PoolId."] + pub fn create_with_pool_id( + &self, + amount: ::core::primitive::u128, + root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pool_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "create_with_pool_id", + CreateWithPoolId { + amount, + root, + nominator, + state_toggler, + pool_id, + }, + [ + 234u8, 228u8, 116u8, 171u8, 77u8, 41u8, 166u8, 254u8, 20u8, 78u8, 38u8, + 28u8, 144u8, 58u8, 2u8, 64u8, 11u8, 27u8, 124u8, 215u8, 8u8, 10u8, + 172u8, 189u8, 118u8, 131u8, 102u8, 191u8, 251u8, 208u8, 167u8, 103u8, + ], + ) + } + #[doc = "Nominate on behalf of the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role."] + #[doc = ""] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + pub fn nominate( + &self, + pool_id: ::core::primitive::u32, + validators: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "nominate", + Nominate { + pool_id, + validators, + }, + [ + 10u8, 235u8, 64u8, 157u8, 36u8, 249u8, 186u8, 27u8, 79u8, 172u8, 25u8, + 3u8, 203u8, 19u8, 192u8, 182u8, 36u8, 103u8, 13u8, 20u8, 89u8, 140u8, + 159u8, 4u8, 132u8, 242u8, 192u8, 146u8, 55u8, 251u8, 216u8, 255u8, + ], + ) + } + #[doc = "Set a new state for the pool."] + #[doc = ""] + #[doc = "If a pool is already in the `Destroying` state, then under no condition can its state"] + #[doc = "change again."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be either:"] + #[doc = ""] + #[doc = "1. signed by the state toggler, or the root role of the pool,"] + #[doc = "2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and"] + #[doc = " then the state of the pool can be permissionlessly changed to `Destroying`."] + pub fn set_state( + &self, + pool_id: ::core::primitive::u32, + state: runtime_types::pallet_nomination_pools::PoolState, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "set_state", + SetState { pool_id, state }, + [ + 104u8, 40u8, 213u8, 88u8, 159u8, 115u8, 35u8, 249u8, 78u8, 180u8, 99u8, + 1u8, 225u8, 218u8, 192u8, 151u8, 25u8, 194u8, 192u8, 187u8, 39u8, + 170u8, 212u8, 125u8, 75u8, 250u8, 248u8, 175u8, 159u8, 161u8, 151u8, + 162u8, + ], + ) + } + #[doc = "Set a new metadata for the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the state toggler, or the root role"] + #[doc = "of the pool."] + pub fn set_metadata( + &self, + pool_id: ::core::primitive::u32, + metadata: ::std::vec::Vec<::core::primitive::u8>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "set_metadata", + SetMetadata { pool_id, metadata }, + [ + 156u8, 81u8, 170u8, 161u8, 34u8, 100u8, 183u8, 174u8, 5u8, 81u8, 31u8, + 76u8, 12u8, 42u8, 77u8, 1u8, 6u8, 26u8, 168u8, 7u8, 8u8, 115u8, 158u8, + 151u8, 30u8, 211u8, 52u8, 177u8, 234u8, 87u8, 125u8, 127u8, + ], + ) + } + #[doc = "Update configurations for the nomination pools. The origin for this call must be"] + #[doc = "Root."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `min_join_bond` - Set [`MinJoinBond`]."] + #[doc = "* `min_create_bond` - Set [`MinCreateBond`]."] + #[doc = "* `max_pools` - Set [`MaxPools`]."] + #[doc = "* `max_members` - Set [`MaxPoolMembers`]."] + #[doc = "* `max_members_per_pool` - Set [`MaxPoolMembersPerPool`]."] + pub fn set_configs( + &self, + min_join_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + min_create_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + max_pools: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members_per_pool: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "set_configs", + SetConfigs { + min_join_bond, + min_create_bond, + max_pools, + max_members, + max_members_per_pool, + }, + [ + 143u8, 196u8, 211u8, 30u8, 71u8, 15u8, 150u8, 243u8, 7u8, 178u8, 179u8, + 168u8, 40u8, 116u8, 220u8, 140u8, 18u8, 206u8, 6u8, 189u8, 190u8, 37u8, + 68u8, 41u8, 45u8, 233u8, 247u8, 172u8, 185u8, 34u8, 243u8, 187u8, + ], + ) + } + #[doc = "Update the roles of the pool."] + #[doc = ""] + #[doc = "The root is the only entity that can change any of the roles, including itself,"] + #[doc = "excluding the depositor, who can never change."] + #[doc = ""] + #[doc = "It emits an event, notifying UIs of the role change. This event is quite relevant to"] + #[doc = "most pool members and they should be informed of changes to pool roles."] + pub fn update_roles( + &self, + pool_id: ::core::primitive::u32, + new_root: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "update_roles", + UpdateRoles { + pool_id, + new_root, + new_nominator, + new_state_toggler, + }, + [ + 247u8, 95u8, 234u8, 56u8, 181u8, 229u8, 158u8, 97u8, 69u8, 165u8, 38u8, + 17u8, 27u8, 209u8, 204u8, 250u8, 91u8, 193u8, 35u8, 93u8, 215u8, 131u8, + 148u8, 73u8, 67u8, 188u8, 92u8, 32u8, 34u8, 37u8, 113u8, 93u8, + ], + ) + } + #[doc = "Chill on behalf of the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role, same as [`Pallet::nominate`]."] + #[doc = ""] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + pub fn chill( + &self, + pool_id: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "NominationPools", + "chill", + Chill { pool_id }, + [ + 41u8, 114u8, 128u8, 121u8, 244u8, 15u8, 15u8, 52u8, 129u8, 88u8, 239u8, + 167u8, 216u8, 38u8, 123u8, 240u8, 172u8, 229u8, 132u8, 64u8, 175u8, + 87u8, 217u8, 27u8, 11u8, 124u8, 1u8, 140u8, 40u8, 191u8, 187u8, 36u8, + ], + ) + } + } + } + #[doc = "Events of this pallet."] + pub type Event = runtime_types::pallet_nomination_pools::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A pool has been created."] + pub struct Created { + pub depositor: ::subxt::ext::sp_core::crypto::AccountId32, + pub pool_id: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Created { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "Created"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A member has became bonded in a pool."] + pub struct Bonded { + pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub pool_id: ::core::primitive::u32, + pub bonded: ::core::primitive::u128, + pub joined: ::core::primitive::bool, + } + impl ::subxt::events::StaticEvent for Bonded { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "Bonded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A payout has been made to a member."] + pub struct PaidOut { + pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub pool_id: ::core::primitive::u32, + pub payout: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for PaidOut { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "PaidOut"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A member has unbonded from their pool."] + #[doc = ""] + #[doc = "- `balance` is the corresponding balance of the number of points that has been"] + #[doc = " requested to be unbonded (the argument of the `unbond` transaction) from the bonded"] + #[doc = " pool."] + #[doc = "- `points` is the number of points that are issued as a result of `balance` being"] + #[doc = "dissolved into the corresponding unbonding pool."] + #[doc = "- `era` is the era in which the balance will be unbonded."] + #[doc = "In the absence of slashing, these values will match. In the presence of slashing, the"] + #[doc = "number of points that are issued in the unbonding pool will be less than the amount"] + #[doc = "requested to be unbonded."] + pub struct Unbonded { + pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub pool_id: ::core::primitive::u32, + pub balance: ::core::primitive::u128, + pub points: ::core::primitive::u128, + pub era: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Unbonded { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "Unbonded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A member has withdrawn from their pool."] + #[doc = ""] + #[doc = "The given number of `points` have been dissolved in return of `balance`."] + #[doc = ""] + #[doc = "Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance"] + #[doc = "will be 1."] + pub struct Withdrawn { + pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub pool_id: ::core::primitive::u32, + pub balance: ::core::primitive::u128, + pub points: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Withdrawn { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "Withdrawn"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A pool has been destroyed."] + pub struct Destroyed { + pub pool_id: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for Destroyed { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "Destroyed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The state of a pool has changed"] + pub struct StateChanged { + pub pool_id: ::core::primitive::u32, + pub new_state: runtime_types::pallet_nomination_pools::PoolState, + } + impl ::subxt::events::StaticEvent for StateChanged { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "StateChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A member has been removed from a pool."] + #[doc = ""] + #[doc = "The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked)."] + pub struct MemberRemoved { + pub pool_id: ::core::primitive::u32, + pub member: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for MemberRemoved { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "MemberRemoved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The roles of a pool have been updated to the given new roles. Note that the depositor"] + #[doc = "can never change."] + pub struct RolesUpdated { + pub root: ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + pub state_toggler: + ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + pub nominator: ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + } + impl ::subxt::events::StaticEvent for RolesUpdated { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "RolesUpdated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The active balance of pool `pool_id` has been slashed to `balance`."] + pub struct PoolSlashed { + pub pool_id: ::core::primitive::u32, + pub balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for PoolSlashed { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "PoolSlashed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "The unbond pool at `era` of pool `pool_id` has been slashed to `balance`."] + pub struct UnbondingPoolSlashed { + pub pool_id: ::core::primitive::u32, + pub era: ::core::primitive::u32, + pub balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for UnbondingPoolSlashed { + const PALLET: &'static str = "NominationPools"; + const EVENT: &'static str = "UnbondingPoolSlashed"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Minimum amount to bond to join a pool."] + pub fn min_join_bond( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "MinJoinBond", + vec![], + [ + 125u8, 239u8, 45u8, 225u8, 74u8, 129u8, 247u8, 184u8, 205u8, 58u8, + 45u8, 186u8, 126u8, 170u8, 112u8, 120u8, 23u8, 190u8, 247u8, 97u8, + 131u8, 126u8, 215u8, 44u8, 147u8, 122u8, 132u8, 212u8, 217u8, 84u8, + 240u8, 91u8, + ], + ) + } + #[doc = " Minimum bond required to create a pool."] + #[doc = ""] + #[doc = " This is the amount that the depositor must put as their initial stake in the pool, as an"] + #[doc = " indication of \"skin in the game\"."] + #[doc = ""] + #[doc = " This is the value that will always exist in the staking ledger of the pool bonded account"] + #[doc = " while all other accounts leave."] + pub fn min_create_bond( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "MinCreateBond", + vec![], + [ + 31u8, 208u8, 240u8, 158u8, 23u8, 218u8, 212u8, 138u8, 92u8, 210u8, + 207u8, 170u8, 32u8, 60u8, 5u8, 21u8, 84u8, 162u8, 1u8, 111u8, 181u8, + 243u8, 24u8, 148u8, 193u8, 253u8, 248u8, 190u8, 16u8, 222u8, 219u8, + 67u8, + ], + ) + } + #[doc = " Maximum number of nomination pools that can exist. If `None`, then an unbounded number of"] + #[doc = " pools can exist."] + pub fn max_pools( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "MaxPools", + vec![], + [ + 216u8, 111u8, 68u8, 103u8, 33u8, 50u8, 109u8, 3u8, 176u8, 195u8, 23u8, + 73u8, 112u8, 138u8, 9u8, 194u8, 233u8, 73u8, 68u8, 215u8, 162u8, 255u8, + 217u8, 173u8, 141u8, 27u8, 72u8, 199u8, 7u8, 240u8, 25u8, 34u8, + ], + ) + } + #[doc = " Maximum number of members that can exist in the system. If `None`, then the count"] + #[doc = " members are not bound on a system wide basis."] + pub fn max_pool_members( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "MaxPoolMembers", + vec![], + [ + 82u8, 217u8, 26u8, 234u8, 223u8, 241u8, 66u8, 182u8, 43u8, 233u8, 59u8, + 242u8, 202u8, 254u8, 69u8, 50u8, 254u8, 196u8, 166u8, 89u8, 120u8, + 87u8, 76u8, 148u8, 31u8, 197u8, 49u8, 88u8, 206u8, 41u8, 242u8, 62u8, + ], + ) + } + #[doc = " Maximum number of members that may belong to pool. If `None`, then the count of"] + #[doc = " members is not bound on a per pool basis."] + pub fn max_pool_members_per_pool( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "MaxPoolMembersPerPool", + vec![], + [ + 93u8, 241u8, 16u8, 169u8, 138u8, 199u8, 128u8, 149u8, 65u8, 30u8, 55u8, + 11u8, 41u8, 252u8, 83u8, 250u8, 9u8, 33u8, 152u8, 239u8, 195u8, 147u8, + 16u8, 248u8, 180u8, 153u8, 88u8, 231u8, 248u8, 169u8, 186u8, 48u8, + ], + ) + } + #[doc = " Active members."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn pool_members( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::PoolMember, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "PoolMembers", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 252u8, 236u8, 201u8, 127u8, 219u8, 1u8, 19u8, 144u8, 5u8, 108u8, 70u8, + 30u8, 177u8, 232u8, 253u8, 237u8, 211u8, 91u8, 63u8, 62u8, 155u8, + 151u8, 153u8, 165u8, 206u8, 53u8, 111u8, 31u8, 60u8, 120u8, 100u8, + 249u8, + ], + ) + } + #[doc = " Active members."] + #[doc = ""] + #[doc = " TWOX-NOTE: SAFE since `AccountId` is a secure hash."] + pub fn pool_members_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::PoolMember, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "PoolMembers", + Vec::new(), + [ + 252u8, 236u8, 201u8, 127u8, 219u8, 1u8, 19u8, 144u8, 5u8, 108u8, 70u8, + 30u8, 177u8, 232u8, 253u8, 237u8, 211u8, 91u8, 63u8, 62u8, 155u8, + 151u8, 153u8, 165u8, 206u8, 53u8, 111u8, 31u8, 60u8, 120u8, 100u8, + 249u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_pool_members( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForPoolMembers", + vec![], + [ + 114u8, 126u8, 27u8, 138u8, 119u8, 44u8, 45u8, 129u8, 84u8, 107u8, + 171u8, 206u8, 117u8, 141u8, 20u8, 75u8, 229u8, 237u8, 31u8, 229u8, + 124u8, 190u8, 27u8, 124u8, 63u8, 59u8, 167u8, 42u8, 62u8, 212u8, 160u8, + 2u8, + ], + ) + } + #[doc = " Storage for bonded pools."] + pub fn bonded_pools( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::BondedPoolInner, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "BondedPools", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 34u8, 51u8, 86u8, 95u8, 237u8, 118u8, 40u8, 212u8, 128u8, 227u8, 113u8, + 6u8, 116u8, 28u8, 96u8, 223u8, 63u8, 249u8, 33u8, 152u8, 61u8, 7u8, + 205u8, 220u8, 221u8, 174u8, 207u8, 39u8, 53u8, 176u8, 13u8, 74u8, + ], + ) + } + #[doc = " Storage for bonded pools."] + pub fn bonded_pools_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::BondedPoolInner, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "BondedPools", + Vec::new(), + [ + 34u8, 51u8, 86u8, 95u8, 237u8, 118u8, 40u8, 212u8, 128u8, 227u8, 113u8, + 6u8, 116u8, 28u8, 96u8, 223u8, 63u8, 249u8, 33u8, 152u8, 61u8, 7u8, + 205u8, 220u8, 221u8, 174u8, 207u8, 39u8, 53u8, 176u8, 13u8, 74u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_bonded_pools( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForBondedPools", + vec![], + [ + 134u8, 94u8, 199u8, 73u8, 174u8, 253u8, 66u8, 242u8, 233u8, 244u8, + 140u8, 170u8, 242u8, 40u8, 41u8, 185u8, 183u8, 151u8, 58u8, 111u8, + 221u8, 225u8, 81u8, 71u8, 169u8, 219u8, 223u8, 135u8, 8u8, 171u8, + 180u8, 236u8, + ], + ) + } + #[doc = " Reward pools. This is where there rewards for each pool accumulate. When a members payout"] + #[doc = " is claimed, the balance comes out fo the reward pool. Keyed by the bonded pools account."] + pub fn reward_pools( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::RewardPool, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "RewardPools", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 139u8, 123u8, 46u8, 107u8, 9u8, 83u8, 141u8, 12u8, 188u8, 225u8, 170u8, + 215u8, 154u8, 21u8, 100u8, 95u8, 237u8, 245u8, 46u8, 216u8, 199u8, + 184u8, 187u8, 155u8, 8u8, 16u8, 34u8, 177u8, 153u8, 65u8, 109u8, 198u8, + ], + ) + } + #[doc = " Reward pools. This is where there rewards for each pool accumulate. When a members payout"] + #[doc = " is claimed, the balance comes out fo the reward pool. Keyed by the bonded pools account."] + pub fn reward_pools_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::RewardPool, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "RewardPools", + Vec::new(), + [ + 139u8, 123u8, 46u8, 107u8, 9u8, 83u8, 141u8, 12u8, 188u8, 225u8, 170u8, + 215u8, 154u8, 21u8, 100u8, 95u8, 237u8, 245u8, 46u8, 216u8, 199u8, + 184u8, 187u8, 155u8, 8u8, 16u8, 34u8, 177u8, 153u8, 65u8, 109u8, 198u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_reward_pools( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForRewardPools", + vec![], + [ + 209u8, 139u8, 212u8, 116u8, 210u8, 178u8, 213u8, 38u8, 75u8, 23u8, + 188u8, 57u8, 253u8, 213u8, 95u8, 118u8, 182u8, 250u8, 45u8, 205u8, + 17u8, 175u8, 17u8, 201u8, 234u8, 14u8, 98u8, 49u8, 143u8, 135u8, 201u8, + 81u8, + ], + ) + } + #[doc = " Groups of unbonding pools. Each group of unbonding pools belongs to a bonded pool,"] + #[doc = " hence the name sub-pools. Keyed by the bonded pools account."] + pub fn sub_pools_storage( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::SubPools, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "SubPoolsStorage", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 231u8, 13u8, 111u8, 248u8, 1u8, 208u8, 179u8, 134u8, 224u8, 196u8, + 94u8, 201u8, 229u8, 29u8, 155u8, 211u8, 163u8, 150u8, 157u8, 34u8, + 68u8, 238u8, 55u8, 4u8, 222u8, 96u8, 186u8, 29u8, 205u8, 237u8, 80u8, + 42u8, + ], + ) + } + #[doc = " Groups of unbonding pools. Each group of unbonding pools belongs to a bonded pool,"] + #[doc = " hence the name sub-pools. Keyed by the bonded pools account."] + pub fn sub_pools_storage_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_nomination_pools::SubPools, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "SubPoolsStorage", + Vec::new(), + [ + 231u8, 13u8, 111u8, 248u8, 1u8, 208u8, 179u8, 134u8, 224u8, 196u8, + 94u8, 201u8, 229u8, 29u8, 155u8, 211u8, 163u8, 150u8, 157u8, 34u8, + 68u8, 238u8, 55u8, 4u8, 222u8, 96u8, 186u8, 29u8, 205u8, 237u8, 80u8, + 42u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_sub_pools_storage( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForSubPoolsStorage", + vec![], + [ + 212u8, 145u8, 212u8, 226u8, 234u8, 31u8, 26u8, 240u8, 107u8, 91u8, + 171u8, 120u8, 41u8, 195u8, 16u8, 86u8, 55u8, 127u8, 103u8, 93u8, 128u8, + 48u8, 69u8, 104u8, 168u8, 236u8, 81u8, 54u8, 2u8, 184u8, 215u8, 51u8, + ], + ) + } + #[doc = " Metadata for the pool."] + pub fn metadata( + &self, + _0: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "Metadata", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 108u8, 250u8, 163u8, 54u8, 192u8, 143u8, 239u8, 62u8, 97u8, 163u8, + 161u8, 215u8, 171u8, 225u8, 49u8, 18u8, 37u8, 200u8, 143u8, 254u8, + 136u8, 26u8, 54u8, 187u8, 39u8, 3u8, 216u8, 24u8, 188u8, 25u8, 243u8, + 251u8, + ], + ) + } + #[doc = " Metadata for the pool."] + pub fn metadata_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "Metadata", + Vec::new(), + [ + 108u8, 250u8, 163u8, 54u8, 192u8, 143u8, 239u8, 62u8, 97u8, 163u8, + 161u8, 215u8, 171u8, 225u8, 49u8, 18u8, 37u8, 200u8, 143u8, 254u8, + 136u8, 26u8, 54u8, 187u8, 39u8, 3u8, 216u8, 24u8, 188u8, 25u8, 243u8, + 251u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_metadata( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForMetadata", + vec![], + [ + 190u8, 232u8, 77u8, 134u8, 245u8, 89u8, 160u8, 187u8, 163u8, 68u8, + 188u8, 204u8, 31u8, 145u8, 219u8, 165u8, 213u8, 1u8, 167u8, 90u8, + 175u8, 218u8, 147u8, 144u8, 158u8, 226u8, 23u8, 233u8, 55u8, 168u8, + 161u8, 237u8, + ], + ) + } + #[doc = " Ever increasing number of all pools created so far."] + pub fn last_pool_id( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "LastPoolId", + vec![], + [ + 50u8, 254u8, 218u8, 41u8, 213u8, 184u8, 170u8, 166u8, 31u8, 29u8, + 196u8, 57u8, 215u8, 20u8, 40u8, 40u8, 19u8, 22u8, 9u8, 184u8, 11u8, + 21u8, 21u8, 125u8, 97u8, 38u8, 219u8, 209u8, 2u8, 238u8, 247u8, 51u8, + ], + ) + } + #[doc = " A reverse lookup from the pool's account id to its id."] + #[doc = ""] + #[doc = " This is only used for slashing. In all other instances, the pool id is used, and the"] + #[doc = " accounts are deterministically derived from it."] + pub fn reverse_pool_id_lookup( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "ReversePoolIdLookup", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 178u8, 161u8, 51u8, 220u8, 128u8, 1u8, 135u8, 83u8, 236u8, 159u8, 36u8, + 237u8, 120u8, 128u8, 6u8, 191u8, 41u8, 159u8, 94u8, 178u8, 174u8, + 235u8, 221u8, 173u8, 44u8, 81u8, 211u8, 255u8, 231u8, 81u8, 16u8, 87u8, + ], + ) + } + #[doc = " A reverse lookup from the pool's account id to its id."] + #[doc = ""] + #[doc = " This is only used for slashing. In all other instances, the pool id is used, and the"] + #[doc = " accounts are deterministically derived from it."] + pub fn reverse_pool_id_lookup_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "ReversePoolIdLookup", + Vec::new(), + [ + 178u8, 161u8, 51u8, 220u8, 128u8, 1u8, 135u8, 83u8, 236u8, 159u8, 36u8, + 237u8, 120u8, 128u8, 6u8, 191u8, 41u8, 159u8, 94u8, 178u8, 174u8, + 235u8, 221u8, 173u8, 44u8, 81u8, 211u8, 255u8, 231u8, 81u8, 16u8, 87u8, + ], + ) + } + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_reverse_pool_id_lookup( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "NominationPools", + "CounterForReversePoolIdLookup", + vec![], + [ + 148u8, 83u8, 81u8, 33u8, 188u8, 72u8, 148u8, 208u8, 245u8, 178u8, 52u8, + 245u8, 229u8, 140u8, 100u8, 152u8, 8u8, 217u8, 161u8, 80u8, 226u8, + 42u8, 15u8, 252u8, 90u8, 197u8, 120u8, 114u8, 144u8, 90u8, 199u8, + 123u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The nomination pool's pallet id."] + pub fn pallet_id( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType, + > { + ::subxt::constants::StaticConstantAddress::new( + "NominationPools", + "PalletId", + [ + 139u8, 109u8, 228u8, 151u8, 252u8, 32u8, 130u8, 69u8, 112u8, 154u8, + 174u8, 45u8, 83u8, 245u8, 51u8, 132u8, 173u8, 5u8, 186u8, 24u8, 243u8, + 9u8, 12u8, 214u8, 80u8, 74u8, 69u8, 189u8, 30u8, 94u8, 22u8, 39u8, + ], + ) + } + #[doc = " The maximum pool points-to-balance ratio that an `open` pool can have."] + #[doc = ""] + #[doc = " This is important in the event slashing takes place and the pool's points-to-balance"] + #[doc = " ratio becomes disproportional."] + #[doc = ""] + #[doc = " Moreover, this relates to the `RewardCounter` type as well, as the arithmetic operations"] + #[doc = " are a function of number of points, and by setting this value to e.g. 10, you ensure"] + #[doc = " that the total number of points in the system are at most 10 times the total_issuance of"] + #[doc = " the chain, in the absolute worse case."] + #[doc = ""] + #[doc = " For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1."] + #[doc = " Such a scenario would also be the equivalent of the pool being 90% slashed."] + pub fn max_points_to_balance( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u8>, + > { + ::subxt::constants::StaticConstantAddress::new( + "NominationPools", + "MaxPointsToBalance", + [ + 141u8, 130u8, 11u8, 35u8, 226u8, 114u8, 92u8, 179u8, 168u8, 110u8, + 28u8, 91u8, 221u8, 64u8, 4u8, 148u8, 201u8, 193u8, 185u8, 66u8, 226u8, + 114u8, 97u8, 79u8, 62u8, 212u8, 202u8, 114u8, 237u8, 228u8, 183u8, + 165u8, + ], + ) + } + } + } + } + pub mod identity { + use super::{root_mod, runtime_types}; + #[doc = "Identity pallet declaration."] + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AddRegistrar { + pub account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetIdentity { + pub info: ::std::boxed::Box, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetSubs { + pub subs: ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::pallet_identity::types::Data, + )>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ClearIdentity; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RequestJudgement { + #[codec(compact)] + pub reg_index: ::core::primitive::u32, + #[codec(compact)] + pub max_fee: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CancelRequest { + pub reg_index: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetFee { + #[codec(compact)] + pub index: ::core::primitive::u32, + #[codec(compact)] + pub fee: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetAccountId { + #[codec(compact)] + pub index: ::core::primitive::u32, + pub new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SetFields { + #[codec(compact)] + pub index: ::core::primitive::u32, + pub fields: runtime_types::pallet_identity::types::BitFlags< + runtime_types::pallet_identity::types::IdentityField, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ProvideJudgement { + #[codec(compact)] + pub reg_index: ::core::primitive::u32, + pub target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub judgement: + runtime_types::pallet_identity::types::Judgement<::core::primitive::u128>, + pub identity: ::subxt::ext::sp_core::H256, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct KillIdentity { + pub target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AddSub { + pub sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub data: runtime_types::pallet_identity::types::Data, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RenameSub { + pub sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pub data: runtime_types::pallet_identity::types::Data, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RemoveSub { + pub sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct QuitSub; + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Add a registrar to the system."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `T::RegistrarOrigin`."] + #[doc = ""] + #[doc = "- `account`: the account of the registrar."] + #[doc = ""] + #[doc = "Emits `RegistrarAdded` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)` where `R` registrar-count (governance-bounded and code-bounded)."] + #[doc = "- One storage mutation (codec `O(R)`)."] + #[doc = "- One event."] + #[doc = "# "] + pub fn add_registrar( + &self, + account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "add_registrar", + AddRegistrar { account }, + [ + 157u8, 232u8, 252u8, 190u8, 203u8, 233u8, 127u8, 63u8, 111u8, 16u8, + 118u8, 200u8, 31u8, 234u8, 144u8, 111u8, 161u8, 224u8, 217u8, 86u8, + 179u8, 254u8, 162u8, 212u8, 248u8, 8u8, 125u8, 89u8, 23u8, 195u8, 4u8, + 231u8, + ], + ) + } + #[doc = "Set an account's identity information and reserve the appropriate deposit."] + #[doc = ""] + #[doc = "If the account already has identity information, the deposit is taken as part payment"] + #[doc = "for the new deposit."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `info`: The identity information."] + #[doc = ""] + #[doc = "Emits `IdentitySet` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(X + X' + R)`"] + #[doc = " - where `X` additional-field-count (deposit-bounded and code-bounded)"] + #[doc = " - where `R` judgements-count (registrar-count-bounded)"] + #[doc = "- One balance reserve operation."] + #[doc = "- One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`)."] + #[doc = "- One event."] + #[doc = "# "] + pub fn set_identity( + &self, + info: runtime_types::pallet_identity::types::IdentityInfo, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "set_identity", + SetIdentity { + info: ::std::boxed::Box::new(info), + }, + [ + 130u8, 89u8, 118u8, 6u8, 134u8, 166u8, 35u8, 192u8, 73u8, 6u8, 171u8, + 20u8, 225u8, 255u8, 152u8, 142u8, 111u8, 8u8, 206u8, 200u8, 64u8, 52u8, + 110u8, 123u8, 42u8, 101u8, 191u8, 242u8, 133u8, 139u8, 154u8, 205u8, + ], + ) + } + #[doc = "Set the sub-accounts of the sender."] + #[doc = ""] + #[doc = "Payment: Any aggregate balance reserved by previous `set_subs` calls will be returned"] + #[doc = "and an amount `SubAccountDeposit` will be reserved for each item in `subs`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "identity."] + #[doc = ""] + #[doc = "- `subs`: The identity's (new) sub-accounts."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(P + S)`"] + #[doc = " - where `P` old-subs-count (hard- and deposit-bounded)."] + #[doc = " - where `S` subs-count (hard- and deposit-bounded)."] + #[doc = "- At most one balance operations."] + #[doc = "- DB:"] + #[doc = " - `P + S` storage mutations (codec complexity `O(1)`)"] + #[doc = " - One storage read (codec complexity `O(P)`)."] + #[doc = " - One storage write (codec complexity `O(S)`)."] + #[doc = " - One storage-exists (`IdentityOf::contains_key`)."] + #[doc = "# "] + pub fn set_subs( + &self, + subs: ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::pallet_identity::types::Data, + )>, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "set_subs", + SetSubs { subs }, + [ + 177u8, 219u8, 84u8, 183u8, 5u8, 32u8, 192u8, 82u8, 174u8, 68u8, 198u8, + 224u8, 56u8, 85u8, 134u8, 171u8, 30u8, 132u8, 140u8, 236u8, 117u8, + 24u8, 150u8, 218u8, 146u8, 194u8, 144u8, 92u8, 103u8, 206u8, 46u8, + 90u8, + ], + ) + } + #[doc = "Clear an account's identity info and all sub-accounts and return all deposits."] + #[doc = ""] + #[doc = "Payment: All reserved balances on the account are returned."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "identity."] + #[doc = ""] + #[doc = "Emits `IdentityCleared` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + S + X)`"] + #[doc = " - where `R` registrar-count (governance-bounded)."] + #[doc = " - where `S` subs-count (hard- and deposit-bounded)."] + #[doc = " - where `X` additional-field-count (deposit-bounded and code-bounded)."] + #[doc = "- One balance-unreserve operation."] + #[doc = "- `2` storage reads and `S + 2` storage deletions."] + #[doc = "- One event."] + #[doc = "# "] + pub fn clear_identity(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "clear_identity", + ClearIdentity {}, + [ + 75u8, 44u8, 74u8, 122u8, 149u8, 202u8, 114u8, 230u8, 0u8, 255u8, 140u8, + 122u8, 14u8, 196u8, 205u8, 249u8, 220u8, 94u8, 216u8, 34u8, 63u8, 14u8, + 8u8, 205u8, 74u8, 23u8, 181u8, 129u8, 252u8, 110u8, 231u8, 114u8, + ], + ) + } + #[doc = "Request a judgement from a registrar."] + #[doc = ""] + #[doc = "Payment: At most `max_fee` will be reserved for payment to the registrar if judgement"] + #[doc = "given."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a"] + #[doc = "registered identity."] + #[doc = ""] + #[doc = "- `reg_index`: The index of the registrar whose judgement is requested."] + #[doc = "- `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:"] + #[doc = ""] + #[doc = "```nocompile"] + #[doc = "Self::registrars().get(reg_index).unwrap().fee"] + #[doc = "```"] + #[doc = ""] + #[doc = "Emits `JudgementRequested` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- Storage: 1 read `O(R)`, 1 mutate `O(X + R)`."] + #[doc = "- One event."] + #[doc = "# "] + pub fn request_judgement( + &self, + reg_index: ::core::primitive::u32, + max_fee: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "request_judgement", + RequestJudgement { reg_index, max_fee }, + [ + 186u8, 149u8, 61u8, 54u8, 159u8, 194u8, 77u8, 161u8, 220u8, 157u8, 3u8, + 216u8, 23u8, 105u8, 119u8, 76u8, 144u8, 198u8, 157u8, 45u8, 235u8, + 139u8, 87u8, 82u8, 81u8, 12u8, 25u8, 134u8, 225u8, 92u8, 182u8, 101u8, + ], + ) + } + #[doc = "Cancel a previous request."] + #[doc = ""] + #[doc = "Payment: A previously reserved deposit is returned on success."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a"] + #[doc = "registered identity."] + #[doc = ""] + #[doc = "- `reg_index`: The index of the registrar whose judgement is no longer requested."] + #[doc = ""] + #[doc = "Emits `JudgementUnrequested` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- One storage mutation `O(R + X)`."] + #[doc = "- One event"] + #[doc = "# "] + pub fn cancel_request( + &self, + reg_index: ::core::primitive::u32, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "cancel_request", + CancelRequest { reg_index }, + [ + 83u8, 180u8, 239u8, 126u8, 32u8, 51u8, 17u8, 20u8, 180u8, 3u8, 59u8, + 96u8, 24u8, 32u8, 136u8, 92u8, 58u8, 254u8, 68u8, 70u8, 50u8, 11u8, + 51u8, 91u8, 180u8, 79u8, 81u8, 84u8, 216u8, 138u8, 6u8, 215u8, + ], + ) + } + #[doc = "Set the fee required for a judgement to be requested from a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `fee`: the new fee."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 7.315 + R * 0.329 µs (min squares analysis)"] + #[doc = "# "] + pub fn set_fee( + &self, + index: ::core::primitive::u32, + fee: ::core::primitive::u128, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "set_fee", + SetFee { index, fee }, + [ + 21u8, 157u8, 123u8, 182u8, 160u8, 190u8, 117u8, 37u8, 136u8, 133u8, + 104u8, 234u8, 31u8, 145u8, 115u8, 154u8, 125u8, 40u8, 2u8, 87u8, 118u8, + 56u8, 247u8, 73u8, 89u8, 0u8, 251u8, 3u8, 58u8, 105u8, 239u8, 211u8, + ], + ) + } + #[doc = "Change the account associated with a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `new`: the new account ID."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 8.823 + R * 0.32 µs (min squares analysis)"] + #[doc = "# "] + pub fn set_account_id( + &self, + index: ::core::primitive::u32, + new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "set_account_id", + SetAccountId { index, new }, + [ + 13u8, 91u8, 36u8, 7u8, 88u8, 64u8, 151u8, 104u8, 94u8, 174u8, 195u8, + 99u8, 97u8, 181u8, 236u8, 251u8, 26u8, 236u8, 234u8, 40u8, 183u8, 38u8, + 220u8, 216u8, 48u8, 115u8, 7u8, 230u8, 216u8, 28u8, 123u8, 11u8, + ], + ) + } + #[doc = "Set the field information for a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `fields`: the fields that the registrar concerns themselves with."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 7.464 + R * 0.325 µs (min squares analysis)"] + #[doc = "# "] + pub fn set_fields( + &self, + index: ::core::primitive::u32, + fields: runtime_types::pallet_identity::types::BitFlags< + runtime_types::pallet_identity::types::IdentityField, + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "set_fields", + SetFields { index, fields }, + [ + 50u8, 196u8, 179u8, 71u8, 66u8, 65u8, 235u8, 7u8, 51u8, 14u8, 81u8, + 173u8, 201u8, 58u8, 6u8, 151u8, 174u8, 245u8, 102u8, 184u8, 28u8, 84u8, + 125u8, 93u8, 126u8, 134u8, 92u8, 203u8, 200u8, 129u8, 240u8, 252u8, + ], + ) + } + #[doc = "Provide a judgement for an account's identity."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `reg_index`."] + #[doc = ""] + #[doc = "- `reg_index`: the index of the registrar whose judgement is being made."] + #[doc = "- `target`: the account whose identity the judgement is upon. This must be an account"] + #[doc = " with a registered identity."] + #[doc = "- `judgement`: the judgement of the registrar of index `reg_index` about `target`."] + #[doc = "- `identity`: The hash of the [`IdentityInfo`] for that the judgement is provided."] + #[doc = ""] + #[doc = "Emits `JudgementGiven` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-transfer operation."] + #[doc = "- Up to one account-lookup operation."] + #[doc = "- Storage: 1 read `O(R)`, 1 mutate `O(R + X)`."] + #[doc = "- One event."] + #[doc = "# "] + pub fn provide_judgement( + &self, + reg_index: ::core::primitive::u32, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + judgement: runtime_types::pallet_identity::types::Judgement< + ::core::primitive::u128, + >, + identity: ::subxt::ext::sp_core::H256, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "provide_judgement", + ProvideJudgement { + reg_index, + target, + judgement, + identity, + }, + [ + 147u8, 66u8, 29u8, 90u8, 149u8, 65u8, 161u8, 115u8, 12u8, 254u8, 188u8, + 248u8, 165u8, 115u8, 191u8, 2u8, 167u8, 223u8, 199u8, 169u8, 203u8, + 64u8, 101u8, 217u8, 73u8, 185u8, 93u8, 109u8, 22u8, 184u8, 146u8, 73u8, + ], + ) + } + #[doc = "Remove an account's identity and sub-account information and slash the deposits."] + #[doc = ""] + #[doc = "Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by"] + #[doc = "`Slash`. Verification request deposits are not returned; they should be cancelled"] + #[doc = "manually using `cancel_request`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must match `T::ForceOrigin`."] + #[doc = ""] + #[doc = "- `target`: the account whose identity the judgement is upon. This must be an account"] + #[doc = " with a registered identity."] + #[doc = ""] + #[doc = "Emits `IdentityKilled` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + S + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- `S + 2` storage mutations."] + #[doc = "- One event."] + #[doc = "# "] + pub fn kill_identity( + &self, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "kill_identity", + KillIdentity { target }, + [ + 76u8, 13u8, 158u8, 219u8, 221u8, 0u8, 151u8, 241u8, 137u8, 136u8, + 179u8, 194u8, 188u8, 230u8, 56u8, 16u8, 254u8, 28u8, 127u8, 216u8, + 205u8, 117u8, 224u8, 121u8, 240u8, 231u8, 126u8, 181u8, 230u8, 68u8, + 13u8, 174u8, + ], + ) + } + #[doc = "Add the given account to the sender's subs."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + pub fn add_sub( + &self, + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + data: runtime_types::pallet_identity::types::Data, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "add_sub", + AddSub { sub, data }, + [ + 122u8, 218u8, 25u8, 93u8, 33u8, 176u8, 191u8, 254u8, 223u8, 147u8, + 100u8, 135u8, 86u8, 71u8, 47u8, 163u8, 105u8, 222u8, 162u8, 173u8, + 207u8, 182u8, 130u8, 128u8, 214u8, 242u8, 101u8, 250u8, 242u8, 24u8, + 17u8, 84u8, + ], + ) + } + #[doc = "Alter the associated name of the given sub-account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + pub fn rename_sub( + &self, + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + data: runtime_types::pallet_identity::types::Data, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "rename_sub", + RenameSub { sub, data }, + [ + 166u8, 167u8, 49u8, 114u8, 199u8, 168u8, 187u8, 221u8, 100u8, 85u8, + 147u8, 211u8, 157u8, 31u8, 109u8, 135u8, 194u8, 135u8, 15u8, 89u8, + 59u8, 57u8, 252u8, 163u8, 9u8, 138u8, 216u8, 189u8, 177u8, 42u8, 96u8, + 34u8, + ], + ) + } + #[doc = "Remove the given account from the sender's subs."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + pub fn remove_sub( + &self, + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + ) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "remove_sub", + RemoveSub { sub }, + [ + 106u8, 223u8, 210u8, 67u8, 54u8, 11u8, 144u8, 222u8, 42u8, 46u8, 157u8, + 33u8, 13u8, 245u8, 166u8, 195u8, 227u8, 81u8, 224u8, 149u8, 154u8, + 158u8, 187u8, 203u8, 215u8, 91u8, 43u8, 105u8, 69u8, 213u8, 141u8, + 124u8, + ], + ) + } + #[doc = "Remove the sender as a sub-account."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender (*not* the original depositor)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "super-identity."] + #[doc = ""] + #[doc = "NOTE: This should not normally be used, but is provided in the case that the non-"] + #[doc = "controller of an account is maliciously registered as a sub-account."] + pub fn quit_sub(&self) -> ::subxt::tx::StaticTxPayload { + ::subxt::tx::StaticTxPayload::new( + "Identity", + "quit_sub", + QuitSub {}, + [ + 62u8, 57u8, 73u8, 72u8, 119u8, 216u8, 250u8, 155u8, 57u8, 169u8, 157u8, + 44u8, 87u8, 51u8, 63u8, 231u8, 77u8, 7u8, 0u8, 119u8, 244u8, 42u8, + 179u8, 51u8, 254u8, 240u8, 55u8, 25u8, 142u8, 38u8, 87u8, 44u8, + ], + ) + } + } + } + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub type Event = runtime_types::pallet_identity::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A name was set or reset (which will remove all judgements)."] + pub struct IdentitySet { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + } + impl ::subxt::events::StaticEvent for IdentitySet { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "IdentitySet"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A name was cleared, and the given balance returned."] + pub struct IdentityCleared { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub deposit: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for IdentityCleared { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "IdentityCleared"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A name was removed and the given balance slashed."] + pub struct IdentityKilled { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub deposit: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for IdentityKilled { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "IdentityKilled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A judgement was asked from a registrar."] + pub struct JudgementRequested { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub registrar_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for JudgementRequested { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "JudgementRequested"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A judgement request was retracted."] + pub struct JudgementUnrequested { + pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub registrar_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for JudgementUnrequested { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "JudgementUnrequested"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A judgement was given by a registrar."] + pub struct JudgementGiven { + pub target: ::subxt::ext::sp_core::crypto::AccountId32, + pub registrar_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for JudgementGiven { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "JudgementGiven"; + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A registrar was added."] + pub struct RegistrarAdded { + pub registrar_index: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for RegistrarAdded { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "RegistrarAdded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A sub-identity was added to an identity and the deposit paid."] + pub struct SubIdentityAdded { + pub sub: ::subxt::ext::sp_core::crypto::AccountId32, + pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub deposit: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for SubIdentityAdded { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "SubIdentityAdded"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A sub-identity was removed from an identity and the deposit freed."] + pub struct SubIdentityRemoved { + pub sub: ::subxt::ext::sp_core::crypto::AccountId32, + pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub deposit: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for SubIdentityRemoved { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "SubIdentityRemoved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "A sub-identity was cleared, and the given deposit repatriated from the"] + #[doc = "main identity account to the sub-identity account."] + pub struct SubIdentityRevoked { + pub sub: ::subxt::ext::sp_core::crypto::AccountId32, + pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub deposit: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for SubIdentityRevoked { + const PALLET: &'static str = "Identity"; + const EVENT: &'static str = "SubIdentityRevoked"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Information that is pertinent to identify the entity behind an account."] + #[doc = ""] + #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] + pub fn identity_of( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_identity::types::Registration< + ::core::primitive::u128, + >, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "IdentityOf", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 193u8, 195u8, 180u8, 188u8, 129u8, 250u8, 180u8, 219u8, 22u8, 95u8, + 175u8, 170u8, 143u8, 188u8, 80u8, 124u8, 234u8, 228u8, 245u8, 39u8, + 72u8, 153u8, 107u8, 199u8, 23u8, 75u8, 47u8, 247u8, 104u8, 208u8, + 171u8, 82u8, + ], + ) + } + #[doc = " Information that is pertinent to identify the entity behind an account."] + #[doc = ""] + #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] + pub fn identity_of_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::pallet_identity::types::Registration< + ::core::primitive::u128, + >, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "IdentityOf", + Vec::new(), + [ + 193u8, 195u8, 180u8, 188u8, 129u8, 250u8, 180u8, 219u8, 22u8, 95u8, + 175u8, 170u8, 143u8, 188u8, 80u8, 124u8, 234u8, 228u8, 245u8, 39u8, + 72u8, 153u8, 107u8, 199u8, 23u8, 75u8, 47u8, 247u8, 104u8, 208u8, + 171u8, 82u8, + ], + ) + } + #[doc = " The super-identity of an alternative \"sub\" identity together with its name, within that"] + #[doc = " context. If the account is not some other account's sub-identity, then just `None`."] + pub fn super_of( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::pallet_identity::types::Data, + )>, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "SuperOf", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Blake2_128Concat, + )], + [ + 170u8, 249u8, 112u8, 249u8, 75u8, 176u8, 21u8, 29u8, 152u8, 149u8, + 69u8, 113u8, 20u8, 92u8, 113u8, 130u8, 135u8, 62u8, 18u8, 204u8, 166u8, + 193u8, 133u8, 167u8, 248u8, 117u8, 80u8, 137u8, 158u8, 111u8, 100u8, + 137u8, + ], + ) + } + #[doc = " The super-identity of an alternative \"sub\" identity together with its name, within that"] + #[doc = " context. If the account is not some other account's sub-identity, then just `None`."] + pub fn super_of_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::pallet_identity::types::Data, + )>, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "SuperOf", + Vec::new(), + [ + 170u8, 249u8, 112u8, 249u8, 75u8, 176u8, 21u8, 29u8, 152u8, 149u8, + 69u8, 113u8, 20u8, 92u8, 113u8, 130u8, 135u8, 62u8, 18u8, 204u8, 166u8, + 193u8, 133u8, 167u8, 248u8, 117u8, 80u8, 137u8, 158u8, 111u8, 100u8, + 137u8, + ], + ) + } + #[doc = " Alternative \"sub\" identities of this account."] + #[doc = ""] + #[doc = " The first item is the deposit, the second is a vector of the accounts."] + #[doc = ""] + #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] + pub fn subs_of( + &self, + _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::core::primitive::u128, + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + )>, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "SubsOf", + vec![::subxt::storage::address::StorageMapKey::new( + _0.borrow(), + ::subxt::storage::address::StorageHasher::Twox64Concat, + )], + [ + 128u8, 15u8, 175u8, 155u8, 216u8, 225u8, 200u8, 169u8, 215u8, 206u8, + 110u8, 22u8, 204u8, 89u8, 212u8, 210u8, 159u8, 169u8, 53u8, 7u8, 44u8, + 164u8, 91u8, 151u8, 7u8, 227u8, 38u8, 230u8, 175u8, 84u8, 6u8, 4u8, + ], + ) + } + #[doc = " Alternative \"sub\" identities of this account."] + #[doc = ""] + #[doc = " The first item is the deposit, the second is a vector of the accounts."] + #[doc = ""] + #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] + pub fn subs_of_root( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType<( + ::core::primitive::u128, + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + )>, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "SubsOf", + Vec::new(), + [ + 128u8, 15u8, 175u8, 155u8, 216u8, 225u8, 200u8, 169u8, 215u8, 206u8, + 110u8, 22u8, 204u8, 89u8, 212u8, 210u8, 159u8, 169u8, 53u8, 7u8, 44u8, + 164u8, 91u8, 151u8, 7u8, 227u8, 38u8, 230u8, 175u8, 84u8, 6u8, 4u8, + ], + ) + } + #[doc = " The set of registrars. Not expected to get very big as can only be added through a"] + #[doc = " special origin (likely a council motion)."] + #[doc = ""] + #[doc = " The index into this can be cast to `RegistrarIndex` to get a valid value."] + pub fn registrars( + &self, + ) -> ::subxt::storage::address::StaticStorageAddress< + ::subxt::metadata::DecodeStaticType< + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::option::Option< + runtime_types::pallet_identity::types::RegistrarInfo< + ::core::primitive::u128, + ::subxt::ext::sp_core::crypto::AccountId32, + >, + >, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::StaticStorageAddress::new( + "Identity", + "Registrars", + vec![], + [ + 157u8, 87u8, 39u8, 240u8, 154u8, 54u8, 241u8, 229u8, 76u8, 9u8, 62u8, + 252u8, 40u8, 143u8, 186u8, 182u8, 233u8, 187u8, 251u8, 61u8, 236u8, + 229u8, 19u8, 55u8, 42u8, 36u8, 82u8, 173u8, 215u8, 155u8, 229u8, 111u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The amount held on deposit for a registered identity"] + pub fn basic_deposit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "BasicDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount held on deposit per additional field for a registered identity."] + pub fn field_deposit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "FieldDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount held on deposit for a registered subaccount. This should account for the fact"] + #[doc = " that one storage item's value will increase by the size of an account ID, and there will"] + #[doc = " be another trie item whose value is the size of an account ID plus 32 bytes."] + pub fn sub_account_deposit( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "SubAccountDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The maximum number of sub-accounts allowed per identified account."] + pub fn max_sub_accounts( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "MaxSubAccounts", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O"] + #[doc = " required to access an identity, but can be pretty high."] + pub fn max_additional_fields( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "MaxAdditionalFields", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " Maxmimum number of registrars allowed in the system. Needed to bound the complexity"] + #[doc = " of, e.g., updating judgements."] + pub fn max_registrars( + &self, + ) -> ::subxt::constants::StaticConstantAddress< + ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, + > { + ::subxt::constants::StaticConstantAddress::new( + "Identity", + "MaxRegistrars", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod runtime_types { + use super::runtime_types; + pub mod aleph_runtime { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum OriginCaller { + #[codec(index = 0)] + system( + runtime_types::frame_support::dispatch::RawOrigin< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + ), + #[codec(index = 1)] + Void(runtime_types::sp_core::Void), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Runtime; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum RuntimeCall { + #[codec(index = 0)] + System(runtime_types::frame_system::pallet::Call), + #[codec(index = 2)] + Scheduler(runtime_types::pallet_scheduler::pallet::Call), + #[codec(index = 4)] + Timestamp(runtime_types::pallet_timestamp::pallet::Call), + #[codec(index = 5)] + Balances(runtime_types::pallet_balances::pallet::Call), + #[codec(index = 8)] + Staking(runtime_types::pallet_staking::pallet::pallet::Call), + #[codec(index = 10)] + Session(runtime_types::pallet_session::pallet::Call), + #[codec(index = 11)] + Aleph(runtime_types::pallet_aleph::pallet::Call), + #[codec(index = 12)] + Elections(runtime_types::pallet_elections::pallet::Call), + #[codec(index = 13)] + Treasury(runtime_types::pallet_treasury::pallet::Call), + #[codec(index = 14)] + Vesting(runtime_types::pallet_vesting::pallet::Call), + #[codec(index = 15)] + Utility(runtime_types::pallet_utility::pallet::Call), + #[codec(index = 16)] + Multisig(runtime_types::pallet_multisig::pallet::Call), + #[codec(index = 17)] + Sudo(runtime_types::pallet_sudo::pallet::Call), + #[codec(index = 18)] + Contracts(runtime_types::pallet_contracts::pallet::Call), + #[codec(index = 19)] + NominationPools(runtime_types::pallet_nomination_pools::pallet::Call), + #[codec(index = 20)] + Identity(runtime_types::pallet_identity::pallet::Call), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum RuntimeEvent { + #[codec(index = 0)] + System(runtime_types::frame_system::pallet::Event), + #[codec(index = 2)] + Scheduler(runtime_types::pallet_scheduler::pallet::Event), + #[codec(index = 5)] + Balances(runtime_types::pallet_balances::pallet::Event), + #[codec(index = 6)] + TransactionPayment(runtime_types::pallet_transaction_payment::pallet::Event), + #[codec(index = 8)] + Staking(runtime_types::pallet_staking::pallet::pallet::Event), + #[codec(index = 10)] + Session(runtime_types::pallet_session::pallet::Event), + #[codec(index = 11)] + Aleph(runtime_types::pallet_aleph::pallet::Event), + #[codec(index = 12)] + Elections(runtime_types::pallet_elections::pallet::Event), + #[codec(index = 13)] + Treasury(runtime_types::pallet_treasury::pallet::Event), + #[codec(index = 14)] + Vesting(runtime_types::pallet_vesting::pallet::Event), + #[codec(index = 15)] + Utility(runtime_types::pallet_utility::pallet::Event), + #[codec(index = 16)] + Multisig(runtime_types::pallet_multisig::pallet::Event), + #[codec(index = 17)] + Sudo(runtime_types::pallet_sudo::pallet::Event), + #[codec(index = 18)] + Contracts(runtime_types::pallet_contracts::pallet::Event), + #[codec(index = 19)] + NominationPools(runtime_types::pallet_nomination_pools::pallet::Event), + #[codec(index = 20)] + Identity(runtime_types::pallet_identity::pallet::Event), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SessionKeys { + pub aura: runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + pub aleph: runtime_types::primitives::app::Public, + } + } + pub mod frame_support { + use super::runtime_types; + pub mod dispatch { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum DispatchClass { + #[codec(index = 0)] + Normal, + #[codec(index = 1)] + Operational, + #[codec(index = 2)] + Mandatory, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct DispatchInfo { + pub weight: runtime_types::sp_weights::weight_v2::Weight, + pub class: runtime_types::frame_support::dispatch::DispatchClass, + pub pays_fee: runtime_types::frame_support::dispatch::Pays, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Pays { + #[codec(index = 0)] + Yes, + #[codec(index = 1)] + No, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PerDispatchClass<_0> { + pub normal: _0, + pub operational: _0, + pub mandatory: _0, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum RawOrigin<_0> { + #[codec(index = 0)] + Root, + #[codec(index = 1)] + Signed(_0), + #[codec(index = 2)] + None, + } + } + pub mod traits { + use super::runtime_types; + pub mod preimages { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Bounded<_0> { + #[codec(index = 0)] + Legacy { + hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 1)] + Inline( + runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + ), + #[codec(index = 2)] + Lookup { + hash: ::subxt::ext::sp_core::H256, + len: ::core::primitive::u32, + }, + __Ignore(::core::marker::PhantomData<_0>), + } + } + pub mod tokens { + use super::runtime_types; + pub mod misc { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum BalanceStatus { + #[codec(index = 0)] + Free, + #[codec(index = 1)] + Reserved, + } + } + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PalletId(pub [::core::primitive::u8; 8usize]); + } + pub mod frame_system { + use super::runtime_types; + pub mod extensions { + use super::runtime_types; + pub mod check_genesis { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckGenesis; + } + pub mod check_mortality { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckMortality(pub runtime_types::sp_runtime::generic::era::Era); + } + pub mod check_nonce { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckNonce(#[codec(compact)] pub ::core::primitive::u32); + } + pub mod check_spec_version { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckSpecVersion; + } + pub mod check_tx_version { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckTxVersion; + } + pub mod check_weight { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CheckWeight; + } + } + pub mod limits { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BlockLength { + pub max: runtime_types::frame_support::dispatch::PerDispatchClass< + ::core::primitive::u32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BlockWeights { + pub base_block: runtime_types::sp_weights::weight_v2::Weight, + pub max_block: runtime_types::sp_weights::weight_v2::Weight, + pub per_class: runtime_types::frame_support::dispatch::PerDispatchClass< + runtime_types::frame_system::limits::WeightsPerClass, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct WeightsPerClass { + pub base_extrinsic: runtime_types::sp_weights::weight_v2::Weight, + pub max_extrinsic: + ::core::option::Option, + pub max_total: + ::core::option::Option, + pub reserved: + ::core::option::Option, + } + } + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Make some on-chain remark."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`"] + #[doc = "# "] + remark { + remark: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 1)] + #[doc = "Set the number of pages in the WebAssembly environment's heap."] + set_heap_pages { pages: ::core::primitive::u64 }, + #[codec(index = 2)] + #[doc = "Set the new runtime code."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`"] + #[doc = "- 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is"] + #[doc = " expensive)."] + #[doc = "- 1 storage write (codec `O(C)`)."] + #[doc = "- 1 digest item."] + #[doc = "- 1 event."] + #[doc = "The weight of this function is dependent on the runtime, but generally this is very"] + #[doc = "expensive. We will treat this as a full block."] + #[doc = "# "] + set_code { + code: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 3)] + #[doc = "Set the new runtime code without doing any checks of the given `code`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(C)` where `C` length of `code`"] + #[doc = "- 1 storage write (codec `O(C)`)."] + #[doc = "- 1 digest item."] + #[doc = "- 1 event."] + #[doc = "The weight of this function is dependent on the runtime. We will treat this as a full"] + #[doc = "block. # "] + set_code_without_checks { + code: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 4)] + #[doc = "Set some items of storage."] + set_storage { + items: ::std::vec::Vec<( + ::std::vec::Vec<::core::primitive::u8>, + ::std::vec::Vec<::core::primitive::u8>, + )>, + }, + #[codec(index = 5)] + #[doc = "Kill some items from storage."] + kill_storage { + keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, + }, + #[codec(index = 6)] + #[doc = "Kill all storage items with a key that starts with the given prefix."] + #[doc = ""] + #[doc = "**NOTE:** We rely on the Root origin to provide us the number of subkeys under"] + #[doc = "the prefix we are removing to accurately calculate the weight of this function."] + kill_prefix { + prefix: ::std::vec::Vec<::core::primitive::u8>, + subkeys: ::core::primitive::u32, + }, + #[codec(index = 7)] + #[doc = "Make some on-chain remark and emit event."] + remark_with_event { + remark: ::std::vec::Vec<::core::primitive::u8>, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Error for the System pallet"] + pub enum Error { + #[codec(index = 0)] + #[doc = "The name of specification does not match between the current runtime"] + #[doc = "and the new runtime."] + InvalidSpecName, + #[codec(index = 1)] + #[doc = "The specification version is not allowed to decrease between the current runtime"] + #[doc = "and the new runtime."] + SpecVersionNeedsToIncrease, + #[codec(index = 2)] + #[doc = "Failed to extract the runtime version from the new runtime."] + #[doc = ""] + #[doc = "Either calling `Core_version` or decoding `RuntimeVersion` failed."] + FailedToExtractRuntimeVersion, + #[codec(index = 3)] + #[doc = "Suicide called when the account has non-default composite data."] + NonDefaultComposite, + #[codec(index = 4)] + #[doc = "There is a non-zero reference count preventing the account from being purged."] + NonZeroRefCount, + #[codec(index = 5)] + #[doc = "The origin filter prevent the call to be dispatched."] + CallFiltered, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Event for the System pallet."] + pub enum Event { + #[codec(index = 0)] + #[doc = "An extrinsic completed successfully."] + ExtrinsicSuccess { + dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + }, + #[codec(index = 1)] + #[doc = "An extrinsic failed."] + ExtrinsicFailed { + dispatch_error: runtime_types::sp_runtime::DispatchError, + dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + }, + #[codec(index = 2)] + #[doc = "`:code` was updated."] + CodeUpdated, + #[codec(index = 3)] + #[doc = "A new account was created."] + NewAccount { + account: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 4)] + #[doc = "An account was reaped."] + KilledAccount { + account: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 5)] + #[doc = "On on-chain remark happened."] + Remarked { + sender: ::subxt::ext::sp_core::crypto::AccountId32, + hash: ::subxt::ext::sp_core::H256, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AccountInfo<_0, _1> { + pub nonce: _0, + pub consumers: _0, + pub providers: _0, + pub sufficients: _0, + pub data: _1, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct EventRecord<_0, _1> { + pub phase: runtime_types::frame_system::Phase, + pub event: _0, + pub topics: ::std::vec::Vec<_1>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct LastRuntimeUpgradeInfo { + #[codec(compact)] + pub spec_version: ::core::primitive::u32, + pub spec_name: ::std::string::String, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Phase { + #[codec(index = 0)] + ApplyExtrinsic(::core::primitive::u32), + #[codec(index = 1)] + Finalization, + #[codec(index = 2)] + Initialization, + } + } + pub mod pallet_aleph { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Sets the emergency finalization key. If called in session `N` the key can be used to"] + #[doc = "finalize blocks from session `N+2` onwards, until it gets overridden."] + set_emergency_finalizer { + emergency_finalizer: runtime_types::primitives::app::Public, + }, + #[codec(index = 1)] + #[doc = "Schedules a finality version change for a future session. If such a scheduled future"] + #[doc = "version is already set, it is replaced with the provided one."] + #[doc = "Any rescheduling of a future version change needs to occur at least 2 sessions in"] + #[doc = "advance of the provided session of the version change."] + #[doc = "In order to cancel a scheduled version change, a new version change should be scheduled"] + #[doc = "with the same version as the current one."] + schedule_finality_version_change { + version_incoming: ::core::primitive::u32, + session: ::core::primitive::u32, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + ChangeEmergencyFinalizer(runtime_types::primitives::app::Public), + #[codec(index = 1)] + ScheduleFinalityVersionChange(runtime_types::primitives::VersionChange), + #[codec(index = 2)] + FinalityVersionChange(runtime_types::primitives::VersionChange), + } + } + } + pub mod pallet_balances { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Transfer some liquid free balance to another account."] + #[doc = ""] + #[doc = "`transfer` will set the `FreeBalance` of the sender and receiver."] + #[doc = "If the sender's account is below the existential deposit as a result"] + #[doc = "of the transfer, the account will be reaped."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `Signed` by the transactor."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Dependent on arguments but not critical, given proper implementations for input config"] + #[doc = " types. See related functions below."] + #[doc = "- It contains a limited number of reads and writes internally and no complex"] + #[doc = " computation."] + #[doc = ""] + #[doc = "Related functions:"] + #[doc = ""] + #[doc = " - `ensure_can_withdraw` is always called internally but has a bounded complexity."] + #[doc = " - Transferring balances to accounts that did not exist before will cause"] + #[doc = " `T::OnNewAccount::on_new_account` to be called."] + #[doc = " - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`."] + #[doc = " - `transfer_keep_alive` works the same way as `transfer`, but has an additional check"] + #[doc = " that the transfer will not kill the origin account."] + #[doc = "---------------------------------"] + #[doc = "- Origin account is already in memory, so no DB operations for them."] + #[doc = "# "] + transfer { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 1)] + #[doc = "Set the balances of a given account."] + #[doc = ""] + #[doc = "This will alter `FreeBalance` and `ReservedBalance` in storage. it will"] + #[doc = "also alter the total issuance of the system (`TotalIssuance`) appropriately."] + #[doc = "If the new free or reserved balance is below the existential deposit,"] + #[doc = "it will reset the account nonce (`frame_system::AccountNonce`)."] + #[doc = ""] + #[doc = "The dispatch origin for this call is `root`."] + set_balance { + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + new_free: ::core::primitive::u128, + #[codec(compact)] + new_reserved: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Exactly as `transfer`, except the origin must be root and the source account may be"] + #[doc = "specified."] + #[doc = "# "] + #[doc = "- Same as transfer, but additional read and write because the source account is not"] + #[doc = " assumed to be in the overlay."] + #[doc = "# "] + force_transfer { + source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "Same as the [`transfer`] call, but with a check that the transfer will not kill the"] + #[doc = "origin account."] + #[doc = ""] + #[doc = "99% of the time you want [`transfer`] instead."] + #[doc = ""] + #[doc = "[`transfer`]: struct.Pallet.html#method.transfer"] + transfer_keep_alive { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "Transfer the entire transferable balance from the caller account."] + #[doc = ""] + #[doc = "NOTE: This function only attempts to transfer _transferable_ balances. This means that"] + #[doc = "any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be"] + #[doc = "transferred by this function. To ensure that this function results in a killed account,"] + #[doc = "you might need to prepare the account by removing any reference counters, storage"] + #[doc = "deposits, etc..."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be Signed."] + #[doc = ""] + #[doc = "- `dest`: The recipient of the transfer."] + #[doc = "- `keep_alive`: A boolean to determine if the `transfer_all` operation should send all"] + #[doc = " of the funds the account has, causing the sender account to be killed (false), or"] + #[doc = " transfer everything except at least the existential deposit, which will guarantee to"] + #[doc = " keep the sender account alive (true). # "] + #[doc = "- O(1). Just like transfer, but reading the user's transferable balance first."] + #[doc = " #"] + transfer_all { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + keep_alive: ::core::primitive::bool, + }, + #[codec(index = 5)] + #[doc = "Unreserve some balance from a user by force."] + #[doc = ""] + #[doc = "Can only be called by ROOT."] + force_unreserve { + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + amount: ::core::primitive::u128, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Vesting balance too high to send value"] + VestingBalance, + #[codec(index = 1)] + #[doc = "Account liquidity restrictions prevent withdrawal"] + LiquidityRestrictions, + #[codec(index = 2)] + #[doc = "Balance too low to send value."] + InsufficientBalance, + #[codec(index = 3)] + #[doc = "Value too low to create account due to existential deposit"] + ExistentialDeposit, + #[codec(index = 4)] + #[doc = "Transfer/payment would kill account"] + KeepAlive, + #[codec(index = 5)] + #[doc = "A vesting schedule already exists for this account"] + ExistingVestingSchedule, + #[codec(index = 6)] + #[doc = "Beneficiary account must pre-exist"] + DeadAccount, + #[codec(index = 7)] + #[doc = "Number of named reserves exceed MaxReserves"] + TooManyReserves, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "An account was created with some free balance."] + Endowed { + account: ::subxt::ext::sp_core::crypto::AccountId32, + free_balance: ::core::primitive::u128, + }, + #[codec(index = 1)] + #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] + #[doc = "resulting in an outright loss."] + DustLost { + account: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Transfer succeeded."] + Transfer { + from: ::subxt::ext::sp_core::crypto::AccountId32, + to: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "A balance was set by root."] + BalanceSet { + who: ::subxt::ext::sp_core::crypto::AccountId32, + free: ::core::primitive::u128, + reserved: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "Some balance was reserved (moved from free to reserved)."] + Reserved { + who: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "Some balance was unreserved (moved from reserved to free)."] + Unreserved { + who: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 6)] + #[doc = "Some balance was moved from the reserve of the first account to the second account."] + #[doc = "Final argument indicates the destination balance type."] + ReserveRepatriated { + from: ::subxt::ext::sp_core::crypto::AccountId32, + to: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + destination_status: + runtime_types::frame_support::traits::tokens::misc::BalanceStatus, + }, + #[codec(index = 7)] + #[doc = "Some amount was deposited (e.g. for transaction fees)."] + Deposit { + who: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 8)] + #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] + Withdraw { + who: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 9)] + #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] + Slashed { + who: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AccountData<_0> { + pub free: _0, + pub reserved: _0, + pub misc_frozen: _0, + pub fee_frozen: _0, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BalanceLock<_0> { + pub id: [::core::primitive::u8; 8usize], + pub amount: _0, + pub reasons: runtime_types::pallet_balances::Reasons, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Reasons { + #[codec(index = 0)] + Fee, + #[codec(index = 1)] + Misc, + #[codec(index = 2)] + All, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ReserveData<_0, _1> { + pub id: _0, + pub amount: _1, + } + } + pub mod pallet_contracts { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Deprecated version if [`Self::call`] for use in an in-storage `Call`."] + call_old_weight { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + #[codec(compact)] + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + data: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 1)] + #[doc = "Deprecated version if [`Self::instantiate_with_code`] for use in an in-storage `Call`."] + instantiate_with_code_old_weight { + #[codec(compact)] + value: ::core::primitive::u128, + #[codec(compact)] + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code: ::std::vec::Vec<::core::primitive::u8>, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 2)] + #[doc = "Deprecated version if [`Self::instantiate`] for use in an in-storage `Call`."] + instantiate_old_weight { + #[codec(compact)] + value: ::core::primitive::u128, + #[codec(compact)] + gas_limit: runtime_types::sp_weights::OldWeight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code_hash: ::subxt::ext::sp_core::H256, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 3)] + #[doc = "Upload new `code` without instantiating a contract from it."] + #[doc = ""] + #[doc = "If the code does not already exist a deposit is reserved from the caller"] + #[doc = "and unreserved only when [`Self::remove_code`] is called. The size of the reserve"] + #[doc = "depends on the instrumented size of the the supplied `code`."] + #[doc = ""] + #[doc = "If the code already exists in storage it will still return `Ok` and upgrades"] + #[doc = "the in storage version to the current"] + #[doc = "[`InstructionWeights::version`](InstructionWeights)."] + #[doc = ""] + #[doc = "- `determinism`: If this is set to any other value but [`Determinism::Deterministic`]"] + #[doc = " then the only way to use this code is to delegate call into it from an offchain"] + #[doc = " execution. Set to [`Determinism::Deterministic`] if in doubt."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Anyone can instantiate a contract from any uploaded code and thus prevent its removal."] + #[doc = "To avoid this situation a constructor could employ access control so that it can"] + #[doc = "only be instantiated by permissioned entities. The same is true when uploading"] + #[doc = "through [`Self::instantiate_with_code`]."] + upload_code { + code: ::std::vec::Vec<::core::primitive::u8>, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + determinism: runtime_types::pallet_contracts::wasm::Determinism, + }, + #[codec(index = 4)] + #[doc = "Remove the code stored under `code_hash` and refund the deposit to its owner."] + #[doc = ""] + #[doc = "A code can only be removed by its original uploader (its owner) and only if it is"] + #[doc = "not used by any contract."] + remove_code { + code_hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 5)] + #[doc = "Privileged function that changes the code of an existing contract."] + #[doc = ""] + #[doc = "This takes care of updating refcounts and all other necessary operations. Returns"] + #[doc = "an error if either the `code_hash` or `dest` do not exist."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "This does **not** change the address of the contract in question. This means"] + #[doc = "that the contract address is no longer derived from its code hash after calling"] + #[doc = "this dispatchable."] + set_code { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + code_hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 6)] + #[doc = "Makes a call to an account, optionally transferring some balance."] + #[doc = ""] + #[doc = "# Parameters"] + #[doc = ""] + #[doc = "* `dest`: Address of the contract to call."] + #[doc = "* `value`: The balance to transfer from the `origin` to `dest`."] + #[doc = "* `gas_limit`: The gas limit enforced when executing the constructor."] + #[doc = "* `storage_deposit_limit`: The maximum amount of balance that can be charged from the"] + #[doc = " caller to pay for the storage consumed."] + #[doc = "* `data`: The input data to pass to the contract."] + #[doc = ""] + #[doc = "* If the account is a smart-contract account, the associated code will be"] + #[doc = "executed and any value will be transferred."] + #[doc = "* If the account is a regular account, any value will be transferred."] + #[doc = "* If no account exists and the call value is not less than `existential_deposit`,"] + #[doc = "a regular account will be created and any value will be transferred."] + call { + dest: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + data: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 7)] + #[doc = "Instantiates a new contract from the supplied `code` optionally transferring"] + #[doc = "some balance."] + #[doc = ""] + #[doc = "This dispatchable has the same effect as calling [`Self::upload_code`] +"] + #[doc = "[`Self::instantiate`]. Bundling them together provides efficiency gains. Please"] + #[doc = "also check the documentation of [`Self::upload_code`]."] + #[doc = ""] + #[doc = "# Parameters"] + #[doc = ""] + #[doc = "* `value`: The balance to transfer from the `origin` to the newly created contract."] + #[doc = "* `gas_limit`: The gas limit enforced when executing the constructor."] + #[doc = "* `storage_deposit_limit`: The maximum amount of balance that can be charged/reserved"] + #[doc = " from the caller to pay for the storage consumed."] + #[doc = "* `code`: The contract code to deploy in raw bytes."] + #[doc = "* `data`: The input data to pass to the contract constructor."] + #[doc = "* `salt`: Used for the address derivation. See [`Pallet::contract_address`]."] + #[doc = ""] + #[doc = "Instantiation is executed as follows:"] + #[doc = ""] + #[doc = "- The supplied `code` is instrumented, deployed, and a `code_hash` is created for that"] + #[doc = " code."] + #[doc = "- If the `code_hash` already exists on the chain the underlying `code` will be shared."] + #[doc = "- The destination address is computed based on the sender, code_hash and the salt."] + #[doc = "- The smart-contract account is created at the computed address."] + #[doc = "- The `value` is transferred to the new account."] + #[doc = "- The `deploy` function is executed in the context of the newly-created account."] + instantiate_with_code { + #[codec(compact)] + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code: ::std::vec::Vec<::core::primitive::u8>, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 8)] + #[doc = "Instantiates a contract from a previously deployed wasm binary."] + #[doc = ""] + #[doc = "This function is identical to [`Self::instantiate_with_code`] but without the"] + #[doc = "code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary"] + #[doc = "must be supplied."] + instantiate { + #[codec(compact)] + value: ::core::primitive::u128, + gas_limit: runtime_types::sp_weights::weight_v2::Weight, + storage_deposit_limit: ::core::option::Option< + ::subxt::ext::codec::Compact<::core::primitive::u128>, + >, + code_hash: ::subxt::ext::sp_core::H256, + data: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "A new schedule must have a greater version than the current one."] + InvalidScheduleVersion, + #[codec(index = 1)] + #[doc = "Invalid combination of flags supplied to `seal_call` or `seal_delegate_call`."] + InvalidCallFlags, + #[codec(index = 2)] + #[doc = "The executed contract exhausted its gas limit."] + OutOfGas, + #[codec(index = 3)] + #[doc = "The output buffer supplied to a contract API call was too small."] + OutputBufferTooSmall, + #[codec(index = 4)] + #[doc = "Performing the requested transfer failed. Probably because there isn't enough"] + #[doc = "free balance in the sender's account."] + TransferFailed, + #[codec(index = 5)] + #[doc = "Performing a call was denied because the calling depth reached the limit"] + #[doc = "of what is specified in the schedule."] + MaxCallDepthReached, + #[codec(index = 6)] + #[doc = "No contract was found at the specified address."] + ContractNotFound, + #[codec(index = 7)] + #[doc = "The code supplied to `instantiate_with_code` exceeds the limit specified in the"] + #[doc = "current schedule."] + CodeTooLarge, + #[codec(index = 8)] + #[doc = "No code could be found at the supplied code hash."] + CodeNotFound, + #[codec(index = 9)] + #[doc = "A buffer outside of sandbox memory was passed to a contract API function."] + OutOfBounds, + #[codec(index = 10)] + #[doc = "Input passed to a contract API function failed to decode as expected type."] + DecodingFailed, + #[codec(index = 11)] + #[doc = "Contract trapped during execution."] + ContractTrapped, + #[codec(index = 12)] + #[doc = "The size defined in `T::MaxValueSize` was exceeded."] + ValueTooLarge, + #[codec(index = 13)] + #[doc = "Termination of a contract is not allowed while the contract is already"] + #[doc = "on the call stack. Can be triggered by `seal_terminate`."] + TerminatedWhileReentrant, + #[codec(index = 14)] + #[doc = "`seal_call` forwarded this contracts input. It therefore is no longer available."] + InputForwarded, + #[codec(index = 15)] + #[doc = "The subject passed to `seal_random` exceeds the limit."] + RandomSubjectTooLong, + #[codec(index = 16)] + #[doc = "The amount of topics passed to `seal_deposit_events` exceeds the limit."] + TooManyTopics, + #[codec(index = 17)] + #[doc = "The chain does not provide a chain extension. Calling the chain extension results"] + #[doc = "in this error. Note that this usually shouldn't happen as deploying such contracts"] + #[doc = "is rejected."] + NoChainExtension, + #[codec(index = 18)] + #[doc = "Removal of a contract failed because the deletion queue is full."] + #[doc = ""] + #[doc = "This can happen when calling `seal_terminate`."] + #[doc = "The queue is filled by deleting contracts and emptied by a fixed amount each block."] + #[doc = "Trying again during another block is the only way to resolve this issue."] + DeletionQueueFull, + #[codec(index = 19)] + #[doc = "A contract with the same AccountId already exists."] + DuplicateContract, + #[codec(index = 20)] + #[doc = "A contract self destructed in its constructor."] + #[doc = ""] + #[doc = "This can be triggered by a call to `seal_terminate`."] + TerminatedInConstructor, + #[codec(index = 21)] + #[doc = "The debug message specified to `seal_debug_message` does contain invalid UTF-8."] + DebugMessageInvalidUTF8, + #[codec(index = 22)] + #[doc = "A call tried to invoke a contract that is flagged as non-reentrant."] + ReentranceDenied, + #[codec(index = 23)] + #[doc = "Origin doesn't have enough balance to pay the required storage deposits."] + StorageDepositNotEnoughFunds, + #[codec(index = 24)] + #[doc = "More storage was created than allowed by the storage deposit limit."] + StorageDepositLimitExhausted, + #[codec(index = 25)] + #[doc = "Code removal was denied because the code is still in use by at least one contract."] + CodeInUse, + #[codec(index = 26)] + #[doc = "The contract ran to completion but decided to revert its storage changes."] + #[doc = "Please note that this error is only returned from extrinsics. When called directly"] + #[doc = "or via RPC an `Ok` will be returned. In this case the caller needs to inspect the flags"] + #[doc = "to determine whether a reversion has taken place."] + ContractReverted, + #[codec(index = 27)] + #[doc = "The contract's code was found to be invalid during validation or instrumentation."] + #[doc = ""] + #[doc = "The most likely cause of this is that an API was used which is not supported by the"] + #[doc = "node. This hapens if an older node is used with a new version of ink!. Try updating"] + #[doc = "your node to the newest available version."] + #[doc = ""] + #[doc = "A more detailed error can be found on the node console if debug messages are enabled"] + #[doc = "by supplying `-lruntime::contracts=debug`."] + CodeRejected, + #[codec(index = 28)] + #[doc = "An indetermistic code was used in a context where this is not permitted."] + Indeterministic, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "Contract deployed by address at the specified address."] + Instantiated { + deployer: ::subxt::ext::sp_core::crypto::AccountId32, + contract: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 1)] + #[doc = "Contract has been removed."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "The only way for a contract to be removed and emitting this event is by calling"] + #[doc = "`seal_terminate`."] + Terminated { + contract: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 2)] + #[doc = "Code with the specified hash has been stored."] + CodeStored { + code_hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 3)] + #[doc = "A custom event emitted by the contract."] + ContractEmitted { + contract: ::subxt::ext::sp_core::crypto::AccountId32, + data: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 4)] + #[doc = "A code with the specified hash was removed."] + CodeRemoved { + code_hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 5)] + #[doc = "A contract's code was updated."] + ContractCodeUpdated { + contract: ::subxt::ext::sp_core::crypto::AccountId32, + new_code_hash: ::subxt::ext::sp_core::H256, + old_code_hash: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 6)] + #[doc = "A contract was called either by a plain account or another contract."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Please keep in mind that like all events this is only emitted for successful"] + #[doc = "calls. This is because on failure all storage changes including events are"] + #[doc = "rolled back."] + Called { + caller: ::subxt::ext::sp_core::crypto::AccountId32, + contract: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 7)] + #[doc = "A contract delegate called a code hash."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "Please keep in mind that like all events this is only emitted for successful"] + #[doc = "calls. This is because on failure all storage changes including events are"] + #[doc = "rolled back."] + DelegateCalled { + contract: ::subxt::ext::sp_core::crypto::AccountId32, + code_hash: ::subxt::ext::sp_core::H256, + }, + } + } + pub mod schedule { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct HostFnWeights { + pub caller: runtime_types::sp_weights::weight_v2::Weight, + pub is_contract: runtime_types::sp_weights::weight_v2::Weight, + pub code_hash: runtime_types::sp_weights::weight_v2::Weight, + pub own_code_hash: runtime_types::sp_weights::weight_v2::Weight, + pub caller_is_origin: runtime_types::sp_weights::weight_v2::Weight, + pub address: runtime_types::sp_weights::weight_v2::Weight, + pub gas_left: runtime_types::sp_weights::weight_v2::Weight, + pub balance: runtime_types::sp_weights::weight_v2::Weight, + pub value_transferred: runtime_types::sp_weights::weight_v2::Weight, + pub minimum_balance: runtime_types::sp_weights::weight_v2::Weight, + pub block_number: runtime_types::sp_weights::weight_v2::Weight, + pub now: runtime_types::sp_weights::weight_v2::Weight, + pub weight_to_fee: runtime_types::sp_weights::weight_v2::Weight, + pub gas: runtime_types::sp_weights::weight_v2::Weight, + pub input: runtime_types::sp_weights::weight_v2::Weight, + pub input_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub r#return: runtime_types::sp_weights::weight_v2::Weight, + pub return_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub terminate: runtime_types::sp_weights::weight_v2::Weight, + pub random: runtime_types::sp_weights::weight_v2::Weight, + pub deposit_event: runtime_types::sp_weights::weight_v2::Weight, + pub deposit_event_per_topic: runtime_types::sp_weights::weight_v2::Weight, + pub deposit_event_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub debug_message: runtime_types::sp_weights::weight_v2::Weight, + pub set_storage: runtime_types::sp_weights::weight_v2::Weight, + pub set_storage_per_new_byte: runtime_types::sp_weights::weight_v2::Weight, + pub set_storage_per_old_byte: runtime_types::sp_weights::weight_v2::Weight, + pub set_code_hash: runtime_types::sp_weights::weight_v2::Weight, + pub clear_storage: runtime_types::sp_weights::weight_v2::Weight, + pub clear_storage_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub contains_storage: runtime_types::sp_weights::weight_v2::Weight, + pub contains_storage_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub get_storage: runtime_types::sp_weights::weight_v2::Weight, + pub get_storage_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub take_storage: runtime_types::sp_weights::weight_v2::Weight, + pub take_storage_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub transfer: runtime_types::sp_weights::weight_v2::Weight, + pub call: runtime_types::sp_weights::weight_v2::Weight, + pub delegate_call: runtime_types::sp_weights::weight_v2::Weight, + pub call_transfer_surcharge: runtime_types::sp_weights::weight_v2::Weight, + pub call_per_cloned_byte: runtime_types::sp_weights::weight_v2::Weight, + pub instantiate: runtime_types::sp_weights::weight_v2::Weight, + pub instantiate_transfer_surcharge: + runtime_types::sp_weights::weight_v2::Weight, + pub instantiate_per_input_byte: runtime_types::sp_weights::weight_v2::Weight, + pub instantiate_per_salt_byte: runtime_types::sp_weights::weight_v2::Weight, + pub hash_sha2_256: runtime_types::sp_weights::weight_v2::Weight, + pub hash_sha2_256_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub hash_keccak_256: runtime_types::sp_weights::weight_v2::Weight, + pub hash_keccak_256_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub hash_blake2_256: runtime_types::sp_weights::weight_v2::Weight, + pub hash_blake2_256_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub hash_blake2_128: runtime_types::sp_weights::weight_v2::Weight, + pub hash_blake2_128_per_byte: runtime_types::sp_weights::weight_v2::Weight, + pub ecdsa_recover: runtime_types::sp_weights::weight_v2::Weight, + pub ecdsa_to_eth_address: runtime_types::sp_weights::weight_v2::Weight, + pub reentrance_count: runtime_types::sp_weights::weight_v2::Weight, + pub account_reentrance_count: runtime_types::sp_weights::weight_v2::Weight, + pub instantiation_nonce: runtime_types::sp_weights::weight_v2::Weight, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct InstructionWeights { + pub version: ::core::primitive::u32, + pub fallback: ::core::primitive::u32, + pub i64const: ::core::primitive::u32, + pub i64load: ::core::primitive::u32, + pub i64store: ::core::primitive::u32, + pub select: ::core::primitive::u32, + pub r#if: ::core::primitive::u32, + pub br: ::core::primitive::u32, + pub br_if: ::core::primitive::u32, + pub br_table: ::core::primitive::u32, + pub br_table_per_entry: ::core::primitive::u32, + pub call: ::core::primitive::u32, + pub call_indirect: ::core::primitive::u32, + pub call_indirect_per_param: ::core::primitive::u32, + pub call_per_local: ::core::primitive::u32, + pub local_get: ::core::primitive::u32, + pub local_set: ::core::primitive::u32, + pub local_tee: ::core::primitive::u32, + pub global_get: ::core::primitive::u32, + pub global_set: ::core::primitive::u32, + pub memory_current: ::core::primitive::u32, + pub memory_grow: ::core::primitive::u32, + pub i64clz: ::core::primitive::u32, + pub i64ctz: ::core::primitive::u32, + pub i64popcnt: ::core::primitive::u32, + pub i64eqz: ::core::primitive::u32, + pub i64extendsi32: ::core::primitive::u32, + pub i64extendui32: ::core::primitive::u32, + pub i32wrapi64: ::core::primitive::u32, + pub i64eq: ::core::primitive::u32, + pub i64ne: ::core::primitive::u32, + pub i64lts: ::core::primitive::u32, + pub i64ltu: ::core::primitive::u32, + pub i64gts: ::core::primitive::u32, + pub i64gtu: ::core::primitive::u32, + pub i64les: ::core::primitive::u32, + pub i64leu: ::core::primitive::u32, + pub i64ges: ::core::primitive::u32, + pub i64geu: ::core::primitive::u32, + pub i64add: ::core::primitive::u32, + pub i64sub: ::core::primitive::u32, + pub i64mul: ::core::primitive::u32, + pub i64divs: ::core::primitive::u32, + pub i64divu: ::core::primitive::u32, + pub i64rems: ::core::primitive::u32, + pub i64remu: ::core::primitive::u32, + pub i64and: ::core::primitive::u32, + pub i64or: ::core::primitive::u32, + pub i64xor: ::core::primitive::u32, + pub i64shl: ::core::primitive::u32, + pub i64shrs: ::core::primitive::u32, + pub i64shru: ::core::primitive::u32, + pub i64rotl: ::core::primitive::u32, + pub i64rotr: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Limits { + pub event_topics: ::core::primitive::u32, + pub globals: ::core::primitive::u32, + pub locals: ::core::primitive::u32, + pub parameters: ::core::primitive::u32, + pub memory_pages: ::core::primitive::u32, + pub table_size: ::core::primitive::u32, + pub br_table_size: ::core::primitive::u32, + pub subject_len: ::core::primitive::u32, + pub payload_len: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Schedule { + pub limits: runtime_types::pallet_contracts::schedule::Limits, + pub instruction_weights: + runtime_types::pallet_contracts::schedule::InstructionWeights, + pub host_fn_weights: runtime_types::pallet_contracts::schedule::HostFnWeights, + } + } + pub mod storage { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ContractInfo { + pub trie_id: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub code_hash: ::subxt::ext::sp_core::H256, + pub storage_bytes: ::core::primitive::u32, + pub storage_items: ::core::primitive::u32, + pub storage_byte_deposit: ::core::primitive::u128, + pub storage_item_deposit: ::core::primitive::u128, + pub storage_base_deposit: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct DeletedContract { + pub trie_id: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + } + } + pub mod wasm { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Determinism { + #[codec(index = 0)] + Deterministic, + #[codec(index = 1)] + AllowIndeterminism, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct OwnerInfo { + pub owner: ::subxt::ext::sp_core::crypto::AccountId32, + #[codec(compact)] + pub deposit: ::core::primitive::u128, + #[codec(compact)] + pub refcount: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PrefabWasmModule { + #[codec(compact)] + pub instruction_weights_version: ::core::primitive::u32, + #[codec(compact)] + pub initial: ::core::primitive::u32, + #[codec(compact)] + pub maximum: ::core::primitive::u32, + pub code: runtime_types::sp_core::bounded::weak_bounded_vec::WeakBoundedVec< + ::core::primitive::u8, + >, + pub determinism: runtime_types::pallet_contracts::wasm::Determinism, + } + } + } + pub mod pallet_elections { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + change_validators { + reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + non_reserved_validators: ::core::option::Option< + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + >, + committee_size: + ::core::option::Option, + }, + #[codec(index = 1)] + #[doc = "Sets ban config, it has an immediate effect"] + set_ban_config { + minimal_expected_performance: ::core::option::Option<::core::primitive::u8>, + underperformed_session_count_threshold: + ::core::option::Option<::core::primitive::u32>, + clean_session_counter_delay: ::core::option::Option<::core::primitive::u32>, + ban_period: ::core::option::Option<::core::primitive::u32>, + }, + #[codec(index = 2)] + #[doc = "Schedule a non-reserved node to be banned out from the committee at the end of the era"] + ban_from_committee { + banned: ::subxt::ext::sp_core::crypto::AccountId32, + ban_reason: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 3)] + #[doc = "Schedule a non-reserved node to be banned out from the committee at the end of the era"] + cancel_ban { + banned: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 4)] + #[doc = "Set openness of the elections"] + set_elections_openness { + openness: runtime_types::primitives::ElectionOpenness, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + NotEnoughValidators, + #[codec(index = 1)] + NotEnoughReservedValidators, + #[codec(index = 2)] + NotEnoughNonReservedValidators, + #[codec(index = 3)] + NonUniqueListOfValidators, + #[codec(index = 4)] + #[doc = "Raised in any scenario [`BanConfig`] is invalid"] + #[doc = "* `performance_ratio_threshold` must be a number in range [0; 100]"] + #[doc = "* `underperformed_session_count_threshold` must be a positive number,"] + #[doc = "* `clean_session_counter_delay` must be a positive number."] + InvalidBanConfig, + #[codec(index = 5)] + #[doc = "Ban reason is too big, ie given vector of bytes is greater than"] + #[doc = "[`Config::MaximumBanReasonLength`]"] + BanReasonTooBig, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "Committee for the next era has changed"] + ChangeValidators( + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + runtime_types::primitives::CommitteeSeats, + ), + #[codec(index = 1)] + #[doc = "Ban thresholds for the next era has changed"] + SetBanConfig(runtime_types::primitives::BanConfig), + #[codec(index = 2)] + #[doc = "Validators have been banned from the committee"] + BanValidators( + ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::primitives::BanInfo, + )>, + ), + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ValidatorTotalRewards<_0>( + pub ::subxt::utils::KeyedVec<_0, ::core::primitive::u32>, + ); + } + pub mod pallet_identity { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Identity pallet declaration."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Add a registrar to the system."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `T::RegistrarOrigin`."] + #[doc = ""] + #[doc = "- `account`: the account of the registrar."] + #[doc = ""] + #[doc = "Emits `RegistrarAdded` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)` where `R` registrar-count (governance-bounded and code-bounded)."] + #[doc = "- One storage mutation (codec `O(R)`)."] + #[doc = "- One event."] + #[doc = "# "] + add_registrar { + account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 1)] + #[doc = "Set an account's identity information and reserve the appropriate deposit."] + #[doc = ""] + #[doc = "If the account already has identity information, the deposit is taken as part payment"] + #[doc = "for the new deposit."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `info`: The identity information."] + #[doc = ""] + #[doc = "Emits `IdentitySet` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(X + X' + R)`"] + #[doc = " - where `X` additional-field-count (deposit-bounded and code-bounded)"] + #[doc = " - where `R` judgements-count (registrar-count-bounded)"] + #[doc = "- One balance reserve operation."] + #[doc = "- One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`)."] + #[doc = "- One event."] + #[doc = "# "] + set_identity { + info: + ::std::boxed::Box, + }, + #[codec(index = 2)] + #[doc = "Set the sub-accounts of the sender."] + #[doc = ""] + #[doc = "Payment: Any aggregate balance reserved by previous `set_subs` calls will be returned"] + #[doc = "and an amount `SubAccountDeposit` will be reserved for each item in `subs`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "identity."] + #[doc = ""] + #[doc = "- `subs`: The identity's (new) sub-accounts."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(P + S)`"] + #[doc = " - where `P` old-subs-count (hard- and deposit-bounded)."] + #[doc = " - where `S` subs-count (hard- and deposit-bounded)."] + #[doc = "- At most one balance operations."] + #[doc = "- DB:"] + #[doc = " - `P + S` storage mutations (codec complexity `O(1)`)"] + #[doc = " - One storage read (codec complexity `O(P)`)."] + #[doc = " - One storage write (codec complexity `O(S)`)."] + #[doc = " - One storage-exists (`IdentityOf::contains_key`)."] + #[doc = "# "] + set_subs { + subs: ::std::vec::Vec<( + ::subxt::ext::sp_core::crypto::AccountId32, + runtime_types::pallet_identity::types::Data, + )>, + }, + #[codec(index = 3)] + #[doc = "Clear an account's identity info and all sub-accounts and return all deposits."] + #[doc = ""] + #[doc = "Payment: All reserved balances on the account are returned."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "identity."] + #[doc = ""] + #[doc = "Emits `IdentityCleared` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + S + X)`"] + #[doc = " - where `R` registrar-count (governance-bounded)."] + #[doc = " - where `S` subs-count (hard- and deposit-bounded)."] + #[doc = " - where `X` additional-field-count (deposit-bounded and code-bounded)."] + #[doc = "- One balance-unreserve operation."] + #[doc = "- `2` storage reads and `S + 2` storage deletions."] + #[doc = "- One event."] + #[doc = "# "] + clear_identity, + #[codec(index = 4)] + #[doc = "Request a judgement from a registrar."] + #[doc = ""] + #[doc = "Payment: At most `max_fee` will be reserved for payment to the registrar if judgement"] + #[doc = "given."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a"] + #[doc = "registered identity."] + #[doc = ""] + #[doc = "- `reg_index`: The index of the registrar whose judgement is requested."] + #[doc = "- `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:"] + #[doc = ""] + #[doc = "```nocompile"] + #[doc = "Self::registrars().get(reg_index).unwrap().fee"] + #[doc = "```"] + #[doc = ""] + #[doc = "Emits `JudgementRequested` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- Storage: 1 read `O(R)`, 1 mutate `O(X + R)`."] + #[doc = "- One event."] + #[doc = "# "] + request_judgement { + #[codec(compact)] + reg_index: ::core::primitive::u32, + #[codec(compact)] + max_fee: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "Cancel a previous request."] + #[doc = ""] + #[doc = "Payment: A previously reserved deposit is returned on success."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a"] + #[doc = "registered identity."] + #[doc = ""] + #[doc = "- `reg_index`: The index of the registrar whose judgement is no longer requested."] + #[doc = ""] + #[doc = "Emits `JudgementUnrequested` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- One storage mutation `O(R + X)`."] + #[doc = "- One event"] + #[doc = "# "] + cancel_request { reg_index: ::core::primitive::u32 }, + #[codec(index = 6)] + #[doc = "Set the fee required for a judgement to be requested from a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `fee`: the new fee."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 7.315 + R * 0.329 µs (min squares analysis)"] + #[doc = "# "] + set_fee { + #[codec(compact)] + index: ::core::primitive::u32, + #[codec(compact)] + fee: ::core::primitive::u128, + }, + #[codec(index = 7)] + #[doc = "Change the account associated with a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `new`: the new account ID."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 8.823 + R * 0.32 µs (min squares analysis)"] + #[doc = "# "] + set_account_id { + #[codec(compact)] + index: ::core::primitive::u32, + new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 8)] + #[doc = "Set the field information for a registrar."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `index`."] + #[doc = ""] + #[doc = "- `index`: the index of the registrar whose fee is to be set."] + #[doc = "- `fields`: the fields that the registrar concerns themselves with."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R)`."] + #[doc = "- One storage mutation `O(R)`."] + #[doc = "- Benchmark: 7.464 + R * 0.325 µs (min squares analysis)"] + #[doc = "# "] + set_fields { + #[codec(compact)] + index: ::core::primitive::u32, + fields: runtime_types::pallet_identity::types::BitFlags< + runtime_types::pallet_identity::types::IdentityField, + >, + }, + #[codec(index = 9)] + #[doc = "Provide a judgement for an account's identity."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must be the account"] + #[doc = "of the registrar whose index is `reg_index`."] + #[doc = ""] + #[doc = "- `reg_index`: the index of the registrar whose judgement is being made."] + #[doc = "- `target`: the account whose identity the judgement is upon. This must be an account"] + #[doc = " with a registered identity."] + #[doc = "- `judgement`: the judgement of the registrar of index `reg_index` about `target`."] + #[doc = "- `identity`: The hash of the [`IdentityInfo`] for that the judgement is provided."] + #[doc = ""] + #[doc = "Emits `JudgementGiven` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + X)`."] + #[doc = "- One balance-transfer operation."] + #[doc = "- Up to one account-lookup operation."] + #[doc = "- Storage: 1 read `O(R)`, 1 mutate `O(R + X)`."] + #[doc = "- One event."] + #[doc = "# "] + provide_judgement { + #[codec(compact)] + reg_index: ::core::primitive::u32, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + judgement: runtime_types::pallet_identity::types::Judgement< + ::core::primitive::u128, + >, + identity: ::subxt::ext::sp_core::H256, + }, + #[codec(index = 10)] + #[doc = "Remove an account's identity and sub-account information and slash the deposits."] + #[doc = ""] + #[doc = "Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by"] + #[doc = "`Slash`. Verification request deposits are not returned; they should be cancelled"] + #[doc = "manually using `cancel_request`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must match `T::ForceOrigin`."] + #[doc = ""] + #[doc = "- `target`: the account whose identity the judgement is upon. This must be an account"] + #[doc = " with a registered identity."] + #[doc = ""] + #[doc = "Emits `IdentityKilled` if successful."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(R + S + X)`."] + #[doc = "- One balance-reserve operation."] + #[doc = "- `S + 2` storage mutations."] + #[doc = "- One event."] + #[doc = "# "] + kill_identity { + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 11)] + #[doc = "Add the given account to the sender's subs."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + add_sub { + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + data: runtime_types::pallet_identity::types::Data, + }, + #[codec(index = 12)] + #[doc = "Alter the associated name of the given sub-account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + rename_sub { + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + data: runtime_types::pallet_identity::types::Data, + }, + #[codec(index = 13)] + #[doc = "Remove the given account from the sender's subs."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "sub identity of `sub`."] + remove_sub { + sub: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 14)] + #[doc = "Remove the sender as a sub-account."] + #[doc = ""] + #[doc = "Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated"] + #[doc = "to the sender (*not* the original depositor)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] + #[doc = "super-identity."] + #[doc = ""] + #[doc = "NOTE: This should not normally be used, but is provided in the case that the non-"] + #[doc = "controller of an account is maliciously registered as a sub-account."] + quit_sub, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Too many subs-accounts."] + TooManySubAccounts, + #[codec(index = 1)] + #[doc = "Account isn't found."] + NotFound, + #[codec(index = 2)] + #[doc = "Account isn't named."] + NotNamed, + #[codec(index = 3)] + #[doc = "Empty index."] + EmptyIndex, + #[codec(index = 4)] + #[doc = "Fee is changed."] + FeeChanged, + #[codec(index = 5)] + #[doc = "No identity found."] + NoIdentity, + #[codec(index = 6)] + #[doc = "Sticky judgement."] + StickyJudgement, + #[codec(index = 7)] + #[doc = "Judgement given."] + JudgementGiven, + #[codec(index = 8)] + #[doc = "Invalid judgement."] + InvalidJudgement, + #[codec(index = 9)] + #[doc = "The index is invalid."] + InvalidIndex, + #[codec(index = 10)] + #[doc = "The target is invalid."] + InvalidTarget, + #[codec(index = 11)] + #[doc = "Too many additional fields."] + TooManyFields, + #[codec(index = 12)] + #[doc = "Maximum amount of registrars reached. Cannot add any more."] + TooManyRegistrars, + #[codec(index = 13)] + #[doc = "Account ID is already named."] + AlreadyClaimed, + #[codec(index = 14)] + #[doc = "Sender is not a sub-account."] + NotSub, + #[codec(index = 15)] + #[doc = "Sub-account isn't owned by sender."] + NotOwned, + #[codec(index = 16)] + #[doc = "The provided judgement was for a different identity."] + JudgementForDifferentIdentity, + #[codec(index = 17)] + #[doc = "Error that occurs when there is an issue paying for judgement."] + JudgementPaymentFailed, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A name was set or reset (which will remove all judgements)."] + IdentitySet { + who: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 1)] + #[doc = "A name was cleared, and the given balance returned."] + IdentityCleared { + who: ::subxt::ext::sp_core::crypto::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "A name was removed and the given balance slashed."] + IdentityKilled { + who: ::subxt::ext::sp_core::crypto::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "A judgement was asked from a registrar."] + JudgementRequested { + who: ::subxt::ext::sp_core::crypto::AccountId32, + registrar_index: ::core::primitive::u32, + }, + #[codec(index = 4)] + #[doc = "A judgement request was retracted."] + JudgementUnrequested { + who: ::subxt::ext::sp_core::crypto::AccountId32, + registrar_index: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "A judgement was given by a registrar."] + JudgementGiven { + target: ::subxt::ext::sp_core::crypto::AccountId32, + registrar_index: ::core::primitive::u32, + }, + #[codec(index = 6)] + #[doc = "A registrar was added."] + RegistrarAdded { + registrar_index: ::core::primitive::u32, + }, + #[codec(index = 7)] + #[doc = "A sub-identity was added to an identity and the deposit paid."] + SubIdentityAdded { + sub: ::subxt::ext::sp_core::crypto::AccountId32, + main: ::subxt::ext::sp_core::crypto::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 8)] + #[doc = "A sub-identity was removed from an identity and the deposit freed."] + SubIdentityRemoved { + sub: ::subxt::ext::sp_core::crypto::AccountId32, + main: ::subxt::ext::sp_core::crypto::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 9)] + #[doc = "A sub-identity was cleared, and the given deposit repatriated from the"] + #[doc = "main identity account to the sub-identity account."] + SubIdentityRevoked { + sub: ::subxt::ext::sp_core::crypto::AccountId32, + main: ::subxt::ext::sp_core::crypto::AccountId32, + deposit: ::core::primitive::u128, + }, + } + } + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BitFlags<_0>( + pub ::core::primitive::u64, + #[codec(skip)] pub ::core::marker::PhantomData<_0>, + ); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Data { + #[codec(index = 0)] + None, + #[codec(index = 1)] + Raw0([::core::primitive::u8; 0usize]), + #[codec(index = 2)] + Raw1([::core::primitive::u8; 1usize]), + #[codec(index = 3)] + Raw2([::core::primitive::u8; 2usize]), + #[codec(index = 4)] + Raw3([::core::primitive::u8; 3usize]), + #[codec(index = 5)] + Raw4([::core::primitive::u8; 4usize]), + #[codec(index = 6)] + Raw5([::core::primitive::u8; 5usize]), + #[codec(index = 7)] + Raw6([::core::primitive::u8; 6usize]), + #[codec(index = 8)] + Raw7([::core::primitive::u8; 7usize]), + #[codec(index = 9)] + Raw8([::core::primitive::u8; 8usize]), + #[codec(index = 10)] + Raw9([::core::primitive::u8; 9usize]), + #[codec(index = 11)] + Raw10([::core::primitive::u8; 10usize]), + #[codec(index = 12)] + Raw11([::core::primitive::u8; 11usize]), + #[codec(index = 13)] + Raw12([::core::primitive::u8; 12usize]), + #[codec(index = 14)] + Raw13([::core::primitive::u8; 13usize]), + #[codec(index = 15)] + Raw14([::core::primitive::u8; 14usize]), + #[codec(index = 16)] + Raw15([::core::primitive::u8; 15usize]), + #[codec(index = 17)] + Raw16([::core::primitive::u8; 16usize]), + #[codec(index = 18)] + Raw17([::core::primitive::u8; 17usize]), + #[codec(index = 19)] + Raw18([::core::primitive::u8; 18usize]), + #[codec(index = 20)] + Raw19([::core::primitive::u8; 19usize]), + #[codec(index = 21)] + Raw20([::core::primitive::u8; 20usize]), + #[codec(index = 22)] + Raw21([::core::primitive::u8; 21usize]), + #[codec(index = 23)] + Raw22([::core::primitive::u8; 22usize]), + #[codec(index = 24)] + Raw23([::core::primitive::u8; 23usize]), + #[codec(index = 25)] + Raw24([::core::primitive::u8; 24usize]), + #[codec(index = 26)] + Raw25([::core::primitive::u8; 25usize]), + #[codec(index = 27)] + Raw26([::core::primitive::u8; 26usize]), + #[codec(index = 28)] + Raw27([::core::primitive::u8; 27usize]), + #[codec(index = 29)] + Raw28([::core::primitive::u8; 28usize]), + #[codec(index = 30)] + Raw29([::core::primitive::u8; 29usize]), + #[codec(index = 31)] + Raw30([::core::primitive::u8; 30usize]), + #[codec(index = 32)] + Raw31([::core::primitive::u8; 31usize]), + #[codec(index = 33)] + Raw32([::core::primitive::u8; 32usize]), + #[codec(index = 34)] + BlakeTwo256([::core::primitive::u8; 32usize]), + #[codec(index = 35)] + Sha256([::core::primitive::u8; 32usize]), + #[codec(index = 36)] + Keccak256([::core::primitive::u8; 32usize]), + #[codec(index = 37)] + ShaThree256([::core::primitive::u8; 32usize]), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum IdentityField { + #[codec(index = 1)] + Display, + #[codec(index = 2)] + Legal, + #[codec(index = 4)] + Web, + #[codec(index = 8)] + Riot, + #[codec(index = 16)] + Email, + #[codec(index = 32)] + PgpFingerprint, + #[codec(index = 64)] + Image, + #[codec(index = 128)] + Twitter, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct IdentityInfo { + pub additional: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<( + runtime_types::pallet_identity::types::Data, + runtime_types::pallet_identity::types::Data, + )>, + pub display: runtime_types::pallet_identity::types::Data, + pub legal: runtime_types::pallet_identity::types::Data, + pub web: runtime_types::pallet_identity::types::Data, + pub riot: runtime_types::pallet_identity::types::Data, + pub email: runtime_types::pallet_identity::types::Data, + pub pgp_fingerprint: ::core::option::Option<[::core::primitive::u8; 20usize]>, + pub image: runtime_types::pallet_identity::types::Data, + pub twitter: runtime_types::pallet_identity::types::Data, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Judgement<_0> { + #[codec(index = 0)] + Unknown, + #[codec(index = 1)] + FeePaid(_0), + #[codec(index = 2)] + Reasonable, + #[codec(index = 3)] + KnownGood, + #[codec(index = 4)] + OutOfDate, + #[codec(index = 5)] + LowQuality, + #[codec(index = 6)] + Erroneous, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RegistrarInfo<_0, _1> { + pub account: _1, + pub fee: _0, + pub fields: runtime_types::pallet_identity::types::BitFlags< + runtime_types::pallet_identity::types::IdentityField, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Registration<_0> { + pub judgements: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<( + ::core::primitive::u32, + runtime_types::pallet_identity::types::Judgement<_0>, + )>, + pub deposit: _0, + pub info: runtime_types::pallet_identity::types::IdentityInfo, + } + } + } + pub mod pallet_multisig { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Immediately dispatch a multi-signature call using a single approval from the caller."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `other_signatories`: The accounts (other than the sender) who are part of the"] + #[doc = "multi-signature, but do not participate in the approval process."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result."] + #[doc = ""] + #[doc = "# "] + #[doc = "O(Z + C) where Z is the length of the call and C its execution weight."] + #[doc = "-------------------------------"] + #[doc = "- DB Weight: None"] + #[doc = "- Plus Call Weight"] + #[doc = "# "] + as_multi_threshold_1 { + other_signatories: + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + call: ::std::boxed::Box, + }, + #[codec(index = 1)] + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "If there are enough, then dispatch the call."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "NOTE: Unless this is the final approval, you will generally want to use"] + #[doc = "`approve_as_multi` instead, since it only requires a hash of the call."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise"] + #[doc = "on success, result is `Ok` and the result from the interior call, if it was executed,"] + #[doc = "may be found in the deposited `MultisigExecuted` event."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S + Z + Call)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- The weight of the `call`."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + #[doc = "-------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Reads: Multisig Storage, [Caller Account]"] + #[doc = " - Writes: Multisig Storage, [Caller Account]"] + #[doc = "- Plus Call Weight"] + #[doc = "# "] + as_multi { + threshold: ::core::primitive::u16, + other_signatories: + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call: ::std::boxed::Box, + max_weight: runtime_types::sp_weights::weight_v2::Weight, + }, + #[codec(index = 2)] + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "NOTE: If this is the final approval, you will want to use `as_multi` instead."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + #[doc = "----------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Multisig Storage, [Caller Account]"] + #[doc = " - Write: Multisig Storage, [Caller Account]"] + #[doc = "# "] + approve_as_multi { + threshold: ::core::primitive::u16, + other_signatories: + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call_hash: [::core::primitive::u8; 32usize], + max_weight: runtime_types::sp_weights::weight_v2::Weight, + }, + #[codec(index = 3)] + #[doc = "Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously"] + #[doc = "for this operation will be unreserved on success."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `timepoint`: The timepoint (block number and transaction index) of the first approval"] + #[doc = "transaction for this dispatch."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- One event."] + #[doc = "- I/O: 1 read `O(S)`, one remove."] + #[doc = "- Storage: removes one item."] + #[doc = "----------------------------------"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Multisig Storage, [Caller Account], Refund Account"] + #[doc = " - Write: Multisig Storage, [Caller Account], Refund Account"] + #[doc = "# "] + cancel_as_multi { + threshold: ::core::primitive::u16, + other_signatories: + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + call_hash: [::core::primitive::u8; 32usize], + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Threshold must be 2 or greater."] + MinimumThreshold, + #[codec(index = 1)] + #[doc = "Call is already approved by this signatory."] + AlreadyApproved, + #[codec(index = 2)] + #[doc = "Call doesn't need any (more) approvals."] + NoApprovalsNeeded, + #[codec(index = 3)] + #[doc = "There are too few signatories in the list."] + TooFewSignatories, + #[codec(index = 4)] + #[doc = "There are too many signatories in the list."] + TooManySignatories, + #[codec(index = 5)] + #[doc = "The signatories were provided out of order; they should be ordered."] + SignatoriesOutOfOrder, + #[codec(index = 6)] + #[doc = "The sender was contained in the other signatories; it shouldn't be."] + SenderInSignatories, + #[codec(index = 7)] + #[doc = "Multisig operation not found when attempting to cancel."] + NotFound, + #[codec(index = 8)] + #[doc = "Only the account that originally created the multisig is able to cancel it."] + NotOwner, + #[codec(index = 9)] + #[doc = "No timepoint was given, yet the multisig operation is already underway."] + NoTimepoint, + #[codec(index = 10)] + #[doc = "A different timepoint was given to the multisig operation that is underway."] + WrongTimepoint, + #[codec(index = 11)] + #[doc = "A timepoint was given, yet no multisig operation is underway."] + UnexpectedTimepoint, + #[codec(index = 12)] + #[doc = "The maximum weight information provided was too low."] + MaxWeightTooLow, + #[codec(index = 13)] + #[doc = "The data to be stored is already stored."] + AlreadyStored, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A new multisig operation has begun."] + NewMultisig { + approving: ::subxt::ext::sp_core::crypto::AccountId32, + multisig: ::subxt::ext::sp_core::crypto::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + }, + #[codec(index = 1)] + #[doc = "A multisig operation has been approved by someone."] + MultisigApproval { + approving: ::subxt::ext::sp_core::crypto::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::ext::sp_core::crypto::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + }, + #[codec(index = 2)] + #[doc = "A multisig operation has been executed."] + MultisigExecuted { + approving: ::subxt::ext::sp_core::crypto::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::ext::sp_core::crypto::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + #[codec(index = 3)] + #[doc = "A multisig operation has been cancelled."] + MultisigCancelled { + cancelling: ::subxt::ext::sp_core::crypto::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::ext::sp_core::crypto::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Multisig<_0, _1, _2> { + pub when: runtime_types::pallet_multisig::Timepoint<_0>, + pub deposit: _1, + pub depositor: _2, + pub approvals: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<_2>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Timepoint<_0> { + pub height: _0, + pub index: _0, + } + } + pub mod pallet_nomination_pools { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Stake funds with a pool. The amount to bond is transferred from the member to the"] + #[doc = "pools account and immediately increases the pools bond."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "* An account can only be a member of a single pool."] + #[doc = "* An account cannot join the same pool multiple times."] + #[doc = "* This call will *not* dust the member account, so the member must have at least"] + #[doc = " `existential deposit + amount` in their account."] + #[doc = "* Only a pool with [`PoolState::Open`] can be joined"] + join { + #[codec(compact)] + amount: ::core::primitive::u128, + pool_id: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "Bond `extra` more funds from `origin` into the pool to which they already belong."] + #[doc = ""] + #[doc = "Additional funds can come from either the free balance of the account, of from the"] + #[doc = "accumulated rewards, see [`BondExtra`]."] + #[doc = ""] + #[doc = "Bonding extra funds implies an automatic payout of all pending rewards as well."] + bond_extra { + extra: runtime_types::pallet_nomination_pools::BondExtra< + ::core::primitive::u128, + >, + }, + #[codec(index = 2)] + #[doc = "A bonded member can use this to claim their payout based on the rewards that the pool"] + #[doc = "has accumulated since their last claimed payout (OR since joining if this is there first"] + #[doc = "time claiming rewards). The payout will be transferred to the member's account."] + #[doc = ""] + #[doc = "The member will earn rewards pro rata based on the members stake vs the sum of the"] + #[doc = "members in the pools stake. Rewards do not \"expire\"."] + claim_payout, + #[codec(index = 3)] + #[doc = "Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It"] + #[doc = "implicitly collects the rewards one last time, since not doing so would mean some"] + #[doc = "rewards would be forfeited."] + #[doc = ""] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] + #[doc = ""] + #[doc = "# Conditions for a permissionless dispatch."] + #[doc = ""] + #[doc = "* The pool is blocked and the caller is either the root or state-toggler. This is"] + #[doc = " refereed to as a kick."] + #[doc = "* The pool is destroying and the member is not the depositor."] + #[doc = "* The pool is destroying, the member is the depositor and no other members are in the"] + #[doc = " pool."] + #[doc = ""] + #[doc = "## Conditions for permissioned dispatch (i.e. the caller is also the"] + #[doc = "`member_account`):"] + #[doc = ""] + #[doc = "* The caller is not the depositor."] + #[doc = "* The caller is the depositor, the pool is destroying and no other members are in the"] + #[doc = " pool."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If there are too many unlocking chunks to unbond with the pool account,"] + #[doc = "[`Call::pool_withdraw_unbonded`] can be called to try and minimize unlocking chunks."] + #[doc = "The [`StakingInterface::unbond`] will implicitly call [`Call::pool_withdraw_unbonded`]"] + #[doc = "to try to free chunks if necessary (ie. if unbound was called and no unlocking chunks"] + #[doc = "are available). However, it may not be possible to release the current unlocking chunks,"] + #[doc = "in which case, the result of this call will likely be the `NoMoreChunks` error from the"] + #[doc = "staking system."] + unbond { + member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + unbonding_points: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "Call `withdraw_unbonded` for the pools account. This call can be made by any account."] + #[doc = ""] + #[doc = "This is useful if their are too many unlocking chunks to call `unbond`, and some"] + #[doc = "can be cleared by withdrawing. In the case there are too many unlocking chunks, the user"] + #[doc = "would probably see an error like `NoMoreChunks` emitted from the staking system when"] + #[doc = "they attempt to unbond."] + pool_withdraw_unbonded { + pool_id: ::core::primitive::u32, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "Withdraw unbonded funds from `member_account`. If no bonded funds can be unbonded, an"] + #[doc = "error is returned."] + #[doc = ""] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] + #[doc = ""] + #[doc = "# Conditions for a permissionless dispatch"] + #[doc = ""] + #[doc = "* The pool is in destroy mode and the target is not the depositor."] + #[doc = "* The target is the depositor and they are the only member in the sub pools."] + #[doc = "* The pool is blocked and the caller is either the root or state-toggler."] + #[doc = ""] + #[doc = "# Conditions for permissioned dispatch"] + #[doc = ""] + #[doc = "* The caller is the target and they are not the depositor."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If the target is the depositor, the pool will be destroyed."] + withdraw_unbonded { + member_account: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 6)] + #[doc = "Create a new delegation pool."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `amount` - The amount of funds to delegate to the pool. This also acts of a sort of"] + #[doc = " deposit since the pools creator cannot fully unbond funds until the pool is being"] + #[doc = " destroyed."] + #[doc = "* `index` - A disambiguation index for creating the account. Likely only useful when"] + #[doc = " creating multiple pools in the same extrinsic."] + #[doc = "* `root` - The account to set as [`PoolRoles::root`]."] + #[doc = "* `nominator` - The account to set as the [`PoolRoles::nominator`]."] + #[doc = "* `state_toggler` - The account to set as the [`PoolRoles::state_toggler`]."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "In addition to `amount`, the caller will transfer the existential deposit; so the caller"] + #[doc = "needs at have at least `amount + existential_deposit` transferrable."] + create { + #[codec(compact)] + amount: ::core::primitive::u128, + root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 7)] + #[doc = "Create a new delegation pool with a previously used pool id"] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "same as `create` with the inclusion of"] + #[doc = "* `pool_id` - `A valid PoolId."] + create_with_pool_id { + #[codec(compact)] + amount: ::core::primitive::u128, + root: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + nominator: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + state_toggler: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + pool_id: ::core::primitive::u32, + }, + #[codec(index = 8)] + #[doc = "Nominate on behalf of the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role."] + #[doc = ""] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + nominate { + pool_id: ::core::primitive::u32, + validators: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + }, + #[codec(index = 9)] + #[doc = "Set a new state for the pool."] + #[doc = ""] + #[doc = "If a pool is already in the `Destroying` state, then under no condition can its state"] + #[doc = "change again."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be either:"] + #[doc = ""] + #[doc = "1. signed by the state toggler, or the root role of the pool,"] + #[doc = "2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and"] + #[doc = " then the state of the pool can be permissionlessly changed to `Destroying`."] + set_state { + pool_id: ::core::primitive::u32, + state: runtime_types::pallet_nomination_pools::PoolState, + }, + #[codec(index = 10)] + #[doc = "Set a new metadata for the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the state toggler, or the root role"] + #[doc = "of the pool."] + set_metadata { + pool_id: ::core::primitive::u32, + metadata: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 11)] + #[doc = "Update configurations for the nomination pools. The origin for this call must be"] + #[doc = "Root."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `min_join_bond` - Set [`MinJoinBond`]."] + #[doc = "* `min_create_bond` - Set [`MinCreateBond`]."] + #[doc = "* `max_pools` - Set [`MaxPools`]."] + #[doc = "* `max_members` - Set [`MaxPoolMembers`]."] + #[doc = "* `max_members_per_pool` - Set [`MaxPoolMembersPerPool`]."] + set_configs { + min_join_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + min_create_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + max_pools: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members_per_pool: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + }, + #[codec(index = 12)] + #[doc = "Update the roles of the pool."] + #[doc = ""] + #[doc = "The root is the only entity that can change any of the roles, including itself,"] + #[doc = "excluding the depositor, who can never change."] + #[doc = ""] + #[doc = "It emits an event, notifying UIs of the role change. This event is quite relevant to"] + #[doc = "most pool members and they should be informed of changes to pool roles."] + update_roles { + pool_id: ::core::primitive::u32, + new_root: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + }, + #[codec(index = 13)] + #[doc = "Chill on behalf of the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role, same as [`Pallet::nominate`]."] + #[doc = ""] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + chill { pool_id: ::core::primitive::u32 }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum DefensiveError { + #[codec(index = 0)] + NotEnoughSpaceInUnbondPool, + #[codec(index = 1)] + PoolNotFound, + #[codec(index = 2)] + RewardPoolNotFound, + #[codec(index = 3)] + SubPoolsNotFound, + #[codec(index = 4)] + BondedStashKilledPrematurely, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "A (bonded) pool id does not exist."] + PoolNotFound, + #[codec(index = 1)] + #[doc = "An account is not a member."] + PoolMemberNotFound, + #[codec(index = 2)] + #[doc = "A reward pool does not exist. In all cases this is a system logic error."] + RewardPoolNotFound, + #[codec(index = 3)] + #[doc = "A sub pool does not exist."] + SubPoolsNotFound, + #[codec(index = 4)] + #[doc = "An account is already delegating in another pool. An account may only belong to one"] + #[doc = "pool at a time."] + AccountBelongsToOtherPool, + #[codec(index = 5)] + #[doc = "The member is fully unbonded (and thus cannot access the bonded and reward pool"] + #[doc = "anymore to, for example, collect rewards)."] + FullyUnbonding, + #[codec(index = 6)] + #[doc = "The member cannot unbond further chunks due to reaching the limit."] + MaxUnbondingLimit, + #[codec(index = 7)] + #[doc = "None of the funds can be withdrawn yet because the bonding duration has not passed."] + CannotWithdrawAny, + #[codec(index = 8)] + #[doc = "The amount does not meet the minimum bond to either join or create a pool."] + #[doc = ""] + #[doc = "The depositor can never unbond to a value less than"] + #[doc = "`Pallet::depositor_min_bond`. The caller does not have nominating"] + #[doc = "permissions for the pool. Members can never unbond to a value below `MinJoinBond`."] + MinimumBondNotMet, + #[codec(index = 9)] + #[doc = "The transaction could not be executed due to overflow risk for the pool."] + OverflowRisk, + #[codec(index = 10)] + #[doc = "A pool must be in [`PoolState::Destroying`] in order for the depositor to unbond or for"] + #[doc = "other members to be permissionlessly unbonded."] + NotDestroying, + #[codec(index = 11)] + #[doc = "The caller does not have nominating permissions for the pool."] + NotNominator, + #[codec(index = 12)] + #[doc = "Either a) the caller cannot make a valid kick or b) the pool is not destroying."] + NotKickerOrDestroying, + #[codec(index = 13)] + #[doc = "The pool is not open to join"] + NotOpen, + #[codec(index = 14)] + #[doc = "The system is maxed out on pools."] + MaxPools, + #[codec(index = 15)] + #[doc = "Too many members in the pool or system."] + MaxPoolMembers, + #[codec(index = 16)] + #[doc = "The pools state cannot be changed."] + CanNotChangeState, + #[codec(index = 17)] + #[doc = "The caller does not have adequate permissions."] + DoesNotHavePermission, + #[codec(index = 18)] + #[doc = "Metadata exceeds [`Config::MaxMetadataLen`]"] + MetadataExceedsMaxLen, + #[codec(index = 19)] + #[doc = "Some error occurred that should never happen. This should be reported to the"] + #[doc = "maintainers."] + Defensive(runtime_types::pallet_nomination_pools::pallet::DefensiveError), + #[codec(index = 20)] + #[doc = "Partial unbonding now allowed permissionlessly."] + PartialUnbondNotAllowedPermissionlessly, + #[codec(index = 21)] + #[doc = "Pool id currently in use."] + PoolIdInUse, + #[codec(index = 22)] + #[doc = "Pool id provided is not correct/usable."] + InvalidPoolId, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Events of this pallet."] + pub enum Event { + #[codec(index = 0)] + #[doc = "A pool has been created."] + Created { + depositor: ::subxt::ext::sp_core::crypto::AccountId32, + pool_id: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "A member has became bonded in a pool."] + Bonded { + member: ::subxt::ext::sp_core::crypto::AccountId32, + pool_id: ::core::primitive::u32, + bonded: ::core::primitive::u128, + joined: ::core::primitive::bool, + }, + #[codec(index = 2)] + #[doc = "A payout has been made to a member."] + PaidOut { + member: ::subxt::ext::sp_core::crypto::AccountId32, + pool_id: ::core::primitive::u32, + payout: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "A member has unbonded from their pool."] + #[doc = ""] + #[doc = "- `balance` is the corresponding balance of the number of points that has been"] + #[doc = " requested to be unbonded (the argument of the `unbond` transaction) from the bonded"] + #[doc = " pool."] + #[doc = "- `points` is the number of points that are issued as a result of `balance` being"] + #[doc = "dissolved into the corresponding unbonding pool."] + #[doc = "- `era` is the era in which the balance will be unbonded."] + #[doc = "In the absence of slashing, these values will match. In the presence of slashing, the"] + #[doc = "number of points that are issued in the unbonding pool will be less than the amount"] + #[doc = "requested to be unbonded."] + Unbonded { + member: ::subxt::ext::sp_core::crypto::AccountId32, + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + points: ::core::primitive::u128, + era: ::core::primitive::u32, + }, + #[codec(index = 4)] + #[doc = "A member has withdrawn from their pool."] + #[doc = ""] + #[doc = "The given number of `points` have been dissolved in return of `balance`."] + #[doc = ""] + #[doc = "Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance"] + #[doc = "will be 1."] + Withdrawn { + member: ::subxt::ext::sp_core::crypto::AccountId32, + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + points: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "A pool has been destroyed."] + Destroyed { pool_id: ::core::primitive::u32 }, + #[codec(index = 6)] + #[doc = "The state of a pool has changed"] + StateChanged { + pool_id: ::core::primitive::u32, + new_state: runtime_types::pallet_nomination_pools::PoolState, + }, + #[codec(index = 7)] + #[doc = "A member has been removed from a pool."] + #[doc = ""] + #[doc = "The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked)."] + MemberRemoved { + pool_id: ::core::primitive::u32, + member: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 8)] + #[doc = "The roles of a pool have been updated to the given new roles. Note that the depositor"] + #[doc = "can never change."] + RolesUpdated { + root: ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + state_toggler: + ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + nominator: + ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + }, + #[codec(index = 9)] + #[doc = "The active balance of pool `pool_id` has been slashed to `balance`."] + PoolSlashed { + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + }, + #[codec(index = 10)] + #[doc = "The unbond pool at `era` of pool `pool_id` has been slashed to `balance`."] + UnbondingPoolSlashed { + pool_id: ::core::primitive::u32, + era: ::core::primitive::u32, + balance: ::core::primitive::u128, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum BondExtra<_0> { + #[codec(index = 0)] + FreeBalance(_0), + #[codec(index = 1)] + Rewards, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BondedPoolInner { + pub points: ::core::primitive::u128, + pub state: runtime_types::pallet_nomination_pools::PoolState, + pub member_counter: ::core::primitive::u32, + pub roles: runtime_types::pallet_nomination_pools::PoolRoles< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum ConfigOp<_0> { + #[codec(index = 0)] + Noop, + #[codec(index = 1)] + Set(_0), + #[codec(index = 2)] + Remove, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PoolMember { + pub pool_id: ::core::primitive::u32, + pub points: ::core::primitive::u128, + pub last_recorded_reward_counter: + runtime_types::sp_arithmetic::fixed_point::FixedU128, + pub unbonding_eras: + runtime_types::sp_core::bounded::bounded_btree_map::BoundedBTreeMap< + ::core::primitive::u32, + ::core::primitive::u128, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct PoolRoles<_0> { + pub depositor: _0, + pub root: ::core::option::Option<_0>, + pub nominator: ::core::option::Option<_0>, + pub state_toggler: ::core::option::Option<_0>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum PoolState { + #[codec(index = 0)] + Open, + #[codec(index = 1)] + Blocked, + #[codec(index = 2)] + Destroying, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RewardPool { + pub last_recorded_reward_counter: + runtime_types::sp_arithmetic::fixed_point::FixedU128, + pub last_recorded_total_payouts: ::core::primitive::u128, + pub total_rewards_claimed: ::core::primitive::u128, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SubPools { + pub no_era: runtime_types::pallet_nomination_pools::UnbondPool, + pub with_era: runtime_types::sp_core::bounded::bounded_btree_map::BoundedBTreeMap< + ::core::primitive::u32, + runtime_types::pallet_nomination_pools::UnbondPool, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UnbondPool { + pub points: ::core::primitive::u128, + pub balance: ::core::primitive::u128, + } + } + pub mod pallet_scheduler { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Anonymously schedule a task."] + schedule { + when: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: ::std::boxed::Box, + }, + #[codec(index = 1)] + #[doc = "Cancel an anonymously scheduled task."] + cancel { + when: ::core::primitive::u32, + index: ::core::primitive::u32, + }, + #[codec(index = 2)] + #[doc = "Schedule a named task."] + schedule_named { + id: [::core::primitive::u8; 32usize], + when: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: ::std::boxed::Box, + }, + #[codec(index = 3)] + #[doc = "Cancel a named scheduled task."] + cancel_named { + id: [::core::primitive::u8; 32usize], + }, + #[codec(index = 4)] + #[doc = "Anonymously schedule a task after a delay."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`schedule`]."] + #[doc = "# "] + schedule_after { + after: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: ::std::boxed::Box, + }, + #[codec(index = 5)] + #[doc = "Schedule a named task after a delay."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`schedule_named`](Self::schedule_named)."] + #[doc = "# "] + schedule_named_after { + id: [::core::primitive::u8; 32usize], + after: ::core::primitive::u32, + maybe_periodic: ::core::option::Option<( + ::core::primitive::u32, + ::core::primitive::u32, + )>, + priority: ::core::primitive::u8, + call: ::std::boxed::Box, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Failed to schedule a call"] + FailedToSchedule, + #[codec(index = 1)] + #[doc = "Cannot find the scheduled call."] + NotFound, + #[codec(index = 2)] + #[doc = "Given target block number is in the past."] + TargetBlockNumberInPast, + #[codec(index = 3)] + #[doc = "Reschedule failed because it does not change scheduled time."] + RescheduleNoChange, + #[codec(index = 4)] + #[doc = "Attempt to use a non-named function on a named task."] + Named, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Events type."] + pub enum Event { + #[codec(index = 0)] + #[doc = "Scheduled some task."] + Scheduled { + when: ::core::primitive::u32, + index: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "Canceled some task."] + Canceled { + when: ::core::primitive::u32, + index: ::core::primitive::u32, + }, + #[codec(index = 2)] + #[doc = "Dispatched some task."] + Dispatched { + task: (::core::primitive::u32, ::core::primitive::u32), + id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + #[codec(index = 3)] + #[doc = "The call for the provided hash was not found so the task has been aborted."] + CallUnavailable { + task: (::core::primitive::u32, ::core::primitive::u32), + id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + }, + #[codec(index = 4)] + #[doc = "The given task was unable to be renewed since the agenda is full at that block."] + PeriodicFailed { + task: (::core::primitive::u32, ::core::primitive::u32), + id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + }, + #[codec(index = 5)] + #[doc = "The given task can never be executed since it is overweight."] + PermanentlyOverweight { + task: (::core::primitive::u32, ::core::primitive::u32), + id: ::core::option::Option<[::core::primitive::u8; 32usize]>, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Scheduled<_0, _1, _2, _3, _4> { + pub maybe_id: ::core::option::Option<_0>, + pub priority: ::core::primitive::u8, + pub call: _1, + pub maybe_periodic: ::core::option::Option<(_2, _2)>, + pub origin: _3, + #[codec(skip)] + pub __subxt_unused_type_params: ::core::marker::PhantomData<_4>, + } + } + pub mod pallet_session { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Sets the session key(s) of the function caller to `keys`."] + #[doc = "Allows an account to set its session key prior to becoming a validator."] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be signed."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: `O(1)`. Actual cost depends on the number of length of"] + #[doc = " `T::Keys::key_ids()` which is fixed."] + #[doc = "- DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`"] + #[doc = "- DbWrites: `origin account`, `NextKeys`"] + #[doc = "- DbReads per key id: `KeyOwner`"] + #[doc = "- DbWrites per key id: `KeyOwner`"] + #[doc = "# "] + set_keys { + keys: runtime_types::aleph_runtime::SessionKeys, + proof: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 1)] + #[doc = "Removes any session key(s) of the function caller."] + #[doc = ""] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be Signed and the account must be either be"] + #[doc = "convertible to a validator ID using the chain's typical addressing system (this usually"] + #[doc = "means being a controller account) or directly convertible into a validator ID (which"] + #[doc = "usually means being a stash account)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: `O(1)` in number of key types. Actual cost depends on the number of length"] + #[doc = " of `T::Keys::key_ids()` which is fixed."] + #[doc = "- DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`"] + #[doc = "- DbWrites: `NextKeys`, `origin account`"] + #[doc = "- DbWrites per key id: `KeyOwner`"] + #[doc = "# "] + purge_keys, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Error for the session pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Invalid ownership proof."] + InvalidProof, + #[codec(index = 1)] + #[doc = "No associated validator ID for account."] + NoAssociatedValidatorId, + #[codec(index = 2)] + #[doc = "Registered duplicate key."] + DuplicatedKey, + #[codec(index = 3)] + #[doc = "No keys are associated with this account."] + NoKeys, + #[codec(index = 4)] + #[doc = "Key setting account is not live, so it's impossible to associate keys."] + NoAccount, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "New session has happened. Note that the argument is the session index, not the"] + #[doc = "block number as the type might suggest."] + NewSession { + session_index: ::core::primitive::u32, + }, + } + } + } + pub mod pallet_staking { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Take the origin account as a stash and lock up `value` of its balance. `controller` will"] + #[doc = "be the account that controls it."] + #[doc = ""] + #[doc = "`value` must be more than the `minimum_balance` specified by `T::Currency`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash account."] + #[doc = ""] + #[doc = "Emits `Bonded`."] + #[doc = "# "] + #[doc = "- Independent of the arguments. Moderate complexity."] + #[doc = "- O(1)."] + #[doc = "- Three extra DB entries."] + #[doc = ""] + #[doc = "NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned"] + #[doc = "unless the `origin` falls below _existential deposit_ and gets removed as dust."] + #[doc = "------------------"] + #[doc = "# "] + bond { + controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + #[codec(compact)] + value: ::core::primitive::u128, + payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + }, + #[codec(index = 1)] + #[doc = "Add some extra amount that have appeared in the stash `free_balance` into the balance up"] + #[doc = "for staking."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash, not the controller."] + #[doc = ""] + #[doc = "Use this if there are additional funds in your stash account that you wish to bond."] + #[doc = "Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose"] + #[doc = "any limitation on the amount that can be added."] + #[doc = ""] + #[doc = "Emits `Bonded`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- O(1)."] + #[doc = "# "] + bond_extra { + #[codec(compact)] + max_additional: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Schedule a portion of the stash to be unlocked ready for transfer out after the bond"] + #[doc = "period ends. If this leaves an amount actively bonded less than"] + #[doc = "T::Currency::minimum_balance(), then it is increased to the full amount."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "Once the unlock period is done, you can call `withdraw_unbonded` to actually move"] + #[doc = "the funds out of management ready for transfer."] + #[doc = ""] + #[doc = "No more than a limited number of unlocking chunks (see `MaxUnlockingChunks`)"] + #[doc = "can co-exists at the same time. If there are no unlocking chunks slots available"] + #[doc = "[`Call::withdraw_unbonded`] is called to remove some of the chunks (if possible)."] + #[doc = ""] + #[doc = "If a user encounters the `InsufficientBond` error when calling this extrinsic,"] + #[doc = "they should call `chill` first in order to free up their bonded funds."] + #[doc = ""] + #[doc = "Emits `Unbonded`."] + #[doc = ""] + #[doc = "See also [`Call::withdraw_unbonded`]."] + unbond { + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "Remove any unlocked chunks from the `unlocking` queue from our management."] + #[doc = ""] + #[doc = "This essentially frees up that balance to be used by the stash account to do"] + #[doc = "whatever it wants."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller."] + #[doc = ""] + #[doc = "Emits `Withdrawn`."] + #[doc = ""] + #[doc = "See also [`Call::unbond`]."] + #[doc = ""] + #[doc = "# "] + #[doc = "Complexity O(S) where S is the number of slashing spans to remove"] + #[doc = "NOTE: Weight annotation is the kill scenario, we refund otherwise."] + #[doc = "# "] + withdraw_unbonded { + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 4)] + #[doc = "Declare the desire to validate for the origin controller."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + validate { + prefs: runtime_types::pallet_staking::ValidatorPrefs, + }, + #[codec(index = 5)] + #[doc = "Declare the desire to nominate `targets` for the origin controller."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- The transaction's complexity is proportional to the size of `targets` (N)"] + #[doc = "which is capped at CompactAssignments::LIMIT (T::MaxNominations)."] + #[doc = "- Both the reads and writes follow a similar pattern."] + #[doc = "# "] + nominate { + targets: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + }, + #[codec(index = 6)] + #[doc = "Declare no desire to either validate or nominate."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains one read."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "# "] + chill, + #[codec(index = 7)] + #[doc = "(Re-)set the payment target for a controller."] + #[doc = ""] + #[doc = "Effects will be felt instantly (as soon as this function is completed successfully)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains a limited number of reads."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "---------"] + #[doc = "- Weight: O(1)"] + #[doc = "- DB Weight:"] + #[doc = " - Read: Ledger"] + #[doc = " - Write: Payee"] + #[doc = "# "] + set_payee { + payee: runtime_types::pallet_staking::RewardDestination< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + }, + #[codec(index = 8)] + #[doc = "(Re-)set the controller of a stash."] + #[doc = ""] + #[doc = "Effects will be felt instantly (as soon as this function is completed successfully)."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the stash, not the controller."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Independent of the arguments. Insignificant complexity."] + #[doc = "- Contains a limited number of reads."] + #[doc = "- Writes are limited to the `origin` account key."] + #[doc = "----------"] + #[doc = "Weight: O(1)"] + #[doc = "DB Weight:"] + #[doc = "- Read: Bonded, Ledger New Controller, Ledger Old Controller"] + #[doc = "- Write: Bonded, Ledger New Controller, Ledger Old Controller"] + #[doc = "# "] + set_controller { + controller: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 9)] + #[doc = "Sets the ideal number of validators."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Weight: O(1)"] + #[doc = "Write: Validator Count"] + #[doc = "# "] + set_validator_count { + #[codec(compact)] + new: ::core::primitive::u32, + }, + #[codec(index = 10)] + #[doc = "Increments the ideal number of validators upto maximum of"] + #[doc = "`ElectionProviderBase::MaxWinners`."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`Self::set_validator_count`]."] + #[doc = "# "] + increase_validator_count { + #[codec(compact)] + additional: ::core::primitive::u32, + }, + #[codec(index = 11)] + #[doc = "Scale up the ideal number of validators by a factor upto maximum of"] + #[doc = "`ElectionProviderBase::MaxWinners`."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# "] + #[doc = "Same as [`Self::set_validator_count`]."] + #[doc = "# "] + scale_validator_count { + factor: runtime_types::sp_arithmetic::per_things::Percent, + }, + #[codec(index = 12)] + #[doc = "Force there to be no new eras indefinitely."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "Thus the election process may be ongoing when this is called. In this case the"] + #[doc = "election will continue until the next era is triggered."] + #[doc = ""] + #[doc = "# "] + #[doc = "- No arguments."] + #[doc = "- Weight: O(1)"] + #[doc = "- Write: ForceEra"] + #[doc = "# "] + force_no_eras, + #[codec(index = 13)] + #[doc = "Force there to be a new era at the end of the next session. After this, it will be"] + #[doc = "reset to normal (non-forced) behaviour."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "If this is called just before a new era is triggered, the election process may not"] + #[doc = "have enough blocks to get a result."] + #[doc = ""] + #[doc = "# "] + #[doc = "- No arguments."] + #[doc = "- Weight: O(1)"] + #[doc = "- Write ForceEra"] + #[doc = "# "] + force_new_era, + #[codec(index = 14)] + #[doc = "Set the validators who cannot be slashed (if any)."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + set_invulnerables { + invulnerables: + ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + }, + #[codec(index = 15)] + #[doc = "Force a current staker to become completely unstaked, immediately."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + force_unstake { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 16)] + #[doc = "Force there to be a new era at the end of sessions indefinitely."] + #[doc = ""] + #[doc = "The dispatch origin must be Root."] + #[doc = ""] + #[doc = "# Warning"] + #[doc = ""] + #[doc = "The election process starts multiple blocks before the end of the era."] + #[doc = "If this is called just before a new era is triggered, the election process may not"] + #[doc = "have enough blocks to get a result."] + force_new_era_always, + #[codec(index = 17)] + #[doc = "Cancel enactment of a deferred slash."] + #[doc = ""] + #[doc = "Can be called by the `T::AdminOrigin`."] + #[doc = ""] + #[doc = "Parameters: era and indices of the slashes for that era to kill."] + cancel_deferred_slash { + era: ::core::primitive::u32, + slash_indices: ::std::vec::Vec<::core::primitive::u32>, + }, + #[codec(index = 18)] + #[doc = "Pay out all the stakers behind a single validator for a single era."] + #[doc = ""] + #[doc = "- `validator_stash` is the stash account of the validator. Their nominators, up to"] + #[doc = " `T::MaxNominatorRewardedPerValidator`, will also receive their rewards."] + #[doc = "- `era` may be any era between `[current_era - history_depth; current_era]`."] + #[doc = ""] + #[doc = "The origin of this call must be _Signed_. Any account can call this function, even if"] + #[doc = "it is not one of the stakers."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Time complexity: at most O(MaxNominatorRewardedPerValidator)."] + #[doc = "- Contains a limited number of reads and writes."] + #[doc = "-----------"] + #[doc = "N is the Number of payouts for the validator (including the validator)"] + #[doc = "Weight:"] + #[doc = "- Reward Destination Staked: O(N)"] + #[doc = "- Reward Destination Controller (Creating): O(N)"] + #[doc = ""] + #[doc = " NOTE: weights are assuming that payouts are made to alive stash account (Staked)."] + #[doc = " Paying even a dead controller is cheaper weight-wise. We don't do any refunds here."] + #[doc = "# "] + payout_stakers { + validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + era: ::core::primitive::u32, + }, + #[codec(index = 19)] + #[doc = "Rebond a portion of the stash scheduled to be unlocked."] + #[doc = ""] + #[doc = "The dispatch origin must be signed by the controller."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Time complexity: O(L), where L is unlocking chunks"] + #[doc = "- Bounded by `MaxUnlockingChunks`."] + #[doc = "- Storage changes: Can't increase storage, only decrease it."] + #[doc = "# "] + rebond { + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 20)] + #[doc = "Remove all data structures concerning a staker/stash once it is at a state where it can"] + #[doc = "be considered `dust` in the staking system. The requirements are:"] + #[doc = ""] + #[doc = "1. the `total_balance` of the stash is below existential deposit."] + #[doc = "2. or, the `ledger.total` of the stash is below existential deposit."] + #[doc = ""] + #[doc = "The former can happen in cases like a slash; the latter when a fully unbonded account"] + #[doc = "is still receiving staking rewards in `RewardDestination::Staked`."] + #[doc = ""] + #[doc = "It can be called by anyone, as long as `stash` meets the above requirements."] + #[doc = ""] + #[doc = "Refunds the transaction fees upon successful execution."] + reap_stash { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 21)] + #[doc = "Remove the given nominations from the calling validator."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ by the controller, not the stash."] + #[doc = ""] + #[doc = "- `who`: A list of nominator stash accounts who are nominating this validator which"] + #[doc = " should no longer be nominating this validator."] + #[doc = ""] + #[doc = "Note: Making this call only makes sense if you first set the validator preferences to"] + #[doc = "block any further nominations."] + kick { + who: ::std::vec::Vec< + ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + >, + }, + #[codec(index = 22)] + #[doc = "Update the various staking configurations ."] + #[doc = ""] + #[doc = "* `min_nominator_bond`: The minimum active bond needed to be a nominator."] + #[doc = "* `min_validator_bond`: The minimum active bond needed to be a validator."] + #[doc = "* `max_nominator_count`: The max number of users who can be a nominator at once. When"] + #[doc = " set to `None`, no limit is enforced."] + #[doc = "* `max_validator_count`: The max number of users who can be a validator at once. When"] + #[doc = " set to `None`, no limit is enforced."] + #[doc = "* `chill_threshold`: The ratio of `max_nominator_count` or `max_validator_count` which"] + #[doc = " should be filled in order for the `chill_other` transaction to work."] + #[doc = "* `min_commission`: The minimum amount of commission that each validators must maintain."] + #[doc = " This is checked only upon calling `validate`. Existing validators are not affected."] + #[doc = ""] + #[doc = "RuntimeOrigin must be Root to call this function."] + #[doc = ""] + #[doc = "NOTE: Existing nominators and validators will not be affected by this update."] + #[doc = "to kick people under the new limits, `chill_other` should be called."] + set_staking_configs { + min_nominator_bond: + runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + min_validator_bond: + runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u128, + >, + max_nominator_count: + runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u32, + >, + max_validator_count: + runtime_types::pallet_staking::pallet::pallet::ConfigOp< + ::core::primitive::u32, + >, + chill_threshold: + runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Percent, + >, + min_commission: runtime_types::pallet_staking::pallet::pallet::ConfigOp< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + }, + #[codec(index = 23)] + #[doc = "Declare a `controller` to stop participating as either a validator or nominator."] + #[doc = ""] + #[doc = "Effects will be felt at the beginning of the next era."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_, but can be called by anyone."] + #[doc = ""] + #[doc = "If the caller is the same as the controller being targeted, then no further checks are"] + #[doc = "enforced, and this function behaves just like `chill`."] + #[doc = ""] + #[doc = "If the caller is different than the controller being targeted, the following conditions"] + #[doc = "must be met:"] + #[doc = ""] + #[doc = "* `controller` must belong to a nominator who has become non-decodable,"] + #[doc = ""] + #[doc = "Or:"] + #[doc = ""] + #[doc = "* A `ChillThreshold` must be set and checked which defines how close to the max"] + #[doc = " nominators or validators we must reach before users can start chilling one-another."] + #[doc = "* A `MaxNominatorCount` and `MaxValidatorCount` must be set which is used to determine"] + #[doc = " how close we are to the threshold."] + #[doc = "* A `MinNominatorBond` and `MinValidatorBond` must be set and checked, which determines"] + #[doc = " if this is a person that should be chilled because they have not met the threshold"] + #[doc = " bond required."] + #[doc = ""] + #[doc = "This can be helpful if bond requirements are updated, and we need to remove old users"] + #[doc = "who do not satisfy these requirements."] + chill_other { + controller: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 24)] + #[doc = "Force a validator to have at least the minimum commission. This will not affect a"] + #[doc = "validator who already has a commission greater than or equal to the minimum. Any account"] + #[doc = "can call this."] + force_apply_min_commission { + validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 25)] + #[doc = "Sets the minimum amount of commission that each validators must maintain."] + #[doc = ""] + #[doc = "This call has lower privilege requirements than `set_staking_config` and can be called"] + #[doc = "by the `T::AdminOrigin`. Root can always call this."] + set_min_commission { + new: runtime_types::sp_arithmetic::per_things::Perbill, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum ConfigOp<_0> { + #[codec(index = 0)] + Noop, + #[codec(index = 1)] + Set(_0), + #[codec(index = 2)] + Remove, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Not a controller account."] + NotController, + #[codec(index = 1)] + #[doc = "Not a stash account."] + NotStash, + #[codec(index = 2)] + #[doc = "Stash is already bonded."] + AlreadyBonded, + #[codec(index = 3)] + #[doc = "Controller is already paired."] + AlreadyPaired, + #[codec(index = 4)] + #[doc = "Targets cannot be empty."] + EmptyTargets, + #[codec(index = 5)] + #[doc = "Duplicate index."] + DuplicateIndex, + #[codec(index = 6)] + #[doc = "Slash record index out of bounds."] + InvalidSlashIndex, + #[codec(index = 7)] + #[doc = "Cannot have a validator or nominator role, with value less than the minimum defined by"] + #[doc = "governance (see `MinValidatorBond` and `MinNominatorBond`). If unbonding is the"] + #[doc = "intention, `chill` first to remove one's role as validator/nominator."] + InsufficientBond, + #[codec(index = 8)] + #[doc = "Can not schedule more unlock chunks."] + NoMoreChunks, + #[codec(index = 9)] + #[doc = "Can not rebond without unlocking chunks."] + NoUnlockChunk, + #[codec(index = 10)] + #[doc = "Attempting to target a stash that still has funds."] + FundedTarget, + #[codec(index = 11)] + #[doc = "Invalid era to reward."] + InvalidEraToReward, + #[codec(index = 12)] + #[doc = "Invalid number of nominations."] + InvalidNumberOfNominations, + #[codec(index = 13)] + #[doc = "Items are not sorted and unique."] + NotSortedAndUnique, + #[codec(index = 14)] + #[doc = "Rewards for this era have already been claimed for this validator."] + AlreadyClaimed, + #[codec(index = 15)] + #[doc = "Incorrect previous history depth input provided."] + IncorrectHistoryDepth, + #[codec(index = 16)] + #[doc = "Incorrect number of slashing spans provided."] + IncorrectSlashingSpans, + #[codec(index = 17)] + #[doc = "Internal state has become somehow corrupted and the operation cannot continue."] + BadState, + #[codec(index = 18)] + #[doc = "Too many nomination targets supplied."] + TooManyTargets, + #[codec(index = 19)] + #[doc = "A nomination target was supplied that was blocked or otherwise not a validator."] + BadTarget, + #[codec(index = 20)] + #[doc = "The user has enough bond and thus cannot be chilled forcefully by an external person."] + CannotChillOther, + #[codec(index = 21)] + #[doc = "There are too many nominators in the system. Governance needs to adjust the staking"] + #[doc = "settings to keep things safe for the runtime."] + TooManyNominators, + #[codec(index = 22)] + #[doc = "There are too many validator candidates in the system. Governance needs to adjust the"] + #[doc = "staking settings to keep things safe for the runtime."] + TooManyValidators, + #[codec(index = 23)] + #[doc = "Commission is too low. Must be at least `MinCommission`."] + CommissionTooLow, + #[codec(index = 24)] + #[doc = "Some bound is not met."] + BoundNotMet, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "The era payout has been set; the first balance is the validator-payout; the second is"] + #[doc = "the remainder from the maximum amount of reward."] + EraPaid { + era_index: ::core::primitive::u32, + validator_payout: ::core::primitive::u128, + remainder: ::core::primitive::u128, + }, + #[codec(index = 1)] + #[doc = "The nominator has been rewarded by this amount."] + Rewarded { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "A staker (validator or nominator) has been slashed by the given amount."] + Slashed { + staker: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "A slash for the given validator, for the given percentage of their stake, at the given"] + #[doc = "era as been reported."] + SlashReported { + validator: ::subxt::ext::sp_core::crypto::AccountId32, + fraction: runtime_types::sp_arithmetic::per_things::Perbill, + slash_era: ::core::primitive::u32, + }, + #[codec(index = 4)] + #[doc = "An old slashing report from a prior era was discarded because it could"] + #[doc = "not be processed."] + OldSlashingReportDiscarded { + session_index: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "A new set of stakers was elected."] + StakersElected, + #[codec(index = 6)] + #[doc = "An account has bonded this amount. \\[stash, amount\\]"] + #[doc = ""] + #[doc = "NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably,"] + #[doc = "it will not be emitted for staking rewards when they are added to stake."] + Bonded { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 7)] + #[doc = "An account has unbonded this amount."] + Unbonded { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 8)] + #[doc = "An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`"] + #[doc = "from the unlocking queue."] + Withdrawn { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 9)] + #[doc = "A nominator has been kicked from a validator."] + Kicked { + nominator: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 10)] + #[doc = "The election failed. No new era is planned."] + StakingElectionFailed, + #[codec(index = 11)] + #[doc = "An account has stopped participating as either a validator or nominator."] + Chilled { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 12)] + #[doc = "The stakers' rewards are getting paid."] + PayoutStarted { + era_index: ::core::primitive::u32, + validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 13)] + #[doc = "A validator has set their preferences."] + ValidatorPrefsSet { + stash: ::subxt::ext::sp_core::crypto::AccountId32, + prefs: runtime_types::pallet_staking::ValidatorPrefs, + }, + #[codec(index = 14)] + #[doc = "A new force era mode was set."] + ForceEra { + mode: runtime_types::pallet_staking::Forcing, + }, + } + } + } + pub mod slashing { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SlashingSpans { + pub span_index: ::core::primitive::u32, + pub last_start: ::core::primitive::u32, + pub last_nonzero_slash: ::core::primitive::u32, + pub prior: ::std::vec::Vec<::core::primitive::u32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct SpanRecord<_0> { + pub slashed: _0, + pub paid_out: _0, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ActiveEraInfo { + pub index: ::core::primitive::u32, + pub start: ::core::option::Option<::core::primitive::u64>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct EraRewardPoints<_0> { + pub total: ::core::primitive::u32, + pub individual: ::subxt::utils::KeyedVec<_0, ::core::primitive::u32>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Exposure<_0, _1> { + #[codec(compact)] + pub total: _1, + #[codec(compact)] + pub own: _1, + pub others: + ::std::vec::Vec>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Forcing { + #[codec(index = 0)] + NotForcing, + #[codec(index = 1)] + ForceNew, + #[codec(index = 2)] + ForceNone, + #[codec(index = 3)] + ForceAlways, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct IndividualExposure<_0, _1> { + pub who: _0, + #[codec(compact)] + pub value: _1, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Nominations { + pub targets: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::subxt::ext::sp_core::crypto::AccountId32, + >, + pub submitted_in: ::core::primitive::u32, + pub suppressed: ::core::primitive::bool, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum RewardDestination<_0> { + #[codec(index = 0)] + Staked, + #[codec(index = 1)] + Stash, + #[codec(index = 2)] + Controller, + #[codec(index = 3)] + Account(_0), + #[codec(index = 4)] + None, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct StakingLedger { + pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + #[codec(compact)] + pub total: ::core::primitive::u128, + #[codec(compact)] + pub active: ::core::primitive::u128, + pub unlocking: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + runtime_types::pallet_staking::UnlockChunk<::core::primitive::u128>, + >, + pub claimed_rewards: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< + ::core::primitive::u32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UnappliedSlash<_0, _1> { + pub validator: _0, + pub own: _1, + pub others: ::std::vec::Vec<(_0, _1)>, + pub reporters: ::std::vec::Vec<_0>, + pub payout: _1, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UnlockChunk<_0> { + #[codec(compact)] + pub value: _0, + #[codec(compact)] + pub era: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ValidatorPrefs { + #[codec(compact)] + pub commission: runtime_types::sp_arithmetic::per_things::Perbill, + pub blocked: ::core::primitive::bool, + } + } + pub mod pallet_sudo { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Authenticates the sudo key and dispatches a function call with `Root` origin."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + 10,000."] + #[doc = "# "] + sudo { + call: ::std::boxed::Box, + }, + #[codec(index = 1)] + #[doc = "Authenticates the sudo key and dispatches a function call with `Root` origin."] + #[doc = "This function does not check the weight of the call, and instead allows the"] + #[doc = "Sudo user to specify the weight of the call."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- The weight of this call is defined by the caller."] + #[doc = "# "] + sudo_unchecked_weight { + call: ::std::boxed::Box, + weight: runtime_types::sp_weights::weight_v2::Weight, + }, + #[codec(index = 2)] + #[doc = "Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo"] + #[doc = "key."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB change."] + #[doc = "# "] + set_key { + new: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 3)] + #[doc = "Authenticates the sudo key and dispatches a function call with `Signed` origin from"] + #[doc = "a given account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + 10,000."] + #[doc = "# "] + sudo_as { + who: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + call: ::std::boxed::Box, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Error for the Sudo pallet"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Sender must be the Sudo account"] + RequireSudo, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A sudo just took place. \\[result\\]"] + Sudid { + sudo_result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + #[codec(index = 1)] + #[doc = "The \\[sudoer\\] just switched identity; the old key is supplied if one existed."] + KeyChanged { + old_sudoer: + ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + }, + #[codec(index = 2)] + #[doc = "A sudo just took place. \\[result\\]"] + SudoAsDone { + sudo_result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + } + } + } + pub mod pallet_timestamp { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Set the current time."] + #[doc = ""] + #[doc = "This call should be invoked exactly once per block. It will panic at the finalization"] + #[doc = "phase, if this call hasn't been invoked by that time."] + #[doc = ""] + #[doc = "The timestamp should be greater than the previous one by the amount specified by"] + #[doc = "`MinimumPeriod`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be `Inherent`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)"] + #[doc = "- 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in"] + #[doc = " `on_finalize`)"] + #[doc = "- 1 event handler `on_timestamp_set`. Must be `O(1)`."] + #[doc = "# "] + set { + #[codec(compact)] + now: ::core::primitive::u64, + }, + } + } + } + pub mod pallet_transaction_payment { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] + #[doc = "has been paid by `who`."] + TransactionFeePaid { + who: ::subxt::ext::sp_core::crypto::AccountId32, + actual_fee: ::core::primitive::u128, + tip: ::core::primitive::u128, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ChargeTransactionPayment(#[codec(compact)] pub ::core::primitive::u128); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Releases { + #[codec(index = 0)] + V1Ancient, + #[codec(index = 1)] + V2, + } + } + pub mod pallet_treasury { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Put forward a suggestion for spending. A deposit proportional to the value"] + #[doc = "is reserved and slashed if the proposal is rejected. It is returned once the"] + #[doc = "proposal is awarded."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)"] + #[doc = "- DbReads: `ProposalCount`, `origin account`"] + #[doc = "- DbWrites: `ProposalCount`, `Proposals`, `origin account`"] + #[doc = "# "] + propose_spend { + #[codec(compact)] + value: ::core::primitive::u128, + beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 1)] + #[doc = "Reject a proposed spend. The original deposit will be slashed."] + #[doc = ""] + #[doc = "May only be called from `T::RejectOrigin`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)"] + #[doc = "- DbReads: `Proposals`, `rejected proposer account`"] + #[doc = "- DbWrites: `Proposals`, `rejected proposer account`"] + #[doc = "# "] + reject_proposal { + #[codec(compact)] + proposal_id: ::core::primitive::u32, + }, + #[codec(index = 2)] + #[doc = "Approve a proposal. At a later time, the proposal will be allocated to the beneficiary"] + #[doc = "and the original deposit will be returned."] + #[doc = ""] + #[doc = "May only be called from `T::ApproveOrigin`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(1)."] + #[doc = "- DbReads: `Proposals`, `Approvals`"] + #[doc = "- DbWrite: `Approvals`"] + #[doc = "# "] + approve_proposal { + #[codec(compact)] + proposal_id: ::core::primitive::u32, + }, + #[codec(index = 3)] + #[doc = "Propose and approve a spend of treasury funds."] + #[doc = ""] + #[doc = "- `origin`: Must be `SpendOrigin` with the `Success` value being at least `amount`."] + #[doc = "- `amount`: The amount to be transferred from the treasury to the `beneficiary`."] + #[doc = "- `beneficiary`: The destination account for the transfer."] + #[doc = ""] + #[doc = "NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the"] + #[doc = "beneficiary."] + spend { + #[codec(compact)] + amount: ::core::primitive::u128, + beneficiary: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 4)] + #[doc = "Force a previously approved proposal to be removed from the approval queue."] + #[doc = "The original deposit will no longer be returned."] + #[doc = ""] + #[doc = "May only be called from `T::RejectOrigin`."] + #[doc = "- `proposal_id`: The index of a proposal"] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(A) where `A` is the number of approvals"] + #[doc = "- Db reads and writes: `Approvals`"] + #[doc = "# "] + #[doc = ""] + #[doc = "Errors:"] + #[doc = "- `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,"] + #[doc = "i.e., the proposal has not been approved. This could also mean the proposal does not"] + #[doc = "exist altogether, thus there is no way it would have been approved in the first place."] + remove_approval { + #[codec(compact)] + proposal_id: ::core::primitive::u32, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Error for the treasury pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Proposer's balance is too low."] + InsufficientProposersBalance, + #[codec(index = 1)] + #[doc = "No proposal or bounty at that index."] + InvalidIndex, + #[codec(index = 2)] + #[doc = "Too many approvals in the queue."] + TooManyApprovals, + #[codec(index = 3)] + #[doc = "The spend origin is valid but the amount it is allowed to spend is lower than the"] + #[doc = "amount to be spent."] + InsufficientPermission, + #[codec(index = 4)] + #[doc = "Proposal has not been approved."] + ProposalNotApproved, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "New proposal."] + Proposed { + proposal_index: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "We have ended a spend period and will now allocate funds."] + Spending { + budget_remaining: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Some funds have been allocated."] + Awarded { + proposal_index: ::core::primitive::u32, + award: ::core::primitive::u128, + account: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 3)] + #[doc = "A proposal was rejected; funds were slashed."] + Rejected { + proposal_index: ::core::primitive::u32, + slashed: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "Some of our funds have been burnt."] + Burnt { + burnt_funds: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "Spending has finished; this is the amount that rolls over until next spend."] + Rollover { + rollover_balance: ::core::primitive::u128, + }, + #[codec(index = 6)] + #[doc = "Some funds have been deposited."] + Deposit { value: ::core::primitive::u128 }, + #[codec(index = 7)] + #[doc = "A new spend proposal has been approved."] + SpendApproved { + proposal_index: ::core::primitive::u32, + amount: ::core::primitive::u128, + beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + }, + #[codec(index = 8)] + #[doc = "The inactive funds of the pallet have been updated."] + UpdatedInactive { + reactivated: ::core::primitive::u128, + deactivated: ::core::primitive::u128, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Proposal<_0, _1> { + pub proposer: _0, + pub value: _1, + pub beneficiary: _0, + pub bond: _1, + } + } + pub mod pallet_utility { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Send a batch of dispatch calls."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatched without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + #[doc = ""] + #[doc = "This will return `Ok` in all circumstances. To determine the success of the batch, an"] + #[doc = "event is deposited. If a call failed and the batch was interrupted, then the"] + #[doc = "`BatchInterrupted` event is deposited, along with the number of successful calls made"] + #[doc = "and the error of the failed call. If all were successful, then the `BatchCompleted`"] + #[doc = "event is deposited."] + batch { + calls: ::std::vec::Vec, + }, + #[codec(index = 1)] + #[doc = "Send a call through an indexed pseudonym of the sender."] + #[doc = ""] + #[doc = "Filter from origin are passed along. The call will be dispatched with an origin which"] + #[doc = "use the same filter as the origin of this call."] + #[doc = ""] + #[doc = "NOTE: If you need to ensure that any account-based filtering is not honored (i.e."] + #[doc = "because you expect `proxy` to have been used prior in the call stack and you do not want"] + #[doc = "the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1`"] + #[doc = "in the Multisig pallet instead."] + #[doc = ""] + #[doc = "NOTE: Prior to version *12, this was called `as_limited_sub`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + as_derivative { + index: ::core::primitive::u16, + call: ::std::boxed::Box, + }, + #[codec(index = 2)] + #[doc = "Send a batch of dispatch calls and atomically execute them."] + #[doc = "The whole transaction will rollback and fail if any of the calls failed."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatched without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + batch_all { + calls: ::std::vec::Vec, + }, + #[codec(index = 3)] + #[doc = "Dispatches a function call with a provided origin."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + #[doc = ""] + #[doc = "# "] + #[doc = "- O(1)."] + #[doc = "- Limited storage reads."] + #[doc = "- One DB write (event)."] + #[doc = "- Weight of derivative `call` execution + T::WeightInfo::dispatch_as()."] + #[doc = "# "] + dispatch_as { + as_origin: ::std::boxed::Box, + call: ::std::boxed::Box, + }, + #[codec(index = 4)] + #[doc = "Send a batch of dispatch calls."] + #[doc = "Unlike `batch`, it allows errors and won't interrupt."] + #[doc = ""] + #[doc = "May be called from any origin except `None`."] + #[doc = ""] + #[doc = "- `calls`: The calls to be dispatched from the same origin. The number of call must not"] + #[doc = " exceed the constant: `batched_calls_limit` (available in constant metadata)."] + #[doc = ""] + #[doc = "If origin is root then the calls are dispatch without checking origin filter. (This"] + #[doc = "includes bypassing `frame_system::Config::BaseCallFilter`)."] + #[doc = ""] + #[doc = "# "] + #[doc = "- Complexity: O(C) where C is the number of calls to be batched."] + #[doc = "# "] + force_batch { + calls: ::std::vec::Vec, + }, + #[codec(index = 5)] + #[doc = "Dispatch a function call with a specified weight."] + #[doc = ""] + #[doc = "This function does not check the weight of the call, and instead allows the"] + #[doc = "Root origin to specify the weight of the call."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + with_weight { + call: ::std::boxed::Box, + weight: runtime_types::sp_weights::weight_v2::Weight, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Too many calls batched."] + TooManyCalls, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "Batch of dispatches did not complete fully. Index of first failing dispatch given, as"] + #[doc = "well as the error."] + BatchInterrupted { + index: ::core::primitive::u32, + error: runtime_types::sp_runtime::DispatchError, + }, + #[codec(index = 1)] + #[doc = "Batch of dispatches completed fully with no error."] + BatchCompleted, + #[codec(index = 2)] + #[doc = "Batch of dispatches completed but has errors."] + BatchCompletedWithErrors, + #[codec(index = 3)] + #[doc = "A single item within a Batch of dispatches has completed with no error."] + ItemCompleted, + #[codec(index = 4)] + #[doc = "A single item within a Batch of dispatches has completed with error."] + ItemFailed { + error: runtime_types::sp_runtime::DispatchError, + }, + #[codec(index = 5)] + #[doc = "A call was dispatched."] + DispatchedAs { + result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + } + } + } + pub mod pallet_vesting { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Unlock any vested funds of the sender account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have funds still"] + #[doc = "locked under this pallet."] + #[doc = ""] + #[doc = "Emits either `VestingCompleted` or `VestingUpdated`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 2 Reads, 2 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, [Sender Account]"] + #[doc = " - Writes: Vesting Storage, Balances Locks, [Sender Account]"] + #[doc = "# "] + vest, + #[codec(index = 1)] + #[doc = "Unlock any vested funds of a `target` account."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `target`: The account whose vested funds should be unlocked. Must have funds still"] + #[doc = "locked under this pallet."] + #[doc = ""] + #[doc = "Emits either `VestingCompleted` or `VestingUpdated`."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 3 Reads, 3 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account"] + #[doc = "# "] + vest_other { + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + }, + #[codec(index = 2)] + #[doc = "Create a vested transfer."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `target`: The account receiving the vested funds."] + #[doc = "- `schedule`: The vesting schedule attached to the transfer."] + #[doc = ""] + #[doc = "Emits `VestingCreated`."] + #[doc = ""] + #[doc = "NOTE: This will unlock all schedules through the current block."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 3 Reads, 3 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]"] + #[doc = "# "] + vested_transfer { + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + }, + #[codec(index = 3)] + #[doc = "Force a vested transfer."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Root_."] + #[doc = ""] + #[doc = "- `source`: The account whose funds should be transferred."] + #[doc = "- `target`: The account that should be transferred the vested funds."] + #[doc = "- `schedule`: The vesting schedule attached to the transfer."] + #[doc = ""] + #[doc = "Emits `VestingCreated`."] + #[doc = ""] + #[doc = "NOTE: This will unlock all schedules through the current block."] + #[doc = ""] + #[doc = "# "] + #[doc = "- `O(1)`."] + #[doc = "- DbWeight: 4 Reads, 4 Writes"] + #[doc = " - Reads: Vesting Storage, Balances Locks, Target Account, Source Account"] + #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, Source Account"] + #[doc = "# "] + force_vested_transfer { + source: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + target: ::subxt::ext::sp_runtime::MultiAddress< + ::subxt::ext::sp_core::crypto::AccountId32, + (), + >, + schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< + ::core::primitive::u128, + ::core::primitive::u32, + >, + }, + #[codec(index = 4)] + #[doc = "Merge two vesting schedules together, creating a new vesting schedule that unlocks over"] + #[doc = "the highest possible start and end blocks. If both schedules have already started the"] + #[doc = "current block will be used as the schedule start; with the caveat that if one schedule"] + #[doc = "is finished by the current block, the other will be treated as the new merged schedule,"] + #[doc = "unmodified."] + #[doc = ""] + #[doc = "NOTE: If `schedule1_index == schedule2_index` this is a no-op."] + #[doc = "NOTE: This will unlock all schedules through the current block prior to merging."] + #[doc = "NOTE: If both schedules have ended by the current block, no new schedule will be created"] + #[doc = "and both will be removed."] + #[doc = ""] + #[doc = "Merged schedule attributes:"] + #[doc = "- `starting_block`: `MAX(schedule1.starting_block, scheduled2.starting_block,"] + #[doc = " current_block)`."] + #[doc = "- `ending_block`: `MAX(schedule1.ending_block, schedule2.ending_block)`."] + #[doc = "- `locked`: `schedule1.locked_at(current_block) + schedule2.locked_at(current_block)`."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `schedule1_index`: index of the first schedule to merge."] + #[doc = "- `schedule2_index`: index of the second schedule to merge."] + merge_schedules { + schedule1_index: ::core::primitive::u32, + schedule2_index: ::core::primitive::u32, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "Error for the vesting pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "The account given is not vesting."] + NotVesting, + #[codec(index = 1)] + #[doc = "The account already has `MaxVestingSchedules` count of schedules and thus"] + #[doc = "cannot add another one. Consider merging existing schedules in order to add another."] + AtMaxVestingSchedules, + #[codec(index = 2)] + #[doc = "Amount being transferred is too low to create a vesting schedule."] + AmountLow, + #[codec(index = 3)] + #[doc = "An index was out of bounds of the vesting schedules."] + ScheduleIndexOutOfBounds, + #[codec(index = 4)] + #[doc = "Failed to create a new schedule because some parameter was invalid."] + InvalidScheduleParams, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "The amount vested has been updated. This could indicate a change in funds available."] + #[doc = "The balance given is the amount which is left unvested (and thus locked)."] + VestingUpdated { + account: ::subxt::ext::sp_core::crypto::AccountId32, + unvested: ::core::primitive::u128, + }, + #[codec(index = 1)] + #[doc = "An \\[account\\] has become fully vested."] + VestingCompleted { + account: ::subxt::ext::sp_core::crypto::AccountId32, + }, + } + } + pub mod vesting_info { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct VestingInfo<_0, _1> { + pub locked: _0, + pub per_block: _0, + pub starting_block: _1, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Releases { + #[codec(index = 0)] + V0, + #[codec(index = 1)] + V1, + } + } + pub mod primitive_types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct H256(pub [::core::primitive::u8; 32usize]); + } + pub mod primitives { + use super::runtime_types; + pub mod app { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Public(pub runtime_types::sp_core::ed25519::Public); + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BanConfig { + pub minimal_expected_performance: runtime_types::sp_arithmetic::per_things::Perbill, + pub underperformed_session_count_threshold: ::core::primitive::u32, + pub clean_session_counter_delay: ::core::primitive::u32, + pub ban_period: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BanInfo { + pub reason: runtime_types::primitives::BanReason, + pub start: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum BanReason { + #[codec(index = 0)] + InsufficientUptime(::core::primitive::u32), + #[codec(index = 1)] + OtherReason( + runtime_types::sp_core::bounded::bounded_vec::BoundedVec<::core::primitive::u8>, + ), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct CommitteeSeats { + pub reserved_seats: ::core::primitive::u32, + pub non_reserved_seats: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum ElectionOpenness { + #[codec(index = 0)] + Permissioned, + #[codec(index = 1)] + Permissionless, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct EraValidators<_0> { + pub reserved: ::std::vec::Vec<_0>, + pub non_reserved: ::std::vec::Vec<_0>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct VersionChange { + pub version_incoming: ::core::primitive::u32, + pub session: ::core::primitive::u32, + } + } + pub mod sp_arithmetic { + use super::runtime_types; + pub mod fixed_point { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct FixedU128(pub ::core::primitive::u128); + } + pub mod per_things { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Perbill(pub ::core::primitive::u32); + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Percent(pub ::core::primitive::u8); + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Permill(pub ::core::primitive::u32); + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum ArithmeticError { + #[codec(index = 0)] + Underflow, + #[codec(index = 1)] + Overflow, + #[codec(index = 2)] + DivisionByZero, + } + } + pub mod sp_consensus_aura { + use super::runtime_types; + pub mod sr25519 { + use super::runtime_types; + pub mod app_sr25519 { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Public(pub runtime_types::sp_core::sr25519::Public); + } + } + } + pub mod sp_consensus_slots { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Slot(pub ::core::primitive::u64); + } + pub mod sp_core { + use super::runtime_types; + pub mod bounded { + use super::runtime_types; + pub mod bounded_btree_map { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BoundedBTreeMap<_0, _1>(pub ::subxt::utils::KeyedVec<_0, _1>); + } + pub mod bounded_vec { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct BoundedVec<_0>(pub ::std::vec::Vec<_0>); + } + pub mod weak_bounded_vec { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct WeakBoundedVec<_0>(pub ::std::vec::Vec<_0>); + } + } + pub mod crypto { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct AccountId32(pub [::core::primitive::u8; 32usize]); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct KeyTypeId(pub [::core::primitive::u8; 4usize]); + } + pub mod ecdsa { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Signature(pub [::core::primitive::u8; 65usize]); + } + pub mod ed25519 { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Public(pub [::core::primitive::u8; 32usize]); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Signature(pub [::core::primitive::u8; 64usize]); + } + pub mod sr25519 { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Public(pub [::core::primitive::u8; 32usize]); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Signature(pub [::core::primitive::u8; 64usize]); + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Void {} + } + pub mod sp_runtime { + use super::runtime_types; + pub mod generic { + use super::runtime_types; + pub mod digest { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Digest { + pub logs: + ::std::vec::Vec, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum DigestItem { + #[codec(index = 6)] + PreRuntime( + [::core::primitive::u8; 4usize], + ::std::vec::Vec<::core::primitive::u8>, + ), + #[codec(index = 4)] + Consensus( + [::core::primitive::u8; 4usize], + ::std::vec::Vec<::core::primitive::u8>, + ), + #[codec(index = 5)] + Seal( + [::core::primitive::u8; 4usize], + ::std::vec::Vec<::core::primitive::u8>, + ), + #[codec(index = 0)] + Other(::std::vec::Vec<::core::primitive::u8>), + #[codec(index = 8)] + RuntimeEnvironmentUpdated, + } + } + pub mod era { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum Era { + #[codec(index = 0)] + Immortal, + #[codec(index = 1)] + Mortal1(::core::primitive::u8), + #[codec(index = 2)] + Mortal2(::core::primitive::u8), + #[codec(index = 3)] + Mortal3(::core::primitive::u8), + #[codec(index = 4)] + Mortal4(::core::primitive::u8), + #[codec(index = 5)] + Mortal5(::core::primitive::u8), + #[codec(index = 6)] + Mortal6(::core::primitive::u8), + #[codec(index = 7)] + Mortal7(::core::primitive::u8), + #[codec(index = 8)] + Mortal8(::core::primitive::u8), + #[codec(index = 9)] + Mortal9(::core::primitive::u8), + #[codec(index = 10)] + Mortal10(::core::primitive::u8), + #[codec(index = 11)] + Mortal11(::core::primitive::u8), + #[codec(index = 12)] + Mortal12(::core::primitive::u8), + #[codec(index = 13)] + Mortal13(::core::primitive::u8), + #[codec(index = 14)] + Mortal14(::core::primitive::u8), + #[codec(index = 15)] + Mortal15(::core::primitive::u8), + #[codec(index = 16)] + Mortal16(::core::primitive::u8), + #[codec(index = 17)] + Mortal17(::core::primitive::u8), + #[codec(index = 18)] + Mortal18(::core::primitive::u8), + #[codec(index = 19)] + Mortal19(::core::primitive::u8), + #[codec(index = 20)] + Mortal20(::core::primitive::u8), + #[codec(index = 21)] + Mortal21(::core::primitive::u8), + #[codec(index = 22)] + Mortal22(::core::primitive::u8), + #[codec(index = 23)] + Mortal23(::core::primitive::u8), + #[codec(index = 24)] + Mortal24(::core::primitive::u8), + #[codec(index = 25)] + Mortal25(::core::primitive::u8), + #[codec(index = 26)] + Mortal26(::core::primitive::u8), + #[codec(index = 27)] + Mortal27(::core::primitive::u8), + #[codec(index = 28)] + Mortal28(::core::primitive::u8), + #[codec(index = 29)] + Mortal29(::core::primitive::u8), + #[codec(index = 30)] + Mortal30(::core::primitive::u8), + #[codec(index = 31)] + Mortal31(::core::primitive::u8), + #[codec(index = 32)] + Mortal32(::core::primitive::u8), + #[codec(index = 33)] + Mortal33(::core::primitive::u8), + #[codec(index = 34)] + Mortal34(::core::primitive::u8), + #[codec(index = 35)] + Mortal35(::core::primitive::u8), + #[codec(index = 36)] + Mortal36(::core::primitive::u8), + #[codec(index = 37)] + Mortal37(::core::primitive::u8), + #[codec(index = 38)] + Mortal38(::core::primitive::u8), + #[codec(index = 39)] + Mortal39(::core::primitive::u8), + #[codec(index = 40)] + Mortal40(::core::primitive::u8), + #[codec(index = 41)] + Mortal41(::core::primitive::u8), + #[codec(index = 42)] + Mortal42(::core::primitive::u8), + #[codec(index = 43)] + Mortal43(::core::primitive::u8), + #[codec(index = 44)] + Mortal44(::core::primitive::u8), + #[codec(index = 45)] + Mortal45(::core::primitive::u8), + #[codec(index = 46)] + Mortal46(::core::primitive::u8), + #[codec(index = 47)] + Mortal47(::core::primitive::u8), + #[codec(index = 48)] + Mortal48(::core::primitive::u8), + #[codec(index = 49)] + Mortal49(::core::primitive::u8), + #[codec(index = 50)] + Mortal50(::core::primitive::u8), + #[codec(index = 51)] + Mortal51(::core::primitive::u8), + #[codec(index = 52)] + Mortal52(::core::primitive::u8), + #[codec(index = 53)] + Mortal53(::core::primitive::u8), + #[codec(index = 54)] + Mortal54(::core::primitive::u8), + #[codec(index = 55)] + Mortal55(::core::primitive::u8), + #[codec(index = 56)] + Mortal56(::core::primitive::u8), + #[codec(index = 57)] + Mortal57(::core::primitive::u8), + #[codec(index = 58)] + Mortal58(::core::primitive::u8), + #[codec(index = 59)] + Mortal59(::core::primitive::u8), + #[codec(index = 60)] + Mortal60(::core::primitive::u8), + #[codec(index = 61)] + Mortal61(::core::primitive::u8), + #[codec(index = 62)] + Mortal62(::core::primitive::u8), + #[codec(index = 63)] + Mortal63(::core::primitive::u8), + #[codec(index = 64)] + Mortal64(::core::primitive::u8), + #[codec(index = 65)] + Mortal65(::core::primitive::u8), + #[codec(index = 66)] + Mortal66(::core::primitive::u8), + #[codec(index = 67)] + Mortal67(::core::primitive::u8), + #[codec(index = 68)] + Mortal68(::core::primitive::u8), + #[codec(index = 69)] + Mortal69(::core::primitive::u8), + #[codec(index = 70)] + Mortal70(::core::primitive::u8), + #[codec(index = 71)] + Mortal71(::core::primitive::u8), + #[codec(index = 72)] + Mortal72(::core::primitive::u8), + #[codec(index = 73)] + Mortal73(::core::primitive::u8), + #[codec(index = 74)] + Mortal74(::core::primitive::u8), + #[codec(index = 75)] + Mortal75(::core::primitive::u8), + #[codec(index = 76)] + Mortal76(::core::primitive::u8), + #[codec(index = 77)] + Mortal77(::core::primitive::u8), + #[codec(index = 78)] + Mortal78(::core::primitive::u8), + #[codec(index = 79)] + Mortal79(::core::primitive::u8), + #[codec(index = 80)] + Mortal80(::core::primitive::u8), + #[codec(index = 81)] + Mortal81(::core::primitive::u8), + #[codec(index = 82)] + Mortal82(::core::primitive::u8), + #[codec(index = 83)] + Mortal83(::core::primitive::u8), + #[codec(index = 84)] + Mortal84(::core::primitive::u8), + #[codec(index = 85)] + Mortal85(::core::primitive::u8), + #[codec(index = 86)] + Mortal86(::core::primitive::u8), + #[codec(index = 87)] + Mortal87(::core::primitive::u8), + #[codec(index = 88)] + Mortal88(::core::primitive::u8), + #[codec(index = 89)] + Mortal89(::core::primitive::u8), + #[codec(index = 90)] + Mortal90(::core::primitive::u8), + #[codec(index = 91)] + Mortal91(::core::primitive::u8), + #[codec(index = 92)] + Mortal92(::core::primitive::u8), + #[codec(index = 93)] + Mortal93(::core::primitive::u8), + #[codec(index = 94)] + Mortal94(::core::primitive::u8), + #[codec(index = 95)] + Mortal95(::core::primitive::u8), + #[codec(index = 96)] + Mortal96(::core::primitive::u8), + #[codec(index = 97)] + Mortal97(::core::primitive::u8), + #[codec(index = 98)] + Mortal98(::core::primitive::u8), + #[codec(index = 99)] + Mortal99(::core::primitive::u8), + #[codec(index = 100)] + Mortal100(::core::primitive::u8), + #[codec(index = 101)] + Mortal101(::core::primitive::u8), + #[codec(index = 102)] + Mortal102(::core::primitive::u8), + #[codec(index = 103)] + Mortal103(::core::primitive::u8), + #[codec(index = 104)] + Mortal104(::core::primitive::u8), + #[codec(index = 105)] + Mortal105(::core::primitive::u8), + #[codec(index = 106)] + Mortal106(::core::primitive::u8), + #[codec(index = 107)] + Mortal107(::core::primitive::u8), + #[codec(index = 108)] + Mortal108(::core::primitive::u8), + #[codec(index = 109)] + Mortal109(::core::primitive::u8), + #[codec(index = 110)] + Mortal110(::core::primitive::u8), + #[codec(index = 111)] + Mortal111(::core::primitive::u8), + #[codec(index = 112)] + Mortal112(::core::primitive::u8), + #[codec(index = 113)] + Mortal113(::core::primitive::u8), + #[codec(index = 114)] + Mortal114(::core::primitive::u8), + #[codec(index = 115)] + Mortal115(::core::primitive::u8), + #[codec(index = 116)] + Mortal116(::core::primitive::u8), + #[codec(index = 117)] + Mortal117(::core::primitive::u8), + #[codec(index = 118)] + Mortal118(::core::primitive::u8), + #[codec(index = 119)] + Mortal119(::core::primitive::u8), + #[codec(index = 120)] + Mortal120(::core::primitive::u8), + #[codec(index = 121)] + Mortal121(::core::primitive::u8), + #[codec(index = 122)] + Mortal122(::core::primitive::u8), + #[codec(index = 123)] + Mortal123(::core::primitive::u8), + #[codec(index = 124)] + Mortal124(::core::primitive::u8), + #[codec(index = 125)] + Mortal125(::core::primitive::u8), + #[codec(index = 126)] + Mortal126(::core::primitive::u8), + #[codec(index = 127)] + Mortal127(::core::primitive::u8), + #[codec(index = 128)] + Mortal128(::core::primitive::u8), + #[codec(index = 129)] + Mortal129(::core::primitive::u8), + #[codec(index = 130)] + Mortal130(::core::primitive::u8), + #[codec(index = 131)] + Mortal131(::core::primitive::u8), + #[codec(index = 132)] + Mortal132(::core::primitive::u8), + #[codec(index = 133)] + Mortal133(::core::primitive::u8), + #[codec(index = 134)] + Mortal134(::core::primitive::u8), + #[codec(index = 135)] + Mortal135(::core::primitive::u8), + #[codec(index = 136)] + Mortal136(::core::primitive::u8), + #[codec(index = 137)] + Mortal137(::core::primitive::u8), + #[codec(index = 138)] + Mortal138(::core::primitive::u8), + #[codec(index = 139)] + Mortal139(::core::primitive::u8), + #[codec(index = 140)] + Mortal140(::core::primitive::u8), + #[codec(index = 141)] + Mortal141(::core::primitive::u8), + #[codec(index = 142)] + Mortal142(::core::primitive::u8), + #[codec(index = 143)] + Mortal143(::core::primitive::u8), + #[codec(index = 144)] + Mortal144(::core::primitive::u8), + #[codec(index = 145)] + Mortal145(::core::primitive::u8), + #[codec(index = 146)] + Mortal146(::core::primitive::u8), + #[codec(index = 147)] + Mortal147(::core::primitive::u8), + #[codec(index = 148)] + Mortal148(::core::primitive::u8), + #[codec(index = 149)] + Mortal149(::core::primitive::u8), + #[codec(index = 150)] + Mortal150(::core::primitive::u8), + #[codec(index = 151)] + Mortal151(::core::primitive::u8), + #[codec(index = 152)] + Mortal152(::core::primitive::u8), + #[codec(index = 153)] + Mortal153(::core::primitive::u8), + #[codec(index = 154)] + Mortal154(::core::primitive::u8), + #[codec(index = 155)] + Mortal155(::core::primitive::u8), + #[codec(index = 156)] + Mortal156(::core::primitive::u8), + #[codec(index = 157)] + Mortal157(::core::primitive::u8), + #[codec(index = 158)] + Mortal158(::core::primitive::u8), + #[codec(index = 159)] + Mortal159(::core::primitive::u8), + #[codec(index = 160)] + Mortal160(::core::primitive::u8), + #[codec(index = 161)] + Mortal161(::core::primitive::u8), + #[codec(index = 162)] + Mortal162(::core::primitive::u8), + #[codec(index = 163)] + Mortal163(::core::primitive::u8), + #[codec(index = 164)] + Mortal164(::core::primitive::u8), + #[codec(index = 165)] + Mortal165(::core::primitive::u8), + #[codec(index = 166)] + Mortal166(::core::primitive::u8), + #[codec(index = 167)] + Mortal167(::core::primitive::u8), + #[codec(index = 168)] + Mortal168(::core::primitive::u8), + #[codec(index = 169)] + Mortal169(::core::primitive::u8), + #[codec(index = 170)] + Mortal170(::core::primitive::u8), + #[codec(index = 171)] + Mortal171(::core::primitive::u8), + #[codec(index = 172)] + Mortal172(::core::primitive::u8), + #[codec(index = 173)] + Mortal173(::core::primitive::u8), + #[codec(index = 174)] + Mortal174(::core::primitive::u8), + #[codec(index = 175)] + Mortal175(::core::primitive::u8), + #[codec(index = 176)] + Mortal176(::core::primitive::u8), + #[codec(index = 177)] + Mortal177(::core::primitive::u8), + #[codec(index = 178)] + Mortal178(::core::primitive::u8), + #[codec(index = 179)] + Mortal179(::core::primitive::u8), + #[codec(index = 180)] + Mortal180(::core::primitive::u8), + #[codec(index = 181)] + Mortal181(::core::primitive::u8), + #[codec(index = 182)] + Mortal182(::core::primitive::u8), + #[codec(index = 183)] + Mortal183(::core::primitive::u8), + #[codec(index = 184)] + Mortal184(::core::primitive::u8), + #[codec(index = 185)] + Mortal185(::core::primitive::u8), + #[codec(index = 186)] + Mortal186(::core::primitive::u8), + #[codec(index = 187)] + Mortal187(::core::primitive::u8), + #[codec(index = 188)] + Mortal188(::core::primitive::u8), + #[codec(index = 189)] + Mortal189(::core::primitive::u8), + #[codec(index = 190)] + Mortal190(::core::primitive::u8), + #[codec(index = 191)] + Mortal191(::core::primitive::u8), + #[codec(index = 192)] + Mortal192(::core::primitive::u8), + #[codec(index = 193)] + Mortal193(::core::primitive::u8), + #[codec(index = 194)] + Mortal194(::core::primitive::u8), + #[codec(index = 195)] + Mortal195(::core::primitive::u8), + #[codec(index = 196)] + Mortal196(::core::primitive::u8), + #[codec(index = 197)] + Mortal197(::core::primitive::u8), + #[codec(index = 198)] + Mortal198(::core::primitive::u8), + #[codec(index = 199)] + Mortal199(::core::primitive::u8), + #[codec(index = 200)] + Mortal200(::core::primitive::u8), + #[codec(index = 201)] + Mortal201(::core::primitive::u8), + #[codec(index = 202)] + Mortal202(::core::primitive::u8), + #[codec(index = 203)] + Mortal203(::core::primitive::u8), + #[codec(index = 204)] + Mortal204(::core::primitive::u8), + #[codec(index = 205)] + Mortal205(::core::primitive::u8), + #[codec(index = 206)] + Mortal206(::core::primitive::u8), + #[codec(index = 207)] + Mortal207(::core::primitive::u8), + #[codec(index = 208)] + Mortal208(::core::primitive::u8), + #[codec(index = 209)] + Mortal209(::core::primitive::u8), + #[codec(index = 210)] + Mortal210(::core::primitive::u8), + #[codec(index = 211)] + Mortal211(::core::primitive::u8), + #[codec(index = 212)] + Mortal212(::core::primitive::u8), + #[codec(index = 213)] + Mortal213(::core::primitive::u8), + #[codec(index = 214)] + Mortal214(::core::primitive::u8), + #[codec(index = 215)] + Mortal215(::core::primitive::u8), + #[codec(index = 216)] + Mortal216(::core::primitive::u8), + #[codec(index = 217)] + Mortal217(::core::primitive::u8), + #[codec(index = 218)] + Mortal218(::core::primitive::u8), + #[codec(index = 219)] + Mortal219(::core::primitive::u8), + #[codec(index = 220)] + Mortal220(::core::primitive::u8), + #[codec(index = 221)] + Mortal221(::core::primitive::u8), + #[codec(index = 222)] + Mortal222(::core::primitive::u8), + #[codec(index = 223)] + Mortal223(::core::primitive::u8), + #[codec(index = 224)] + Mortal224(::core::primitive::u8), + #[codec(index = 225)] + Mortal225(::core::primitive::u8), + #[codec(index = 226)] + Mortal226(::core::primitive::u8), + #[codec(index = 227)] + Mortal227(::core::primitive::u8), + #[codec(index = 228)] + Mortal228(::core::primitive::u8), + #[codec(index = 229)] + Mortal229(::core::primitive::u8), + #[codec(index = 230)] + Mortal230(::core::primitive::u8), + #[codec(index = 231)] + Mortal231(::core::primitive::u8), + #[codec(index = 232)] + Mortal232(::core::primitive::u8), + #[codec(index = 233)] + Mortal233(::core::primitive::u8), + #[codec(index = 234)] + Mortal234(::core::primitive::u8), + #[codec(index = 235)] + Mortal235(::core::primitive::u8), + #[codec(index = 236)] + Mortal236(::core::primitive::u8), + #[codec(index = 237)] + Mortal237(::core::primitive::u8), + #[codec(index = 238)] + Mortal238(::core::primitive::u8), + #[codec(index = 239)] + Mortal239(::core::primitive::u8), + #[codec(index = 240)] + Mortal240(::core::primitive::u8), + #[codec(index = 241)] + Mortal241(::core::primitive::u8), + #[codec(index = 242)] + Mortal242(::core::primitive::u8), + #[codec(index = 243)] + Mortal243(::core::primitive::u8), + #[codec(index = 244)] + Mortal244(::core::primitive::u8), + #[codec(index = 245)] + Mortal245(::core::primitive::u8), + #[codec(index = 246)] + Mortal246(::core::primitive::u8), + #[codec(index = 247)] + Mortal247(::core::primitive::u8), + #[codec(index = 248)] + Mortal248(::core::primitive::u8), + #[codec(index = 249)] + Mortal249(::core::primitive::u8), + #[codec(index = 250)] + Mortal250(::core::primitive::u8), + #[codec(index = 251)] + Mortal251(::core::primitive::u8), + #[codec(index = 252)] + Mortal252(::core::primitive::u8), + #[codec(index = 253)] + Mortal253(::core::primitive::u8), + #[codec(index = 254)] + Mortal254(::core::primitive::u8), + #[codec(index = 255)] + Mortal255(::core::primitive::u8), + } + } + pub mod unchecked_extrinsic { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct UncheckedExtrinsic<_0, _1, _2, _3>( + pub ::std::vec::Vec<::core::primitive::u8>, + #[codec(skip)] pub ::core::marker::PhantomData<(_1, _0, _2, _3)>, + ); + } + } + pub mod multiaddress { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum MultiAddress<_0, _1> { + #[codec(index = 0)] + Id(_0), + #[codec(index = 1)] + Index(#[codec(compact)] _1), + #[codec(index = 2)] + Raw(::std::vec::Vec<::core::primitive::u8>), + #[codec(index = 3)] + Address32([::core::primitive::u8; 32usize]), + #[codec(index = 4)] + Address20([::core::primitive::u8; 20usize]), + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum DispatchError { + #[codec(index = 0)] + Other, + #[codec(index = 1)] + CannotLookup, + #[codec(index = 2)] + BadOrigin, + #[codec(index = 3)] + Module(runtime_types::sp_runtime::ModuleError), + #[codec(index = 4)] + ConsumerRemaining, + #[codec(index = 5)] + NoProviders, + #[codec(index = 6)] + TooManyConsumers, + #[codec(index = 7)] + Token(runtime_types::sp_runtime::TokenError), + #[codec(index = 8)] + Arithmetic(runtime_types::sp_arithmetic::ArithmeticError), + #[codec(index = 9)] + Transactional(runtime_types::sp_runtime::TransactionalError), + #[codec(index = 10)] + Exhausted, + #[codec(index = 11)] + Corruption, + #[codec(index = 12)] + Unavailable, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct ModuleError { + pub index: ::core::primitive::u8, + pub error: [::core::primitive::u8; 4usize], + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum MultiSignature { + #[codec(index = 0)] + Ed25519(runtime_types::sp_core::ed25519::Signature), + #[codec(index = 1)] + Sr25519(runtime_types::sp_core::sr25519::Signature), + #[codec(index = 2)] + Ecdsa(runtime_types::sp_core::ecdsa::Signature), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum TokenError { + #[codec(index = 0)] + NoFunds, + #[codec(index = 1)] + WouldDie, + #[codec(index = 2)] + BelowMinimum, + #[codec(index = 3)] + CannotCreate, + #[codec(index = 4)] + UnknownAsset, + #[codec(index = 5)] + Frozen, + #[codec(index = 6)] + Unsupported, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub enum TransactionalError { + #[codec(index = 0)] + LimitReached, + #[codec(index = 1)] + NoLayer, + } + } + pub mod sp_version { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RuntimeVersion { + pub spec_name: ::std::string::String, + pub impl_name: ::std::string::String, + pub authoring_version: ::core::primitive::u32, + pub spec_version: ::core::primitive::u32, + pub impl_version: ::core::primitive::u32, + pub apis: + ::std::vec::Vec<([::core::primitive::u8; 8usize], ::core::primitive::u32)>, + pub transaction_version: ::core::primitive::u32, + pub state_version: ::core::primitive::u8, + } + } + pub mod sp_weights { + use super::runtime_types; + pub mod weight_v2 { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct Weight { + #[codec(compact)] + pub ref_time: ::core::primitive::u64, + #[codec(compact)] + pub proof_size: ::core::primitive::u64, + } + } + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct OldWeight(pub ::core::primitive::u64); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + Clone, + Debug, + Eq, + PartialEq, + )] + pub struct RuntimeDbWeight { + pub read: ::core::primitive::u64, + pub write: ::core::primitive::u64, + } + } + } + #[doc = r" The default error type returned when there is a runtime issue,"] + #[doc = r" exposed here for ease of use."] + pub type DispatchError = runtime_types::sp_runtime::DispatchError; + pub fn constants() -> ConstantsApi { + ConstantsApi + } + pub fn storage() -> StorageApi { + StorageApi + } + pub fn tx() -> TransactionApi { + TransactionApi + } + pub struct ConstantsApi; + impl ConstantsApi { + pub fn system(&self) -> system::constants::ConstantsApi { + system::constants::ConstantsApi + } + pub fn scheduler(&self) -> scheduler::constants::ConstantsApi { + scheduler::constants::ConstantsApi + } + pub fn timestamp(&self) -> timestamp::constants::ConstantsApi { + timestamp::constants::ConstantsApi + } + pub fn balances(&self) -> balances::constants::ConstantsApi { + balances::constants::ConstantsApi + } + pub fn transaction_payment(&self) -> transaction_payment::constants::ConstantsApi { + transaction_payment::constants::ConstantsApi + } + pub fn staking(&self) -> staking::constants::ConstantsApi { + staking::constants::ConstantsApi + } + pub fn elections(&self) -> elections::constants::ConstantsApi { + elections::constants::ConstantsApi + } + pub fn treasury(&self) -> treasury::constants::ConstantsApi { + treasury::constants::ConstantsApi + } + pub fn vesting(&self) -> vesting::constants::ConstantsApi { + vesting::constants::ConstantsApi + } + pub fn utility(&self) -> utility::constants::ConstantsApi { + utility::constants::ConstantsApi + } + pub fn multisig(&self) -> multisig::constants::ConstantsApi { + multisig::constants::ConstantsApi + } + pub fn contracts(&self) -> contracts::constants::ConstantsApi { + contracts::constants::ConstantsApi + } + pub fn nomination_pools(&self) -> nomination_pools::constants::ConstantsApi { + nomination_pools::constants::ConstantsApi + } + pub fn identity(&self) -> identity::constants::ConstantsApi { + identity::constants::ConstantsApi + } + } + pub struct StorageApi; + impl StorageApi { + pub fn system(&self) -> system::storage::StorageApi { + system::storage::StorageApi + } + pub fn randomness_collective_flip( + &self, + ) -> randomness_collective_flip::storage::StorageApi { + randomness_collective_flip::storage::StorageApi + } + pub fn scheduler(&self) -> scheduler::storage::StorageApi { + scheduler::storage::StorageApi + } + pub fn aura(&self) -> aura::storage::StorageApi { + aura::storage::StorageApi + } + pub fn timestamp(&self) -> timestamp::storage::StorageApi { + timestamp::storage::StorageApi + } + pub fn balances(&self) -> balances::storage::StorageApi { + balances::storage::StorageApi + } + pub fn transaction_payment(&self) -> transaction_payment::storage::StorageApi { + transaction_payment::storage::StorageApi + } + pub fn authorship(&self) -> authorship::storage::StorageApi { + authorship::storage::StorageApi + } + pub fn staking(&self) -> staking::storage::StorageApi { + staking::storage::StorageApi + } + pub fn history(&self) -> history::storage::StorageApi { + history::storage::StorageApi + } + pub fn session(&self) -> session::storage::StorageApi { + session::storage::StorageApi + } + pub fn aleph(&self) -> aleph::storage::StorageApi { + aleph::storage::StorageApi + } + pub fn elections(&self) -> elections::storage::StorageApi { + elections::storage::StorageApi + } + pub fn treasury(&self) -> treasury::storage::StorageApi { + treasury::storage::StorageApi + } + pub fn vesting(&self) -> vesting::storage::StorageApi { + vesting::storage::StorageApi + } + pub fn multisig(&self) -> multisig::storage::StorageApi { + multisig::storage::StorageApi + } + pub fn sudo(&self) -> sudo::storage::StorageApi { + sudo::storage::StorageApi + } + pub fn contracts(&self) -> contracts::storage::StorageApi { + contracts::storage::StorageApi + } + pub fn nomination_pools(&self) -> nomination_pools::storage::StorageApi { + nomination_pools::storage::StorageApi + } + pub fn identity(&self) -> identity::storage::StorageApi { + identity::storage::StorageApi + } + } + pub struct TransactionApi; + impl TransactionApi { + pub fn system(&self) -> system::calls::TransactionApi { + system::calls::TransactionApi + } + pub fn scheduler(&self) -> scheduler::calls::TransactionApi { + scheduler::calls::TransactionApi + } + pub fn timestamp(&self) -> timestamp::calls::TransactionApi { + timestamp::calls::TransactionApi + } + pub fn balances(&self) -> balances::calls::TransactionApi { + balances::calls::TransactionApi + } + pub fn staking(&self) -> staking::calls::TransactionApi { + staking::calls::TransactionApi + } + pub fn session(&self) -> session::calls::TransactionApi { + session::calls::TransactionApi + } + pub fn aleph(&self) -> aleph::calls::TransactionApi { + aleph::calls::TransactionApi + } + pub fn elections(&self) -> elections::calls::TransactionApi { + elections::calls::TransactionApi + } + pub fn treasury(&self) -> treasury::calls::TransactionApi { + treasury::calls::TransactionApi + } + pub fn vesting(&self) -> vesting::calls::TransactionApi { + vesting::calls::TransactionApi + } + pub fn utility(&self) -> utility::calls::TransactionApi { + utility::calls::TransactionApi + } + pub fn multisig(&self) -> multisig::calls::TransactionApi { + multisig::calls::TransactionApi + } + pub fn sudo(&self) -> sudo::calls::TransactionApi { + sudo::calls::TransactionApi + } + pub fn contracts(&self) -> contracts::calls::TransactionApi { + contracts::calls::TransactionApi + } + pub fn nomination_pools(&self) -> nomination_pools::calls::TransactionApi { + nomination_pools::calls::TransactionApi + } + pub fn identity(&self) -> identity::calls::TransactionApi { + identity::calls::TransactionApi + } + } + #[doc = r" check whether the Client you are using is aligned with the statically generated codegen."] + pub fn validate_codegen>( + client: &C, + ) -> Result<(), ::subxt::error::MetadataError> { + let runtime_metadata_hash = client.metadata().metadata_hash(&PALLETS); + if runtime_metadata_hash + != [ + 191u8, 48u8, 69u8, 156u8, 0u8, 234u8, 203u8, 221u8, 166u8, 21u8, 15u8, 202u8, + 223u8, 93u8, 68u8, 245u8, 104u8, 158u8, 76u8, 167u8, 70u8, 9u8, 196u8, 75u8, 158u8, + 131u8, 248u8, 255u8, 120u8, 66u8, 210u8, 100u8, + ] + { + Err(::subxt::error::MetadataError::IncompatibleMetadata) + } else { + Ok(()) + } + } +} diff --git a/aleph-client/src/balances.rs b/aleph-client/src/balances.rs deleted file mode 100644 index ad589394e5..0000000000 --- a/aleph-client/src/balances.rs +++ /dev/null @@ -1,10 +0,0 @@ -use primitives::Balance; - -use crate::ReadStorage; - -/// Reads from the storage how much balance is currently on chain. -/// -/// Performs a single storage read. -pub fn total_issuance(connection: &C) -> Balance { - connection.read_storage_value("Balances", "TotalIssuance") -} diff --git a/aleph-client/src/connections.rs b/aleph-client/src/connections.rs new file mode 100644 index 0000000000..15bc42577d --- /dev/null +++ b/aleph-client/src/connections.rs @@ -0,0 +1,429 @@ +use std::{thread::sleep, time::Duration}; + +use anyhow::anyhow; +use codec::Decode; +use log::info; +use serde::{Deserialize, Serialize}; +use subxt::{ + blocks::ExtrinsicEvents, + ext::sp_core::Bytes, + metadata::DecodeWithMetadata, + rpc::RpcParams, + storage::{address::Yes, StaticStorageAddress, StorageAddress}, + tx::TxPayload, +}; + +use crate::{ + api, sp_weights::weight_v2::Weight, AccountId, AlephConfig, BlockHash, Call, KeyPair, + ParamsBuilder, SubxtClient, TxHash, TxStatus, +}; + +/// Capable of communicating with a live Aleph chain. +#[derive(Clone)] +pub struct Connection { + client: SubxtClient, +} + +/// Any connection that is signed by some key. +#[derive(Clone)] +pub struct SignedConnection { + connection: Connection, + signer: KeyPair, +} + +/// Specific connection that is signed by the sudo key. +#[derive(Clone)] +pub struct RootConnection { + connection: SignedConnection, +} + +/// Castability to a plain connection. +pub trait AsConnection { + /// Allows cast to [`Connection`] reference + fn as_connection(&self) -> &Connection; +} + +/// Castability to a signed connection. +pub trait AsSigned { + /// Allows cast to [`SignedConnection`] reference + fn as_signed(&self) -> &SignedConnection; +} + +/// Any connection should be able to request storage and submit RPC calls +#[async_trait::async_trait] +pub trait ConnectionApi: Sync { + /// Retrieves a decoded storage value stored under given key. + /// + /// # Panic + /// This method `panic`s, in case storage key is invalid, or in case value cannot be decoded, + /// or there is no such value + /// * `addrs` - represents a storage key, see [more info about keys](https://docs.substrate.io/fundamentals/state-transitions-and-storage/#querying-storage) + /// * `at` - optional block hash to query state from + async fn get_storage_entry( + &self, + addrs: &StaticStorageAddress, + at: Option, + ) -> T::Target; + + /// Retrieves a decoded storage value stored under given key. + /// + /// # Panic + /// This method `panic`s, in case storage key is invalid, or in case value cannot be decoded, + /// but does _not_ `panic` if there is no such value + /// * `addrs` - represents a storage key, see [more info about keys](https://docs.substrate.io/fundamentals/state-transitions-and-storage/#querying-storage) + /// * `at` - optional block hash to query state from + /// + /// # Examples + /// ```ignore + /// let addrs = api::storage().treasury().proposal_count(); + /// get_storage_entry_maybe(&addrs, None).await + /// ``` + async fn get_storage_entry_maybe< + T: DecodeWithMetadata + Sync, + Defaultable: Sync, + Iterable: Sync, + >( + &self, + addrs: &StaticStorageAddress, + at: Option, + ) -> Option; + + /// Submit a RPC call. + /// + /// * `func_name` - name of a RPC call + /// * `params` - result of calling `rpc_params!` macro, that's `Vec` of encoded data + /// to this rpc call + /// + /// # Examples + /// ```ignore + /// let args = ContractCallArgs { + /// origin: address.clone(), + /// dest: address.clone(), + /// value: 0, + /// gas_limit: None, + /// input_data: payload, + /// storage_deposit_limit: None, + /// }; + /// let params = rpc_params!["ContractsApi_call", Bytes(args.encode())]; + /// rpc_call("state_call".to_string(), params).await; + /// ``` + async fn rpc_call(&self, func_name: String, params: RpcParams) -> anyhow::Result; +} + +/// Data regarding submitted transaction. +#[derive(Copy, Clone, Eq, PartialEq, Debug, Deserialize, Serialize)] +pub struct TxInfo { + /// Hash of the block containing tx. + pub block_hash: BlockHash, + /// Hash of the transaction itself. + pub tx_hash: TxHash, +} + +impl From> for TxInfo { + fn from(ee: ExtrinsicEvents) -> Self { + Self { + block_hash: ee.block_hash(), + tx_hash: ee.extrinsic_hash(), + } + } +} + +/// Signed connection should be able to sends transactions to chain +#[async_trait::async_trait] +pub trait SignedConnectionApi: ConnectionApi { + /// Send a transaction to a chain. It waits for a given tx `status`. + /// * `tx` - encoded transaction payload + /// * `status` - a [`TxStatus`] for a tx to wait for + /// # Returns + /// Block hash of block where transaction was put together with transaction hash, or error. + /// # Examples + /// ```ignore + /// let tx = api::tx() + /// .balances() + /// .transfer(MultiAddress::Id(dest), amount); + /// send_tx(tx, status).await + /// ``` + async fn send_tx( + &self, + tx: Call, + status: TxStatus, + ) -> anyhow::Result; + + /// Send a transaction to a chain. It waits for a given tx `status`. + /// * `tx` - encoded transaction payload + /// * `params` - optional tx params e.g. tip + /// * `status` - a [`TxStatus`] of a tx to wait for + /// # Returns + /// Block hash of block where transaction was put together with transaction hash, or error. + async fn send_tx_with_params( + &self, + tx: Call, + params: ParamsBuilder, + status: TxStatus, + ) -> anyhow::Result; + + /// Returns account id which signs this connection + fn account_id(&self) -> &AccountId; + + /// Returns a [`KeyPair`] which signs this connection + fn signer(&self) -> &KeyPair; + + /// Tries to convert [`SignedConnection`] as [`RootConnection`] + async fn try_as_root(&self) -> anyhow::Result; +} + +/// API for [sudo pallet](https://paritytech.github.io/substrate/master/pallet_sudo/index.html). +#[async_trait::async_trait] +pub trait SudoCall { + /// API for [`sudo_unchecked_weight`](https://paritytech.github.io/substrate/master/pallet_sudo/pallet/enum.Call.html#variant.sudo_unchecked_weight) call. + async fn sudo_unchecked(&self, call: Call, status: TxStatus) -> anyhow::Result; + /// API for [`sudo`](https://paritytech.github.io/substrate/master/pallet_sudo/pallet/enum.Call.html#variant.sudo) call. + async fn sudo(&self, call: Call, status: TxStatus) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl SudoCall for RootConnection { + async fn sudo_unchecked(&self, call: Call, status: TxStatus) -> anyhow::Result { + info!(target: "aleph-client", "sending call as sudo_unchecked {:?}", call); + let sudo = api::tx().sudo().sudo_unchecked_weight( + call, + Weight { + ref_time: 0, + proof_size: 0, + }, + ); + + self.as_signed().send_tx(sudo, status).await + } + + async fn sudo(&self, call: Call, status: TxStatus) -> anyhow::Result { + info!(target: "aleph-client", "sending call as sudo {:?}", call); + let sudo = api::tx().sudo().sudo(call); + + self.as_signed().send_tx(sudo, status).await + } +} + +impl AsConnection for Connection { + fn as_connection(&self) -> &Connection { + self + } +} + +impl AsConnection for S { + fn as_connection(&self) -> &Connection { + &self.as_signed().connection + } +} + +impl AsSigned for SignedConnection { + fn as_signed(&self) -> &SignedConnection { + self + } +} + +impl AsSigned for RootConnection { + fn as_signed(&self) -> &SignedConnection { + &self.connection + } +} + +#[async_trait::async_trait] +impl ConnectionApi for C { + async fn get_storage_entry( + &self, + addrs: &StaticStorageAddress, + at: Option, + ) -> T::Target { + self.get_storage_entry_maybe(addrs, at) + .await + .expect("There should be a value") + } + + async fn get_storage_entry_maybe< + T: DecodeWithMetadata + Sync, + Defaultable: Sync, + Iterable: Sync, + >( + &self, + addrs: &StaticStorageAddress, + at: Option, + ) -> Option { + info!(target: "aleph-client", "accessing storage at {}::{} at block {:?}", addrs.pallet_name(), addrs.entry_name(), at); + self.as_connection() + .as_client() + .storage() + .fetch(addrs, at) + .await + .expect("Should access storage") + } + + async fn rpc_call(&self, func_name: String, params: RpcParams) -> anyhow::Result { + info!(target: "aleph-client", "submitting rpc call `{}`, with params {:?}", func_name, params); + let bytes: Bytes = self + .as_connection() + .as_client() + .rpc() + .request(&func_name, params) + .await?; + + Ok(R::decode(&mut bytes.as_ref())?) + } +} + +#[async_trait::async_trait] +impl SignedConnectionApi for S { + async fn send_tx( + &self, + tx: Call, + status: TxStatus, + ) -> anyhow::Result { + self.send_tx_with_params(tx, Default::default(), status) + .await + } + + async fn send_tx_with_params( + &self, + tx: Call, + params: ParamsBuilder, + status: TxStatus, + ) -> anyhow::Result { + if let Some(details) = tx.validation_details() { + info!(target:"aleph-client", "Sending extrinsic {}.{} with params: {:?}", details.pallet_name, details.call_name, params); + } + + let progress = self + .as_connection() + .as_client() + .tx() + .sign_and_submit_then_watch(&tx, &self.as_signed().signer().inner, params) + .await + .map_err(|e| anyhow!("Failed to submit transaction: {:?}", e))?; + + let info: TxInfo = match status { + TxStatus::InBlock => progress + .wait_for_in_block() + .await? + .wait_for_success() + .await? + .into(), + TxStatus::Finalized => progress.wait_for_finalized_success().await?.into(), + // In case of Submitted block hash does not mean anything + TxStatus::Submitted => { + return Ok(TxInfo { + block_hash: Default::default(), + tx_hash: progress.extrinsic_hash(), + }) + } + }; + info!(target: "aleph-client", "tx with hash {:?} included in block {:?}", info.tx_hash, info.block_hash); + + Ok(info) + } + + fn account_id(&self) -> &AccountId { + self.as_signed().signer().account_id() + } + + fn signer(&self) -> &KeyPair { + &self.as_signed().signer + } + + async fn try_as_root(&self) -> anyhow::Result { + let temp = self.as_signed().clone(); + RootConnection::try_from_connection(temp.connection, temp.signer).await + } +} + +impl Connection { + const DEFAULT_RETRIES: u32 = 10; + const RETRY_WAIT_SECS: u64 = 1; + + /// Creates new connection from a given url. + /// By default, it tries to connect 10 times, waiting 1 second between each unsuccessful attempt. + /// * `address` - address in websocket format, e.g. `ws://127.0.0.1:9943` + pub async fn new(address: &str) -> Connection { + Self::new_with_retries(address, Self::DEFAULT_RETRIES).await + } + + /// Creates new connection from a given url and given number of connection attempts. + /// * `address` - address in websocket format, e.g. `ws://127.0.0.1:9943` + /// * `retries` - number of connection attempts + async fn new_with_retries(address: &str, mut retries: u32) -> Connection { + loop { + let client = SubxtClient::from_url(&address).await; + match (retries, client) { + (_, Ok(client)) => return Connection { client }, + (0, Err(e)) => panic!("{:?}", e), + _ => { + sleep(Duration::from_secs(Self::RETRY_WAIT_SECS)); + retries -= 1; + } + } + } + } + + /// Casts self to the underlying RPC client. + pub fn as_client(&self) -> &SubxtClient { + &self.client + } +} + +impl SignedConnection { + /// Creates new signed connection from existing [`Connection`] object. + /// * `connection` - existing connection + /// * `signer` - a [`KeyPair`] of signing account + pub async fn new(address: &str, signer: KeyPair) -> Self { + Self::from_connection(Connection::new(address).await, signer) + } + + /// Creates new signed connection from existing [`Connection`] object. + /// * `connection` - existing connection + /// * `signer` - a [`KeyPair`] of signing account + pub fn from_connection(connection: Connection, signer: KeyPair) -> Self { + Self { connection, signer } + } +} + +impl RootConnection { + /// Creates new root connection from a given url. + /// It tries to connect 10 times, waiting 1 second between each unsuccessful attempt. + /// * `address` - address in websocket format, e.g. `ws://127.0.0.1:9943` + /// * `root` - a [`KeyPair`] of the Sudo account + pub async fn new(address: &str, root: KeyPair) -> anyhow::Result { + RootConnection::try_from_connection(Connection::new(address).await, root).await + } + + /// Creates new root connection from a given [`Connection`] object. It validates whether given + /// key is really a sudo account + /// * `connection` - existing connection + /// * `signer` - a [`KeyPair`] of the Sudo account + pub async fn try_from_connection( + connection: Connection, + signer: KeyPair, + ) -> anyhow::Result { + let root_address = api::storage().sudo().key(); + + let root = match connection + .as_client() + .storage() + .fetch(&root_address, None) + .await + { + Ok(Some(account)) => account, + _ => return Err(anyhow!("Could not read sudo key from chain")), + }; + + if root != *signer.account_id() { + return Err(anyhow!( + "Provided account is not a sudo on chain. sudo key - {}, provided: {}", + root, + signer.account_id() + )); + } + + Ok(Self { + connection: SignedConnection { connection, signer }, + }) + } +} diff --git a/aleph-client/src/contract/convertible_value.rs b/aleph-client/src/contract/convertible_value.rs index ff27c894d6..b7e16e651b 100644 --- a/aleph-client/src/contract/convertible_value.rs +++ b/aleph-client/src/contract/convertible_value.rs @@ -1,8 +1,7 @@ -use std::ops::Deref; +use std::{fmt::Debug, ops::Deref, str::FromStr}; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result}; use contract_transcode::Value; -use sp_core::crypto::Ss58Codec; use crate::AccountId; @@ -16,7 +15,9 @@ use crate::AccountId; /// # use aleph_client::{AccountId, contract::ConvertibleValue}; /// use contract_transcode::Value; /// -/// assert_matches!(ConvertibleValue(Value::UInt(42)).try_into(), Ok(42)); +/// assert_matches!(ConvertibleValue(Value::UInt(42)).try_into(), Ok(42u128)); +/// assert_matches!(ConvertibleValue(Value::UInt(42)).try_into(), Ok(42u32)); +/// assert_matches!(ConvertibleValue(Value::UInt(u128::MAX)).try_into(): Result, Err(_)); /// assert_matches!(ConvertibleValue(Value::Bool(true)).try_into(), Ok(true)); /// assert_matches!( /// ConvertibleValue(Value::Literal("5H8cjBBzCJrAvDn9LHZpzzJi2UKvEGC9VeVYzWX5TrwRyVCA".to_string())). @@ -39,24 +40,41 @@ impl Deref for ConvertibleValue { } } -impl TryFrom for bool { - type Error = anyhow::Error; +macro_rules! try_from_flat_value { + ($ty: ty, $variant: ident, $desc: literal) => { + impl TryFrom for $ty { + type Error = anyhow::Error; - fn try_from(value: ConvertibleValue) -> Result { - match value.0 { - Value::Bool(value) => Ok(value), - _ => bail!("Expected {:?} to be a boolean", value.0), + fn try_from(value: ConvertibleValue) -> anyhow::Result<$ty> { + match value.0 { + Value::$variant(value) => Ok(value.try_into()?), + _ => anyhow::bail!("Expected {:?} to be {}", value, $desc), + } + } } - } + }; } -impl TryFrom for u128 { +try_from_flat_value!(bool, Bool, "boolean"); +try_from_flat_value!(char, Char, "char"); +try_from_flat_value!(u16, UInt, "unsigned integer"); +try_from_flat_value!(u32, UInt, "unsigned integer"); +try_from_flat_value!(u64, UInt, "unsigned integer"); +try_from_flat_value!(u128, UInt, "unsigned integer"); +try_from_flat_value!(i16, Int, "signed integer"); +try_from_flat_value!(i32, Int, "signed integer"); +try_from_flat_value!(i64, Int, "signed integer"); +try_from_flat_value!(i128, Int, "signed integer"); + +impl TryFrom for () { type Error = anyhow::Error; - fn try_from(value: ConvertibleValue) -> Result { + fn try_from(value: ConvertibleValue) -> Result { match value.0 { - Value::UInt(value) => Ok(value), - _ => bail!("Expected {:?} to be an integer", value.0), + Value::Tuple(tuple) if tuple.ident().is_none() && tuple.values().next().is_none() => { + Ok(()) + } + _ => bail!("Expected {:?} to be a unit", value.0), } } } @@ -64,9 +82,11 @@ impl TryFrom for u128 { impl TryFrom for AccountId { type Error = anyhow::Error; - fn try_from(value: ConvertibleValue) -> Result { + fn try_from(value: ConvertibleValue) -> Result { match value.0 { - Value::Literal(value) => Ok(AccountId::from_ss58check(&value)?), + Value::Literal(value) => { + AccountId::from_str(&value).map_err(|_| anyhow!("Invalid account id")) + } _ => bail!("Expected {:?} to be a string", value), } } @@ -78,7 +98,7 @@ where { type Error = anyhow::Error; - fn try_from(value: ConvertibleValue) -> Result, Self::Error> { + fn try_from(value: ConvertibleValue) -> Result> { if let Value::Tuple(tuple) = &value.0 { match tuple.ident() { Some(x) if x == "Ok" => { @@ -104,3 +124,199 @@ where bail!("Expected {:?} to be an Ok(_) or Err(_) tuple.", value); } } + +impl TryFrom for String { + type Error = anyhow::Error; + + fn try_from(value: ConvertibleValue) -> Result { + let seq = match value.0 { + Value::Seq(seq) => seq, + _ => bail!("Failed parsing `ConvertibleValue` to `String`. Expected `Seq(Value::UInt)` but instead got: {:?}", value), + }; + + let mut bytes: Vec = Vec::with_capacity(seq.len()); + for el in seq.elems() { + if let Value::UInt(byte) = *el { + if byte > u8::MAX as u128 { + bail!("Expected number <= u8::MAX but instead got: {:?}", byte) + } + bytes.push(byte as u8); + } else { + bail!("Failed parsing `ConvertibleValue` to `String`. Expected `Value::UInt` but instead got: {:?}", el); + } + } + String::from_utf8(bytes).context("Failed parsing bytes to UTF-8 String.") + } +} + +auto trait NotEq {} +// We're basically telling the compiler that there is no instance of NotEq for `(X,X)` tuple. +// Or put differently - that you can't implement `NotEq` for `(X,X)`. +impl !NotEq for (X, X) {} + +impl TryFrom for Option +where + T: TryFrom + Debug, + // We will derive this impl only when `T != ConvertibleValue`. + // Otherwise we will get a conflict with generic impl in the rust `core` crate. + (ConvertibleValue, T): NotEq, +{ + type Error = anyhow::Error; + + fn try_from(value: ConvertibleValue) -> Result> { + let tuple = match &value.0 { + Value::Tuple(tuple) => tuple, + _ => bail!("Expected {:?} to be a Some(_) or None Tuple.", &value), + }; + + match tuple.ident() { + Some(x) if x == "Some" => { + if tuple.values().count() == 1 { + let item = + ConvertibleValue(tuple.values().next().unwrap().clone()).try_into()?; + Ok(Some(item)) + } else { + bail!( + "Unexpected number of elements in Some(_) variant: {:?}. Expected one.", + &value + ); + } + } + Some(x) if x == "None" => { + if tuple.values().count() == 0 { + Ok(None) + } else { + bail!( + "Unexpected number of elements in None variant: {:?}. Expected zero.", + &value + ); + } + } + _ => bail!( + "Expected `.ident()` to be `Some` or `None`, got: {:?}", + &tuple + ), + } + } +} + +impl> TryFrom + for Vec +{ + type Error = anyhow::Error; + + fn try_from(value: ConvertibleValue) -> Result { + let seq = match value.0 { + Value::Seq(seq) => seq, + _ => bail!("Failed parsing `ConvertibleValue` to `Vec`. Expected `Seq(_)` but instead got: {:?}", value), + }; + + let mut result = vec![]; + for element in seq.elems() { + result.push(ConvertibleValue(element.clone()).try_into()?); + } + + Ok(result) + } +} + +impl + Debug> + TryFrom for [Elem; N] +{ + type Error = anyhow::Error; + + fn try_from(value: ConvertibleValue) -> Result { + Vec::::try_from(value)? + .try_into() + .map_err(|e| anyhow!("Failed to convert vector to an array: {e:?}")) + } +} + +#[cfg(test)] +mod tests { + use contract_transcode::Value::{Bool, Char, Int, Seq, UInt}; + + use crate::contract::ConvertibleValue; + + #[test] + fn converts_boolean() { + let cast: bool = ConvertibleValue(Bool(true)) + .try_into() + .expect("Should cast successfully"); + assert!(cast); + } + + #[test] + fn converts_char() { + let cast: char = ConvertibleValue(Char('x')) + .try_into() + .expect("Should cast successfully"); + assert_eq!('x', cast); + } + + #[test] + fn converts_biguint() { + let long_uint = 41414141414141414141414141414141414141u128; + let cast: u128 = ConvertibleValue(UInt(long_uint)) + .try_into() + .expect("Should cast successfully"); + assert_eq!(long_uint, cast); + } + + #[test] + fn converts_uint() { + let cast: u32 = ConvertibleValue(UInt(41)) + .try_into() + .expect("Should cast successfully"); + assert_eq!(41, cast); + } + + #[test] + fn converts_bigint() { + let long_int = -41414141414141414141414141414141414141i128; + let cast: i128 = ConvertibleValue(Int(long_int)) + .try_into() + .expect("Should cast successfully"); + assert_eq!(long_int, cast); + } + + #[test] + fn converts_int() { + let cast: i32 = ConvertibleValue(Int(-41)) + .try_into() + .expect("Should cast successfully"); + assert_eq!(-41, cast); + } + + #[test] + fn converts_integer_array() { + let cv = ConvertibleValue(Seq(vec![UInt(4), UInt(1)].into())); + let cast: [u32; 2] = cv.try_into().expect("Should cast successfully"); + assert_eq!([4u32, 1u32], cast); + } + + #[test] + fn converts_integer_sequence() { + let cv = ConvertibleValue(Seq(vec![UInt(4), UInt(1)].into())); + let cast: Vec = cv.try_into().expect("Should cast successfully"); + assert_eq!(vec![4u32, 1u32], cast); + } + + #[test] + fn converts_nested_sequence() { + let words = vec![ + vec!['s', 'u', 'r', 'f', 'i', 'n'], + vec![], + vec!['b', 'i', 'r', 'd'], + ]; + let encoded_words = words + .iter() + .map(|word| Seq(word.iter().cloned().map(Char).collect::>().into())) + .collect::>(); + + let cv = ConvertibleValue(Seq(encoded_words.into())); + let cast: Vec> = cv.try_into().expect("Should cast successfully"); + + assert_eq!(words, cast); + } +} diff --git a/aleph-client/src/contract/event.rs b/aleph-client/src/contract/event.rs index 2377dc3bf8..ab650c8f35 100644 --- a/aleph-client/src/contract/event.rs +++ b/aleph-client/src/contract/event.rs @@ -1,230 +1,187 @@ -//! Utilities for listening for contract events. +//! This module provides utilities corresponding to the events emitted by a contract. //! -//! To use the module you will need to first create a subscription (a glorified `Receiver`), -//! then run the listen loop. You might want to run the loop in a separate thread. -//! -//! ```no_run -//! # use std::sync::Arc; -//! # use std::sync::mpsc::channel; -//! # use std::thread; -//! # use std::time::Duration; -//! # use aleph_client::{Connection, SignedConnection}; -//! # use aleph_client::contract::ContractInstance; -//! # use aleph_client::contract::event::{listen_contract_events, subscribe_events}; -//! # use anyhow::Result; -//! # use sp_core::crypto::AccountId32; -//! # fn example(conn: SignedConnection, address1: AccountId32, address2: AccountId32, path1: &str, path2: &str) -> Result<()> { -//! let subscription = subscribe_events(&conn)?; -//! -//! // The `Arc` makes it possible to pass a reference to the contract to another thread -//! let contract1 = Arc::new(ContractInstance::new(address1, path1)?); -//! let contract2 = Arc::new(ContractInstance::new(address2, path2)?); -//! let (cancel_tx, cancel_rx) = channel(); -//! -//! let contract1_copy = contract1.clone(); -//! let contract2_copy = contract2.clone(); -//! -//! thread::spawn(move || { -//! listen_contract_events( -//! subscription, -//! &[contract1_copy.as_ref(), &contract2_copy.as_ref()], -//! Some(cancel_rx), -//! |event_or_error| { println!("{:?}", event_or_error) } -//! ); -//! }); -//! -//! thread::sleep(Duration::from_secs(20)); -//! cancel_tx.send(()).unwrap(); -//! -//! contract1.contract_exec0(&conn, "some_method")?; -//! contract2.contract_exec0(&conn, "some_other_method")?; -//! -//! # Ok(()) -//! # } -//! ``` - -use std::{ - collections::HashMap, - sync::mpsc::{channel, Receiver}, +//! There are two ways that you can get contract events: +//! 1. By fetching events corresponding to a particular transaction. For this, you will need to +//! provide a connection, contract instance and transaction coordinate to [get_contract_events] +//! function. Similarly to [crate::utility::BlocksApi::get_tx_events], it will fetch block +//! events, filter them and decode all relevant ones. +//! 2. By listening to all contract events. For this, you will need to provide a connection, some +//! contracts and an `UnboundedSender` to the [listen_contract_events] function. In a loop, +//! it will inspect every finalized block and look for contract events. + +use std::{collections::HashMap, error::Error}; + +use anyhow::{anyhow, bail, Result}; +use contract_transcode::Value; +use futures::{channel::mpsc::UnboundedSender, StreamExt}; +use subxt::events::EventDetails; + +use crate::{ + api::contracts::events::ContractEmitted, connections::TxInfo, contract::ContractInstance, + utility::BlocksApi, AccountId, Connection, }; -use ac_node_api::events::{EventsDecoder, Raw, RawEvent}; -use anyhow::{bail, Context, Result}; -use contract_transcode::{ContractMessageTranscoder, Transcoder, TranscoderBuilder, Value}; -use ink_metadata::InkProject; -use sp_core::crypto::{AccountId32, Ss58Codec}; -use substrate_api_client::Metadata; - -use crate::{contract::ContractInstance, AnyConnection}; - /// Represents a single event emitted by a contract. #[derive(Debug, Clone, Eq, PartialEq)] pub struct ContractEvent { /// The address of the contract that emitted the event. - pub contract: AccountId32, + pub contract: AccountId, /// The name of the event. - pub ident: Option, + pub name: Option, /// Data contained in the event. pub data: HashMap, } -/// An opaque wrapper around a `Receiver` that can be used to listen for contract events. -pub struct EventSubscription { - receiver: Receiver, - metadata: Metadata, -} - -/// Creates a subscription to all events that can be used to [listen_contract_events] -pub fn subscribe_events(conn: &C) -> Result { - let conn = conn.as_connection(); - let (sender, receiver) = channel(); - - conn.subscribe_events(sender)?; - - Ok(EventSubscription { - metadata: conn.metadata, - receiver, - }) +/// Fetch and decode all events that correspond to the call identified by `tx_info` made to +/// `contract`. +/// +/// ```no_run +/// # use aleph_client::{AccountId, Connection, SignedConnection}; +/// # use aleph_client::contract::ContractInstance; +/// # use aleph_client::contract::event::{get_contract_events, listen_contract_events}; +/// # use anyhow::Result; +/// use futures::{channel::mpsc::unbounded, StreamExt}; +/// +/// # async fn example(conn: Connection, signed_conn: SignedConnection, address: AccountId, path: &str) -> Result<()> { +/// let contract = ContractInstance::new(address, path)?; +/// +/// let tx_info = contract.contract_exec0(&signed_conn, "some_method").await?; +/// +/// println!("Received events {:?}", get_contract_events(&conn, &contract, tx_info).await); +/// +/// # Ok(()) +/// # } +/// ``` +pub async fn get_contract_events( + conn: &Connection, + contract: &ContractInstance, + tx_info: TxInfo, +) -> Result> { + let events = conn.get_tx_events(tx_info).await?; + translate_events(events.iter(), &[contract]) + .into_iter() + .collect() } -/// Starts an event listening loop. +/// Starts an event listening loop. Will send contract event and every error encountered while +/// fetching through the provided [UnboundedSender]. +/// +/// Only events coming from the address of one of the `contracts` will be decoded. +/// +/// The loop will terminate once `sender` is closed. The loop may also terminate in case of errors while fetching blocks +/// or decoding events (pallet events, contract event decoding errors are sent over the channel). +/// +/// You most likely want to `tokio::spawn` the resulting future, so that it runs concurrently. +/// +/// ```no_run +/// # use std::sync::Arc; +/// # use std::sync::mpsc::channel; +/// # use std::time::Duration; +/// # use aleph_client::{AccountId, Connection, SignedConnection}; +/// # use aleph_client::contract::ContractInstance; +/// # use aleph_client::contract::event::{listen_contract_events}; +/// # use anyhow::Result; +/// use futures::{channel::mpsc::unbounded, StreamExt}; +/// +/// # async fn example(conn: Connection, signed_conn: SignedConnection, address1: AccountId, address2: AccountId, path1: &str, path2: &str) -> Result<()> { +/// // The `Arc` makes it possible to pass a reference to the contract to another thread +/// let contract1 = Arc::new(ContractInstance::new(address1, path1)?); +/// let contract2 = Arc::new(ContractInstance::new(address2, path2)?); +/// +/// let conn_copy = conn.clone(); +/// let contract1_copy = contract1.clone(); +/// let contract2_copy = contract2.clone(); /// -/// Will execute the handler for every contract event and every error encountered while fetching -/// from `subscription`. Only events coming from the address of one of the `contracts` will be -/// decoded. +/// let (tx, mut rx) = unbounded(); +/// let listen = || async move { +/// listen_contract_events(&conn, &[contract1_copy.as_ref(), contract2_copy.as_ref()], tx).await?; +/// >::Ok(()) +/// }; +/// let join = tokio::spawn(listen()); /// -/// The loop will terminate once `subscription` is closed or once any message is received on -/// `cancel` (if provided). -pub fn listen_contract_events)>( - subscription: EventSubscription, +/// contract1.contract_exec0(&signed_conn, "some_method").await?; +/// contract2.contract_exec0(&signed_conn, "some_other_method").await?; +/// +/// println!("Received event {:?}", rx.next().await); +/// +/// rx.close(); +/// join.await??; +/// +/// # Ok(()) +/// # } +/// ``` +pub async fn listen_contract_events( + conn: &Connection, contracts: &[&ContractInstance], - cancel: Option>, - handler: F, -) { - let events_decoder = EventsDecoder::new(subscription.metadata.clone()); - let events_transcoder = TranscoderBuilder::new(&subscription.metadata.runtime_metadata().types) - .with_default_custom_type_transcoders() - .done(); - let contracts = contracts - .iter() - .map(|contract| (contract.address().clone(), contract.ink_project())) - .collect::>(); - - for batch in subscription.receiver.iter() { - match decode_contract_event_batch( - &subscription.metadata, - &events_decoder, - &events_transcoder, - &contracts, - batch, - ) { - Ok(events) => { - for event in events { - handler(event); - } - } - Err(err) => handler(Err(err)), - } + sender: UnboundedSender>, +) -> Result<()> { + let mut block_subscription = conn.as_client().blocks().subscribe_finalized().await?; - if cancel - .as_ref() - .map(|cancel| cancel.try_recv().is_ok()) - .unwrap_or(false) - { + while let Some(block) = block_subscription.next().await { + if sender.is_closed() { break; } - } -} - -use crate::contract::anyhow; - -/// Consumes a raw `batch` of chain events, and returns only those that are coming from `contracts`. -/// -/// This function, somewhat confusingly, returns a `Result>>` - this is to represent -/// the fact that an error might occur both while decoding the whole batch and for each event. This -/// is unwrapped in [listen_contract_events] and doesn't leak outside this module. -fn decode_contract_event_batch( - metadata: &Metadata, - events_decoder: &EventsDecoder, - events_transcoder: &Transcoder, - contracts: &HashMap, - batch: String, -) -> Result>> { - let mut results = vec![]; - - let batch = batch.replacen("0x", "", 1); - let bytes = hex::decode(batch)?; - let events = events_decoder - .decode_events(&mut bytes.as_slice()) - .map_err(|err| anyhow!("{:?}", err))?; - - for (_phase, raw_event) in events { - match raw_event { - Raw::Error(err) => results.push(Err(anyhow!("{:?}", err))), - Raw::Event(event) => { - if event.pallet == "Contracts" && event.variant == "ContractEmitted" { - results.push(decode_contract_event( - metadata, - contracts, - events_transcoder, - event, - )) - } - } + let events = block?.events().await?; + for event in translate_events(events.iter(), contracts) { + sender.unbounded_send(event)?; } } - Ok(results) + Ok(()) } -fn decode_contract_event( - metadata: &Metadata, - contracts: &HashMap, - events_transcoder: &Transcoder, - event: RawEvent, -) -> Result { - let event_metadata = metadata - .event(event.pallet_index, event.variant_index) - .map_err(|err| anyhow!("{:?}", err))?; - - let parse_pointer = &mut event.data.0.as_slice(); - let mut raw_data = None; - let mut contract_address = None; - - for field in event_metadata.variant().fields() { - if field.name() == Some(&"data".to_string()) { - raw_data = Some(<&[u8]>::clone(parse_pointer)); - } else { - let field_value = events_transcoder.decode(field.ty().id(), parse_pointer); +/// Try to convert `events` to `ContractEvent` using matching contract from `contracts`. +fn translate_events< + Err: Error + Into + Send + Sync + 'static, + E: Iterator>, +>( + events: E, + contracts: &[&ContractInstance], +) -> Vec> { + events + .filter_map(|maybe_event| { + maybe_event + .map(|e| e.as_event::().ok().flatten()) + .transpose() + }) + .map(|maybe_event| match maybe_event { + Ok(e) => translate_event(&e, contracts), + Err(e) => Err(anyhow::Error::from(e)), + }) + .collect() +} - if field.name() == Some(&"contract".to_string()) { - contract_address = field_value.ok(); - } - } - } +/// Try to convert `event` to `ContractEvent` using matching contract from `contracts`. +fn translate_event( + event: &ContractEmitted, + contracts: &[&ContractInstance], +) -> Result { + let matching_contract = contracts + .iter() + .find(|contract| contract.address() == &event.contract) + .ok_or_else(|| anyhow!("The event wasn't emitted by any of the provided contracts"))?; - if let Some(Value::Literal(address)) = contract_address { - let address = AccountId32::from_string(&address)?; - let contract_metadata = contracts - .get(&address) - .context("Event from unknown contract")?; + let data = zero_prefixed(&event.data); + let data = matching_contract + .transcoder + .decode_contract_event(&mut data.as_slice())?; - let mut raw_data = raw_data.context("Event data field not found")?; - let event_data = ContractMessageTranscoder::new(contract_metadata) - .decode_contract_event(&mut raw_data) - .context("Failed to decode contract event")?; + build_event(matching_contract.address.clone(), data) +} - build_event(address, event_data) - } else { - bail!("Contract event did not contain contract address"); - } +/// The contract transcoder assumes there is an extra byte (that it discards) indicating the size of the data. However, +/// data arriving through the subscription as used in this file don't have this extra byte. This function adds it. +fn zero_prefixed(data: &[u8]) -> Vec { + let mut result = vec![0]; + result.extend_from_slice(data); + result } -fn build_event(address: AccountId32, event_data: Value) -> Result { +fn build_event(address: AccountId, event_data: Value) -> Result { match event_data { Value::Map(map) => Ok(ContractEvent { contract: address, - ident: map.ident(), + name: map.ident(), data: map .iter() .map(|(key, value)| (key.to_string(), value.clone())) diff --git a/aleph-client/src/contract/mod.rs b/aleph-client/src/contract/mod.rs index d039b0f8d4..e9e9466641 100644 --- a/aleph-client/src/contract/mod.rs +++ b/aleph-client/src/contract/mod.rs @@ -5,8 +5,8 @@ //! //! ```no_run //! # use anyhow::{Result, Context}; -//! # use aleph_client::AccountId; -//! # use aleph_client::{Connection, SignedConnection}; +//! # use aleph_client::{AccountId, Balance}; +//! # use aleph_client::{Connection, SignedConnection, TxInfo}; //! # use aleph_client::contract::ContractInstance; //! # //! #[derive(Debug)] @@ -24,20 +24,20 @@ //! }) //! } //! -//! fn transfer(&self, conn: &SignedConnection, to: AccountId, amount: u128) -> Result<()> { +//! async fn transfer(&self, conn: &SignedConnection, to: AccountId, amount: Balance) -> Result { //! self.contract.contract_exec( //! conn, //! "PSP22::transfer", //! vec![to.to_string().as_str(), amount.to_string().as_str(), "0x00"].as_slice(), -//! ) +//! ).await //! } //! -//! fn balance_of(&self, conn: &Connection, account: AccountId) -> Result { +//! async fn balance_of(&self, conn: &Connection, account: AccountId) -> Result { //! self.contract.contract_read( //! conn, //! "PSP22::balance_of", //! &vec![account.to_string().as_str()], -//! )?.try_into() +//! ).await? //! } //! } //! ``` @@ -45,155 +45,222 @@ mod convertible_value; pub mod event; -use std::{ - fmt::{Debug, Formatter}, - fs::File, -}; +use std::fmt::{Debug, Formatter}; use anyhow::{anyhow, Context, Result}; -use contract_metadata::ContractMetadata; use contract_transcode::ContractMessageTranscoder; pub use convertible_value::ConvertibleValue; -use ink_metadata::{InkProject, MetadataVersioned}; -use serde_json::{from_reader, from_str, from_value, json}; -use substrate_api_client::{compose_extrinsic, GenericAddress, XtStatus}; +use log::{error, info}; +use pallet_contracts_primitives::ContractExecResult; + +use crate::{ + connections::TxInfo, + contract_transcode::Value, + pallets::contract::{ContractCallArgs, ContractRpc, ContractsUserApi}, + sp_weights::weight_v2::Weight, + AccountId, Balance, ConnectionApi, SignedConnectionApi, TxStatus, +}; -use crate::{try_send_xt, AccountId, AnyConnection, SignedConnection}; +/// Default gas limit, which allows up to 25% of block time (62.5% of the actual block capacity). +pub const DEFAULT_MAX_GAS: u64 = 250_000_000_000u64; +/// Default proof size limit, which allows up to 25% of block time (62.5% of the actual block +/// capacity). +pub const DEFAULT_MAX_PROOF_SIZE: u64 = 250_000_000_000u64; /// Represents a contract instantiated on the chain. pub struct ContractInstance { address: AccountId, - ink_project: InkProject, + transcoder: ContractMessageTranscoder, + max_gas_override: Option, + max_proof_size_override: Option, } impl ContractInstance { - const MAX_READ_GAS: u64 = 500000000000u64; - const MAX_GAS: u64 = 100000000000u64; - const STORAGE_FEE_LIMIT: Option = None; - /// Creates a new contract instance under `address` with metadata read from `metadata_path`. pub fn new(address: AccountId, metadata_path: &str) -> Result { Ok(Self { address, - ink_project: load_metadata(metadata_path)?, + transcoder: ContractMessageTranscoder::load(metadata_path)?, + max_gas_override: None, + max_proof_size_override: None, }) } + /// From now on, the contract instance will use `limit_override` as the gas limit for all + /// contract calls. If `limit_override` is `None`, then [DEFAULT_MAX_GAS] will be used. + pub fn override_gas_limit(&mut self, limit_override: Option) { + self.max_gas_override = limit_override; + } + + /// From now on, the contract instance will use `limit_override` as the proof size limit for all + /// contract calls. If `limit_override` is `None`, then [DEFAULT_MAX_PROOF_SIZE] will be used. + pub fn override_proof_size_limit(&mut self, limit_override: Option) { + self.max_proof_size_override = limit_override; + } + /// The address of this contract instance. pub fn address(&self) -> &AccountId { &self.address } - /// The metadata of this contract instance. - pub fn ink_project(&self) -> &InkProject { - &self.ink_project - } - /// Reads the value of a read-only, 0-argument call via RPC. - pub fn contract_read0( + pub async fn contract_read0< + T: TryFrom, + C: ConnectionApi, + >( &self, conn: &C, message: &str, - ) -> Result { - self.contract_read::(conn, message, &[]) + ) -> Result { + self.contract_read::(conn, message, &[]).await } /// Reads the value of a read-only call via RPC. - pub fn contract_read + Debug>( + pub async fn contract_read< + S: AsRef + Debug, + T: TryFrom, + C: ConnectionApi, + >( &self, conn: &C, message: &str, args: &[S], - ) -> Result { - let payload = self.encode(message, args)?; - let request = self.contract_read_request(&payload); - let response = conn - .as_connection() - .get_request(request)? - .context("RPC request error - there may be more info in node logs.")?; - let response_data = from_str::(&response)?; - let hex_data = response_data["result"]["Ok"]["data"] - .as_str() - .context("Contract response data not found - the contract address might be invalid.")?; - self.decode_response(message, hex_data) + ) -> Result { + self.contract_read_as(conn, message, args, self.address.clone()) + .await + } + + /// Reads the value of a contract call via RPC as if it was executed by `sender`. + pub async fn contract_read_as< + S: AsRef + Debug, + T: TryFrom, + C: ConnectionApi, + >( + &self, + conn: &C, + message: &str, + args: &[S], + sender: AccountId, + ) -> Result { + let result = self + .dry_run(conn, message, args, sender) + .await? + .result + .map_err(|e| anyhow!("Contract exec failed {:?}", e))?; + + let decoded = self.decode(message, result.data)?; + ConvertibleValue(decoded).try_into()? } /// Executes a 0-argument contract call. - pub fn contract_exec0(&self, conn: &SignedConnection, message: &str) -> Result<()> { - self.contract_exec_value::(conn, message, &[], 0) + pub async fn contract_exec0( + &self, + conn: &C, + message: &str, + ) -> Result { + self.contract_exec::(conn, message, &[]).await } /// Executes a contract call. - pub fn contract_exec + Debug>( + pub async fn contract_exec + Debug>( &self, - conn: &SignedConnection, + conn: &C, message: &str, args: &[S], - ) -> Result<()> { - self.contract_exec_value(conn, message, args, 0) + ) -> Result { + self.contract_exec_value::(conn, message, args, 0) + .await } /// Executes a 0-argument contract call sending the given amount of value with it. - pub fn contract_exec_value0( + pub async fn contract_exec_value0( &self, - conn: &SignedConnection, + conn: &C, message: &str, - value: u128, - ) -> Result<()> { - self.contract_exec_value::(conn, message, &[], value) + value: Balance, + ) -> Result { + self.contract_exec_value::(conn, message, &[], value) + .await } /// Executes a contract call sending the given amount of value with it. - pub fn contract_exec_value + Debug>( + pub async fn contract_exec_value + Debug>( &self, - conn: &SignedConnection, + conn: &C, message: &str, args: &[S], - value: u128, - ) -> Result<()> { + value: Balance, + ) -> Result { + let dry_run_result = self + .dry_run(conn, message, args, conn.account_id().clone()) + .await?; + let data = self.encode(message, args)?; - let xt = compose_extrinsic!( - conn.as_connection(), - "Contracts", - "call", - GenericAddress::Id(self.address.clone()), - Compact(value), - Compact(Self::MAX_GAS), - Self::STORAGE_FEE_LIMIT, - data - ); - - try_send_xt(conn, xt, Some("Contracts call"), XtStatus::InBlock) - .context("Failed to exec contract message")?; - Ok(()) + conn.call( + self.address.clone(), + value, + Weight { + ref_time: dry_run_result.gas_required.ref_time(), + proof_size: dry_run_result.gas_required.proof_size(), + }, + None, + data, + TxStatus::Finalized, + ) + .await } - fn contract_read_request(&self, payload: &[u8]) -> serde_json::Value { - let payload = hex::encode(payload); - json!({ - "jsonrpc": "2.0", - "method": "contracts_call", - "params": [{ - "origin": self.address, - "dest": self.address, - "value": 0, - "gasLimit": Self::MAX_READ_GAS, - "inputData": payload - }], - "id": 1 - }) + fn encode + Debug>(&self, message: &str, args: &[S]) -> Result> { + self.transcoder.encode(message, args) } - fn encode + Debug>(&self, message: &str, args: &[S]) -> Result> { - ContractMessageTranscoder::new(&self.ink_project).encode(message, args) + fn decode(&self, message: &str, data: Vec) -> Result { + self.transcoder.decode_return(message, &mut data.as_slice()) } - fn decode_response(&self, from: &str, contract_response: &str) -> Result { - let contract_response = contract_response.trim_start_matches("0x"); - let bytes = hex::decode(contract_response)?; - ContractMessageTranscoder::new(&self.ink_project) - .decode_return(from, &mut bytes.as_slice()) - .map(ConvertibleValue) + async fn dry_run + Debug, C: ConnectionApi>( + &self, + conn: &C, + message: &str, + args: &[S], + sender: AccountId, + ) -> Result> { + let payload = self.encode(message, args)?; + let args = ContractCallArgs { + origin: sender, + dest: self.address.clone(), + value: 0, + gas_limit: None, + input_data: payload, + storage_deposit_limit: None, + }; + + let contract_read_result = conn + .call_and_get(args) + .await + .context("RPC request error - there may be more info in node logs.")?; + + if !contract_read_result.debug_message.is_empty() { + info!( + target: "aleph_client::contract", + "Dry-run debug messages: {:?}", + core::str::from_utf8(&contract_read_result.debug_message) + .unwrap_or("") + .split('\n') + .filter(|m| !m.is_empty()) + .collect::>() + ); + } + + if let Ok(res) = &contract_read_result.result { + if res.did_revert() { + // For dry run, failed transactions don't return `Err` but `Ok(_)` + // and we have to inspect flags manually. + error!("Dry-run call reverted"); + } + } + + Ok(contract_read_result) } } @@ -201,24 +268,6 @@ impl Debug for ContractInstance { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("ContractInstance") .field("address", &self.address) - .field("ink_project", &self.ink_project) .finish() } } - -/// Helper for loading contract metadata from a file. -/// -/// The contract-metadata lib contains a similar function starting with version 0.2. It seems that -/// version conflicts with some of our other dependencies, however, if we upgrade in the future we -/// can drop this function in favour of their implementation. -fn load_metadata(path: &str) -> Result { - let file = File::open(path)?; - let metadata: ContractMetadata = from_reader(file)?; - let ink_metadata = from_value(serde_json::Value::Object(metadata.abi))?; - - if let MetadataVersioned::V3(ink_project) = ink_metadata { - Ok(ink_project) - } else { - Err(anyhow!("Unsupported ink metadata version. Expected V3")) - } -} diff --git a/aleph-client/src/debug/aleph.rs b/aleph-client/src/debug/aleph.rs deleted file mode 100644 index 543a731ae2..0000000000 --- a/aleph-client/src/debug/aleph.rs +++ /dev/null @@ -1,20 +0,0 @@ -use primitives::AuthorityId; - -use crate::{ - debug::{element_prompt, entry_prompt, pallet_prompt}, - ReadStorage, -}; - -pub fn print_storage(connection: &C) { - let authorities: Vec = connection.read_storage_value("Aleph", "Authorities"); - - println!("{}", pallet_prompt("Aleph")); - println!("{}", entry_prompt("Authorities")); - - for auth in authorities { - println!( - "{}", - element_prompt(format!("\tAuthority {:?}", auth.to_string())) - ); - } -} diff --git a/aleph-client/src/debug/elections.rs b/aleph-client/src/debug/elections.rs deleted file mode 100644 index 1889a82304..0000000000 --- a/aleph-client/src/debug/elections.rs +++ /dev/null @@ -1,20 +0,0 @@ -use primitives::AuthorityId; - -use crate::{ - debug::{element_prompt, entry_prompt, pallet_prompt}, - ReadStorage, -}; - -pub fn print_storage(connection: &C) { - let members: Vec = connection.read_storage_value("Elections", "Members"); - - println!("{}", pallet_prompt("Elections")); - println!("{}", entry_prompt("Members")); - - for member in members { - println!( - "{}", - element_prompt(format!("\tMember {:?}", member.to_string())) - ); - } -} diff --git a/aleph-client/src/debug/mod.rs b/aleph-client/src/debug/mod.rs deleted file mode 100644 index 59cfa42017..0000000000 --- a/aleph-client/src/debug/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::ReadStorage; - -mod aleph; -mod elections; -mod treasury; - -fn pallet_prompt(name: &'static str) -> String { - format!("-----------{}-----------", name) -} - -fn entry_prompt(name: &'static str) -> String { - format!("----{}", name) -} - -fn element_prompt(el: String) -> String { - format!("\t{}", el) -} - -pub fn print_storages(connection: &C) { - treasury::print_storage(connection); - aleph::print_storage(connection); - elections::print_storage(connection); -} diff --git a/aleph-client/src/debug/treasury.rs b/aleph-client/src/debug/treasury.rs deleted file mode 100644 index 8286a80122..0000000000 --- a/aleph-client/src/debug/treasury.rs +++ /dev/null @@ -1,42 +0,0 @@ -use log::trace; -use pallet_treasury::{Proposal, ProposalIndex}; -use sp_core::crypto::AccountId32; -use substrate_api_client::Balance; - -use crate::{ - debug::{element_prompt, entry_prompt, pallet_prompt}, - ReadStorage, -}; - -const PALLET: &str = "Treasury"; - -pub fn print_storage(connection: &C) { - let proposal_count: u32 = connection.read_storage_value_or_default(PALLET, "ProposalCount"); - let approvals: Vec = - connection.read_storage_value_or_default(PALLET, "Approvals"); - - println!("{}", pallet_prompt(PALLET)); - println!("{}: {}", entry_prompt("ProposalCount"), proposal_count); - println!(); - println!("{}", entry_prompt("Approvals")); - for x in approvals { - println!( - "{}", - element_prompt(format!("Proposal id {} was approved ", x)) - ); - } - println!(); - println!("{}", entry_prompt("Proposals")); - for x in 0..=proposal_count { - let p: Option> = connection - .read_storage_map(PALLET, "Proposals", x, None) - .unwrap(); - - if let Some(p) = p { - println!("{}", element_prompt(format!("\tProposalId {}: {:?}", x, p))); - } else { - trace!("No proposal with id {:?} in the storage", x) - } - } - println!(); -} diff --git a/aleph-client/src/elections.rs b/aleph-client/src/elections.rs deleted file mode 100644 index 94961c7162..0000000000 --- a/aleph-client/src/elections.rs +++ /dev/null @@ -1,149 +0,0 @@ -use primitives::{ - BanConfig, BanInfo, CommitteeSeats, EraIndex, EraValidators, SessionCount, SessionIndex, -}; -use sp_core::H256; -use substrate_api_client::{compose_call, compose_extrinsic}; - -use crate::{ - get_session_first_block, send_xt, AccountId, AnyConnection, ReadStorage, RootConnection, - XtStatus, -}; - -const PALLET: &str = "Elections"; - -pub fn get_committee_seats( - connection: &C, - block_hash: Option, -) -> CommitteeSeats { - connection.read_storage_value_at_block(PALLET, "CommitteeSize", block_hash) -} - -pub fn get_next_era_committee_seats(connection: &C) -> CommitteeSeats { - connection.read_storage_value(PALLET, "NextEraCommitteeSize") -} - -pub fn get_validator_block_count( - connection: &C, - account_id: &AccountId, - block_hash: Option, -) -> Option { - connection.read_storage_map(PALLET, "SessionValidatorBlockCount", account_id, block_hash) -} - -pub fn get_current_era_validators(connection: &C) -> EraValidators { - connection.read_storage_value(PALLET, "CurrentEraValidators") -} - -pub fn get_current_era_reserved_validators(connection: &C) -> Vec { - get_current_era_validators(connection).reserved -} - -pub fn get_current_era_non_reserved_validators(connection: &C) -> Vec { - get_current_era_validators(connection).non_reserved -} - -pub fn get_next_era_reserved_validators(connection: &C) -> Vec { - connection.read_storage_value(PALLET, "NextEraReservedValidators") -} - -pub fn get_next_era_non_reserved_validators(connection: &C) -> Vec { - connection.read_storage_value(PALLET, "NextEraNonReservedValidators") -} - -pub fn get_next_era_validators(connection: &C) -> EraValidators { - let reserved: Vec = - connection.read_storage_value(PALLET, "NextEraReservedValidators"); - let non_reserved: Vec = - connection.read_storage_value(PALLET, "NextEraNonReservedValidators"); - EraValidators { - reserved, - non_reserved, - } -} - -pub fn get_era_validators( - connection: &C, - session: SessionIndex, -) -> EraValidators { - let block_hash = get_session_first_block(connection, session); - connection.read_storage_value_at_block(PALLET, "CurrentEraValidators", Some(block_hash)) -} - -pub fn get_ban_config(connection: &C) -> BanConfig { - connection.read_storage_value(PALLET, "BanConfig") -} - -pub fn get_underperformed_validator_session_count( - connection: &C, - account_id: &AccountId, -) -> SessionCount { - connection - .read_storage_map( - PALLET, - "UnderperformedValidatorSessionCount", - account_id, - None, - ) - .unwrap_or(0) -} - -pub fn get_ban_reason_for_validator( - connection: &C, - account_id: &AccountId, -) -> Option { - connection.read_storage_map(PALLET, "Banned", account_id, None) -} - -pub fn ban_from_committee( - connection: &RootConnection, - to_be_banned: &AccountId, - reason: &Vec, - status: XtStatus, -) { - let call_name = "ban_from_committee"; - - let ban_from_committee_call = compose_call!( - connection.as_connection().metadata, - PALLET, - call_name, - to_be_banned, - reason - ); - - let xt = compose_extrinsic!( - connection.as_connection(), - "Sudo", - "sudo_unchecked_weight", - ban_from_committee_call, - 0_u64 - ); - - send_xt(connection, xt, Some(call_name), status); -} - -pub fn change_ban_config( - sudo_connection: &RootConnection, - minimal_expected_performance: Option, - underperformed_session_count_threshold: Option, - clean_session_counter_delay: Option, - ban_period: Option, - status: XtStatus, -) { - let call = compose_call!( - sudo_connection.as_connection().metadata, - PALLET, - "set_ban_config", - minimal_expected_performance, - underperformed_session_count_threshold, - clean_session_counter_delay, - ban_period - ); - let xt = compose_extrinsic!( - sudo_connection.as_connection(), - "Sudo", - "sudo_unchecked_weight", - call, - 0_u64 - ); - send_xt(sudo_connection, xt, Some("set_ban_config"), status); -} diff --git a/aleph-client/src/fee.rs b/aleph-client/src/fee.rs deleted file mode 100644 index 0a4e536bdc..0000000000 --- a/aleph-client/src/fee.rs +++ /dev/null @@ -1,33 +0,0 @@ -use substrate_api_client::Balance; - -use crate::{AnyConnection, BalanceTransfer, FeeInfo, GetTxInfo, ReadStorage, SignedConnection}; - -impl GetTxInfo<::TransferTx> for SignedConnection { - fn get_tx_info(&self, tx: &::TransferTx) -> FeeInfo { - let tx = self.create_transfer_extrinsic(tx.clone()); - let tx_hex = tx.hex_encode(); - let unadjusted_weight = self - .as_connection() - .get_payment_info(&tx_hex, None) - .expect("Should access payment info") - .expect("Payment info should be present") - .weight as Balance; - - let fee = self - .as_connection() - .get_fee_details(&tx_hex, None) - .expect("Should access fee details") - .expect("Should read fee details"); - let inclusion_fee = fee.inclusion_fee.expect("Transaction should be payable"); - - FeeInfo { - fee_without_weight: inclusion_fee.base_fee + inclusion_fee.len_fee + fee.tip, - unadjusted_weight, - adjusted_weight: inclusion_fee.adjusted_weight_fee, - } - } -} - -pub fn get_next_fee_multiplier(connection: &C) -> u128 { - connection.read_storage_value("TransactionPayment", "NextFeeMultiplier") -} diff --git a/aleph-client/src/finalization.rs b/aleph-client/src/finalization.rs deleted file mode 100644 index 78925e7d0b..0000000000 --- a/aleph-client/src/finalization.rs +++ /dev/null @@ -1,25 +0,0 @@ -use substrate_api_client::{compose_call, compose_extrinsic, AccountId, XtStatus}; - -use crate::{send_xt, AnyConnection, RootConnection}; - -/// Sets the emergency finalizer to the provided `AccountId`. -pub fn set_emergency_finalizer( - connection: &RootConnection, - finalizer: AccountId, - status: XtStatus, -) { - let set_emergency_finalizer_call = compose_call!( - connection.as_connection().metadata, - "Aleph", - "set_emergency_finalizer", - finalizer - ); - let xt = compose_extrinsic!( - connection.as_connection(), - "Sudo", - "sudo_unchecked_weight", - set_emergency_finalizer_call, - 0_u64 - ); - send_xt(connection, xt, Some("set_emergency_finalizer"), status); -} diff --git a/aleph-client/src/lib.rs b/aleph-client/src/lib.rs index 9e212a9c30..3d800e174b 100644 --- a/aleph-client/src/lib.rs +++ b/aleph-client/src/lib.rs @@ -1,476 +1,142 @@ -use std::{default::Default, error::Error as StdError, fmt::Debug, thread::sleep, time::Duration}; +#![warn(missing_docs)] +//! API for [aleph-node](https://github.com/Cardinal-Cryptography/aleph-node) chain. +//! +//! This crate provides a Rust application interface for submitting transactions to `aleph-node` chain. +//! Most of the [pallets](https://docs.substrate.io/reference/frame-pallets/) are common to any +//! [Substrate](https://github.com/paritytech/substrate) chain, but there are some unique to `aleph-node`, +//! e.g. [`pallets::elections::ElectionsApi`]. -use ac_primitives::{PlainTip, PlainTipExtrinsicParamsBuilder, SubstrateDefaultSignedExtra}; -pub use account::{get_free_balance, locks}; -pub use balances::total_issuance; -use codec::{Decode, Encode}; -pub use contract_transcode; -pub use debug::print_storages; -pub use elections::{ - ban_from_committee, change_ban_config, get_ban_config, get_ban_reason_for_validator, - get_committee_seats, get_current_era_non_reserved_validators, - get_current_era_reserved_validators, get_current_era_validators, get_era_validators, - get_next_era_committee_seats, get_next_era_non_reserved_validators, - get_next_era_reserved_validators, get_next_era_validators, - get_underperformed_validator_session_count, get_validator_block_count, -}; -pub use fee::get_next_fee_multiplier; -pub use finalization::set_emergency_finalizer as finalization_set_emergency_finalizer; -use log::{info, warn}; -pub use multisig::{ - compute_call_hash, perform_multisig_with_threshold_1, MultisigError, MultisigParty, - SignatureAggregation, -}; -pub use primitives::{Balance, BlockHash, BlockNumber, Header}; -pub use rpc::{emergency_finalize, rotate_keys, rotate_keys_raw_result, state_query_storage_at}; -pub use session::{ - change_next_era_reserved_validators, change_validators, get_current_session, - get_current_validator_count, get_current_validators, get_next_session_keys, get_session, - get_session_first_block, get_session_period, get_validators_for_session, set_keys, - wait_for as wait_for_session, wait_for_at_least as wait_for_at_least_session, - Keys as SessionKeys, -}; -use sp_core::{ed25519, sr25519, storage::StorageKey, Pair, H256}; -pub use staking::{ - batch_bond as staking_batch_bond, batch_nominate as staking_batch_nominate, - bond as staking_bond, bond_extra_stake, bonded as staking_bonded, - chill_validator as staking_chill_validator, chill_validators as staking_chill_validators, - force_new_era as staking_force_new_era, get_active_era, get_current_era, get_era, - get_era_reward_points, get_eras_stakers_storage_key, get_exposure, get_minimum_validator_count, - get_payout_for_era, get_sessions_per_era, get_stakers_as_storage_keys, - get_stakers_as_storage_keys_from_storage_key, ledger as staking_ledger, - multi_bond as staking_multi_bond, nominate as staking_nominate, payout_stakers, - payout_stakers_and_assert_locked_balance, set_staking_limits as staking_set_staking_limits, - validate as staking_validate, wait_for_at_least_era, wait_for_era_completion, - wait_for_full_era_completion, wait_for_next_era, RewardPoint, StakingLedger, -}; -pub use substrate_api_client::{self, AccountId, XtStatus}; -use substrate_api_client::{ - rpc::ws_client::WsRpcClient, std::error::Error, Api, ApiResult, PlainTipExtrinsicParams, - RpcClient, UncheckedExtrinsicV4, -}; -pub use system::set_code; -pub use transfer::{ - batch_transfer as balances_batch_transfer, transfer as balances_transfer, TransferTransaction, -}; -pub use treasury::{ - approve as approve_treasury_proposal, proposals_counter as treasury_proposals_counter, - propose as make_treasury_proposal, reject as reject_treasury_proposal, staking_treasury_payout, - treasury_account, -}; -pub use version_upgrade::{schedule_upgrade, Version}; -pub use vesting::{ - get_schedules, merge_schedules, vest, vest_other, vested_transfer, VestingError, - VestingSchedule, -}; -pub use waiting::{wait_for_event, wait_for_finalized_block}; +#![feature(auto_traits)] +#![feature(negative_impls)] -mod account; -mod balances; -pub mod contract; -mod debug; -mod elections; -mod fee; -mod finalization; -mod multisig; -mod rpc; -mod session; -mod staking; -mod system; -mod transfer; -mod treasury; -mod version_upgrade; -mod vesting; -mod waiting; +extern crate core; -pub trait FromStr: Sized { - type Err; +use std::str::FromStr; - fn from_str(s: &str) -> Result; -} +use anyhow::anyhow; +pub use contract_transcode; +pub use subxt::ext::{codec, sp_core, sp_core::Pair, sp_runtime}; +use subxt::{ + ext::sp_core::{ed25519, sr25519, H256}, + OnlineClient, PolkadotConfig, SubstrateConfig, +}; -impl FromStr for WsRpcClient { - type Err = (); +use crate::api::runtime_types::aleph_runtime::RuntimeCall as Call; - fn from_str(url: &str) -> Result { - Ok(WsRpcClient::new(url)) - } -} - -pub type KeyPair = sr25519::Pair; +// generated by running `subxt codegen --derive Clone Debug Eq PartialEq | rustfmt --edition=2021 > src/aleph_zero.rs` +#[allow(clippy::all)] +#[doc(hidden)] +mod aleph_zero; +mod connections; +pub mod contract; +/// API for pallets. +pub mod pallets; +mod runtime_types; +/// Block / session / era API. +pub mod utility; +/// Waiting for some events API. +pub mod waiting; + +pub use ::primitives::{Balance, BlockNumber}; +pub use aleph_zero::api; +pub use runtime_types::*; + +/// An alias for a pallet aleph keys. pub type AlephKeyPair = ed25519::Pair; -pub type ExtrinsicParams = PlainTipExtrinsicParams; -pub type Connection = Api; -pub type Extrinsic = UncheckedExtrinsicV4>; - -/// Common abstraction for different types of connections. -pub trait AnyConnection: Clone + Send { - /// 'Castability' to `Connection`. - /// - /// Direct casting is often more handy than generic `.into()`. Justification: `Connection` - /// objects are often passed to some macro like `compose_extrinsic!` and thus there is not - /// enough information for type inferring required for `Into`. - fn as_connection(&self) -> Connection; -} - -pub trait ReadStorage: AnyConnection { - /// Reads value from storage. Panics if it couldn't be read. - fn read_storage_value(&self, pallet: &'static str, key: &'static str) -> T { - self.read_storage_value_or_else(pallet, key, || { - panic!("Value is `None` or couldn't have been decoded") - }) - } - - /// Reads value from storage at given block (empty means `best known`). Panics if it couldn't be read. - fn read_storage_value_at_block( - &self, - pallet: &'static str, - key: &'static str, - block_hash: Option, - ) -> T { - self.read_storage_value_at_block_or_else(pallet, key, block_hash, || { - panic!( - "Retrieved storage value ({}/{}) was equal `null`", - pallet, key - ) - }) - } - - /// Reads value from storage. In case value is `None` or couldn't have been decoded, result of - /// `fallback` is returned. - fn read_storage_value_or_else T, T: Decode>( - &self, - pallet: &'static str, - key: &'static str, - fallback: F, - ) -> T { - self.read_storage_value_at_block_or_else(pallet, key, None, fallback) - } - - /// Reads value from storage from a given block. In case value is `None` or couldn't have been decoded, result of - /// `fallback` is returned. - fn read_storage_value_at_block_or_else T, T: Decode>( - &self, - pallet: &'static str, - key: &'static str, - block_hash: Option, - fallback: F, - ) -> T { - self.as_connection() - .get_storage_value(pallet, key, block_hash) - .unwrap_or_else(|e| { - panic!( - "Unable to retrieve a storage value {}/{} at block {:#?}: {}", - pallet, key, block_hash, e - ) - }) - .unwrap_or_else(fallback) - } - - /// Reads value from storage. In case value is `None` or couldn't have been decoded, the default - /// value is returned. - fn read_storage_value_or_default( - &self, - pallet: &'static str, - key: &'static str, - ) -> T { - self.read_storage_value_or_else(pallet, key, Default::default) - } - - /// Reads pallet's constant from metadata. Panics if it couldn't be read. - fn read_constant(&self, pallet: &'static str, constant: &'static str) -> T { - self.read_constant_or_else(pallet, constant, || { - panic!( - "Constant `{}::{}` should be present and decodable", - pallet, constant - ) - }) - } - - /// Reads pallet's constant from metadata. In case value is `None` or couldn't have been - /// decoded, result of `fallback` is returned. - fn read_constant_or_else T, T: Decode>( - &self, - pallet: &'static str, - constant: &'static str, - fallback: F, - ) -> T { - self.as_connection() - .get_constant(pallet, constant) - .unwrap_or_else(|_| fallback()) - } - - /// Reads pallet's constant from metadata. In case value is `None` or couldn't have been - /// decoded, the default value is returned. - fn read_constant_or_default( - &self, - pallet: &'static str, - constant: &'static str, - ) -> T { - self.read_constant_or_else(pallet, constant, Default::default) - } - - fn read_storage_map( - &self, - pallet: &'static str, - map_name: &'static str, - map_key: K, - block_hash: Option, - ) -> Option { - self.as_connection() - .get_storage_map(pallet, map_name, map_key.clone(), block_hash) - .unwrap_or_else(|e| panic!("Unable to retrieve a storage map for pallet={} map_name={} map_key={:#?} block_hash={:#?}: {}", pallet, map_name, &map_key, block_hash, e)) - } -} - -impl ReadStorage for C {} - -pub trait BalanceTransfer { - type TransferTx; - type Error: StdError; - - fn create_transfer_tx(&self, account: AccountId, amount: Balance) -> Self::TransferTx; - fn transfer(&self, tx: Self::TransferTx, status: XtStatus) - -> Result, Self::Error>; -} - -pub trait BatchTransactions { - type Error: StdError; - - fn batch_and_send_transactions<'a>( - &self, - transactions: impl IntoIterator, - status: XtStatus, - ) -> Result, Self::Error> - where - Tx: 'a; -} - -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Default)] -pub struct FeeInfo { - pub fee_without_weight: Balance, - pub unadjusted_weight: Balance, - pub adjusted_weight: Balance, -} - -pub trait GetTxInfo { - fn get_tx_info(&self, tx: &Tx) -> FeeInfo; -} - -pub trait CallSystem { - type Error: StdError; - - fn fill_block(&self, target_ratio: u32, status: XtStatus) -> Result<(), Self::Error>; -} - -pub trait ManageParams { - fn set_tip(self, tip: Balance) -> Self; -} - -impl ManageParams for SignedConnection { - fn set_tip(self, tip: Balance) -> Self { - let xt_params = PlainTipExtrinsicParamsBuilder::new().tip(tip); - let SignedConnection { mut inner, signer } = self; - inner = inner.set_extrinsic_params_builder(xt_params); - Self { inner, signer } - } -} - -impl AnyConnection for Connection { - fn as_connection(&self) -> Connection { - self.clone() - } -} - -/// A connection that is signed. -#[derive(Clone)] -pub struct SignedConnection { - inner: Connection, - signer: KeyPair, -} - -impl SignedConnection { - pub fn new(address: &str, signer: KeyPair) -> Self { - let unsigned = create_connection(address); - Self { - inner: unsigned.set_signer(signer.clone()), - signer, - } - } - - /// Semantically equivalent to `connection.set_signer(signer)`. - pub fn from_any_connection(connection: &C, signer: KeyPair) -> Self { - Self { - inner: connection - .clone() - .as_connection() - .set_signer(signer.clone()), - signer, - } - } - - /// A signer corresponding to `self.inner`. - pub fn signer(&self) -> KeyPair { - self.signer.clone() - } -} - -impl AnyConnection for SignedConnection { - fn as_connection(&self) -> Connection { - self.inner.clone() - } -} - -/// We can always try casting `AnyConnection` to `SignedConnection`, which fails if it is not -/// signed. -impl TryFrom for SignedConnection { - type Error = &'static str; - - fn try_from(connection: Connection) -> Result { - if let Some(signer) = connection.signer.clone() { - Ok(Self::from_any_connection(&connection, signer)) - } else { - Err("Connection should be signed.") - } - } -} - -/// A connection that is signed by the root account. -/// -/// Since verifying signature is expensive (requires interaction with the node for checking -/// storage), there is no guarantee that in fact the signer has sudo access. Hence, effectively it -/// is just a type wrapper requiring explicit casting. -#[derive(Clone)] -pub struct RootConnection { - inner: SignedConnection, -} +/// An alias for a type of a key pair that signs chain transactions. +pub type RawKeyPair = sr25519::Pair; +/// An alias for an account id type. +pub type AccountId = subxt::ext::sp_core::crypto::AccountId32; +/// An alias for a hash type. +pub type CodeHash = H256; +/// An alias for a block hash type. +pub type BlockHash = H256; +/// An alias for a transaction hash type. +pub type TxHash = H256; +/// An alias for an RPC client type. +pub type SubxtClient = OnlineClient; + +pub use connections::{ + AsConnection, AsSigned, Connection, ConnectionApi, RootConnection, SignedConnection, + SignedConnectionApi, SudoCall, TxInfo, +}; -impl RootConnection { - pub fn new(address: &str, root: KeyPair) -> Self { - Self { - inner: SignedConnection::new(address, root), - } - } +/// An alias for a configuration of live chain, e.g. block index type, hash type. +type AlephConfig = PolkadotConfig; +type ParamsBuilder = subxt::tx::PolkadotExtrinsicParamsBuilder; +type PairSigner = subxt::tx::PairSigner; - /// A direct casting is often more handy than a generic `.into()`. - pub fn as_signed(&self) -> SignedConnection { - self.inner.clone() - } -} - -impl From for RootConnection { - fn from(signed: SignedConnection) -> Self { - Self { inner: signed } - } +/// Used for signing extrinsic payload +pub struct KeyPair { + inner: PairSigner, } -impl AnyConnection for RootConnection { - fn as_connection(&self) -> Connection { - self.as_signed().as_connection() +impl Clone for KeyPair { + fn clone(&self) -> Self { + KeyPair::new(self.inner.signer().clone()) } } -pub fn create_connection(address: &str) -> Connection { - create_custom_connection(address).expect("Connection should be created") -} - -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] -enum Protocol { - Ws, - Wss, -} - -impl Default for Protocol { - fn default() -> Self { - Protocol::Ws +impl FromStr for KeyPair { + type Err = anyhow::Error; + fn from_str(s: &str) -> anyhow::Result { + let pair = sr25519::Pair::from_string(s, None) + .map_err(|e| anyhow!("Can't create pair from seed value: {:?}", e))?; + Ok(KeyPair::new(pair)) } } -impl ToString for Protocol { - fn to_string(&self) -> String { - match self { - Protocol::Ws => String::from("ws://"), - Protocol::Wss => String::from("wss://"), +impl KeyPair { + /// Constructs a new KeyPair from RawKeyPair + pub fn new(keypair: RawKeyPair) -> Self { + KeyPair { + inner: PairSigner::new(keypair), } } -} -/// Unless `address` already contains protocol, we prepend to it `ws://`. -fn ensure_protocol(address: &str) -> String { - if address.starts_with(&Protocol::Ws.to_string()) - || address.starts_with(&Protocol::Wss.to_string()) - { - return address.to_string(); + /// Returns a reference to the inner RawKeyPair + pub fn signer(&self) -> &RawKeyPair { + self.inner.signer() } - format!("{}{}", Protocol::default().to_string(), address) -} -pub fn create_custom_connection( - address: &str, -) -> Result, ::Err> { - loop { - let client = Client::from_str(&ensure_protocol(address))?; - match Api::::new(client) { - Ok(api) => return Ok(api), - Err(why) => { - warn!( - "[+] Can't create_connection because {:?}, will try again in 1s", - why - ); - sleep(Duration::from_millis(1000)); - } - } + /// Returns corresponding AccountId + pub fn account_id(&self) -> &AccountId { + self.inner.account_id() } } -/// `panic`able utility wrapper for `try_send_xt`. -pub fn send_xt( - connection: &C, - xt: Extrinsic, - xt_name: Option<&'static str>, - xt_status: XtStatus, -) -> Option { - try_send_xt(connection, xt, xt_name, xt_status).expect("Should manage to send extrinsic") +/// When submitting a transaction, wait for given status before proceeding. +#[derive(Copy, Clone)] +pub enum TxStatus { + /// A tx must be included in some block. + InBlock, + /// A tx must be included in some finalized block. + Finalized, + /// A tx must be successfully submitted. + Submitted, } -/// Sends transaction `xt` using `connection`. -/// -/// If `tx_status` is either `Finalized` or `InBlock`, additionally returns hash of the containing -/// block. `xt_name` is used only for logging purposes. -/// -/// Recoverable. -pub fn try_send_xt( - connection: &C, - xt: Extrinsic, - xt_name: Option<&'static str>, - xt_status: XtStatus, -) -> ApiResult> { - let hash = connection - .as_connection() - .send_extrinsic(xt.hex_encode(), xt_status)? - .ok_or_else(|| Error::Other(String::from("Could not get tx/block hash").into()))?; - - match xt_status { - XtStatus::Finalized | XtStatus::InBlock => { - info!(target: "aleph-client", - "Transaction `{}` was included in block with hash {}.", - xt_name.unwrap_or_default(), hash); - Ok(Some(hash)) - } - // Other variants either do not return (see https://github.com/scs/substrate-api-client/issues/175) - // or return xt hash, which is kinda useless here. - _ => Ok(None), - } +/// Converts given seed phrase to a sr25519 [`KeyPair`] object. +/// * `seed` - a 12 or 24 word seed phrase +pub fn keypair_from_string(seed: &str) -> KeyPair { + let pair = sr25519::Pair::from_string(seed, None).expect("Can't create pair from seed value"); + KeyPair::new(pair) } -pub fn keypair_from_string(seed: &str) -> KeyPair { - KeyPair::from_string(seed, None).expect("Can't create pair from seed value") +/// Converts given seed phrase to a sr25519 [`RawKeyPair`] object. +/// * `seed` - a 12 or 24 word seed phrase +pub fn raw_keypair_from_string(seed: &str) -> RawKeyPair { + sr25519::Pair::from_string(seed, None).expect("Can't create pair from seed value") } +/// Converts given seed phrase to a ed25519 [`AlephKeyPair`] object. +/// * `seed` - a 12 or 24 word seed phrase pub fn aleph_keypair_from_string(seed: &str) -> AlephKeyPair { - AlephKeyPair::from_string(seed, None).expect("Can't create aleph pair from seed value") + ed25519::Pair::from_string(seed, None).expect("Can't create pair from seed value") } +/// Converts a key pair object to `AccountId`. +/// * `keypair` - a key-pair object, e.g. [`ed25519::Pair`] or [`sr25519::Pair`] pub fn account_from_keypair

(keypair: &P) -> AccountId where P: Pair, @@ -478,48 +144,3 @@ where { AccountId::from(keypair.public()) } - -fn storage_key(module: &str, version: &str) -> [u8; 32] { - let pallet_name = sp_core::hashing::twox_128(module.as_bytes()); - let postfix = sp_core::hashing::twox_128(version.as_bytes()); - let mut final_key = [0u8; 32]; - final_key[..16].copy_from_slice(&pallet_name); - final_key[16..].copy_from_slice(&postfix); - final_key -} - -/// Computes hash of given pallet's call. You can use that to pass result to `state.getKeys` RPC call. -/// * `pallet` name of the pallet -/// * `call` name of the pallet's call -/// -/// # Example -/// ``` -/// use aleph_client::get_storage_key; -/// -/// let staking_nominate_storage_key = get_storage_key("Staking", "Nominators"); -/// assert_eq!(staking_nominate_storage_key, String::from("5f3e4907f716ac89b6347d15ececedca9c6a637f62ae2af1c7e31eed7e96be04")); -/// ``` -pub fn get_storage_key(pallet: &str, call: &str) -> String { - let bytes = storage_key(pallet, call); - let storage_key = StorageKey(bytes.into()); - hex::encode(storage_key.0) -} - -pub fn get_block_hash(connection: &C, block_number: BlockNumber) -> BlockHash { - connection - .as_connection() - .get_block_hash(Some(block_number)) - .expect("Could not fetch block hash") - .unwrap_or_else(|| { - panic!("Failed to obtain block hash for block {}.", block_number); - }) -} - -pub fn get_current_block_number(connection: &C) -> BlockNumber { - connection - .as_connection() - .get_header::

(None) - .expect("Could not fetch header") - .expect("Block exists; qed") - .number -} diff --git a/aleph-client/src/multisig.rs b/aleph-client/src/multisig.rs deleted file mode 100644 index c98481a2e7..0000000000 --- a/aleph-client/src/multisig.rs +++ /dev/null @@ -1,480 +0,0 @@ -use std::{ - collections::HashSet, - fmt::{Debug, Formatter}, -}; - -use anyhow::{ensure, Result}; -use codec::{Decode, Encode}; -use log::{error, info}; -use primitives::Balance; -use sp_core::{blake2_256, crypto::AccountId32}; -use sp_runtime::traits::TrailingZeroInput; -use substrate_api_client::{compose_extrinsic, XtStatus::Finalized}; -use thiserror::Error; - -use crate::{ - account_from_keypair, try_send_xt, AccountId, AnyConnection, BlockNumber, Extrinsic, - SignedConnection, H256, -}; - -/// `MAX_WEIGHT` is the extrinsic parameter specifying upperbound for executing approved call. -/// Unless the approval is final, it has no effect. However, if due to your approval the -/// threshold is reached, you will be charged for execution process. By setting `max_weight` -/// low enough, you can avoid paying and left it for another member. -/// -/// However, passing such parameter everytime is cumbersome and introduces the need of either -/// estimating call weight or setting very high universal bound at every caller side. -/// Thus, we keep a fairly high limit, which should cover almost any call (0.05 token). -const MAX_WEIGHT: u64 = 500_000_000; - -/// Gathers all possible errors from this module. -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Error)] -pub enum MultisigError { - #[error("👪❌ Threshold should be between 2 and {0}.")] - IncorrectThreshold(usize), - #[error("👪❌ There should be at least 2 unique members.")] - TooFewMembers, - #[error("👪❌ There is no such member in the party.")] - NoSuchMember, - #[error("👪❌ There is no entry for this multisig aggregation in the pallet storage.")] - NoAggregationFound, - #[error("👪❌ Trying to report approval for a different call that already registered.")] - CallConflict, - #[error("👪❌ Only the author can cancel aggregation.")] - NotAuthor, - #[error("👪❌ The connection is signed by an account that doesn't match to any member.")] - NonMemberSignature, -} - -type CallHash = [u8; 32]; -type Call = Vec; -type Timepoint = pallet_multisig::Timepoint; - -type ApproveAsMultiCall = Extrinsic<( - [u8; 2], // call index - u16, // threshold - Vec, // other signatories - Option, // timepoint, `None` for initiating - CallHash, // call hash - u64, // max weight -)>; - -type AsMultiCall = Extrinsic<( - [u8; 2], // call index - u16, // threshold - Vec, // other signatories - Option, // timepoint, `None` for initiating - Call, // call - bool, // whether to store call - u64, // max weight -)>; - -type CancelAsMultiCall = Extrinsic<( - [u8; 2], // call index - u16, // threshold - Vec, // other signatories - Timepoint, // timepoint, `None` for initiating - CallHash, // call hash -)>; - -pub fn compute_call_hash(call: &Extrinsic) -> CallHash { - blake2_256(&call.function.encode()) -} - -/// Unfortunately, we have to copy this struct from the pallet. We can get such object from storage -/// but there is no way of accessing the info within nor interacting in any manner 💩. -#[derive(Clone, Decode)] -#[allow(dead_code)] -struct Multisig { - when: Timepoint, - deposit: Balance, - depositor: AccountId, - approvals: Vec, -} - -/// This represents the ongoing procedure of aggregating approvals among members -/// of multisignature party. -#[derive(Eq, PartialEq, Debug)] -pub struct SignatureAggregation { - /// The point in 'time' when the aggregation was initiated on the chain. - /// Internally it is a pair: number of the block containing initial call and the position - /// of the corresponding extrinsic within block. - /// - /// It is actually the easiest (and the chosen) way of distinguishing between - /// independent aggregations within the same party for the same call. - timepoint: Timepoint, - /// The member, who initiated the aggregation. They also had to deposit money, and they - /// are the only person with power of canceling the procedure. - /// - /// We keep just their index within the (sorted) set of members. - author: usize, - /// The hash of the target call. - call_hash: CallHash, - /// The call to be dispatched. Maybe. - call: Option, - /// We keep counting approvals, just for information. - approvers: HashSet, -} - -impl SignatureAggregation { - /// How many approvals has already been aggregated. - pub fn num_of_approvals(&self) -> usize { - self.approvers.len() - } -} - -/// `MultisigParty` is representing a multiparty entity constructed from -/// a group of accounts (`members`) and a threshold (`threshold`). -#[derive(Clone)] -pub struct MultisigParty { - /// Derived multiparty account (public key). - account: AccountId, - /// *Sorted* collection of members. - members: Vec, - /// Minimum required approvals. - threshold: u16, -} - -impl Debug for MultisigParty { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.debug_struct("MultisigParty") - .field("account", &self.account) - .field("threshold", &self.threshold) - .field("member count", &self.members.len()) - .finish() - } -} - -impl MultisigParty { - /// Creates new party. `members` does *not* have to be already sorted. Also: - /// - `members` must be of length between 2 and `pallet_multisig::MaxSignatories`; - /// since checking the upperbound is expensive, it is the caller's responsibility - /// to ensure it is not exceeded - /// - `members` may contain duplicates, but they are ignored and not counted to the cardinality - /// - `threshold` must be between 2 and `members.len()` - pub fn new(members: &[AccountId], threshold: u16) -> Result { - let mut members = members.to_vec(); - members.sort(); - members.dedup(); - - ensure!(2 <= members.len(), MultisigError::TooFewMembers); - ensure!( - 2 <= threshold && threshold <= members.len() as u16, - MultisigError::IncorrectThreshold(members.len()) - ); - - let account = Self::multi_account_id(&members, threshold); - Ok(Self { - account, - members, - threshold, - }) - } - - /// This method generates deterministic account id for a given set of members and a threshold. - /// `who` must be sorted, otherwise the result will be incorrect. - /// - /// It comes from pallet multisig. However, since it is an associated method for a struct - /// `pallet_multisig::Pallet` it is easier to just copy - /// these two lines. - /// - /// *Note:* if this function changes in some newer Substrate version, this code should be adjusted. - pub fn multi_account_id(who: &[AccountId], threshold: u16) -> AccountId { - let entropy = (b"modlpy/utilisuba", who, threshold).using_encoded(blake2_256); - Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref())) - .expect("infinite length input; no invalid inputs for type; qed") - } - - /// Provide the address corresponding to the party (and the threshold). - pub fn get_account(&self) -> AccountId { - self.account.clone() - } - - /// This is a convenience method, as usually you may want to perform an action - /// as a particular member, without sorting their public keys on the callee side. - pub fn get_member_index(&self, member: AccountId) -> Result { - self.members - .binary_search(&member) - .map_err(|_| MultisigError::NoSuchMember.into()) - } - - /// For all extrinsics we have to sign them with the caller (representative) and pass - /// accounts of the other party members (represented). - /// - /// Assumes that `representative_idx` is a valid index for `self.members`. - fn designate_represented(&self, representative_idx: usize) -> Vec { - let mut members = self.members.clone(); - members.remove(representative_idx); - members - } - - /// Compose extrinsic for `multisig::approve_as_multi` call. - fn construct_approve_as_multi( - &self, - connection: &SignedConnection, - other_signatories: Vec, - timepoint: Option, - call_hash: CallHash, - ) -> ApproveAsMultiCall { - compose_extrinsic!( - connection.as_connection(), - "Multisig", - "approve_as_multi", - self.threshold, - other_signatories, - timepoint, - call_hash, - MAX_WEIGHT - ) - } - - /// Tries sending `xt` with `connection` and waits for its finalization. Returns the hash - /// of the containing block. - fn finalize_xt( - &self, - connection: &C, - xt: Extrinsic, - description: &'static str, - ) -> Result { - Ok(try_send_xt(connection, xt, Some(description), Finalized)? - .expect("For `Finalized` status a block hash should be returned")) - } - - /// Reads the pallet storage and takes the timestamp regarding procedure for the `self` party - /// initiated at `block_hash`. - fn get_timestamp( - &self, - connection: &C, - call_hash: &CallHash, - block_hash: H256, - ) -> Result { - let multisig: Multisig = connection - .as_connection() - .get_storage_double_map( - "Multisig", - "Multisigs", - self.account.clone(), - *call_hash, - Some(block_hash), - )? - .ok_or(MultisigError::NoAggregationFound)?; - Ok(multisig.when) - } - - /// Checks whether `connection` is signed by some member and if so, returns their index. - fn map_signer_to_member_index(&self, connection: &SignedConnection) -> Result { - self.members - .binary_search(&account_from_keypair(&connection.signer)) - .map_err(|_| MultisigError::NonMemberSignature.into()) - } - - /// Effectively starts the aggregation process by calling `approveAsMulti`. - /// - /// `connection` should be signed by some member. - pub fn initiate_aggregation_with_hash( - &self, - connection: &SignedConnection, - call_hash: CallHash, - ) -> Result { - let author_idx = self.map_signer_to_member_index(connection)?; - - let other_signatories = self.designate_represented(author_idx); - let xt = self.construct_approve_as_multi(connection, other_signatories, None, call_hash); - - let block_hash = self.finalize_xt(connection, xt, "Initiate multisig aggregation")?; - info!(target: "aleph-client", "Initiating multisig aggregation for call hash: {:?}", call_hash); - - Ok(SignatureAggregation { - timepoint: self.get_timestamp(connection, &call_hash, block_hash)?, - author: author_idx, - call_hash, - call: None, - approvers: HashSet::from([self.members[author_idx].clone()]), - }) - } - - /// Compose extrinsic for `multisig::as_multi` call. - fn construct_as_multi( - &self, - connection: &SignedConnection, - other_signatories: Vec, - timepoint: Option, - call: Extrinsic, - store_call: bool, - ) -> AsMultiCall { - compose_extrinsic!( - connection.as_connection(), - "Multisig", - "as_multi", - self.threshold, - other_signatories, - timepoint, - call.function.encode(), - store_call, - MAX_WEIGHT - ) - } - - /// Effectively starts aggregation process by calling `asMulti`. - /// - /// `connection` should be signed by some member. - pub fn initiate_aggregation_with_call( - &self, - connection: &SignedConnection, - call: Extrinsic, - store_call: bool, - ) -> Result { - let author_idx = self.map_signer_to_member_index(connection)?; - - let xt = self.construct_as_multi( - connection, - self.designate_represented(author_idx), - None, - call.clone(), - store_call, - ); - - let block_hash = - self.finalize_xt(connection, xt, "Initiate multisig aggregation with call")?; - - let call_hash = compute_call_hash(&call); - info!(target: "aleph-client", "Initiating multisig aggregation for call hash: {:?}", call_hash); - - Ok(SignatureAggregation { - timepoint: self.get_timestamp(connection, &call_hash, block_hash)?, - author: author_idx, - call_hash, - call: Some(call.encode()), - approvers: HashSet::from([self.members[author_idx].clone()]), - }) - } - - /// Report approval for `sig_agg` aggregation. - /// - /// `connection` should be signed by some member. - pub fn approve( - &self, - connection: &SignedConnection, - mut sig_agg: SignatureAggregation, - ) -> Result { - let member_idx = self.map_signer_to_member_index(connection)?; - - let xt = self.construct_approve_as_multi( - connection, - self.designate_represented(member_idx), - Some(sig_agg.timepoint), - sig_agg.call_hash, - ); - - self.finalize_xt(connection, xt, "Report approval to multisig aggregation")?; - - info!(target: "aleph-client", "Registered multisig approval for call hash: {:?}", sig_agg.call_hash); - sig_agg.approvers.insert(self.members[member_idx].clone()); - Ok(sig_agg) - } - - /// Report approval for `sig_agg` aggregation. - /// - /// `connection` should be signed by some member. - pub fn approve_with_call( - &self, - connection: &SignedConnection, - mut sig_agg: SignatureAggregation, - call: Extrinsic, - store_call: bool, - ) -> Result { - let member_idx = self.map_signer_to_member_index(connection)?; - if let Some(ref reported_call) = sig_agg.call { - ensure!( - reported_call.eq(&call.encode()), - MultisigError::CallConflict - ); - } else { - ensure!( - compute_call_hash(&call) == sig_agg.call_hash, - MultisigError::CallConflict - ); - } - - let xt = self.construct_as_multi( - connection, - self.designate_represented(member_idx), - Some(sig_agg.timepoint), - call.clone(), - store_call, - ); - - self.finalize_xt( - connection, - xt, - "Report approval to multisig aggregation with call", - )?; - - info!(target: "aleph-client", "Registered multisig approval for call hash: {:?}", sig_agg.call_hash); - sig_agg.approvers.insert(self.members[member_idx].clone()); - sig_agg.call = Some(call.encode()); - Ok(sig_agg) - } - - /// Compose extrinsic for `multisig::cancel_as_multi` call. - fn construct_cancel_as_multi( - &self, - connection: &SignedConnection, - other_signatories: Vec, - timepoint: Timepoint, - call_hash: CallHash, - ) -> CancelAsMultiCall { - compose_extrinsic!( - connection.as_connection(), - "Multisig", - "cancel_as_multi", - self.threshold, - other_signatories, - timepoint, - call_hash - ) - } - - /// Cancel `sig_agg` aggregation. - /// - /// `connection` should be signed by the aggregation author. - pub fn cancel( - &self, - connection: &SignedConnection, - sig_agg: SignatureAggregation, - ) -> Result<()> { - let author_idx = self.map_signer_to_member_index(connection)?; - ensure!(sig_agg.author == author_idx, MultisigError::NotAuthor); - - let xt = self.construct_cancel_as_multi( - connection, - self.designate_represented(author_idx), - sig_agg.timepoint, - sig_agg.call_hash, - ); - self.finalize_xt(connection, xt, "Cancel multisig aggregation")?; - info!(target: "aleph-client", "Cancelled multisig aggregation for call hash: {:?}", sig_agg.call_hash); - Ok(()) - } -} - -/// Dispatch `call` on behalf of the multisig party of `connection.get_signer()` and -/// `other_signatories` with threshold 1. -/// -/// `other_signatories` *must* be sorted (according to the natural ordering on `AccountId`). -pub fn perform_multisig_with_threshold_1( - connection: &SignedConnection, - other_signatories: &[AccountId], - call: CallDetails, -) -> Result<()> { - let xt = compose_extrinsic!( - connection.as_connection(), - "Multisig", - "as_multi_threshold_1", - other_signatories, - call - ); - try_send_xt(connection, xt, Some("Multisig with threshold 1"), Finalized)? - .expect("For `Finalized` status a block hash should be returned"); - Ok(()) -} diff --git a/aleph-client/src/pallets/aleph.rs b/aleph-client/src/pallets/aleph.rs new file mode 100644 index 0000000000..5b3a2441ae --- /dev/null +++ b/aleph-client/src/pallets/aleph.rs @@ -0,0 +1,132 @@ +use codec::Encode; +use primitives::{BlockNumber, SessionIndex, Version}; +use subxt::rpc_params; + +use crate::{ + api, + api::runtime_types::{ + pallet_aleph::pallet::Call::set_emergency_finalizer, primitives::app::Public, + sp_core::ed25519::Public as EdPublic, + }, + connections::TxInfo, + pallet_aleph::pallet::Call::schedule_finality_version_change, + AccountId, AlephKeyPair, BlockHash, + Call::Aleph, + ConnectionApi, Pair, RootConnection, SudoCall, TxStatus, +}; + +// TODO replace docs with link to pallet aleph docs, once they are published +/// Pallet aleph API which does not require sudo. +#[async_trait::async_trait] +pub trait AlephApi { + /// Gets the current finality version. + async fn finality_version(&self, at: Option) -> Version; + /// Gets the finality version for the next session. + async fn next_session_finality_version(&self, at: Option) -> Version; +} + +/// Pallet aleph API that requires sudo. +#[async_trait::async_trait] +pub trait AlephSudoApi { + /// Sets the emergency finalization key. + /// * `finalizer` - a new finalizer key + /// * `status` - a [`TxStatus`] of a tx to wait for + /// # Returns + /// Block hash of block where transaction was put or error + async fn set_emergency_finalizer( + &self, + finalizer: AccountId, + status: TxStatus, + ) -> anyhow::Result; + + /// Schedules a finality version change for a future session. + /// * `version` - next version of the finalizer + /// * `session` - from which session the next version applies + /// * `status` - a [`TxStatus`] of a tx to wait for + /// # Returns + /// Block hash of block where transaction was put or error + async fn schedule_finality_version_change( + &self, + version: u32, + session: SessionIndex, + status: TxStatus, + ) -> anyhow::Result; +} + +/// Pallet aleph RPC api. +#[async_trait::async_trait] +pub trait AlephRpc { + /// Finalize the block with given hash and number using attached signature. + /// # Returns + /// Block hash of block where transaction was put or error + async fn emergency_finalize( + &self, + number: BlockNumber, + hash: BlockHash, + key_pair: AlephKeyPair, + ) -> anyhow::Result<()>; +} + +#[async_trait::async_trait] +impl AlephApi for C { + async fn finality_version(&self, at: Option) -> Version { + let addrs = api::storage().aleph().finality_version(); + + self.get_storage_entry(&addrs, at).await + } + + async fn next_session_finality_version(&self, hash: Option) -> Version { + let method = "state_call"; + let api_method = "AlephSessionApi_next_session_finality_version"; + let params = rpc_params![api_method, "0x", hash]; + + self.rpc_call(method.to_string(), params).await.unwrap() + } +} + +#[async_trait::async_trait] +impl AlephSudoApi for RootConnection { + async fn set_emergency_finalizer( + &self, + finalizer: AccountId, + status: TxStatus, + ) -> anyhow::Result { + let call = Aleph(set_emergency_finalizer { + emergency_finalizer: Public(EdPublic(finalizer.into())), + }); + self.sudo_unchecked(call, status).await + } + + async fn schedule_finality_version_change( + &self, + version: u32, + session: SessionIndex, + status: TxStatus, + ) -> anyhow::Result { + let call = Aleph(schedule_finality_version_change { + version_incoming: version, + session, + }); + + self.sudo_unchecked(call, status).await + } +} + +#[async_trait::async_trait] +impl AlephRpc for C { + async fn emergency_finalize( + &self, + number: BlockNumber, + hash: BlockHash, + key_pair: AlephKeyPair, + ) -> anyhow::Result<()> { + let method = "alephNode_emergencyFinalize"; + let signature = key_pair.sign(&hash.encode()); + let raw_signature: &[u8] = signature.as_ref(); + let params = rpc_params![raw_signature, hash, number]; + + let _: () = self.rpc_call(method.to_string(), params).await?; + + Ok(()) + } +} diff --git a/aleph-client/src/pallets/author.rs b/aleph-client/src/pallets/author.rs new file mode 100644 index 0000000000..7e8006e194 --- /dev/null +++ b/aleph-client/src/pallets/author.rs @@ -0,0 +1,18 @@ +use codec::Decode; + +use crate::{aleph_runtime::SessionKeys, connections::AsConnection}; + +/// Implements RPC calls for [`author`](https://paritytech.github.io/substrate/master/sc_rpc/author/struct.Author.html) pallet +#[async_trait::async_trait] +pub trait AuthorRpc { + /// API for [`rotate_keys`](https://paritytech.github.io/substrate/master/sc_rpc/author/struct.Author.html#method.rotate_keys) call + async fn author_rotate_keys(&self) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl AuthorRpc for C { + async fn author_rotate_keys(&self) -> anyhow::Result { + let bytes = self.as_connection().as_client().rpc().rotate_keys().await?; + SessionKeys::decode(&mut bytes.0.as_slice()).map_err(|e| e.into()) + } +} diff --git a/aleph-client/src/pallets/balances.rs b/aleph-client/src/pallets/balances.rs new file mode 100644 index 0000000000..f1050cf59c --- /dev/null +++ b/aleph-client/src/pallets/balances.rs @@ -0,0 +1,167 @@ +use subxt::ext::sp_runtime::MultiAddress; + +use crate::{ + aleph_zero::{self, api, api::runtime_types::pallet_balances::BalanceLock}, + connections::TxInfo, + pallet_balances::pallet::Call::transfer, + pallets::utility::UtilityApi, + AccountId, Balance, BlockHash, + Call::Balances, + ConnectionApi, ParamsBuilder, SignedConnectionApi, TxStatus, +}; + +/// Pallet balances read-only API. +#[async_trait::async_trait] +pub trait BalanceApi { + /// API for [`locks`](https://paritytech.github.io/substrate/master/pallet_balances/pallet/struct.Pallet.html#method.locks) call. + /// * `account` - an account to query locked balance for + /// * `at` - optional hash of a block to query state from + async fn locks_for_account( + &self, + account: AccountId, + at: Option, + ) -> Vec>; + + /// API for [`locks`](https://paritytech.github.io/substrate/master/pallet_balances/pallet/struct.Pallet.html#method.locks) call. + /// * `accounts` - a list of accounts to query locked balance for + /// * `at` - optional hash of a block to query state from + async fn locks( + &self, + accounts: &[AccountId], + at: Option, + ) -> Vec>>; + + /// Returns [`total_issuance`](https://paritytech.github.io/substrate/master/pallet_balances/pallet/type.TotalIssuance.html). + async fn total_issuance(&self, at: Option) -> Balance; +} + +/// Pallet balances API +#[async_trait::async_trait] +pub trait BalanceUserApi { + /// API for [`transfer`](https://paritytech.github.io/substrate/master/pallet_balances/pallet/struct.Pallet.html#method.transfer) call. + async fn transfer( + &self, + dest: AccountId, + amount: Balance, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`transfer`](https://paritytech.github.io/substrate/master/pallet_balances/pallet/struct.Pallet.html#method.transfer) call. + /// Include tip in the tx. + async fn transfer_with_tip( + &self, + dest: AccountId, + amount: Balance, + tip: Balance, + status: TxStatus, + ) -> anyhow::Result; +} + +/// Pallet balances logic not directly related to any pallet call. +#[async_trait::async_trait] +pub trait BalanceUserBatchExtApi { + /// Performs batch of `balances.transfer` calls. + /// * `dest` - a list of accounts to send tokens to + /// * `amount` - an amount to transfer + /// * `status` - a [`TxStatus`] for a tx to wait for + /// + /// # Examples + /// ```ignore + /// for chunk in stash_accounts.chunks(1024) { + /// connection + /// .batch_transfer(chunk, 1_000_000_000_000u128, TxStatus::InBlock) + /// .await + /// .unwrap(); + /// } + /// ``` + async fn batch_transfer( + &self, + dest: &[AccountId], + amount: Balance, + status: TxStatus, + ) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl BalanceApi for C { + async fn locks_for_account( + &self, + account: AccountId, + at: Option, + ) -> Vec> { + let address = aleph_zero::api::storage().balances().locks(&account); + + self.get_storage_entry(&address, at).await.0 + } + + async fn locks( + &self, + accounts: &[AccountId], + at: Option, + ) -> Vec>> { + let mut locks = vec![]; + + for account in accounts { + locks.push(self.locks_for_account(account.clone(), at).await); + } + + locks + } + + async fn total_issuance(&self, at: Option) -> Balance { + let address = api::storage().balances().total_issuance(); + + self.get_storage_entry(&address, at).await + } +} + +#[async_trait::async_trait] +impl BalanceUserApi for S { + async fn transfer( + &self, + dest: AccountId, + amount: Balance, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .balances() + .transfer(MultiAddress::Id(dest), amount); + self.send_tx(tx, status).await + } + + async fn transfer_with_tip( + &self, + dest: AccountId, + amount: Balance, + tip: Balance, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .balances() + .transfer(MultiAddress::Id(dest), amount); + + self.send_tx_with_params(tx, ParamsBuilder::new().tip(tip), status) + .await + } +} + +#[async_trait::async_trait] +impl BalanceUserBatchExtApi for S { + async fn batch_transfer( + &self, + dests: &[AccountId], + amount: Balance, + status: TxStatus, + ) -> anyhow::Result { + let calls = dests + .iter() + .map(|dest| { + Balances(transfer { + dest: MultiAddress::Id(dest.clone()), + value: amount, + }) + }) + .collect(); + self.batch_call(calls, status).await + } +} diff --git a/aleph-client/src/pallets/contract.rs b/aleph-client/src/pallets/contract.rs new file mode 100644 index 0000000000..0e92fe05a0 --- /dev/null +++ b/aleph-client/src/pallets/contract.rs @@ -0,0 +1,207 @@ +use codec::{Compact, Encode}; +use pallet_contracts_primitives::ContractExecResult; +use subxt::{ext::sp_core::Bytes, rpc_params}; + +use crate::{ + api, + pallet_contracts::wasm::{Determinism, OwnerInfo}, + sp_weights::weight_v2::Weight, + AccountId, Balance, BlockHash, CodeHash, ConnectionApi, SignedConnectionApi, TxInfo, TxStatus, +}; + +/// Arguments to [`ContractRpc::call_and_get`]. +#[derive(Encode)] +pub struct ContractCallArgs { + /// Who is singing a tx. + pub origin: AccountId, + /// Address of the contract to call. + pub dest: AccountId, + /// The balance to transfer from the `origin` to `dest`. + pub value: Balance, + /// The gas limit enforced when executing the constructor. + pub gas_limit: Option, + /// The maximum amount of balance that can be charged from the caller to pay for the storage consumed. + pub storage_deposit_limit: Option, + /// The input data to pass to the contract. + pub input_data: Vec, +} + +/// Pallet contracts read-only api. +#[async_trait::async_trait] +pub trait ContractsApi { + /// Returns `contracts.owner_info_of` storage for a given code hash. + /// * `code_hash` - a code hash + /// * `at` - optional hash of a block to query state from + async fn get_owner_info(&self, code_hash: CodeHash, at: Option) + -> Option; +} + +/// Pallet contracts api. +#[async_trait::async_trait] +pub trait ContractsUserApi { + /// API for [`upload_code`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.upload_code) call. + async fn upload_code( + &self, + code: Vec, + storage_limit: Option>, + determinism: Determinism, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`instantiate`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.instantiate) call. + #[allow(clippy::too_many_arguments)] + async fn instantiate( + &self, + code_hash: CodeHash, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + salt: Vec, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`instantiate_with_code`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.instantiate_with_code) call. + #[allow(clippy::too_many_arguments)] + async fn instantiate_with_code( + &self, + code: Vec, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + salt: Vec, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`call`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.call) call. + async fn call( + &self, + destination: AccountId, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`remove_code`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.remove_code) call. + async fn remove_code(&self, code_hash: BlockHash, status: TxStatus) -> anyhow::Result; +} + +/// RPC for runtime ContractsApi +#[async_trait::async_trait] +pub trait ContractRpc { + /// API for [`call`](https://paritytech.github.io/substrate/master/pallet_contracts/trait.ContractsApi.html#method.call) call. + async fn call_and_get( + &self, + args: ContractCallArgs, + ) -> anyhow::Result>; +} + +#[async_trait::async_trait] +impl ContractsApi for C { + async fn get_owner_info( + &self, + code_hash: CodeHash, + at: Option, + ) -> Option { + let addrs = api::storage().contracts().owner_info_of(code_hash); + + self.get_storage_entry_maybe(&addrs, at).await + } +} + +#[async_trait::async_trait] +impl ContractsUserApi for S { + async fn upload_code( + &self, + code: Vec, + storage_limit: Option>, + determinism: Determinism, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .contracts() + .upload_code(code, storage_limit, determinism); + + self.send_tx(tx, status).await + } + + async fn instantiate( + &self, + code_hash: CodeHash, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + salt: Vec, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().contracts().instantiate( + balance, + gas_limit, + storage_limit, + code_hash, + data, + salt, + ); + + self.send_tx(tx, status).await + } + + async fn instantiate_with_code( + &self, + code: Vec, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + salt: Vec, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().contracts().instantiate_with_code( + balance, + gas_limit, + storage_limit, + code, + data, + salt, + ); + + self.send_tx(tx, status).await + } + + async fn call( + &self, + destination: AccountId, + balance: Balance, + gas_limit: Weight, + storage_limit: Option>, + data: Vec, + status: TxStatus, + ) -> anyhow::Result { + let tx = + api::tx() + .contracts() + .call(destination.into(), balance, gas_limit, storage_limit, data); + self.send_tx(tx, status).await + } + + async fn remove_code(&self, code_hash: BlockHash, status: TxStatus) -> anyhow::Result { + let tx = api::tx().contracts().remove_code(code_hash); + + self.send_tx(tx, status).await + } +} + +#[async_trait::async_trait] +impl ContractRpc for C { + async fn call_and_get( + &self, + args: ContractCallArgs, + ) -> anyhow::Result> { + let params = rpc_params!["ContractsApi_call", Bytes(args.encode())]; + self.rpc_call("state_call".to_string(), params).await + } +} diff --git a/aleph-client/src/pallets/elections.rs b/aleph-client/src/pallets/elections.rs new file mode 100644 index 0000000000..1e7a9083cb --- /dev/null +++ b/aleph-client/src/pallets/elections.rs @@ -0,0 +1,293 @@ +use primitives::{EraIndex, SessionCount}; + +use crate::{ + api, + api::runtime_types::{ + pallet_elections::pallet::Call::set_ban_config, + primitives::{BanReason, CommitteeSeats, EraValidators}, + }, + connections::{AsConnection, TxInfo}, + pallet_elections::pallet::Call::{ + ban_from_committee, change_validators, set_elections_openness, + }, + primitives::{BanConfig, BanInfo, ElectionOpenness}, + AccountId, BlockHash, + Call::Elections, + ConnectionApi, RootConnection, SudoCall, TxStatus, +}; + +// TODO once pallet elections docs are published, replace api docs with links to public docs +/// Pallet elections read-only api. +#[async_trait::async_trait] +pub trait ElectionsApi { + /// Returns `elections.ban_config` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_ban_config(&self, at: Option) -> BanConfig; + + /// Returns `elections.committee_size` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_committee_seats(&self, at: Option) -> CommitteeSeats; + + /// Returns `elections.next_era_committee_seats` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_next_era_committee_seats(&self, at: Option) -> CommitteeSeats; + + /// Returns `elections.session_validator_block_count` of a given validator. + /// * `validator` - a validator stash account id + /// * `at` - optional hash of a block to query state from + async fn get_validator_block_count( + &self, + validator: AccountId, + at: Option, + ) -> Option; + + /// Returns `elections.current_era_validators` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_current_era_validators(&self, at: Option) -> EraValidators; + + /// Returns `elections.next_era_reserved_validators` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_next_era_reserved_validators(&self, at: Option) -> Vec; + + /// Returns `elections.next_era_non_reserved_validators` storage of the elections pallet. + /// * `at` - optional hash of a block to query state from + async fn get_next_era_non_reserved_validators(&self, at: Option) -> Vec; + + /// Returns `elections.underperformed_validator_session_count` storage of a given validator. + /// * `validator` - a validator stash account id + /// * `at` - optional hash of a block to query state from + async fn get_underperformed_validator_session_count( + &self, + validator: AccountId, + at: Option, + ) -> Option; + + /// Returns `elections.banned.reason` storage of a given validator. + /// * `validator` - a validator stash account id + /// * `at` - optional hash of a block to query state from + async fn get_ban_reason_for_validator( + &self, + validator: AccountId, + at: Option, + ) -> Option; + + /// Returns `elections.banned` storage of a given validator. + /// * `validator` - a validator stash account id + /// * `at` - optional hash of a block to query state from + async fn get_ban_info_for_validator( + &self, + validator: AccountId, + at: Option, + ) -> Option; + /// Returns `elections.session_period` const of the elections pallet. + async fn get_session_period(&self) -> anyhow::Result; +} + +/// any object that implements pallet elections api that requires sudo +#[async_trait::async_trait] +pub trait ElectionsSudoApi { + /// Issues `elections.set_ban_config`. It has an immediate effect. + /// * `minimal_expected_performance` - performance ratio threshold in a session + /// * `underperformed_session_count_threshold` - how many bad uptime sessions force validator to be removed from the committee + /// * `clean_session_counter_delay` - underperformed session counter is cleared every subsequent `clean_session_counter_delay` sessions + /// * `ban_period` - how many eras a validator is banned for + /// * `status` - a [`TxStatus`] for a tx to wait for + async fn set_ban_config( + &self, + minimal_expected_performance: Option, + underperformed_session_count_threshold: Option, + clean_session_counter_delay: Option, + ban_period: Option, + status: TxStatus, + ) -> anyhow::Result; + + /// Issues `elections.change_validators` that sets the committee for the next era. + /// * `new_reserved_validators` - reserved validators to be in place in the next era; optional + /// * `new_non_reserved_validators` - non reserved validators to be in place in the next era; optional + /// * `committee_size` - committee size to be in place in the next era; optional + /// * `status` - a [`TxStatus`] for a tx to wait for + async fn change_validators( + &self, + new_reserved_validators: Option>, + new_non_reserved_validators: Option>, + committee_size: Option, + status: TxStatus, + ) -> anyhow::Result; + + /// Schedule a non-reserved node to be banned out from the committee at the end of the era. + /// * `account` - account to be banned, + /// * `ben_reason` - reaons for ban, expressed as raw bytes + /// * `status` - a [`TxStatus`] for a tx to wait for + async fn ban_from_committee( + &self, + account: AccountId, + ban_reason: Vec, + status: TxStatus, + ) -> anyhow::Result; + + /// Set openness of the elections. + /// * `mode` - new elections openness mode + /// * `status` - a [`TxStatus`] for a tx to wait for + async fn set_election_openness( + &self, + mode: ElectionOpenness, + status: TxStatus, + ) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl ElectionsApi for C { + async fn get_ban_config(&self, at: Option) -> BanConfig { + let addrs = api::storage().elections().ban_config(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_committee_seats(&self, at: Option) -> CommitteeSeats { + let addrs = api::storage().elections().committee_size(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_next_era_committee_seats(&self, at: Option) -> CommitteeSeats { + let addrs = api::storage().elections().next_era_committee_size(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_validator_block_count( + &self, + validator: AccountId, + at: Option, + ) -> Option { + let addrs = api::storage() + .elections() + .session_validator_block_count(&validator); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_current_era_validators(&self, at: Option) -> EraValidators { + let addrs = api::storage().elections().current_era_validators(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_next_era_reserved_validators(&self, at: Option) -> Vec { + let addrs = api::storage().elections().next_era_reserved_validators(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_next_era_non_reserved_validators(&self, at: Option) -> Vec { + let addrs = api::storage() + .elections() + .next_era_non_reserved_validators(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_underperformed_validator_session_count( + &self, + validator: AccountId, + at: Option, + ) -> Option { + let addrs = api::storage() + .elections() + .underperformed_validator_session_count(&validator); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_ban_reason_for_validator( + &self, + validator: AccountId, + at: Option, + ) -> Option { + let addrs = api::storage().elections().banned(validator); + + match self.get_storage_entry_maybe(&addrs, at).await { + None => None, + Some(x) => Some(x.reason), + } + } + + async fn get_ban_info_for_validator( + &self, + validator: AccountId, + at: Option, + ) -> Option { + let addrs = api::storage().elections().banned(validator); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_session_period(&self) -> anyhow::Result { + let addrs = api::constants().elections().session_period(); + self.as_connection() + .as_client() + .constants() + .at(&addrs) + .map_err(|e| e.into()) + } +} + +#[async_trait::async_trait] +impl ElectionsSudoApi for RootConnection { + async fn set_ban_config( + &self, + minimal_expected_performance: Option, + underperformed_session_count_threshold: Option, + clean_session_counter_delay: Option, + ban_period: Option, + status: TxStatus, + ) -> anyhow::Result { + let call = Elections(set_ban_config { + minimal_expected_performance, + underperformed_session_count_threshold, + clean_session_counter_delay, + ban_period, + }); + + self.sudo_unchecked(call, status).await + } + + async fn change_validators( + &self, + new_reserved_validators: Option>, + new_non_reserved_validators: Option>, + committee_size: Option, + status: TxStatus, + ) -> anyhow::Result { + let call = Elections(change_validators { + reserved_validators: new_reserved_validators, + non_reserved_validators: new_non_reserved_validators, + committee_size, + }); + + self.sudo_unchecked(call, status).await + } + + async fn ban_from_committee( + &self, + account: AccountId, + ban_reason: Vec, + status: TxStatus, + ) -> anyhow::Result { + let call = Elections(ban_from_committee { + banned: account, + ban_reason, + }); + self.sudo_unchecked(call, status).await + } + + async fn set_election_openness( + &self, + mode: ElectionOpenness, + status: TxStatus, + ) -> anyhow::Result { + let call = Elections(set_elections_openness { openness: mode }); + + self.sudo_unchecked(call, status).await + } +} diff --git a/aleph-client/src/pallets/fee.rs b/aleph-client/src/pallets/fee.rs new file mode 100644 index 0000000000..1cab7bfd66 --- /dev/null +++ b/aleph-client/src/pallets/fee.rs @@ -0,0 +1,23 @@ +use crate::{api, BlockHash, ConnectionApi}; + +/// An alias for a fee multiplier. +pub type FeeMultiplier = u128; + +/// Transaction payment pallet API. +#[async_trait::async_trait] +pub trait TransactionPaymentApi { + /// API for [`next_fee_multiplier`](https://paritytech.github.io/substrate/master/pallet_transaction_payment/pallet/struct.Pallet.html#method.next_fee_multiplier) call. + async fn get_next_fee_multiplier(&self, at: Option) -> FeeMultiplier; +} + +#[async_trait::async_trait] +impl TransactionPaymentApi for C { + async fn get_next_fee_multiplier(&self, at: Option) -> FeeMultiplier { + let addrs = api::storage().transaction_payment().next_fee_multiplier(); + + match self.get_storage_entry_maybe(&addrs, at).await { + Some(fm) => fm.0, + None => 1, + } + } +} diff --git a/aleph-client/src/pallets/mod.rs b/aleph-client/src/pallets/mod.rs new file mode 100644 index 0000000000..047ea35857 --- /dev/null +++ b/aleph-client/src/pallets/mod.rs @@ -0,0 +1,26 @@ +/// Pallet aleph API +pub mod aleph; +/// Pallet author API +pub mod author; +/// Pallet balances API +pub mod balances; +/// Pallet contracts API +pub mod contract; +/// Pallet elections API +pub mod elections; +/// Pallet transaction payment API +pub mod fee; +/// Pallet multisig API +pub mod multisig; +/// Pallet session API +pub mod session; +/// Pallet staking API +pub mod staking; +/// Pallet system API +pub mod system; +/// Pallet treasury API +pub mod treasury; +/// Pallet utility API +pub mod utility; +/// Pallet vesting API +pub mod vesting; diff --git a/aleph-client/src/pallets/multisig.rs b/aleph-client/src/pallets/multisig.rs new file mode 100644 index 0000000000..7a1136a158 --- /dev/null +++ b/aleph-client/src/pallets/multisig.rs @@ -0,0 +1,618 @@ +use std::{collections::HashSet, marker::PhantomData}; + +use anyhow::{anyhow, ensure}; +use codec::{Decode, Encode}; +use primitives::{Balance, BlockNumber}; + +use crate::{ + account_from_keypair, aleph_runtime::RuntimeCall, api, api::runtime_types, connections::TxInfo, + sp_core::blake2_256, sp_runtime::traits::TrailingZeroInput, sp_weights::weight_v2::Weight, + AccountId, BlockHash, ConnectionApi, SignedConnectionApi, TxStatus, +}; + +/// An alias for a call hash. +pub type CallHash = [u8; 32]; +/// An alias for a call. +pub type Call = RuntimeCall; +/// An alias for a threshold. +pub type MultisigThreshold = u16; +/// An alias for a timepoint. +pub type Timepoint = runtime_types::pallet_multisig::Timepoint; +/// An alias for a multisig structure in the pallet storage. +pub type Multisig = runtime_types::pallet_multisig::Multisig; + +/// `MAX_WEIGHT` is the extrinsic parameter specifying upperbound for executing approved call. +/// Unless the approval is final, it has no effect. However, if due to your approval the +/// threshold is reached, you will be charged for execution process. By setting `max_weight` +/// low enough, you can avoid paying and left it for another member. +/// +/// However, passing such parameter everytime is cumbersome and introduces the need of either +/// estimating call weight or setting very high universal bound at every caller side. +/// Thus, we keep a fairly high limit, which should cover almost any call (0.05 token). +pub const DEFAULT_MAX_WEIGHT: Weight = Weight::new(500_000_000, 0); + +/// Pallet multisig api. +#[async_trait::async_trait] +pub trait MultisigUserApi { + /// API for [`as_multi_threshold_1`](https://paritytech.github.io/substrate/master/pallet_multisig/pallet/struct.Pallet.html#method.as_multi_threshold_1) call. + async fn as_multi_threshold_1( + &self, + other_signatories: Vec, + call: Call, + status: TxStatus, + ) -> anyhow::Result; + /// API for [`as_multi`](https://paritytech.github.io/substrate/master/pallet_multisig/pallet/struct.Pallet.html#method.as_multi) call. + async fn as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Option, + max_weight: Weight, + call: Call, + status: TxStatus, + ) -> anyhow::Result; + /// API for [`approve_as_multi`](https://paritytech.github.io/substrate/master/pallet_multisig/pallet/struct.Pallet.html#method.approve_as_multi) call. + async fn approve_as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Option, + max_weight: Weight, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result; + /// API for [`cancel_as_multi`](https://paritytech.github.io/substrate/master/pallet_multisig/pallet/struct.Pallet.html#method.cancel_as_multi) call. + async fn cancel_as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Timepoint, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl MultisigUserApi for S { + async fn as_multi_threshold_1( + &self, + other_signatories: Vec, + call: Call, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .multisig() + .as_multi_threshold_1(other_signatories, call); + + self.send_tx(tx, status).await + } + + async fn as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Option, + max_weight: Weight, + call: Call, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().multisig().as_multi( + threshold, + other_signatories, + timepoint, + call, + max_weight, + ); + + self.send_tx(tx, status).await + } + + async fn approve_as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Option, + max_weight: Weight, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().multisig().approve_as_multi( + threshold, + other_signatories, + timepoint, + call_hash, + max_weight, + ); + + self.send_tx(tx, status).await + } + + async fn cancel_as_multi( + &self, + threshold: MultisigThreshold, + other_signatories: Vec, + timepoint: Timepoint, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().multisig().cancel_as_multi( + threshold, + other_signatories, + timepoint, + call_hash, + ); + + self.send_tx(tx, status).await + } +} + +/// A group of accounts together with a threshold. +#[derive(Clone, Eq, PartialEq, Debug)] +pub struct MultisigParty { + signatories: Vec, + threshold: MultisigThreshold, +} + +impl MultisigParty { + /// Create new party from `signatories` and `threshold`. + /// + /// `signatories` can contain duplicates and doesn't have to be sorted. However, there must be + /// at least 2 unique accounts. There is also a virtual upper bound - `MaxSignatories` constant. + /// It isn't checked here (since it requires client), however, using too big party will fail + /// when performing any chain interaction. + /// + /// `threshold` must be between 2 and number of unique accounts in `signatories`. For threshold + /// 1, use special method `MultisigUserApi::as_multi_threshold_1`. + pub fn new(signatories: &[AccountId], threshold: MultisigThreshold) -> anyhow::Result { + let mut sorted_signatories = signatories.to_vec(); + sorted_signatories.sort(); + sorted_signatories.dedup(); + + ensure!( + sorted_signatories.len() > 1, + "There must be at least 2 different signatories" + ); + ensure!( + sorted_signatories.len() >= threshold as usize, + "Threshold must not be greater than the number of unique signatories" + ); + ensure!( + threshold >= 2, + "Threshold must be at least 2 - for threshold 1, use `as_multi_threshold_1`" + ); + + Ok(Self { + signatories: sorted_signatories, + threshold, + }) + } + + /// The multisig account derived from signatories and threshold. + /// + /// This method is copied from the pallet, because: + /// - we don't want to add a new dependency + /// - we cannot instantiate pallet object here anyway (the corresponding functionality exists + /// as pallet's method rather than standalone function) + pub fn account(&self) -> AccountId { + let entropy = + (b"modlpy/utilisuba", &self.signatories, &self.threshold).using_encoded(blake2_256); + Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref())) + .expect("infinite length input; no invalid inputs for type; qed") + } +} + +/// Pallet multisig functionality that is not directly related to any pallet call. +#[async_trait::async_trait] +pub trait MultisigApiExt { + /// Get the coordinate that corresponds to the ongoing signature aggregation for `party_account` + /// and `call_hash`. + async fn get_timepoint( + &self, + party_account: &AccountId, + call_hash: &CallHash, + block_hash: Option, + ) -> Timepoint; +} + +#[async_trait::async_trait] +impl MultisigApiExt for C { + async fn get_timepoint( + &self, + party_account: &AccountId, + call_hash: &CallHash, + block_hash: Option, + ) -> Timepoint { + let multisigs = api::storage() + .multisig() + .multisigs(party_account, call_hash); + let Multisig { when, .. } = self.get_storage_entry(&multisigs, block_hash).await; + when + } +} + +/// We will mark context object as either ongoing procedure or a closed one. However, we put this +/// distinction to the type level, so instead of enum, we use a trait. +pub trait ContextState {} + +/// Context of the signature aggregation that is still in progress. +#[derive(Clone, Eq, PartialEq, Debug)] +pub enum Ongoing {} +impl ContextState for Ongoing {} + +/// Context of the signature aggregation that was either successfully performed or canceled. +#[derive(Clone, Eq, PartialEq, Debug)] +pub enum Closed {} +impl ContextState for Closed {} + +/// A context in which ongoing signature aggregation is performed. +#[derive(Clone, Eq, PartialEq, Debug)] +pub struct Context { + /// The entity for which aggregation is being made. + party: MultisigParty, + /// Derived multisig account (the source of the target call). + author: AccountId, + + /// Pallet's coordinate for this aggregation. + timepoint: Timepoint, + /// Weight limit when dispatching the call. + max_weight: Weight, + + /// The target dispatchable, if already provided. + call: Option, + /// The hash of the target dispatchable. + call_hash: CallHash, + + /// The set of accounts, that already approved the call (via this context object), including the + /// author. + /// + /// `approvers.len() < party.threshold` always holds. + approvers: HashSet, + + _phantom: PhantomData, +} + +/// After approval action, our context can be in two modes - either for further use (`Ongoing`), or +/// read only (`Closed`). +#[derive(Clone, Eq, PartialEq, Debug)] +pub enum ContextAfterUse { + /// Signature aggregation is in progress. + Ongoing(Context), + /// Signature aggregation was either successfully performed or was canceled. + Closed(Context), +} + +impl Context { + fn new( + party: MultisigParty, + author: AccountId, + timepoint: Timepoint, + max_weight: Weight, + call: Option, + call_hash: CallHash, + ) -> Self { + Self { + party, + author: author.clone(), + timepoint, + max_weight, + call, + call_hash, + approvers: HashSet::from([author]), + _phantom: PhantomData, + } + } + + /// In case `Context` object has been passed somewhere, where this limit should be adjusted, we + /// allow for that. + /// + /// Actually, this isn't used until threshold is met, so such changing is perfectly safe. + pub fn change_max_weight(&mut self, max_weight: Weight) { + self.max_weight = max_weight; + } + + /// Set `call` only if `self.call_hash` is matching. + fn set_call(&mut self, call: Call) -> anyhow::Result<()> { + ensure!( + self.call_hash == compute_call_hash(&call), + "Call doesn't match to the registered hash" + ); + self.call = Some(call); + Ok(()) + } + + /// Register another approval. Depending on the threshold meeting and `call` content, we treat + /// signature aggregation process as either still ongoing or closed. + fn add_approval(mut self, approver: AccountId) -> ContextAfterUse { + self.approvers.insert(approver); + if self.call.is_some() && self.approvers.len() >= (self.party.threshold as usize) { + ContextAfterUse::Closed(self.close()) + } else { + ContextAfterUse::Ongoing(self) + } + } + + /// Casting to the closed variant. Private, so that the user don't accidentally call `into()` + /// and close ongoing context. + fn close(self) -> Context { + Context:: { + party: self.party, + author: self.author, + timepoint: self.timepoint, + max_weight: self.max_weight, + call: self.call, + call_hash: self.call_hash, + approvers: self.approvers, + _phantom: Default::default(), + } + } +} + +impl Context { + /// Read party. + pub fn party(&self) -> &MultisigParty { + &self.party + } + /// Read author. + pub fn author(&self) -> &AccountId { + &self.author + } + /// Read timepoint. + pub fn timepoint(&self) -> &Timepoint { + &self.timepoint + } + /// Read max weight. + pub fn max_weight(&self) -> &Weight { + &self.max_weight + } + /// Read call. + pub fn call(&self) -> &Option { + &self.call + } + /// Read call hash. + pub fn call_hash(&self) -> CallHash { + self.call_hash + } + /// Read approvers set. + pub fn approvers(&self) -> &HashSet { + &self.approvers + } +} + +/// Pallet multisig API, but suited for cases when the whole scenario is performed in a single place +/// - we keep data in a context object which helps in concise programming. +#[async_trait::async_trait] +pub trait MultisigContextualApi { + /// Start signature aggregation for `party` and `call_hash`. Get `Context` object as a result + /// (together with standard tx coordinates). + /// + /// This is the recommended way of initialization. + async fn initiate( + &self, + party: &MultisigParty, + max_weight: &Weight, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)>; + /// Start signature aggregation for `party` and `call`. Get `Context` object as a result + /// (together with standard tx coordinates). + /// + /// Note: it is usually a better idea to pass `call` only with the final approval (so that it + /// isn't stored on-chain). + async fn initiate_with_call( + &self, + party: &MultisigParty, + max_weight: &Weight, + call: Call, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)>; + /// Express contextual approval for the call hash. + /// + /// This is the recommended way for every intermediate approval. + async fn approve( + &self, + context: Context, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, ContextAfterUse)>; + /// Express contextual approval for the `call`. + /// + /// This is the recommended way only for the final approval. + async fn approve_with_call( + &self, + context: Context, + call: Option, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, ContextAfterUse)>; + /// Cancel signature aggregation. + async fn cancel( + &self, + context: Context, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)>; +} + +#[async_trait::async_trait] +impl MultisigContextualApi for S { + async fn initiate( + &self, + party: &MultisigParty, + max_weight: &Weight, + call_hash: CallHash, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)> { + let other_signatories = ensure_signer_in_party(self, party)?; + + let tx_info = self + .approve_as_multi( + party.threshold, + other_signatories, + None, + max_weight.clone(), + call_hash, + status, + ) + .await?; + + // Even though `subxt` allows us to get timepoint when waiting for the submission + // confirmation (see e.g. `ExtrinsicEvents` object that is returned from + // `wait_for_finalized_success`), we chose to perform one additional storage read. + // Firstly, because of brevity here (we would have to duplicate some lines from + // `connections` module. Secondly, if `Timepoint` struct change, this method (reading raw + // extrinsic position) might become incorrect. + let timepoint = self + .get_timepoint(&party.account(), &call_hash, Some(tx_info.block_hash)) + .await; + + Ok(( + tx_info, + Context::new( + party.clone(), + self.account_id().clone(), + timepoint, + max_weight.clone(), + None, + call_hash, + ), + )) + } + + async fn initiate_with_call( + &self, + party: &MultisigParty, + max_weight: &Weight, + call: Call, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)> { + let other_signatories = ensure_signer_in_party(self, party)?; + + let tx_info = self + .as_multi( + party.threshold, + other_signatories, + None, + max_weight.clone(), + call.clone(), + status, + ) + .await?; + + let call_hash = compute_call_hash(&call); + let timepoint = self + .get_timepoint(&party.account(), &call_hash, Some(tx_info.block_hash)) + .await; + + Ok(( + tx_info, + Context::new( + party.clone(), + self.account_id().clone(), + timepoint, + max_weight.clone(), + Some(call.clone()), + call_hash, + ), + )) + } + + async fn approve( + &self, + context: Context, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, ContextAfterUse)> { + let other_signatories = ensure_signer_in_party(self, &context.party)?; + + self.approve_as_multi( + context.party.threshold, + other_signatories, + Some(context.timepoint.clone()), + context.max_weight.clone(), + context.call_hash, + status, + ) + .await + .map(|tx_info| (tx_info, context.add_approval(self.account_id().clone()))) + } + + async fn approve_with_call( + &self, + mut context: Context, + call: Option, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, ContextAfterUse)> { + let other_signatories = ensure_signer_in_party(self, &context.party)?; + + let call = match (call.as_ref(), context.call.as_ref()) { + (None, None) => Err(anyhow!( + "Call wasn't provided earlier - you must pass it now" + )), + (None, Some(call)) => Ok(call), + (Some(call), None) => { + context.set_call(call.clone())?; + Ok(call) + } + (Some(saved_call), Some(new_call)) => { + ensure!( + saved_call == new_call, + "The call is different that the one used previously" + ); + Ok(new_call) + } + }?; + + self.as_multi( + context.party.threshold, + other_signatories, + Some(context.timepoint.clone()), + context.max_weight.clone(), + call.clone(), + status, + ) + .await + .map(|tx_info| (tx_info, context.add_approval(self.account_id().clone()))) + } + + async fn cancel( + &self, + context: Context, + status: TxStatus, + ) -> anyhow::Result<(TxInfo, Context)> { + let other_signatories = ensure_signer_in_party(self, &context.party)?; + + ensure!( + *self.account_id() == context.author, + "Only the author can cancel multisig aggregation" + ); + + let tx_info = self + .cancel_as_multi( + context.party.threshold, + other_signatories, + context.timepoint.clone(), + context.call_hash, + status, + ) + .await?; + + Ok((tx_info, context.close())) + } +} + +/// Compute hash of `call`. +pub fn compute_call_hash(call: &Call) -> CallHash { + call.using_encoded(blake2_256) +} + +/// Ensure that the signer of `conn` is present in `party.signatories`. If so, return all other +/// signatories. +fn ensure_signer_in_party( + conn: &S, + party: &MultisigParty, +) -> anyhow::Result> { + let signer_account = account_from_keypair(conn.signer().signer()); + if let Ok(index) = party.signatories.binary_search(&signer_account) { + let mut other_signatories = party.signatories.clone(); + other_signatories.remove(index); + Ok(other_signatories) + } else { + Err(anyhow!("Connection should be signed by a party member")) + } +} diff --git a/aleph-client/src/pallets/session.rs b/aleph-client/src/pallets/session.rs new file mode 100644 index 0000000000..eaeda5937c --- /dev/null +++ b/aleph-client/src/pallets/session.rs @@ -0,0 +1,66 @@ +use primitives::SessionIndex; + +use crate::{ + api, api::runtime_types::aleph_runtime::SessionKeys, connections::TxInfo, AccountId, BlockHash, + ConnectionApi, SignedConnectionApi, TxStatus, +}; + +/// Pallet session read-only api. +#[async_trait::async_trait] +pub trait SessionApi { + /// API for [`next_keys`](https://paritytech.github.io/substrate/master/pallet_session/pallet/type.NextKeys.html) call. + async fn get_next_session_keys( + &self, + account: AccountId, + at: Option, + ) -> Option; + + /// API for [`current_index`](https://paritytech.github.io/substrate/master/pallet_session/pallet/struct.Pallet.html#method.current_index) call. + async fn get_session(&self, at: Option) -> SessionIndex; + + /// API for [`validators`](https://paritytech.github.io/substrate/master/pallet_session/pallet/struct.Pallet.html#method.validators) call. + async fn get_validators(&self, at: Option) -> Vec; +} + +/// any object that implements pallet session api +#[async_trait::async_trait] +pub trait SessionUserApi { + /// API for [`set_keys`](https://paritytech.github.io/substrate/master/pallet_session/pallet/struct.Pallet.html#method.set_keys) call. + async fn set_keys(&self, new_keys: SessionKeys, status: TxStatus) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl SessionApi for C { + async fn get_next_session_keys( + &self, + account: AccountId, + at: Option, + ) -> Option { + let addrs = api::storage().session().next_keys(account); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_session(&self, at: Option) -> SessionIndex { + let addrs = api::storage().session().current_index(); + + self.get_storage_entry_maybe(&addrs, at) + .await + .unwrap_or_default() + } + + async fn get_validators(&self, at: Option) -> Vec { + let addrs = api::storage().session().validators(); + + self.get_storage_entry(&addrs, at).await + } +} + +#[async_trait::async_trait] +impl SessionUserApi for S { + async fn set_keys(&self, new_keys: SessionKeys, status: TxStatus) -> anyhow::Result { + let tx = api::tx().session().set_keys(new_keys, vec![]); + + self.send_tx(tx, status).await + } +} diff --git a/aleph-client/src/pallets/staking.rs b/aleph-client/src/pallets/staking.rs new file mode 100644 index 0000000000..e35743191b --- /dev/null +++ b/aleph-client/src/pallets/staking.rs @@ -0,0 +1,505 @@ +use primitives::{Balance, EraIndex}; +use subxt::{ + ext::{ + sp_core::storage::StorageKey, + sp_runtime::{MultiAddress, Perbill as SPerbill}, + }, + storage::address::{StorageHasher, StorageMapKey}, +}; + +use crate::{ + api, + connections::{AsConnection, TxInfo}, + pallet_staking::{ + pallet::pallet::{ + Call::{bond, force_new_era, nominate, set_staking_configs}, + ConfigOp, + ConfigOp::{Noop, Set}, + }, + EraRewardPoints, Exposure, RewardDestination, StakingLedger, ValidatorPrefs, + }, + pallet_sudo::pallet::Call::sudo_as, + pallets::utility::UtilityApi, + sp_arithmetic::per_things::Perbill, + AccountId, BlockHash, + Call::{Staking, Sudo}, + ConnectionApi, RootConnection, SignedConnectionApi, SudoCall, TxStatus, +}; + +/// Any object that implemnts pallet staking read-only api. +#[async_trait::async_trait] +pub trait StakingApi { + /// Returns [`active_era`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.active_era). + /// * `at` - optional hash of a block to query state from + async fn get_active_era(&self, at: Option) -> EraIndex; + + /// Returns [`current_era`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.current_era). + /// * `at` - optional hash of a block to query state from + async fn get_current_era(&self, at: Option) -> EraIndex; + + /// Returns [`bonded`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.bonded) for a given stash account. + /// * `stash` - a stash account id + /// * `at` - optional hash of a block to query state from + async fn get_bonded(&self, stash: AccountId, at: Option) -> Option; + + /// Returns [`ledger`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.ledger) for a given controller account. + /// * `controller` - a controller account id + /// * `at` - optional hash of a block to query state from + async fn get_ledger(&self, controller: AccountId, at: Option) -> StakingLedger; + + /// Returns [`eras_validator_reward`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.eras_validator_reward) for a given era. + /// * `era` - an era index + /// * `at` - optional hash of a block to query state from + async fn get_payout_for_era(&self, era: EraIndex, at: Option) -> Balance; + + /// Returns [`eras_stakers`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.eras_stakers) for a given era and account id. + /// * `era` - an era index + /// * `account_id` - an account id + /// * `at` - optional hash of a block to query state from + async fn get_exposure( + &self, + era: EraIndex, + account_id: &AccountId, + at: Option, + ) -> Exposure; + + /// Returns [`eras_reward_points`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.eras_reward_points) for a given era. + /// * `era` - an era index + /// * `at` - optional hash of a block to query state from + async fn get_era_reward_points( + &self, + era: EraIndex, + at: Option, + ) -> Option>; + + /// Returns [`minimum_validator_count`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.minimum_validator_count). + /// * `at` - optional hash of a block to query state from + async fn get_minimum_validator_count(&self, at: Option) -> u32; + /// Returns [`SessionsPerEra`](https://paritytech.github.io/substrate/master/pallet_staking/trait.Config.html#associatedtype.SessionsPerEra) const. + async fn get_session_per_era(&self) -> anyhow::Result; +} + +/// Pallet staking api +#[async_trait::async_trait] +pub trait StakingUserApi { + /// API for [`bond`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.bond) call. + async fn bond( + &self, + initial_stake: Balance, + controller_id: AccountId, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`validate`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.validate) call. + async fn validate( + &self, + validator_commission_percentage: u8, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`payout_stakers`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.payout_stakers) call. + async fn payout_stakers( + &self, + stash_account: AccountId, + era: EraIndex, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`nominate`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.nominate) call. + async fn nominate( + &self, + nominee_account_id: AccountId, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`chill`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.chill) call. + async fn chill(&self, status: TxStatus) -> anyhow::Result; + + /// API for [`bond_extra`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.bond_extra) call. + async fn bond_extra_stake( + &self, + extra_stake: Balance, + status: TxStatus, + ) -> anyhow::Result; +} + +/// Pallet staking logic, not directly related to any particular pallet call. +#[async_trait::async_trait] +pub trait StakingApiExt { + /// Send batch of [`bond`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.bond) calls. + /// * `accounts` - a slice of account ids pairs (stash, controller) + /// * `stake` - what amount should be bonded, + /// * `status` - a [`TxStatus`] of a tx to wait for + /// + /// # Examples + /// ```ignore + /// async fn nominate_validator( + /// connection: &RootConnection, + /// nominator_controller_accounts: Vec, + /// nominator_stash_accounts: Vec, + /// nominee_account: AccountId, + /// ) { + /// let stash_controller_accounts = nominator_stash_accounts + /// .iter() + /// .cloned() + /// .zip(nominator_controller_accounts.iter().cloned()) + /// .collect::>(); + /// + /// let mut rng = thread_rng(); + /// for chunk in stash_controller_accounts + /// .chunks(256) + /// .map(|c| c.to_vec()) + /// { + /// let stake = 100 * 1_000_000_000_000u128; + /// connection + /// .batch_bond(&chunk, stake, TxStatus::Submitted) + /// .await + /// .unwrap(); + /// } + /// let nominator_nominee_accounts = nominator_controller_accounts + /// .iter() + /// .cloned() + /// .zip(iter::repeat(&nominee_account).cloned()) + /// .collect::>(); + /// for chunks in nominator_nominee_accounts.chunks(128) { + /// connection + /// .batch_nominate(chunks, TxStatus::InBlock) + /// .await + /// .unwrap(); + /// } + /// } + /// ``` + async fn batch_bond( + &self, + accounts: &[(AccountId, AccountId)], + stake: Balance, + status: TxStatus, + ) -> anyhow::Result; + + /// Send batch of [`nominate`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.nominate) calls. + /// * `nominator_nominee_pairs` - a slice of account ids pairs (nominator, nominee) + /// * `status` - a [`TxStatus`] of a tx to wait for + /// + /// # Examples + /// see [`Self::batch_bond`] example above + async fn batch_nominate( + &self, + nominator_nominee_pairs: &[(AccountId, AccountId)], + status: TxStatus, + ) -> anyhow::Result; +} + +/// Pallet staking api that requires sudo. +#[async_trait::async_trait] +pub trait StakingSudoApi { + /// API for [`force_new_era`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.force_new_era) call. + async fn force_new_era(&self, status: TxStatus) -> anyhow::Result; + + /// API for [`set_staking_config`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.set_staking_configs) call. + async fn set_staking_config( + &self, + minimal_nominator_bond: Option, + minimal_validator_bond: Option, + max_nominators_count: Option, + max_validators_count: Option, + status: TxStatus, + ) -> anyhow::Result; +} + +/// Logic for retrieving raw storage keys or values from a pallet staking. +#[async_trait::async_trait] +pub trait StakingRawApi { + /// Returns all encoded [`eras_stakers`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.eras_stakers). + /// storage keys for a given era + /// * `era` - an era index + /// * `at` - optional hash of a block to query state from + /// + /// # Examples + /// ```ignore + /// let stakers = connection + /// .get_stakers_storage_keys(current_era, None) + /// .await + /// .into_iter() + /// .map(|key| key.0); + /// ``` + async fn get_stakers_storage_keys( + &self, + era: EraIndex, + at: Option, + ) -> anyhow::Result>; + + /// Returns encoded [`eras_stakers`](https://paritytech.github.io/substrate/master/pallet_staking/struct.Pallet.html#method.eras_stakers). + /// storage keys for a given era and given account ids + /// * `era` - an era index + /// * `accounts` - list of account ids + /// * `at` - optional hash of a block to query state from + async fn get_stakers_storage_keys_from_accounts( + &self, + era: EraIndex, + accounts: &[AccountId], + at: Option, + ) -> Vec; +} + +#[async_trait::async_trait] +impl StakingApi for C { + async fn get_active_era(&self, at: Option) -> EraIndex { + let addrs = api::storage().staking().active_era(); + + self.get_storage_entry(&addrs, at).await.index + } + + async fn get_current_era(&self, at: Option) -> EraIndex { + let addrs = api::storage().staking().current_era(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_bonded(&self, stash: AccountId, at: Option) -> Option { + let addrs = api::storage().staking().bonded(stash); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_ledger(&self, controller: AccountId, at: Option) -> StakingLedger { + let addrs = api::storage().staking().ledger(controller); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_payout_for_era(&self, era: EraIndex, at: Option) -> Balance { + let addrs = api::storage().staking().eras_validator_reward(era); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_exposure( + &self, + era: EraIndex, + account_id: &AccountId, + at: Option, + ) -> Exposure { + let addrs = api::storage().staking().eras_stakers(era, account_id); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_era_reward_points( + &self, + era: EraIndex, + at: Option, + ) -> Option> { + let addrs = api::storage().staking().eras_reward_points(era); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn get_minimum_validator_count(&self, at: Option) -> u32 { + let addrs = api::storage().staking().minimum_validator_count(); + + self.get_storage_entry(&addrs, at).await + } + + async fn get_session_per_era(&self) -> anyhow::Result { + let addrs = api::constants().staking().sessions_per_era(); + self.as_connection() + .as_client() + .constants() + .at(&addrs) + .map_err(|e| e.into()) + } +} + +#[async_trait::async_trait] +impl StakingUserApi for S { + async fn bond( + &self, + initial_stake: Balance, + controller_id: AccountId, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().staking().bond( + MultiAddress::::Id(controller_id), + initial_stake, + RewardDestination::Staked, + ); + + self.send_tx(tx, status).await + } + + async fn validate( + &self, + validator_commission_percentage: u8, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().staking().validate(ValidatorPrefs { + commission: Perbill( + SPerbill::from_percent(validator_commission_percentage as u32).deconstruct(), + ), + blocked: false, + }); + + self.send_tx(tx, status).await + } + + async fn payout_stakers( + &self, + stash_account: AccountId, + era: EraIndex, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().staking().payout_stakers(stash_account, era); + + self.send_tx(tx, status).await + } + + async fn nominate( + &self, + nominee_account_id: AccountId, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .staking() + .nominate(vec![MultiAddress::Id(nominee_account_id)]); + + self.send_tx(tx, status).await + } + + async fn chill(&self, status: TxStatus) -> anyhow::Result { + let tx = api::tx().staking().chill(); + + self.send_tx(tx, status).await + } + + async fn bond_extra_stake( + &self, + extra_stake: Balance, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().staking().bond_extra(extra_stake); + + self.send_tx(tx, status).await + } +} + +#[async_trait::async_trait] +impl StakingSudoApi for RootConnection { + async fn force_new_era(&self, status: TxStatus) -> anyhow::Result { + let call = Staking(force_new_era); + + self.sudo_unchecked(call, status).await + } + + async fn set_staking_config( + &self, + min_nominator_bond: Option, + min_validator_bond: Option, + max_nominator_count: Option, + max_validator_count: Option, + status: TxStatus, + ) -> anyhow::Result { + fn convert(arg: Option) -> ConfigOp { + match arg { + Some(v) => Set(v), + None => Noop, + } + } + let call = Staking(set_staking_configs { + min_nominator_bond: convert(min_nominator_bond), + min_validator_bond: convert(min_validator_bond), + max_nominator_count: convert(max_nominator_count), + max_validator_count: convert(max_validator_count), + chill_threshold: ConfigOp::Noop, + min_commission: ConfigOp::Noop, + }); + self.sudo_unchecked(call, status).await + } +} + +#[async_trait::async_trait] +impl StakingRawApi for C { + async fn get_stakers_storage_keys( + &self, + era: EraIndex, + at: Option, + ) -> anyhow::Result> { + let key_addrs = api::storage().staking().eras_stakers_root(); + let mut key = key_addrs.to_root_bytes(); + StorageMapKey::new(era, StorageHasher::Twox64Concat).to_bytes(&mut key); + self.as_connection() + .as_client() + .storage() + .fetch_keys(&key, 10, None, at) + .await + .map_err(|e| e.into()) + } + + async fn get_stakers_storage_keys_from_accounts( + &self, + era: EraIndex, + accounts: &[AccountId], + _: Option, + ) -> Vec { + let key_addrs = api::storage().staking().eras_stakers_root(); + let mut key = key_addrs.to_root_bytes(); + StorageMapKey::new(era, StorageHasher::Twox64Concat).to_bytes(&mut key); + accounts + .iter() + .map(|account| { + let mut key = key.clone(); + StorageMapKey::new(account, StorageHasher::Twox64Concat).to_bytes(&mut key); + + StorageKey(key) + }) + .collect() + } +} + +#[async_trait::async_trait] +impl StakingApiExt for RootConnection { + async fn batch_bond( + &self, + accounts: &[(AccountId, AccountId)], + stake: Balance, + status: TxStatus, + ) -> anyhow::Result { + let calls = accounts + .iter() + .map(|(s, c)| { + let b = Staking(bond { + controller: MultiAddress::Id(c.clone()), + value: stake, + payee: RewardDestination::Staked, + }); + + Sudo(sudo_as { + who: MultiAddress::Id(s.clone()), + call: Box::new(b), + }) + }) + .collect(); + + self.batch_call(calls, status).await + } + + async fn batch_nominate( + &self, + nominator_nominee_pairs: &[(AccountId, AccountId)], + status: TxStatus, + ) -> anyhow::Result { + let calls = nominator_nominee_pairs + .iter() + .map(|(nominator, nominee)| { + let call = Staking(nominate { + targets: vec![MultiAddress::Id(nominee.clone())], + }); + Sudo(sudo_as { + who: MultiAddress::Id(nominator.clone()), + call: Box::new(call), + }) + }) + .collect(); + + self.batch_call(calls, status).await + } +} diff --git a/aleph-client/src/pallets/system.rs b/aleph-client/src/pallets/system.rs new file mode 100644 index 0000000000..6d61c39fc2 --- /dev/null +++ b/aleph-client/src/pallets/system.rs @@ -0,0 +1,43 @@ +use crate::{ + api, connections::TxInfo, frame_system::pallet::Call::set_code, AccountId, Balance, BlockHash, + Call::System, ConnectionApi, RootConnection, SudoCall, TxStatus, +}; + +/// Pallet system read-only api. +#[async_trait::async_trait] +pub trait SystemApi { + /// returns free balance of a given account + /// * `account` - account id + /// * `at` - optional hash of a block to query state from + /// + /// it uses [`system.account`](https://paritytech.github.io/substrate/master/frame_system/pallet/struct.Pallet.html#method.account) storage + async fn get_free_balance(&self, account: AccountId, at: Option) -> Balance; +} + +/// Pallet system api. +#[async_trait::async_trait] +pub trait SystemSudoApi { + /// API for [`set_code`](https://paritytech.github.io/substrate/master/frame_system/pallet/struct.Pallet.html#method.set_code) call. + async fn set_code(&self, code: Vec, status: TxStatus) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl SystemSudoApi for RootConnection { + async fn set_code(&self, code: Vec, status: TxStatus) -> anyhow::Result { + let call = System(set_code { code }); + + self.sudo_unchecked(call, status).await + } +} + +#[async_trait::async_trait] +impl SystemApi for C { + async fn get_free_balance(&self, account: AccountId, at: Option) -> Balance { + let addrs = api::storage().system().account(&account); + + match self.get_storage_entry_maybe(&addrs, at).await { + None => 0, + Some(account) => account.data.free, + } + } +} diff --git a/aleph-client/src/pallets/treasury.rs b/aleph-client/src/pallets/treasury.rs new file mode 100644 index 0000000000..157ed4e9fd --- /dev/null +++ b/aleph-client/src/pallets/treasury.rs @@ -0,0 +1,140 @@ +use frame_support::PalletId; +use primitives::{Balance, MILLISECS_PER_BLOCK}; +use sp_runtime::traits::AccountIdConversion; +use subxt::ext::sp_runtime::MultiAddress; + +use crate::{ + api, + connections::{AsConnection, TxInfo}, + pallet_treasury::pallet::Call::{approve_proposal, reject_proposal}, + pallets::{elections::ElectionsApi, staking::StakingApi}, + AccountId, BlockHash, + Call::Treasury, + ConnectionApi, RootConnection, SignedConnectionApi, SudoCall, TxStatus, +}; + +/// Pallet treasury read-only api. +#[async_trait::async_trait] +pub trait TreasuryApi { + /// Returns an unique account id for all treasury transfers. + async fn treasury_account(&self) -> AccountId; + + /// Returns storage `proposals_count`. + /// * `at` - an optional block hash to query state from + async fn proposals_count(&self, at: Option) -> Option; + + /// Returns storage `approvals`. + /// * `at` - an optional block hash to query state from + async fn approvals(&self, at: Option) -> Vec; +} + +/// Pallet treasury api. +#[async_trait::async_trait] +pub trait TreasuryUserApi { + /// API for [`propose_spend`](https://paritytech.github.io/substrate/master/pallet_treasury/pallet/struct.Pallet.html#method.propose_spend) call. + async fn propose_spend( + &self, + amount: Balance, + beneficiary: AccountId, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`approve_proposal`](https://paritytech.github.io/substrate/master/pallet_treasury/pallet/struct.Pallet.html#method.approve_proposal) call. + async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; + + /// API for [`reject_proposal`](https://paritytech.github.io/substrate/master/pallet_treasury/pallet/struct.Pallet.html#method.reject_proposal) call. + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; +} + +/// Pallet treasury funcionality that is not directly related to any pallet call. +#[async_trait::async_trait] +pub trait TreasureApiExt { + /// When `staking.payout_stakers` is done, what amount of AZERO is transferred to. + /// the treasury + async fn possible_treasury_payout(&self) -> anyhow::Result; +} + +/// Pallet treasury api issued by the sudo account. +#[async_trait::async_trait] +pub trait TreasurySudoApi { + /// API for [`approve_proposal`](https://paritytech.github.io/substrate/master/pallet_treasury/pallet/struct.Pallet.html#method.approve_proposal) call. + /// wrapped in [`sudo_unchecked_weight`](https://paritytech.github.io/substrate/master/pallet_sudo/pallet/struct.Pallet.html#method.sudo_unchecked_weight) + async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; + + /// API for [`reject_proposal`](https://paritytech.github.io/substrate/master/pallet_treasury/pallet/struct.Pallet.html#method.reject_proposal) call. + /// wrapped [`sudo_unchecked_weight`](https://paritytech.github.io/substrate/master/pallet_sudo/pallet/struct.Pallet.html#method.sudo_unchecked_weight) + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl TreasuryApi for C { + async fn treasury_account(&self) -> AccountId { + PalletId(*b"a0/trsry").into_account_truncating() + } + + async fn proposals_count(&self, at: Option) -> Option { + let addrs = api::storage().treasury().proposal_count(); + + self.get_storage_entry_maybe(&addrs, at).await + } + + async fn approvals(&self, at: Option) -> Vec { + let addrs = api::storage().treasury().approvals(); + + self.get_storage_entry(&addrs, at).await.0 + } +} + +#[async_trait::async_trait] +impl TreasuryUserApi for S { + async fn propose_spend( + &self, + amount: Balance, + beneficiary: AccountId, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .treasury() + .propose_spend(amount, MultiAddress::Id(beneficiary)); + + self.send_tx(tx, status).await + } + + async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + let tx = api::tx().treasury().approve_proposal(proposal_id); + + self.send_tx(tx, status).await + } + + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + let tx = api::tx().treasury().reject_proposal(proposal_id); + + self.send_tx(tx, status).await + } +} + +#[async_trait::async_trait] +impl TreasurySudoApi for RootConnection { + async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + let call = Treasury(approve_proposal { proposal_id }); + + self.sudo_unchecked(call, status).await + } + + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + let call = Treasury(reject_proposal { proposal_id }); + + self.sudo_unchecked(call, status).await + } +} + +#[async_trait::async_trait] +impl TreasureApiExt for C { + async fn possible_treasury_payout(&self) -> anyhow::Result { + let session_period = self.get_session_period().await?; + let sessions_per_era = self.get_session_per_era().await?; + let millisecs_per_era = + MILLISECS_PER_BLOCK * session_period as u64 * sessions_per_era as u64; + Ok(primitives::staking::era_payout(millisecs_per_era).1) + } +} diff --git a/aleph-client/src/pallets/utility.rs b/aleph-client/src/pallets/utility.rs new file mode 100644 index 0000000000..77ac93999c --- /dev/null +++ b/aleph-client/src/pallets/utility.rs @@ -0,0 +1,17 @@ +use crate::{api, connections::TxInfo, Call, SignedConnectionApi, TxStatus}; + +/// Pallet utility api. +#[async_trait::async_trait] +pub trait UtilityApi { + /// API for [`batch`](https://paritytech.github.io/substrate/master/pallet_utility/pallet/struct.Pallet.html#method.batch) call. + async fn batch_call(&self, calls: Vec, status: TxStatus) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl UtilityApi for S { + async fn batch_call(&self, calls: Vec, status: TxStatus) -> anyhow::Result { + let tx = api::tx().utility().batch(calls); + + self.send_tx(tx, status).await + } +} diff --git a/aleph-client/src/pallets/vesting.rs b/aleph-client/src/pallets/vesting.rs new file mode 100644 index 0000000000..daab5915b3 --- /dev/null +++ b/aleph-client/src/pallets/vesting.rs @@ -0,0 +1,98 @@ +use primitives::BlockNumber; +use subxt::ext::sp_runtime::MultiAddress; + +use crate::{ + api, connections::TxInfo, pallet_vesting::vesting_info::VestingInfo, AccountId, Balance, + BlockHash, ConnectionApi, SignedConnectionApi, TxStatus, +}; + +/// Read only pallet vesting API. +#[async_trait::async_trait] +pub trait VestingApi { + /// Returns [`VestingInfo`] of the given account. + /// * `who` - an account id + /// * `at` - optional hash of a block to query state from + async fn get_vesting( + &self, + who: AccountId, + at: Option, + ) -> Vec>; +} + +/// Pallet vesting api. +#[async_trait::async_trait] +pub trait VestingUserApi { + /// API for [`vest`](https://paritytech.github.io/substrate/master/pallet_vesting/pallet/enum.Call.html#variant.vest) call. + async fn vest(&self, status: TxStatus) -> anyhow::Result; + + /// API for [`vest_other`](https://paritytech.github.io/substrate/master/pallet_vesting/pallet/enum.Call.html#variant.vest_other) call. + async fn vest_other(&self, status: TxStatus, other: AccountId) -> anyhow::Result; + + /// API for [`vested_transfer`](https://paritytech.github.io/substrate/master/pallet_vesting/pallet/enum.Call.html#variant.vested_transfer) call. + async fn vested_transfer( + &self, + receiver: AccountId, + schedule: VestingInfo, + status: TxStatus, + ) -> anyhow::Result; + + /// API for [`merge_schedules`](https://paritytech.github.io/substrate/master/pallet_vesting/pallet/enum.Call.html#variant.merge_schedules) call. + async fn merge_schedules( + &self, + idx1: u32, + idx2: u32, + status: TxStatus, + ) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl VestingApi for C { + async fn get_vesting( + &self, + who: AccountId, + at: Option, + ) -> Vec> { + let addrs = api::storage().vesting().vesting(who); + + self.get_storage_entry(&addrs, at).await.0 + } +} + +#[async_trait::async_trait] +impl VestingUserApi for S { + async fn vest(&self, status: TxStatus) -> anyhow::Result { + let tx = api::tx().vesting().vest(); + + self.send_tx(tx, status).await + } + + async fn vest_other(&self, status: TxStatus, other: AccountId) -> anyhow::Result { + let tx = api::tx().vesting().vest_other(MultiAddress::Id(other)); + + self.send_tx(tx, status).await + } + + async fn vested_transfer( + &self, + receiver: AccountId, + schedule: VestingInfo, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx() + .vesting() + .vested_transfer(MultiAddress::Id(receiver), schedule); + + self.send_tx(tx, status).await + } + + async fn merge_schedules( + &self, + idx1: u32, + idx2: u32, + status: TxStatus, + ) -> anyhow::Result { + let tx = api::tx().vesting().merge_schedules(idx1, idx2); + + self.send_tx(tx, status).await + } +} diff --git a/aleph-client/src/rpc.rs b/aleph-client/src/rpc.rs deleted file mode 100644 index f6eab8007a..0000000000 --- a/aleph-client/src/rpc.rs +++ /dev/null @@ -1,216 +0,0 @@ -use codec::Encode; -use serde_json::{json, Value}; -use sp_core::{ - ed25519, - storage::{StorageChangeSet, StorageData}, - Pair, H256, -}; -use substrate_api_client::StorageKey; - -use crate::{AnyConnection, BlockHash, BlockNumber, SessionKeys}; - -fn json_req(method: &str, params: Value, id: u32) -> Value { - json!({ - "method": method, - "params": params, - "jsonrpc": "2.0", - "id": id.to_string(), - }) -} - -pub fn author_rotate_keys_json() -> Value { - json_req("author_rotateKeys", Value::Null, 1) -} - -/// Produces a JSON encoding of an emergency finalization RPC. -fn emergency_finalize_json(signature: Vec, hash: BlockHash, number: BlockNumber) -> Value { - json_req( - "alephNode_emergencyFinalize", - json!([signature, hash, number]), - 1, - ) -} - -fn state_query_storage_at_json(storage_keys: &[StorageKey]) -> Value { - json_req( - "state_queryStorageAt", - Value::Array(vec![ - Value::Array( - storage_keys - .iter() - .map(|storage_key| Value::String(hex::encode(storage_key))) - .collect::>(), - ), - Value::Null, - ]), - 1, - ) -} - -fn parse_query_storage_at_result( - maybe_json_result: Option, - expected_storage_key_size: usize, -) -> Result>, String> { - match maybe_json_result { - None => Err(String::from("Returned result was null!")), - Some(result) => { - let mut storage_change_set_vec: Vec> = - serde_json::from_str(&result[..]).map_err(|_| { - String::from(&format!("Failed to parse result {:?} into JSON", result)) - })?; - if storage_change_set_vec.is_empty() { - return Err(String::from("Expected result to be non-empty!")); - } - // we're interested only in first element, since queryStorageAt returns history of - // changes of given storage key starting from requested block, in our case from - // best known block - let storage_change_set = storage_change_set_vec.remove(0); - if storage_change_set.changes.len() != expected_storage_key_size { - return Err(format!( - "Expected result to have exactly {} entries, got {}!", - expected_storage_key_size, - storage_change_set.changes.len() - )); - } - Ok(storage_change_set - .changes - .into_iter() - .map(|(_, entries)| entries) - .collect()) - } - } -} - -pub fn state_query_storage_at( - connection: &C, - storage_keys: Vec, -) -> Result>, String> { - match connection - .as_connection() - .get_request(state_query_storage_at_json(&storage_keys)) - { - Ok(maybe_json_result) => { - parse_query_storage_at_result(maybe_json_result, storage_keys.len()) - } - Err(_) => Err(format!( - "Failed to obtain results from storage keys {:?}", - &storage_keys - )), - } -} - -pub fn rotate_keys_base( - connection: &C, - rpc_result_mapper: F, -) -> Result -where - F: Fn(String) -> Option, -{ - match connection - .as_connection() - .get_request(author_rotate_keys_json()) - { - Ok(maybe_keys) => match maybe_keys { - Some(keys) => match rpc_result_mapper(keys) { - Some(keys) => Ok(keys), - None => Err("Failed to parse keys from string result"), - }, - None => Err("Failed to retrieve keys from chain"), - }, - Err(_) => Err("Connection does not work"), - } -} - -pub fn rotate_keys(connection: &C) -> Result { - rotate_keys_base(connection, |keys| match SessionKeys::try_from(keys) { - Ok(keys) => Some(keys), - Err(_) => None, - }) -} - -pub fn rotate_keys_raw_result(connection: &C) -> Result { - // we need to escape two characters from RPC result which is escaped quote - rotate_keys_base(connection, |keys| Some(keys.trim_matches('\"').to_string())) -} - -/// Sends an emergency justification to the node, using the provided key to sign the hash. -pub fn emergency_finalize( - connection: &C, - number: BlockNumber, - hash: BlockHash, - key: ed25519::Pair, -) -> Result<(), String> { - let signature = key.sign(&hash.encode()); - let raw_signature: &[u8] = signature.as_ref(); - match connection - .as_connection() - .get_request(emergency_finalize_json( - raw_signature.to_vec(), - hash, - number, - )) { - Ok(_) => Ok(()), - Err(e) => Err(format!("Emergency finalize failed: {}", e)), - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn given_some_input_when_state_query_storage_at_json_then_json_is_as_expected() { - let storage_keys = vec![ - StorageKey(vec![0, 1, 2, 3, 4, 5]), - StorageKey(vec![9, 8, 7, 6, 5]), - ]; - let expected_json_string = r#" -{ - "id": "1", - "jsonrpc": "2.0", - "method":"state_queryStorageAt", - "params": [["000102030405", "0908070605"], null] -}"#; - - let expected_json: Value = serde_json::from_str(expected_json_string).unwrap(); - assert_eq!(expected_json, state_query_storage_at_json(&storage_keys)); - } - - #[test] - fn given_expected_input_when_parse_query_storage_at_result_then_json_is_as_expected() { - let expected_json_string = r#" - [ - { - "block": "0x07825c4cae90d07a322ea434ed82186091e0aae8d465274d07ab1e1dea545d0d", - "changes": [ - [ - "0xc2261276cc9d1f8598ea4b6a74b15c2f218f26c73add634897550b4003b26bc61b614bd4a126f2d5d294e9a8af9da25248d7e931307afb4b68d8d565d4c66e00d856c6d65f5fed6bb82dcfb60e936c67", - "0x047374616b696e672000407a10f35a0000000000000000000002" - ], - [ - "0xc2261276cc9d1f8598ea4b6a74b15c2f218f26c73add634897550b4003b26bc6e2c1dc507e2035edbbd8776c440d870460c57f0008067cc01c5ff9eb2e2f9b3a94299a915a91198bd1021a6c55596f57", - "0x047374616b696e672000407a10f35a0000000000000000000002" - ], - [ - "0xc2261276cc9d1f8598ea4b6a74b15c2f218f26c73add634897550b4003b26bc6e2c1dc507e2035edbbd8776c440d870460c57f0008067cc01c5ff9eb2e2f9b3a94299a915a91198bd1021a6c55596f59", - null - ] - ] - } - ]"#; - assert_eq!( - vec![ - Some(StorageData(vec![ - 4, 115, 116, 97, 107, 105, 110, 103, 32, 0, 64, 122, 16, 243, 90, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2 - ])), - Some(StorageData(vec![ - 4, 115, 116, 97, 107, 105, 110, 103, 32, 0, 64, 122, 16, 243, 90, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2 - ])), - None - ], - parse_query_storage_at_result(Some(String::from(expected_json_string)), 3).unwrap() - ); - } -} diff --git a/aleph-client/src/runtime_types.rs b/aleph-client/src/runtime_types.rs new file mode 100644 index 0000000000..49dc56200d --- /dev/null +++ b/aleph-client/src/runtime_types.rs @@ -0,0 +1,61 @@ +pub use crate::aleph_zero::api::runtime_types::*; +use crate::{ + aleph_runtime::SessionKeys, + api::runtime_types::{ + primitives::app::Public as AlephPublic, + sp_consensus_aura::sr25519::app_sr25519::Public as AuraPublic, + sp_core::{ed25519::Public as EdPublic, sr25519::Public as SrPublic}, + }, + pallet_staking::EraRewardPoints, + sp_weights::weight_v2::Weight, +}; + +impl Default for EraRewardPoints { + fn default() -> Self { + Self { + total: 0, + individual: vec![], + } + } +} + +// Manually implementing decoding +impl From> for SessionKeys { + fn from(bytes: Vec) -> Self { + assert_eq!(bytes.len(), 64); + Self { + aura: AuraPublic(SrPublic( + bytes[..32] + .try_into() + .expect("Failed to convert bytes slice to an Aura key!"), + )), + aleph: AlephPublic(EdPublic( + bytes[32..64] + .try_into() + .expect("Failed to convert bytes slice to an Aleph key!"), + )), + } + } +} + +impl TryFrom for SessionKeys { + type Error = (); + + fn try_from(keys: String) -> Result { + let bytes: Vec = match hex::FromHex::from_hex(keys) { + Ok(bytes) => bytes, + Err(_) => return Err(()), + }; + Ok(SessionKeys::from(bytes)) + } +} + +impl Weight { + /// Returns new instance of weight v2 object. + pub const fn new(ref_time: u64, proof_size: u64) -> Self { + Self { + ref_time, + proof_size, + } + } +} diff --git a/aleph-client/src/session.rs b/aleph-client/src/session.rs deleted file mode 100644 index aeb4fe8c1d..0000000000 --- a/aleph-client/src/session.rs +++ /dev/null @@ -1,167 +0,0 @@ -use codec::{Decode, Encode}; -use log::info; -use primitives::{BlockHash, CommitteeSeats, SessionIndex}; -use sp_core::H256; -use substrate_api_client::{compose_call, compose_extrinsic, AccountId, FromHexString, XtStatus}; - -use crate::{ - get_block_hash, send_xt, waiting::wait_for_event, AnyConnection, BlockNumber, ReadStorage, - RootConnection, SignedConnection, -}; - -const PALLET: &str = "Session"; - -// Using custom struct and rely on default Encode trait from Parity's codec -// it works since byte arrays are encoded in a straight forward way, it as-is -#[derive(Clone, Eq, PartialEq, Hash, Debug, Decode, Encode)] -pub struct Keys { - pub aura: [u8; 32], - pub aleph: [u8; 32], -} - -// Manually implementing decoding -impl From> for Keys { - fn from(bytes: Vec) -> Self { - assert_eq!(bytes.len(), 64); - Self { - aura: bytes[0..32].try_into().unwrap(), - aleph: bytes[32..64].try_into().unwrap(), - } - } -} - -impl TryFrom for Keys { - type Error = (); - - fn try_from(keys: String) -> Result { - let bytes: Vec = match FromHexString::from_hex(keys) { - Ok(bytes) => bytes, - Err(_) => return Err(()), - }; - Ok(Keys::from(bytes)) - } -} - -pub fn get_next_session_keys( - connection: &C, - account_id: AccountId, -) -> Option { - connection.read_storage_map(PALLET, "NextKeys", account_id, None) -} - -pub fn change_validators( - sudo_connection: &RootConnection, - new_reserved_validators: Option>, - new_non_reserved_validators: Option>, - committee_size: Option, - status: XtStatus, -) { - info!(target: "aleph-client", "New validators: reserved: {:#?}, non_reserved: {:#?}, validators_per_session: {:?}", new_reserved_validators, new_non_reserved_validators, committee_size); - let call = compose_call!( - sudo_connection.as_connection().metadata, - "Elections", - "change_validators", - new_reserved_validators, - new_non_reserved_validators, - committee_size - ); - let xt = compose_extrinsic!( - sudo_connection.as_connection(), - "Sudo", - "sudo_unchecked_weight", - call, - 0_u64 - ); - send_xt(sudo_connection, xt, Some("change_validators"), status); -} - -pub fn change_next_era_reserved_validators( - sudo_connection: &RootConnection, - new_validators: Vec, - status: XtStatus, -) { - change_validators(sudo_connection, Some(new_validators), None, None, status) -} - -pub fn set_keys(connection: &SignedConnection, new_keys: Keys, status: XtStatus) { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "set_keys", - new_keys, - 0u8 - ); - send_xt(connection, xt, Some("set_keys"), status); -} - -pub fn get_current_session(connection: &C) -> SessionIndex { - get_session(connection, None) -} - -pub fn get_session(connection: &C, block_hash: Option) -> SessionIndex { - connection - .as_connection() - .get_storage_value(PALLET, "CurrentIndex", block_hash) - .unwrap() - .unwrap_or(0) -} - -pub fn wait_for_predicate bool>( - connection: &C, - session_predicate: P, -) -> anyhow::Result { - info!(target: "aleph-client", "Waiting for session"); - - #[derive(Debug, Decode, Clone)] - struct NewSessionEvent { - session_index: SessionIndex, - } - let result = wait_for_event(connection, (PALLET, "NewSession"), |e: NewSessionEvent| { - info!(target: "aleph-client", "New session {}", e.session_index); - - session_predicate(e.session_index) - })?; - Ok(result.session_index) -} - -pub fn wait_for( - connection: &C, - session_index: SessionIndex, -) -> anyhow::Result { - wait_for_predicate(connection, |session_ix| session_ix == session_index) -} - -pub fn wait_for_at_least( - connection: &C, - session_index: SessionIndex, -) -> anyhow::Result { - wait_for_predicate(connection, |session_ix| session_ix >= session_index) -} - -pub fn get_session_period(connection: &C) -> u32 { - connection.read_constant("Elections", "SessionPeriod") -} - -pub fn get_validators_for_session( - connection: &C, - session: SessionIndex, -) -> Vec { - let session_period = get_session_period(connection); - let first_block = session_period * session; - let block = get_block_hash(connection, first_block); - - connection.read_storage_value_at_block(PALLET, "Validators", Some(block)) -} - -pub fn get_current_validators(connection: &C) -> Vec { - connection.read_storage_value(PALLET, "Validators") -} - -pub fn get_current_validator_count(connection: &C) -> u32 { - get_current_validators(connection).len() as u32 -} - -pub fn get_session_first_block(connection: &C, session: SessionIndex) -> BlockHash { - let block_number = session * get_session_period(connection); - get_block_hash(connection, block_number) -} diff --git a/aleph-client/src/staking.rs b/aleph-client/src/staking.rs deleted file mode 100644 index f5b5f443a6..0000000000 --- a/aleph-client/src/staking.rs +++ /dev/null @@ -1,469 +0,0 @@ -use std::collections::{BTreeMap, BTreeSet}; - -use codec::{Compact, Decode, Encode}; -use frame_support::BoundedVec; -use log::{debug, info}; -use pallet_staking::{ - Exposure, MaxUnlockingChunks, RewardDestination, UnlockChunk, ValidatorPrefs, -}; -use primitives::EraIndex; -use rayon::prelude::*; -use sp_core::{storage::StorageKey, Pair, H256}; -use sp_runtime::Perbill; -use substrate_api_client::{ - compose_call, compose_extrinsic, AccountId, Balance, GenericAddress, XtStatus, -}; - -use crate::{ - account_from_keypair, create_connection, locks, send_xt, session::wait_for_predicate, - wait_for_session, AnyConnection, BlockNumber, KeyPair, ReadStorage, RootConnection, - SignedConnection, -}; - -const PALLET: &str = "Staking"; - -pub fn bond( - connection: &SignedConnection, - initial_stake: Balance, - controller_account_id: &AccountId, - status: XtStatus, -) { - let controller_account_id = GenericAddress::Id(controller_account_id.clone()); - - let xt = connection.as_connection().staking_bond( - controller_account_id, - initial_stake, - RewardDestination::Staked, - ); - send_xt(connection, xt, Some("bond"), status); -} - -pub fn multi_bond(node: &str, bonders: &[KeyPair], stake: Balance) { - bonders.par_iter().for_each(|bonder| { - let connection = create_connection(node) - .set_signer(bonder.clone()) - .try_into() - .expect("Signer has been set"); - - let controller_account = account_from_keypair(bonder); - bond(&connection, stake, &controller_account, XtStatus::InBlock); - }); -} - -pub fn validate( - connection: &SignedConnection, - validator_commission_percentage: u8, - status: XtStatus, -) { - let prefs = ValidatorPrefs { - blocked: false, - commission: Perbill::from_percent(validator_commission_percentage as u32), - }; - let xt = compose_extrinsic!(connection.as_connection(), PALLET, "validate", prefs); - send_xt(connection, xt, Some("validate"), status); -} - -pub fn set_staking_limits( - connection: &RootConnection, - minimal_nominator_stake: u128, - minimal_validator_stake: u128, - max_nominators_count: Option, - max_validators_count: Option, - status: XtStatus, -) { - let set_staking_limits_call = compose_call!( - connection.as_connection().metadata, - PALLET, - "set_staking_limits", - minimal_nominator_stake, - minimal_validator_stake, - max_nominators_count, - max_validators_count, - 0_u8 - ); - let xt = compose_extrinsic!( - connection.as_connection(), - "Sudo", - "sudo", - set_staking_limits_call - ); - send_xt(connection, xt, Some("set_staking_limits"), status); -} - -pub fn force_new_era(connection: &RootConnection, status: XtStatus) { - let force_new_era_call = - compose_call!(connection.as_connection().metadata, PALLET, "force_new_era"); - let xt = compose_extrinsic!( - connection.as_connection(), - "Sudo", - "sudo", - force_new_era_call - ); - send_xt(connection, xt, Some("force_new_era"), status); -} - -pub fn wait_for_full_era_completion(connection: &C) -> anyhow::Result { - // staking works in such a way, that when we request a controller to be a validator in era N, - // then the changes are applied in the era N+1 (so the new validator is receiving points in N+1), - // so that we need N+1 to finish in order to claim the reward in era N+2 for the N+1 era - wait_for_era_completion(connection, get_active_era(connection) + 2) -} - -pub fn wait_for_next_era(connection: &C) -> anyhow::Result { - wait_for_era_completion(connection, get_active_era(connection) + 1) -} - -pub fn wait_for_at_least_era( - connection: &C, - era: EraIndex, -) -> anyhow::Result { - let current_era = get_era(connection, None); - if current_era >= era { - return Ok(current_era); - } - let sessions_per_era: u32 = connection.read_constant(PALLET, "SessionsPerEra"); - let first_session_in_era = era * sessions_per_era; - wait_for_predicate(connection, |session| session >= first_session_in_era)?; - Ok(get_era(connection, None)) -} - -pub fn wait_for_era_completion( - connection: &C, - next_era_index: EraIndex, -) -> anyhow::Result { - debug!("waiting for era {}", next_era_index); - let sessions_per_era: u32 = connection.read_constant(PALLET, "SessionsPerEra"); - let first_session_in_next_era = next_era_index * sessions_per_era; - debug!( - "waiting for session first_session_in_next_era={}", - first_session_in_next_era - ); - wait_for_session(connection, first_session_in_next_era)?; - Ok(next_era_index) -} - -pub fn get_sessions_per_era(connection: &C) -> u32 { - connection.read_constant(PALLET, "SessionsPerEra") -} - -pub fn get_era(connection: &C, block: Option) -> EraIndex { - connection - .as_connection() - .get_storage_value(PALLET, "ActiveEra", block) - .expect("Failed to obtain ActiveEra extrinsic!") - .expect("ActiveEra is empty in the storage!") -} - -pub fn get_active_era(connection: &C) -> EraIndex { - get_era(connection, None) -} - -pub fn get_current_era(connection: &C) -> EraIndex { - connection - .as_connection() - .get_storage_value(PALLET, "CurrentEra", None) - .expect("Failed to obtain CurrentEra extrinsic!") - .expect("CurrentEra is empty in the storage!") -} - -pub fn payout_stakers( - stash_connection: &SignedConnection, - stash_account: &AccountId, - era_number: BlockNumber, -) { - let xt = compose_extrinsic!( - stash_connection.as_connection(), - PALLET, - "payout_stakers", - stash_account, - era_number - ); - - send_xt( - stash_connection, - xt, - Some("payout stakers"), - XtStatus::InBlock, - ); -} - -pub fn payout_stakers_and_assert_locked_balance( - stash_connection: &SignedConnection, - accounts_to_check_balance: &[AccountId], - stash_account: &AccountId, - era: BlockNumber, -) { - let locked_stash_balances_before_payout = locks(stash_connection, accounts_to_check_balance); - payout_stakers(stash_connection, stash_account, era - 1); - let locked_stash_balances_after_payout = locks(stash_connection, accounts_to_check_balance); - locked_stash_balances_before_payout.iter() - .zip(locked_stash_balances_after_payout.iter()) - .zip(accounts_to_check_balance.iter()) - .for_each(|((balances_before, balances_after), account_id)| { - assert!(balances_after[0].amount > balances_before[0].amount, - "Expected payout to be positive in locked balance for account {}. Balance before: {}, balance after: {}", - account_id, balances_before[0].amount, balances_after[0].amount); - }); -} - -pub fn batch_bond( - connection: &RootConnection, - stash_controller_accounts: &[(&AccountId, &AccountId)], - bond_value: u128, - reward_destination: RewardDestination, -) { - let metadata = &connection.as_connection().metadata; - - let batch_bond_calls = stash_controller_accounts - .iter() - .cloned() - .map(|(stash_account, controller_account)| { - let bond_call = compose_call!( - metadata, - PALLET, - "bond", - GenericAddress::Id(controller_account.clone()), - Compact(bond_value), - reward_destination.clone() - ); - compose_call!( - metadata, - "Sudo", - "sudo_as", - GenericAddress::Id(stash_account.clone()), - bond_call - ) - }) - .collect::>(); - - let xt = compose_extrinsic!( - connection.as_connection(), - "Utility", - "batch", - batch_bond_calls - ); - send_xt( - connection, - xt, - Some("batch of bond calls"), - XtStatus::InBlock, - ); -} - -pub fn nominate(connection: &SignedConnection, nominee_account_id: &AccountId) { - let xt = connection - .as_connection() - .staking_nominate(vec![GenericAddress::Id(nominee_account_id.clone())]); - send_xt(connection, xt, Some("nominate"), XtStatus::InBlock); -} - -pub fn batch_nominate( - connection: &RootConnection, - nominator_nominee_pairs: &[(&AccountId, &AccountId)], -) { - let metadata = &connection.as_connection().metadata; - - let batch_nominate_calls = nominator_nominee_pairs - .iter() - .cloned() - .map(|(nominator, nominee)| { - let nominate_call = compose_call!( - metadata, - PALLET, - "nominate", - vec![GenericAddress::Id(nominee.clone())] - ); - compose_call!( - metadata, - "Sudo", - "sudo_as", - GenericAddress::Id(nominator.clone()), - nominate_call - ) - }) - .collect::>(); - - let xt = compose_extrinsic!( - connection.as_connection(), - "Utility", - "batch", - batch_nominate_calls - ); - send_xt( - connection, - xt, - Some("batch of nominate calls"), - XtStatus::InBlock, - ); -} - -pub fn bonded(connection: &C, stash: &KeyPair) -> Option { - let account_id = AccountId::from(stash.public()); - connection - .as_connection() - .get_storage_map(PALLET, "Bonded", &account_id, None) - .unwrap_or_else(|_| panic!("Failed to obtain Bonded for account id {}", account_id)) -} - -/// Since PR #10982 changed `pallet_staking::StakingLedger` to be generic over -/// `T: pallet_staking::Config` (somehow breaking consistency with similar structures in other -/// pallets) we have no easy way of retrieving ledgers from storage. Thus, we chose cloning -/// (relevant part of) this struct instead of implementing `Config` trait. -#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode)] -pub struct StakingLedger { - pub stash: AccountId, - #[codec(compact)] - pub total: Balance, - #[codec(compact)] - pub active: Balance, - pub unlocking: BoundedVec, MaxUnlockingChunks>, -} - -pub fn ledger(connection: &C, controller: &KeyPair) -> Option { - let account_id = AccountId::from(controller.public()); - connection - .as_connection() - .get_storage_map(PALLET, "Ledger", &account_id, None) - .unwrap_or_else(|_| panic!("Failed to obtain Ledger for account id {}", account_id)) -} - -pub fn get_payout_for_era(connection: &C, era: EraIndex) -> u128 { - connection - .as_connection() - .get_storage_map(PALLET, "ErasValidatorReward", era, None) - .expect("Failed to obtain ErasValidatorReward") - .expect("ErasValidatoReward is empty in storage") -} - -pub fn get_exposure( - connection: &C, - era: EraIndex, - account_id: &AccountId, - block_hash: Option, -) -> Exposure { - connection - .as_connection() - .get_storage_double_map(PALLET, "ErasStakers", era, account_id, block_hash) - .expect("Failed to obtain ErasStakers extrinsic!") - .unwrap_or_else(|| panic!("Failed to decode ErasStakers for era {}.", era)) -} - -pub type RewardPoint = u32; - -/// Helper to decode reward points for an era without the need to fill in a generic parameter. -/// Reward points of an era. Used to split era total payout between validators. -/// -/// This points will be used to reward validators and their respective nominators. -#[derive(Clone, Decode, Default)] -pub struct EraRewardPoints { - /// Total number of points. Equals the sum of reward points for each validator. - pub total: RewardPoint, - /// The reward points earned by a given validator. - pub individual: BTreeMap, -} - -pub fn get_era_reward_points( - connection: &C, - era: EraIndex, - block_hash: Option, -) -> Option { - connection - .as_connection() - .get_storage_map(PALLET, "ErasRewardPoints", era, block_hash) - .unwrap_or_else(|e| { - panic!( - "Failed to obtain ErasRewardPoints for era {} at block {:?}: {}", - era, block_hash, e - ) - }) -} - -/// Get `ErasStakers` as `StorageKey`s from `pallet_staking` -pub fn get_stakers_as_storage_keys( - connection: &C, - accounts: &[AccountId], - era: EraIndex, -) -> BTreeSet { - accounts - .iter() - .map(|acc| { - connection - .as_connection() - .metadata - .storage_double_map_key(PALLET, "ErasStakers", era, acc) - .unwrap() - }) - .collect() -} - -/// Produce storage key to `ErasStakers::era`. -/// -/// Since in `substrate-api-client` it seems impossible to get prefix for the first key in double -/// map, we have to do it by hand. -pub fn get_eras_stakers_storage_key(era: EraIndex) -> StorageKey { - let mut bytes = sp_core::twox_128(PALLET.as_bytes()).to_vec(); - bytes.extend(&sp_core::twox_128("ErasStakers".as_bytes())[..]); - - let era_encoded = codec::Encode::encode(&era); - // `pallet_staking::ErasStakers`'s keys are `Twox64Concat`-encoded. - let era_key: Vec = sp_core::twox_64(&era_encoded) - .iter() - .chain(&era_encoded) - .cloned() - .collect(); - bytes.extend(era_key); - - StorageKey(bytes) -} - -/// Get `ErasStakers` as `StorageKey`s based on the manually produced first `StorageKey` in the double map. -pub fn get_stakers_as_storage_keys_from_storage_key( - connection: &C, - current_era: EraIndex, - storage_key: StorageKey, -) -> BTreeSet { - let stakers = connection - .as_connection() - .get_keys(storage_key, None) - .unwrap_or_else(|_| panic!("Couldn't read storage keys")) - .unwrap_or_else(|| panic!("Couldn't read `ErasStakers` for era {}", current_era)) - .into_iter() - .map(|key| { - let mut bytes = [0u8; 84]; - hex::decode_to_slice(&key[2..], &mut bytes as &mut [u8]).expect("Should decode key"); - StorageKey(bytes.to_vec()) - }); - BTreeSet::from_iter(stakers) -} - -/// Chill validator. -pub fn chill_validator(connection: &SignedConnection) { - let xt = compose_extrinsic!(connection.as_connection(), PALLET, "chill"); - send_xt( - connection, - xt, - Some("chilling validator"), - XtStatus::InBlock, - ); -} - -/// Chill all validators in `chilling`. -pub fn chill_validators(node: &str, chilling: Vec) { - for validator in chilling.into_iter() { - info!("Chilling validator {:?}", validator.public()); - let connection = SignedConnection::new(node, validator); - chill_validator(&connection); - } -} - -/// Given a `SignedConnection`, bond an extra stake equal to `additional_stake`. -pub fn bond_extra_stake(connection: &SignedConnection, additional_stake: Balance) { - let xt = connection - .as_connection() - .staking_bond_extra(additional_stake); - send_xt(connection, xt, Some("bond_extra"), XtStatus::Finalized); -} - -pub fn get_minimum_validator_count(connection: &C) -> u32 { - connection.read_storage_value(PALLET, "MinimumValidatorCount") -} diff --git a/aleph-client/src/system.rs b/aleph-client/src/system.rs deleted file mode 100644 index 5db1368e9e..0000000000 --- a/aleph-client/src/system.rs +++ /dev/null @@ -1,38 +0,0 @@ -use sp_runtime::Perbill; -use substrate_api_client::{compose_call, compose_extrinsic, XtStatus}; - -use crate::{send_xt, try_send_xt, AnyConnection, CallSystem, RootConnection}; - -pub fn set_code(connection: &RootConnection, runtime: Vec, status: XtStatus) { - let call = compose_call!( - connection.as_connection().metadata, - "System", - "set_code", - runtime - ); - let xt = compose_extrinsic!( - connection.as_connection(), - "Sudo", - "sudo_unchecked_weight", - call, - 0_u64 - ); - send_xt(connection, xt, Some("set_code"), status); -} - -impl CallSystem for RootConnection { - type Error = substrate_api_client::std::error::Error; - - fn fill_block(&self, target_ratio_percent: u32, status: XtStatus) -> Result<(), Self::Error> { - let connection = self.as_connection(); - let target_ratio_perbill = Perbill::from_percent(target_ratio_percent); - let call = compose_call!( - connection.metadata, - "System", - "fill_block", - target_ratio_perbill.deconstruct() - ); - let xt = compose_extrinsic!(connection, "Sudo", "sudo", call); - try_send_xt(&connection, xt, Some("fill block"), status).map(|_| ()) - } -} diff --git a/aleph-client/src/transfer.rs b/aleph-client/src/transfer.rs deleted file mode 100644 index bfaa80912e..0000000000 --- a/aleph-client/src/transfer.rs +++ /dev/null @@ -1,111 +0,0 @@ -use codec::Compact; -use primitives::Balance; -use sp_core::H256; -use sp_runtime::MultiAddress; -use substrate_api_client::{ - compose_call, compose_extrinsic, compose_extrinsic_offline, std::error::Error as SacError, - AccountId, GenericAddress, XtStatus, -}; - -use crate::{ - send_xt, try_send_xt, AnyConnection, BalanceTransfer, BatchTransactions, Extrinsic, - SignedConnection, -}; - -pub type TransferCall = ([u8; 2], MultiAddress, Compact); -pub type TransferTransaction = Extrinsic; - -pub fn transfer( - connection: &SignedConnection, - target: &AccountId, - value: u128, - status: XtStatus, -) -> TransferTransaction { - let xt = connection - .as_connection() - .balance_transfer(GenericAddress::Id(target.clone()), value); - send_xt(connection, xt.clone(), Some("transfer"), status); - xt -} - -pub fn batch_transfer( - connection: &SignedConnection, - account_keys: Vec, - endowment: u128, -) { - let batch_endow = account_keys - .into_iter() - .map(|account_id| { - compose_call!( - connection.as_connection().metadata, - "Balances", - "transfer", - GenericAddress::Id(account_id), - Compact(endowment) - ) - }) - .collect::>(); - - let xt = compose_extrinsic!(connection.as_connection(), "Utility", "batch", batch_endow); - send_xt( - connection, - xt, - Some("batch of endow balances"), - XtStatus::InBlock, - ); -} - -impl SignedConnection { - pub fn create_transfer_extrinsic( - &self, - tx: ::TransferTx, - ) -> TransferTransaction { - let nonce = self.as_connection().get_nonce().unwrap(); - compose_extrinsic_offline!( - self.as_connection().signer.unwrap(), - tx, - self.as_connection().extrinsic_params(nonce) - ) - } -} - -impl BalanceTransfer for SignedConnection { - type TransferTx = TransferCall; - type Error = SacError; - - fn create_transfer_tx(&self, account: AccountId, amount: Balance) -> Self::TransferTx { - compose_call!( - self.as_connection().metadata, - "Balances", - "transfer", - GenericAddress::Id(account), - amount.into() - ) - } - - fn transfer( - &self, - tx: Self::TransferTx, - status: XtStatus, - ) -> Result, Self::Error> { - let xt = self.create_transfer_extrinsic(tx); - try_send_xt(self, xt, Some("transfer"), status) - } -} - -impl BatchTransactions<::TransferTx> for SignedConnection { - type Error = SacError; - - fn batch_and_send_transactions<'a>( - &self, - transactions: impl IntoIterator::TransferTx>, - status: XtStatus, - ) -> Result, Self::Error> - where - ::TransferTx: 'a, - { - let txs = Vec::from_iter(transactions); - let xt = compose_extrinsic!(self.as_connection(), "Utility", "batch", txs); - try_send_xt(self, xt, Some("batch/transfer"), status) - } -} diff --git a/aleph-client/src/treasury.rs b/aleph-client/src/treasury.rs deleted file mode 100644 index 4629d39aa0..0000000000 --- a/aleph-client/src/treasury.rs +++ /dev/null @@ -1,134 +0,0 @@ -use std::{thread, thread::sleep, time::Duration}; - -use codec::Decode; -use frame_support::PalletId; -use primitives::{Balance, MILLISECS_PER_BLOCK}; -use sp_core::H256; -use sp_runtime::{traits::AccountIdConversion, AccountId32}; -use substrate_api_client::{compose_extrinsic, ApiResult, GenericAddress, XtStatus}; - -use crate::{ - try_send_xt, wait_for_event, AnyConnection, ReadStorage, RootConnection, SignedConnection, -}; - -const PALLET: &str = "Treasury"; - -type AnyResult = anyhow::Result; - -/// Returns the account of the treasury. -pub fn treasury_account() -> AccountId32 { - PalletId(*b"a0/trsry").into_account_truncating() -} - -/// Returns how many treasury proposals have ever been created. -pub fn proposals_counter(connection: &C) -> u32 { - connection.read_storage_value_or_default(PALLET, "ProposalCount") -} - -/// Calculates how much balance will be paid out to the treasury after each era. -pub fn staking_treasury_payout(connection: &C) -> Balance { - let sessions_per_era: u32 = connection.read_constant("Staking", "SessionsPerEra"); - let session_period: u32 = connection.read_constant("Elections", "SessionPeriod"); - let millisecs_per_era = MILLISECS_PER_BLOCK * session_period as u64 * sessions_per_era as u64; - primitives::staking::era_payout(millisecs_per_era).1 -} - -/// Creates a proposal of spending treasury's funds. -/// -/// The intention is to transfer `value` balance to `beneficiary`. The signer of `connection` is the -/// proposer. -pub fn propose( - connection: &SignedConnection, - value: Balance, - beneficiary: &AccountId32, -) -> ApiResult> { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "propose_spend", - Compact(value), - GenericAddress::Id(beneficiary.clone()) - ); - try_send_xt(connection, xt, Some("treasury spend"), XtStatus::Finalized) -} - -/// Approves proposal with id `proposal_id` and waits (in a loop) until pallet storage is updated. -/// -/// Unfortunately, pallet treasury does not emit any event (like while rejecting), so we have to -/// keep reading storage to be sure. Hence, it may be an expensive call. -/// -/// Be careful, since execution might never end. -pub fn approve(connection: &RootConnection, proposal_id: u32) -> AnyResult<()> { - send_approval(connection, proposal_id)?; - wait_for_approval(connection, proposal_id) -} - -/// Rejects proposal with id `proposal_id` and waits for the corresponding event. -/// -/// Be careful, since execution might never end (we may stuck on waiting for the event forever). -pub fn reject(connection: &RootConnection, proposal_id: u32) -> AnyResult<()> { - let listener = { - let (c, p) = (connection.clone(), proposal_id); - thread::spawn(move || wait_for_rejection(&c, p)) - }; - send_rejection(connection, proposal_id)?; - listener - .join() - .expect("Corresponding event should have been emitted") -} - -#[derive(Debug, Decode, Copy, Clone)] -struct ProposalRejectedEvent { - proposal_id: u32, - _slashed: Balance, -} - -fn wait_for_rejection(connection: &C, proposal_id: u32) -> AnyResult<()> { - wait_for_event( - connection, - (PALLET, "Rejected"), - |e: ProposalRejectedEvent| proposal_id.eq(&e.proposal_id), - ) - .map(|_| ()) -} - -fn send_rejection(connection: &RootConnection, proposal_id: u32) -> ApiResult> { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "reject_proposal", - Compact(proposal_id) - ); - try_send_xt( - connection, - xt, - Some("treasury rejection"), - XtStatus::Finalized, - ) -} - -fn send_approval(connection: &RootConnection, proposal_id: u32) -> ApiResult> { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "approve_proposal", - Compact(proposal_id) - ); - try_send_xt( - connection, - xt, - Some("treasury approval"), - XtStatus::Finalized, - ) -} - -fn wait_for_approval(connection: &C, proposal_id: u32) -> AnyResult<()> { - loop { - let approvals: Vec = connection.read_storage_value(PALLET, "Approvals"); - if approvals.contains(&proposal_id) { - return Ok(()); - } else { - sleep(Duration::from_millis(500)) - } - } -} diff --git a/aleph-client/src/utility.rs b/aleph-client/src/utility.rs new file mode 100644 index 0000000000..435deb5cc4 --- /dev/null +++ b/aleph-client/src/utility.rs @@ -0,0 +1,136 @@ +use anyhow::anyhow; +use log::info; +use primitives::{BlockNumber, EraIndex, SessionIndex}; +use subxt::{blocks::ExtrinsicEvents, ext::sp_runtime::traits::Hash, Config}; + +use crate::{ + connections::{AsConnection, TxInfo}, + pallets::{elections::ElectionsApi, staking::StakingApi}, + AlephConfig, BlockHash, +}; + +/// Block info API. +#[async_trait::async_trait] +pub trait BlocksApi { + /// Returns the first block of a session. + /// * `session` - number of the session to query the first block from + async fn first_block_of_session( + &self, + session: SessionIndex, + ) -> anyhow::Result>; + + /// Returns hash of a given block if the given block exists, otherwise `None` + /// * `block` - number of the block + async fn get_block_hash(&self, block: BlockNumber) -> anyhow::Result>; + + /// Returns the most recent block from the current best chain. + async fn get_best_block(&self) -> anyhow::Result>; + + /// Returns the most recent block from the finalized chain. + async fn get_finalized_block_hash(&self) -> anyhow::Result; + + /// Returns number of a given block hash, if the given block exists, otherwise `None` + /// This is version that returns `Result` + /// * `block` - hash of the block to query its number + async fn get_block_number(&self, block: BlockHash) -> anyhow::Result>; + + /// Returns number of a given block hash, if the given block exists, otherwise `None` + /// * `block` - hash of the block to query its number + async fn get_block_number_opt( + &self, + block: Option, + ) -> anyhow::Result>; + + /// Fetch all events that corresponds to the transaction identified by `tx_info`. + async fn get_tx_events(&self, tx_info: TxInfo) -> anyhow::Result>; +} + +/// Interaction logic between pallet session and pallet staking. +#[async_trait::async_trait] +pub trait SessionEraApi { + /// Returns which era given session is. + /// * `session` - session index + async fn get_active_era_for_session(&self, session: SessionIndex) -> anyhow::Result; +} + +#[async_trait::async_trait] +impl BlocksApi for C { + async fn first_block_of_session( + &self, + session: SessionIndex, + ) -> anyhow::Result> { + let period = self.get_session_period().await?; + let block_num = period * session; + + self.get_block_hash(block_num).await + } + + async fn get_block_hash(&self, block: BlockNumber) -> anyhow::Result> { + info!(target: "aleph-client", "querying block hash for number #{}", block); + self.as_connection() + .as_client() + .rpc() + .block_hash(Some(block.into())) + .await + .map_err(|e| e.into()) + } + + async fn get_best_block(&self) -> anyhow::Result> { + self.get_block_number_opt(None).await + } + + async fn get_finalized_block_hash(&self) -> anyhow::Result { + self.as_connection() + .as_client() + .rpc() + .finalized_head() + .await + .map_err(|e| e.into()) + } + + async fn get_block_number_opt( + &self, + block: Option, + ) -> anyhow::Result> { + self.as_connection() + .as_client() + .rpc() + .header(block) + .await + .map(|maybe_header| maybe_header.map(|header| header.number)) + .map_err(|e| e.into()) + } + + async fn get_block_number(&self, block: BlockHash) -> anyhow::Result> { + self.get_block_number_opt(Some(block)).await + } + + async fn get_tx_events(&self, tx_info: TxInfo) -> anyhow::Result> { + let block_body = self + .as_connection() + .as_client() + .blocks() + .at(Some(tx_info.block_hash)) + .await? + .body() + .await?; + + let extrinsic_events = block_body + .extrinsics() + .find(|tx| tx_info.tx_hash == ::Hashing::hash_of(&tx.bytes())) + .ok_or_else(|| anyhow!("Couldn't find the transaction in the block."))? + .events() + .await + .map_err(|e| anyhow!("Couldn't fetch events for the transaction: {e:?}"))?; + + Ok(extrinsic_events) + } +} + +#[async_trait::async_trait] +impl SessionEraApi for C { + async fn get_active_era_for_session(&self, session: SessionIndex) -> anyhow::Result { + let block = self.first_block_of_session(session).await?; + Ok(self.get_active_era(block).await) + } +} diff --git a/aleph-client/src/version_upgrade.rs b/aleph-client/src/version_upgrade.rs deleted file mode 100644 index 5265aaf6d3..0000000000 --- a/aleph-client/src/version_upgrade.rs +++ /dev/null @@ -1,36 +0,0 @@ -use anyhow::Result; -use primitives::SessionIndex; -use substrate_api_client::{compose_call, compose_extrinsic, ApiClientError, XtStatus}; - -use crate::{try_send_xt, AnyConnection, RootConnection}; - -pub type Version = u32; - -pub fn schedule_upgrade( - connection: &RootConnection, - version: Version, - session: SessionIndex, -) -> Result<(), ApiClientError> { - let connection = connection.as_connection(); - let upgrade_call = compose_call!( - connection.metadata, - "Aleph", - "schedule_finality_version_change", - version, - session - ); - let xt = compose_extrinsic!( - connection, - "Sudo", - "sudo_unchecked_weight", - upgrade_call, - 0_u64 - ); - try_send_xt( - &connection, - xt, - Some("schedule finality version change"), - XtStatus::Finalized, - ) - .map(|_| ()) -} diff --git a/aleph-client/src/vesting.rs b/aleph-client/src/vesting.rs deleted file mode 100644 index 16b76d89f1..0000000000 --- a/aleph-client/src/vesting.rs +++ /dev/null @@ -1,121 +0,0 @@ -use anyhow::Result; -use log::info; -pub use pallet_vesting::VestingInfo; -use primitives::Balance; -use substrate_api_client::{compose_extrinsic, GenericAddress, XtStatus::Finalized}; -use thiserror::Error; - -use crate::{ - account_from_keypair, try_send_xt, AccountId, AnyConnection, BlockNumber, SignedConnection, -}; - -const PALLET: &str = "Vesting"; - -/// Gathers errors from this module. -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Error)] -pub enum VestingError { - #[error("🦺❌ The connection should be signed.")] - UnsignedConnection, -} - -pub type VestingSchedule = VestingInfo; - -/// Calls `pallet_vesting::vest` for the signer of `connection`, i.e. makes all unlocked balances -/// transferable. -/// -/// Fails if transaction could not have been sent. -/// -/// *Note*: This function returns `Ok(_)` even if the account has no active vesting schedules -/// and thus the extrinsic was not successful. However, semantically it is still correct. -pub fn vest(connection: SignedConnection) -> Result<()> { - let vester = connection.signer(); - let xt = compose_extrinsic!(connection.as_connection(), PALLET, "vest"); - let block_hash = try_send_xt(&connection, xt, Some("Vesting"), Finalized)? - .expect("For `Finalized` status a block hash should be returned"); - info!( - target: "aleph-client", "Vesting for the account {:?}. Finalized in block {:?}", - account_from_keypair(&vester), block_hash - ); - Ok(()) -} - -/// Calls `pallet_vesting::vest_other` by the signer of `connection` on behalf of `vest_account`, -/// i.e. makes all unlocked balances of `vest_account` transferable. -/// -/// Fails if transaction could not have been sent. -/// -/// *Note*: This function returns `Ok(_)` even if the account has no active vesting schedules -/// and thus the extrinsic was not successful. However, semantically it is still correct. -pub fn vest_other(connection: SignedConnection, vest_account: AccountId) -> Result<()> { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "vest_other", - GenericAddress::Id(vest_account.clone()) - ); - let block_hash = try_send_xt(&connection, xt, Some("Vesting on behalf"), Finalized)? - .expect("For `Finalized` status a block hash should be returned"); - info!(target: "aleph-client", "Vesting on behalf of the account {:?}. Finalized in block {:?}", vest_account, block_hash); - Ok(()) -} - -/// Performs a vested transfer from the signer of `connection` to `receiver` according to -/// `schedule`. -/// -/// Fails if transaction could not have been sent. -pub fn vested_transfer( - connection: SignedConnection, - receiver: AccountId, - schedule: VestingSchedule, -) -> Result<()> { - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "vested_transfer", - GenericAddress::Id(receiver.clone()), - schedule - ); - let block_hash = try_send_xt(&connection, xt, Some("Vested transfer"), Finalized)? - .expect("For `Finalized` status a block hash should be returned"); - info!(target: "aleph-client", "Vested transfer to the account {:?}. Finalized in block {:?}", receiver, block_hash); - Ok(()) -} - -/// Returns all active schedules of `who`. If `who` does not have any active vesting schedules, -/// an empty container is returned. -/// -/// Fails if storage could have not been read. -pub fn get_schedules( - connection: &C, - who: AccountId, -) -> Result> { - connection - .as_connection() - .get_storage_map::>(PALLET, "Vesting", who, None)? - .map_or_else(|| Ok(vec![]), Ok) -} - -/// Merges two vesting schedules (at indices `idx1` and `idx2`) of the signer of `connection`. -/// -/// Fails if transaction could not have been sent. -/// -/// *Note*: This function returns `Ok(_)` even if the account has no active vesting schedules, or -/// it has fewer schedules than `max(idx1, idx2) - 1` and thus the extrinsic was not successful. -pub fn merge_schedules(connection: SignedConnection, idx1: u32, idx2: u32) -> Result<()> { - let who = connection.signer(); - let xt = compose_extrinsic!( - connection.as_connection(), - PALLET, - "merge_schedules", - idx1, - idx2 - ); - - let block_hash = try_send_xt(&connection, xt, Some("Merge vesting schedules"), Finalized)? - .expect("For `Finalized` status a block hash should be returned"); - - info!(target: "aleph-client", - "Merging vesting schedules (indices: {} and {}) for the account {:?}. Finalized in block {:?}", - idx1, idx2, account_from_keypair(&who), block_hash); - Ok(()) -} diff --git a/aleph-client/src/waiting.rs b/aleph-client/src/waiting.rs index a6ee4a9032..559c5ed506 100644 --- a/aleph-client/src/waiting.rs +++ b/aleph-client/src/waiting.rs @@ -1,56 +1,196 @@ -use std::sync::mpsc::channel; +use futures::StreamExt; +use log::info; +use primitives::{EraIndex, SessionIndex}; +use subxt::events::StaticEvent; -use anyhow::{anyhow, Result as AnyResult}; -use codec::Decode; -use log::{error, info}; -use substrate_api_client::ApiResult; +use crate::{ + aleph_zero, + api::session::events::NewSession, + connections::AsConnection, + pallets::{session::SessionApi, staking::StakingApi}, +}; -use crate::{AnyConnection, BlockNumber, Header}; +/// When using waiting API, what kind of block status we should wait for. +pub enum BlockStatus { + /// Wait for event or block to be in the best chain. + Best, + /// Wait for the event or block to be in the finalized chain. + Finalized, +} + +/// Waiting _for_ various events API +#[async_trait::async_trait] +pub trait AlephWaiting { + /// Wait for a particular block to be in a [`BlockStatus`]. + /// Block number must match given predicate. + /// * `predicate` - a `u32` -> `bool` functor, first argument is a block number + /// * `status` - a [`BlockStatus`] of the block we wait for + /// + /// # Examples + /// ```ignore + /// let finalized = connection.connection.get_finalized_block_hash().await; + /// let finalized_number = connection + /// .connection + /// .get_block_number(finalized) + /// .await + /// .unwrap(); + /// connection + /// .connection + /// .wait_for_block(|n| n > finalized_number, BlockStatus::Finalized) + /// .await; + /// ``` + async fn wait_for_block bool + Send>(&self, predicate: P, status: BlockStatus); -pub fn wait_for_event bool>( - connection: &C, - event: (&str, &str), - predicate: P, -) -> AnyResult { - let (module, variant) = event; - info!(target: "aleph-client", "Creating event subscription {}/{}", module, variant); + /// Wait for a particular event to be emitted on chain. + /// * `predicate` - a predicate that has one argument (ref to an emitted event) + /// * `status` - a [`BlockStatus`] of the event we wait for + /// + /// # Examples + /// ```ignore + /// let event = connection + /// .wait_for_event( + /// |event: &BanValidators| { + /// info!("Received BanValidators event: {:?}", event.0); + /// true + /// }, + /// BlockStatus::Best, + /// ) + /// .await; + /// ``` + async fn wait_for_event bool + Send>( + &self, + predicate: P, + status: BlockStatus, + ) -> T; - let (events_in, events_out) = channel(); - connection.as_connection().subscribe_events(events_in)?; + /// Wait for given era to happen. + /// * `era` - number of the era to wait for + /// * `status` - a [`BlockStatus`] of the era we wait for + async fn wait_for_era(&self, era: EraIndex, status: BlockStatus); + + /// Wait for given session to happen. + /// * `session` - number of the session to wait for + /// * `status` - a [`BlockStatus`] of the session we wait for + async fn wait_for_session(&self, session: SessionIndex, status: BlockStatus); +} + +/// nWaiting _from_ the current moment of time API +#[async_trait::async_trait] +pub trait WaitingExt { + /// Wait for a given number of sessions to wait from a current session. + /// `n` - number of sessions to wait from now + /// * `status` - a [`BlockStatus`] of the session we wait for + async fn wait_for_n_sessions(&self, n: SessionIndex, status: BlockStatus); + + /// Wait for a given number of eras to wait from a current era. + /// `n` - number of eras to wait from now + /// * `status` - a [`BlockStatus`] of the era we wait for + async fn wait_for_n_eras(&self, n: EraIndex, status: BlockStatus); +} - loop { - let args: ApiResult = - connection +#[async_trait::async_trait] +impl AlephWaiting for C { + async fn wait_for_block bool + Send>(&self, predicate: P, status: BlockStatus) { + let mut block_sub = match status { + BlockStatus::Best => self .as_connection() - .wait_for_event(module, variant, None, &events_out); + .as_client() + .blocks() + .subscribe_best() + .await + .expect("Failed to subscribe to the best block stream!"), + BlockStatus::Finalized => self + .as_connection() + .as_client() + .blocks() + .subscribe_finalized() + .await + .expect("Failed to subscribe to the finalized block stream!"), + }; - match args { - Ok(event) if predicate(event.clone()) => return Ok(event), - Ok(_) => (), - Err(why) => error!(target: "aleph-client", "Error {:?}", why), + while let Some(Ok(block)) = block_sub.next().await { + if predicate(block.number()) { + return; + } } } -} -pub fn wait_for_finalized_block( - connection: &C, - block_number: BlockNumber, -) -> AnyResult { - let (sender, receiver) = channel(); - connection - .as_connection() - .subscribe_finalized_heads(sender)?; - - while let Ok(header) = receiver - .recv() - .map(|h| serde_json::from_str::
(&h).expect("Should deserialize header")) - { - info!(target: "aleph-client", "Received header for a block number {:?}", header.number); - - if header.number.ge(&block_number) { - return Ok(block_number); + async fn wait_for_event bool + Send>( + &self, + predicate: P, + status: BlockStatus, + ) -> T { + let mut block_sub = match status { + BlockStatus::Best => self + .as_connection() + .as_client() + .blocks() + .subscribe_best() + .await + .expect("Failed to subscribe to the best block stream!"), + BlockStatus::Finalized => self + .as_connection() + .as_client() + .blocks() + .subscribe_finalized() + .await + .expect("Failed to subscribe to the finalized block stream!"), + }; + + info!(target: "aleph-client", "waiting for event {}.{}", T::PALLET, T::EVENT); + + while let Some(Ok(block)) = block_sub.next().await { + let events = match block.events().await { + Ok(events) => events, + _ => continue, + }; + + for event in events.iter() { + let event = event.expect("Failed to obtain event from the block!"); + if let Ok(Some(ev)) = event.as_event::() { + if predicate(&ev) { + return ev; + } + } + } } + + panic!("No more blocks"); } - Err(anyhow!("Waiting for finalization is no longer possible")) + async fn wait_for_era(&self, era: EraIndex, status: BlockStatus) { + let addrs = aleph_zero::api::constants().staking().sessions_per_era(); + let sessions_per_era = self + .as_connection() + .as_client() + .constants() + .at(&addrs) + .expect("Failed to obtain sessions_per_era const!"); + let first_session_in_era = era * sessions_per_era; + + self.wait_for_session(first_session_in_era, status).await; + } + + async fn wait_for_session(&self, session: SessionIndex, status: BlockStatus) { + self.wait_for_event(|event: &NewSession| { + info!(target: "aleph-client", "waiting for session {:?}, current session {:?}", session, event.session_index); + event.session_index >= session + }, status) + .await; + } +} + +#[async_trait::async_trait] +impl WaitingExt for C { + async fn wait_for_n_sessions(&self, n: SessionIndex, status: BlockStatus) { + let current_session = self.get_session(None).await; + + self.wait_for_session(current_session + n, status).await; + } + + async fn wait_for_n_eras(&self, n: EraIndex, status: BlockStatus) { + let current_era = self.get_current_era(None).await; + + self.wait_for_era(current_era + n, status).await; + } } diff --git a/benches/payout-stakers/Cargo.lock b/benches/payout-stakers/Cargo.lock index 8d216c22b4..485f2a3ed1 100644 --- a/benches/payout-stakers/Cargo.lock +++ b/benches/payout-stakers/Cargo.lock @@ -13,61 +13,21 @@ dependencies = [ ] [[package]] -name = "ac-compose-macros" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "log", - "parity-scale-codec", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-node-api" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "derive_more", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-primitives" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "hex", - "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "gimli 0.26.2", ] [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.2", ] [[package]] @@ -87,42 +47,47 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph_client" -version = "1.11.0" +version = "2.13.0" dependencies = [ - "ac-node-api", - "ac-primitives", "anyhow", - "contract-metadata 1.5.0", + "async-trait", + "contract-metadata 2.0.1", "contract-transcode", "frame-support", + "futures", "hex", "ink_metadata", "log", - "pallet-aleph", - "pallet-balances", - "pallet-elections", - "pallet-multisig", - "pallet-staking", - "pallet-treasury", - "pallet-vesting", + "pallet-contracts-primitives", "parity-scale-codec", "primitives", - "rayon", + "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "subxt", "thiserror", ] @@ -141,23 +106,20 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] -name = "approx" -version = "0.5.1" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "arrayref" @@ -165,15 +127,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -186,11 +139,21 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -203,9 +166,9 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -216,16 +179,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -247,6 +210,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -267,21 +260,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -334,15 +317,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -358,31 +341,24 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -392,21 +368,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", "num-traits", - "winapi 0.3.9", + "winapi", ] [[package]] name = "clap" -version = "3.2.21" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -453,22 +429,16 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "contract-metadata" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36318b44d658ee23a2daf66811822bdf6ac686aa534ea87eb9e16e7430ca6928" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -478,10 +448,11 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f25bdb57a728064a0e4909dfbb29957ebb06d205307e337d3b5596c7e67dd3a" +checksum = "f5997814dd5d45804757a616e938c28586875ac793ffc140e57e7ae9f421a066" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -491,35 +462,37 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa6db9d18dd5ef92d29c52d30c8503c857d390d9e4043e12466f1490c43c05e" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ "anyhow", - "contract-metadata 0.6.0", - "env_logger 0.9.1", + "contract-metadata 2.0.0-beta.1", "escape8259", "hex", "indexmap", "ink_env", "ink_metadata", "itertools", - "log", "nom", "nom-supreme", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "core-foundation" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation-sys" @@ -528,55 +501,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.6" +name = "cpp_demangle" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if", ] [[package]] -name = "crossbeam-deque" -version = "0.8.2" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "libc", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.11" +name = "cranelift-entity" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset", - "scopeguard", + "serde", ] [[package]] -name = "crossbeam-utils" -version = "0.8.12" +name = "crc32fast" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -587,9 +544,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -655,9 +612,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -667,9 +624,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -682,28 +639,86 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", "syn", ] [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -712,10 +727,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", ] @@ -739,9 +752,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -777,15 +790,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -795,9 +808,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -810,27 +823,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -854,23 +880,31 @@ dependencies = [ ] [[package]] -name = "env_logger" -version = "0.9.1" +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "errno-dragonfly", + "libc", + "winapi", ] [[package]] -name = "environmental" -version = "1.1.3" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "escape8259" @@ -881,17 +915,38 @@ dependencies = [ "rustversion", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -899,9 +954,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -910,19 +965,10 @@ dependencies = [ ] [[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" @@ -934,84 +980,24 @@ dependencies = [ ] [[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "frame-support", - "frame-system", - "linregress", - "log", + "cfg-if", "parity-scale-codec", - "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", ] [[package]] -name = "frame-election-provider-solution-type" +name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-election-provider-support" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-solution-type", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-npos-elections", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "git+https://github.com/integritee-network/frame-metadata#3b43da9821238681f9431276d55b92a079142083" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "bitflags", - "frame-metadata 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -1023,26 +1009,30 @@ dependencies = [ "serde", "smallvec", "sp-api", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-core-hashing-proc-macro", "sp-inherents", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-staking", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -1051,7 +1041,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1063,46 +1053,13 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "2.0.0" @@ -1111,9 +1068,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1126,9 +1083,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1136,15 +1093,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1154,15 +1111,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1171,15 +1143,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1189,9 +1161,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1230,7 +1202,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -1243,9 +1215,11 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1253,18 +1227,47 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1286,14 +1289,20 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1304,6 +1313,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -1330,6 +1348,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1341,30 +1368,98 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1377,6 +1472,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1398,9 +1499,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -1424,60 +1525,61 @@ checksum = "0cfe9645a18782869361d9c8732246be7b410ad4e919d3609ebabdac00ba12c3" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] name = "ink_allocator" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9588a59a0e8997c0b2153cd11b5aaa77c06a0537a6b18f3811d1f1aa098b12" +checksum = "5323d4f43900266f2d5462cbe2a96d4182d634da0cfc1078d26c74d4117e0ce9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_engine" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487c3b390b7feb0620496b0cd38683433c7d7e6946b1caabda51e1f23eb24b30" +checksum = "de001b0907475ab10211093569d8b92726ef7a37d04b6e90c8a2864fbe14d050" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand 0.8.5", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", ] [[package]] name = "ink_env" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a891d34301a3dbb1c7b7424c49ae184282b163491c54f9acd17fcbe14a80447b" +checksum = "b0354567725e4f635a5c5694e4e4cac105e3e78cefd948ca5ab6cc92ea3d8231" dependencies = [ "arrayref", "blake2", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "ink_allocator", "ink_engine", "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", "static_assertions", @@ -1485,9 +1587,9 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74913aaed5751f5615af4631b7559328b8ed56c9cb821b89e14af0706176e849" +checksum = "9dfb4d5448446656ebf83d800c06effeffc063967ef5986d7d1a277e3e507dae" dependencies = [ "derive_more", "impl-serde", @@ -1499,23 +1601,47 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f031e6b8495594a7288b089bf4122e76c26b994959d1b2b693bdfe846b14c0e" +checksum = "c2626fb0c922f923965774cdd8cddeaaa204931d0ed19e0bf43702b033924173" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.4.0" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91066af898fe4c59b2ed0aca678238928b551dc75f5284bf1422e9f1bb6b2204" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage_traits" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12cf42dce81d060401c7cec95a392ad6d3c2f18661fa3083f619ce135133c33" +checksum = "da15ceaef6bdbece3e8b6338df899ef94e3921d03387fa941af8df3b38803523" dependencies = [ - "cfg-if 1.0.0", + "ink_metadata", "ink_prelude", + "ink_primitives", "parity-scale-codec", "scale-info", + "syn", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] @@ -1528,13 +1654,10 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "io-lifetimes" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "itertools" @@ -1547,9 +1670,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "joinery" @@ -1559,39 +1682,121 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "cpufeatures", ] [[package]] @@ -1600,23 +1805,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.135" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1625,7 +1824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1668,22 +1867,18 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] [[package]] -name = "linregress" -version = "0.4.4" +name = "linux-raw-sys" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" -dependencies = [ - "nalgebra", - "statrs", -] +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "lock_api" @@ -1701,25 +1896,34 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] -name = "matchers" -version = "0.0.1" +name = "lru" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "regex-automata", + "hashbrown 0.12.3", ] [[package]] -name = "matrixmultiply" +name = "mach" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ - "rawpointer", + "libc", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", ] [[package]] @@ -1739,20 +1943,30 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown 0.12.3", +] + [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1774,107 +1988,36 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.6.23" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "nalgebra" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational 0.4.1", - "num-traits", - "rand 0.8.5", - "rand_distr", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "net2" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1894,30 +2037,30 @@ dependencies = [ ] [[package]] -name = "num-bigint" -version = "0.2.6" +name = "nom8" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "memchr", ] [[package]] -name = "num-complex" -version = "0.4.2" +name = "num-bigint" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ + "autocfg", + "num-integer", "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -1933,18 +2076,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -1952,6 +2083,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -1963,16 +2095,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", ] [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -1981,15 +2112,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -2004,255 +2147,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "openssl" -version = "0.10.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-sys" -version = "0.9.77" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" - -[[package]] -name = "pallet-aleph" -version = "0.5.0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "pallet-session", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "serde", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-authorship", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] -name = "pallet-elections" -version = "0.5.0" +name = "pallet-contracts-primitives" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-balances", - "pallet-session", - "pallet-staking", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-session" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "log", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-session", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-staking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec", - "scale-info", - "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-timestamp", -] - -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "serde", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "log", + "bitflags", "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallets-support" -version = "0.1.0" -dependencies = [ - "frame-support", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2260,9 +2187,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2272,17 +2199,17 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", - "hashbrown", + "cfg-if", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", "primitive-types", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2298,9 +2225,15 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -2314,40 +2247,41 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "payout-stakers" -version = "0.2.0" +version = "0.3.2" dependencies = [ "aleph_client", "anyhow", "clap", - "env_logger 0.8.4", + "env_logger", + "futures", "hex", "log", "parity-scale-codec", "primitives", "rand 0.8.5", - "rayon", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-keyring", - "substrate-api-client", + "subxt", + "tokio", ] [[package]] @@ -2368,12 +2302,41 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -2387,22 +2350,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkg-config" -version = "0.3.25" +name = "pkcs8" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -2413,28 +2380,27 @@ dependencies = [ [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", "serde", "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2463,18 +2429,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2548,16 +2523,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -2576,36 +2541,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2617,18 +2552,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2637,9 +2572,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2657,21 +2592,36 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rlibc" version = "1.0.0" @@ -2697,34 +2647,95 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "semver", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -2733,9 +2744,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2743,6 +2754,43 @@ dependencies = [ "syn", ] +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2769,54 +2817,66 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.6.1", ] [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "secp256k1-sys 0.6.1", + "secp256k1-sys 0.8.0", ] [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "642a62736682fdd8c71da0eb273e453c8ac74e33b9fb310e22ba5b03ec7651ff" dependencies = [ "cc", ] @@ -2830,29 +2890,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2861,9 +2944,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -2872,14 +2955,15 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2901,7 +2985,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -2913,9 +2997,9 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2924,7 +3008,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -2938,32 +3022,29 @@ dependencies = [ ] [[package]] -name = "signature" -version = "1.4.0" +name = "signal-hook-registry" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", + "libc", ] [[package]] -name = "simba" -version = "0.5.1" +name = "signature" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", + "digest 0.10.6", + "rand_core 0.6.4", ] [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2974,19 +3055,45 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", "parity-scale-codec", "sp-api-proc-macro", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-version", "thiserror", ] @@ -2994,7 +3101,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", "proc-macro-crate", @@ -3005,90 +3112,77 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] -[[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "async-trait", - "parity-scale-codec", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -3096,120 +3190,116 @@ dependencies = [ "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core-hashing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", + "tiny-bip39 0.8.2", "wasmi", "zeroize", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.0", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", - "wasmi", + "tiny-bip39 1.0.0", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ - "blake2-rfc", + "blake2", "byteorder", - "sha2 0.9.9", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "syn", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3218,8 +3308,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", @@ -3228,109 +3318,109 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-keystore 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-state-machine 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-state-machine 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "secp256k1 0.24.0", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-keystore 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", ] [[package]] name = "sp-keyring" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "lazy_static", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "strum", ] [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3338,15 +3428,15 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures", @@ -3354,30 +3444,16 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] -[[package]] -name = "sp-npos-elections" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", @@ -3386,29 +3462,19 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", "regex", ] -[[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "rustc-hash", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3420,76 +3486,78 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-application-crypto 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3500,8 +3568,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", "proc-macro-crate", @@ -3510,36 +3578,23 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-session" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3548,101 +3603,82 @@ dependencies = [ "parking_lot", "rand 0.7.3", "smallvec", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-panic-handler 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-panic-handler 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-panic-handler 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "sp-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "async-trait", - "futures-timer", - "log", - "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "thiserror", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", "tracing-subscriber", @@ -3650,11 +3686,11 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", "tracing-subscriber", @@ -3662,32 +3698,47 @@ dependencies = [ [[package]] name = "sp-trie" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash 0.7.6", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "lru", + "memory-db 0.30.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "ahash 0.8.3", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3695,7 +3746,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3703,8 +3754,8 @@ dependencies = [ "scale-info", "serde", "sp-core-hashing-proc-macro", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-version-proc-macro", "thiserror", ] @@ -3712,7 +3763,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3722,34 +3773,83 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3761,23 +3861,16 @@ dependencies = [ ] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "statrs" -version = "0.15.0" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.5", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" @@ -3807,36 +3900,6 @@ dependencies = [ "syn", ] -[[package]] -name = "substrate-api-client" -version = "0.6.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-compose-macros", - "ac-node-api", - "ac-primitives", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "pallet-balances", - "pallet-staking", - "pallet-transaction-payment", - "parity-scale-codec", - "primitive-types", - "serde", - "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-rpc", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", - "thiserror", - "ws", -] - [[package]] name = "substrate-bip39" version = "0.4.4" @@ -3856,11 +3919,84 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subxt" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +dependencies = [ + "bitvec", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tracing", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +dependencies = [ + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3885,35 +4021,135 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] -name = "thiserror-impl" -version = "1.0.37" +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3921,65 +4157,53 @@ dependencies = [ ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "tokio-rustls" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "once_cell", + "rustls", + "tokio", + "webpki", ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "tokio-util" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" [[package]] -name = "tinyvec" -version = "1.6.0" +name = "toml_edit" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "tinyvec_macros", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "toml" -version = "0.5.9" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -3987,7 +4211,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4059,12 +4283,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -4079,11 +4303,17 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -4091,23 +4321,23 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", - "digest 0.10.5", + "cfg-if", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -4117,15 +4347,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -4148,6 +4378,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -4166,18 +4402,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4192,19 +4438,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -4217,9 +4463,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4227,9 +4473,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4240,39 +4486,202 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -4284,12 +4693,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4302,7 +4705,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4311,6 +4714,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4318,94 +4734,131 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" +name = "windows_x86_64_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" +name = "windows_x86_64_gnullvm" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] -name = "ws" -version = "0.9.2" +name = "windows_x86_64_msvc" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fe90c75f236a0a00247d5900226aea4f2d7b05ccc34da9e7a8880ff59b5848" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio", - "mio-extras", - "openssl", - "rand 0.7.3", - "sha-1", - "slab", - "url", -] +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "windows_x86_64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + [[package]] name = "zeroize" version = "1.5.7" @@ -4417,9 +4870,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/benches/payout-stakers/Cargo.toml b/benches/payout-stakers/Cargo.toml index 428e441eb6..15c7d2665c 100644 --- a/benches/payout-stakers/Cargo.toml +++ b/benches/payout-stakers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "payout-stakers" -version = "0.2.0" +version = "0.3.2" authors = ["Cardinal Cryptography"] edition = "2021" @@ -11,13 +11,14 @@ codec = { package = 'parity-scale-codec', version = "3.0.0", features = ['derive env_logger = "0.8" hex = { version = "0.4.3", default-features = false, features = ["alloc"] } log = "0.4" -rayon = "1.5" +futures = "0.3.25" rand = "0.8.5" -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["full_crypto"] } -sp-keyring = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", features = ["full_crypto"] } +sp-keyring = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } -substrate-api-client = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28" } +subxt = "0.25.0" +tokio = { version = "1.21.2", features = ["full"] } aleph_client = { path = "../../aleph-client" } primitives = { path = "../../primitives" } diff --git a/benches/payout-stakers/src/main.rs b/benches/payout-stakers/src/main.rs index 3eac534cef..b2a54766cf 100644 --- a/benches/payout-stakers/src/main.rs +++ b/benches/payout-stakers/src/main.rs @@ -1,21 +1,24 @@ use std::{iter, time::Instant}; use aleph_client::{ - balances_batch_transfer, keypair_from_string, payout_stakers_and_assert_locked_balance, - staking_batch_bond, staking_batch_nominate, staking_bond, staking_validate, wait_for_next_era, - AnyConnection, RootConnection, SignedConnection, + keypair_from_string, + pallets::{ + balances::{BalanceApi, BalanceUserBatchExtApi}, + staking::{StakingApi, StakingApiExt, StakingUserApi}, + }, + waiting::{BlockStatus, WaitingExt}, + AccountId, Balance, ConnectionApi, KeyPair, RootConnection, SignedConnection, + SignedConnectionApi, TxStatus, }; use clap::{ArgGroup, Parser}; +use futures::future::join_all; use log::{info, trace, warn}; use primitives::{ staking::{MAX_NOMINATORS_REWARDED_PER_VALIDATOR, MIN_NOMINATOR_BOND, MIN_VALIDATOR_BOND}, - TOKEN, + EraIndex, TOKEN, }; use rand::{thread_rng, Rng}; -use rayon::prelude::*; -use sp_core::{crypto::AccountId32, sr25519::Pair as KeyPair, Pair}; use sp_keyring::AccountKeyring; -use substrate_api_client::{extrinsic::staking::RewardDestination, AccountId, XtStatus}; // testcase parameters const NOMINATOR_COUNT: u32 = MAX_NOMINATORS_REWARDED_PER_VALIDATOR; @@ -31,7 +34,7 @@ const TRANSFER_CALL_BATCH_LIMIT: usize = 1024; #[clap(group(ArgGroup::new("valid").required(true)))] struct Config { /// WS endpoint address of the node to connect to. Use IP:port syntax, e.g. 127.0.0.1:9944 - #[clap(long, default_value = "127.0.0.1:9944")] + #[clap(long, default_value = "ws://127.0.0.1:9944")] pub address: String, /// A path to a file that contains the root account seed. @@ -51,7 +54,8 @@ struct Config { pub validator_count: Option, } -fn main() -> anyhow::Result<()> { +#[tokio::main] +async fn main() -> anyhow::Result<()> { env_logger::init(); info!("Running payout_stakers bench."); @@ -66,7 +70,7 @@ fn main() -> anyhow::Result<()> { let sudoer = get_sudoer_keypair(root_seed_file); - let connection = RootConnection::new(&address, sudoer); + let connection = RootConnection::new(&address, sudoer).await.unwrap(); let validators = match validators_seed_file { Some(validators_seed_file) => { @@ -87,18 +91,30 @@ fn main() -> anyhow::Result<()> { let controllers = generate_controllers_for_validators(validator_count); - bond_validators_funds_and_choose_controllers(&address, controllers.clone(), validators.clone()); - send_validate_txs(&address, controllers); + bond_validators_funds_and_choose_controllers( + &address, + controllers + .iter() + .map(|k| KeyPair::new(k.signer().clone())) + .collect(), + validators + .iter() + .map(|k| KeyPair::new(k.signer().clone())) + .collect(), + ) + .await; + send_validate_txs(&address, controllers).await; let validators_and_nominator_stashes = - setup_test_validators_and_nominator_stashes(&connection, validators); + setup_test_validators_and_nominator_stashes(&connection, validators).await; wait_for_successive_eras( &address, &connection, validators_and_nominator_stashes, ERAS_TO_WAIT, - )?; + ) + .await?; let elapsed = Instant::now().duration_since(start); println!("Ok! Elapsed time {}ms", elapsed.as_millis()); @@ -114,7 +130,7 @@ fn get_sudoer_keypair(root_seed_file: Option) -> KeyPair { .unwrap_or_else(|_| panic!("Failed to read file {}", root_seed_file)); keypair_from_string(root_seed.trim()) } - None => AccountKeyring::Alice.pair(), + None => keypair_from_string(&AccountKeyring::Alice.to_seed()), } } @@ -127,31 +143,36 @@ fn generate_controllers_for_validators(validator_count: u32) -> Vec { /// For a given set of validators, generates nominator accounts (controllers and stashes). /// Bonds nominator controllers to the corresponding nominator stashes. -fn setup_test_validators_and_nominator_stashes( +async fn setup_test_validators_and_nominator_stashes( connection: &RootConnection, validators: Vec, -) -> Vec<(KeyPair, Vec)> { - validators - .iter() - .enumerate() - .map(|(validator_index, validator)| { - let (nominator_controller_accounts, nominator_stash_accounts) = - generate_nominator_accounts_with_minimal_bond( - &connection.as_signed(), - validator_index as u32, - validators.len() as u32, - ); - let nominee_account = AccountId::from(validator.public()); - info!("Nominating validator {}", nominee_account); - nominate_validator( +) -> Vec<(KeyPair, Vec)> { + let mut validators_stashes = vec![]; + let validators_len = validators.len(); + for (validator_index, validator) in validators.into_iter().enumerate() { + let (nominator_controller_accounts, nominator_stash_accounts) = + generate_nominator_accounts_with_minimal_bond( connection, - nominator_controller_accounts, - nominator_stash_accounts.clone(), - nominee_account, - ); - (validator.clone(), nominator_stash_accounts) - }) - .collect() + validator_index as u32, + validators_len as u32, + ) + .await; + let nominee_account = validator.account_id().clone(); + info!("Nominating validator {}", nominee_account); + nominate_validator( + connection, + nominator_controller_accounts, + nominator_stash_accounts.clone(), + nominee_account, + ) + .await; + validators_stashes.push(( + KeyPair::new(validator.signer().clone()), + nominator_stash_accounts, + )); + } + + validators_stashes } pub fn derive_user_account_from_numeric_seed(seed: u32) -> KeyPair { @@ -160,7 +181,7 @@ pub fn derive_user_account_from_numeric_seed(seed: u32) -> KeyPair { } /// For a given number of eras, in each era check whether stash balances of a validator are locked. -fn wait_for_successive_eras( +async fn wait_for_successive_eras( address: &str, connection: &C, validators_and_nominator_stashes: Vec<(KeyPair, Vec)>, @@ -168,36 +189,36 @@ fn wait_for_successive_eras( ) -> anyhow::Result<()> { // in order to have over 8k nominators we need to wait around 60 seconds all calls to be processed // that means not all 8k nominators we'll make i to era 1st, hence we need to wait to 2nd era - wait_for_next_era(connection)?; - wait_for_next_era(connection)?; // then we wait another full era to test rewards - let mut current_era = wait_for_next_era(connection)?; + connection.wait_for_n_eras(3, BlockStatus::Finalized).await; + let mut current_era = connection.get_current_era(None).await; for _ in 0..eras_to_wait { info!( "Era {} started, claiming rewards for era {}", current_era, current_era - 1 ); - validators_and_nominator_stashes - .iter() - .for_each(|(validator, nominators_stashes)| { - let validator_connection = SignedConnection::new(address, validator.clone()); - let validator_account = AccountId::from(validator.public()); - info!("Doing payout_stakers for validator {}", validator_account); - payout_stakers_and_assert_locked_balance( - &validator_connection, - &[&nominators_stashes[..], &[validator_account.clone()]].concat(), - &validator_account, - current_era, - ); - }); - current_era = wait_for_next_era(connection)?; + for (validator, nominators_stashes) in validators_and_nominator_stashes.iter() { + let validator_connection = + SignedConnection::new(address, KeyPair::new(validator.signer().clone())).await; + let validator_account = validator.account_id().clone(); + info!("Doing payout_stakers for validator {}", validator_account); + payout_stakers_and_assert_locked_balance( + &validator_connection, + &[&nominators_stashes[..], &[validator_account.clone()]].concat(), + &validator_account, + current_era, + ) + .await; + } + connection.wait_for_n_eras(1, BlockStatus::Finalized).await; + current_era = connection.get_current_era(None).await; } Ok(()) } /// Nominates a specific validator based on the nominator controller and stash accounts. -fn nominate_validator( +async fn nominate_validator( connection: &RootConnection, nominator_controller_accounts: Vec, nominator_stash_accounts: Vec, @@ -205,65 +226,81 @@ fn nominate_validator( ) { let stash_controller_accounts = nominator_stash_accounts .iter() - .zip(nominator_controller_accounts.iter()) + .cloned() + .zip(nominator_controller_accounts.iter().cloned()) .collect::>(); - stash_controller_accounts + + let mut rng = thread_rng(); + for chunk in stash_controller_accounts .chunks(BOND_CALL_BATCH_LIMIT) - .for_each(|chunk| { - let mut rng = thread_rng(); - staking_batch_bond( - connection, - chunk, - (rng.gen::() % 100) * TOKEN + MIN_NOMINATOR_BOND, - RewardDestination::Staked, - ) - }); + .map(|c| c.to_vec()) + { + let stake = (rng.gen::() % 100) * TOKEN + MIN_NOMINATOR_BOND; + connection + .batch_bond(&chunk, stake, TxStatus::Submitted) + .await + .unwrap(); + } + let nominator_nominee_accounts = nominator_controller_accounts .iter() - .zip(iter::repeat(&nominee_account)) + .cloned() + .zip(iter::repeat(&nominee_account).cloned()) .collect::>(); - nominator_nominee_accounts - .chunks(NOMINATE_CALL_BATCH_LIMIT) - .for_each(|chunk| staking_batch_nominate(connection, chunk)); + for chunks in nominator_nominee_accounts.chunks(NOMINATE_CALL_BATCH_LIMIT) { + connection + .batch_nominate(chunks, TxStatus::InBlock) + .await + .unwrap(); + } } /// Bonds the funds of the validators. /// Chooses controller accounts for the corresponding validators. /// We assume stash == validator != controller. -fn bond_validators_funds_and_choose_controllers( +async fn bond_validators_funds_and_choose_controllers( address: &str, controllers: Vec, validators: Vec, ) { - controllers - .into_par_iter() - .zip(validators.into_par_iter()) - .for_each(|(controller, validator)| { - let connection = SignedConnection::new(address, validator); - let controller_account_id = AccountId::from(controller.public()); - staking_bond( - &connection, - MIN_VALIDATOR_BOND, - &controller_account_id, - XtStatus::InBlock, - ); - }); + let mut handles = vec![]; + for (controller, validator) in controllers.into_iter().zip(validators) { + let validator_address = address.to_string(); + handles.push(tokio::spawn(async move { + let connection = SignedConnection::new(&validator_address, validator).await; + let controller_account_id = controller.account_id().clone(); + connection + .bond(MIN_VALIDATOR_BOND, controller_account_id, TxStatus::InBlock) + .await + .unwrap(); + })); + } + join_all(handles).await; } /// Submits candidate validators via controller accounts. /// We assume stash == validator != controller. -fn send_validate_txs(address: &str, controllers: Vec) { - controllers.par_iter().for_each(|controller| { +async fn send_validate_txs(address: &str, controllers: Vec) { + let mut handles = vec![]; + for controller in controllers { + let node_address = address.to_string(); let mut rng = thread_rng(); - let connection = SignedConnection::new(address, controller.clone()); - staking_validate(&connection, rng.gen::() % 100, XtStatus::InBlock); - }); + let prc = rng.gen::() % 100; + handles.push(tokio::spawn(async move { + let connection = + SignedConnection::new(&node_address, KeyPair::new(controller.signer().clone())) + .await; + connection.validate(prc, TxStatus::InBlock).await.unwrap(); + })); + } + + join_all(handles).await; } /// For a specific validator given by index, generates a predetermined number of nominator accounts. /// Nominator accounts are produced as (controller, stash) tuples with initial endowments. -fn generate_nominator_accounts_with_minimal_bond( - connection: &SignedConnection, +async fn generate_nominator_accounts_with_minimal_bond( + connection: &S, validator_number: u32, validators_count: u32, ) -> (Vec, Vec) { @@ -277,20 +314,48 @@ fn generate_nominator_accounts_with_minimal_bond( let idx = validators_count + nominator_number + NOMINATOR_COUNT * validator_number; let controller = keypair_from_string(&format!("//{}//Controller", idx)); let stash = keypair_from_string(&format!("//{}//Stash", idx)); - controller_accounts.push(AccountId::from(controller.public())); - stash_accounts.push(AccountId::from(stash.public())); + controller_accounts.push(controller.account_id().clone()); + stash_accounts.push(stash.account_id().clone()); }); - controller_accounts - .chunks(TRANSFER_CALL_BATCH_LIMIT) - .for_each(|chunk| { - balances_batch_transfer(connection, chunk.to_vec(), TOKEN); - }); - stash_accounts - .chunks(TRANSFER_CALL_BATCH_LIMIT) - .for_each(|chunk| { - balances_batch_transfer(connection, chunk.to_vec(), MIN_NOMINATOR_BOND * 10); - // potentially change to + 1 - }); + for chunk in controller_accounts.chunks(TRANSFER_CALL_BATCH_LIMIT) { + connection + .batch_transfer(chunk, TOKEN, TxStatus::InBlock) + .await + .unwrap(); + } + for chunk in stash_accounts.chunks(TRANSFER_CALL_BATCH_LIMIT) { + // potentially change to + 1 + connection + .batch_transfer(chunk, MIN_NOMINATOR_BOND * 10, TxStatus::InBlock) + .await + .unwrap(); + } (controller_accounts, stash_accounts) } + +async fn payout_stakers_and_assert_locked_balance( + stash_connection: &SignedConnection, + accounts_to_check_balance: &[AccountId], + stash_account: &AccountId, + era: EraIndex, +) { + let locked_stash_balances_before_payout = stash_connection + .locks(accounts_to_check_balance, None) + .await; + stash_connection + .payout_stakers(stash_account.clone(), era - 1, TxStatus::Finalized) + .await + .unwrap(); + let locked_stash_balances_after_payout = stash_connection + .locks(accounts_to_check_balance, None) + .await; + locked_stash_balances_before_payout.iter() + .zip(locked_stash_balances_after_payout.iter()) + .zip(accounts_to_check_balance.iter()) + .for_each(|((balances_before, balances_after), account_id)| { + assert!(balances_after[0].amount > balances_before[0].amount, + "Expected payout to be positive in locked balance for account {}. Balance before: {}, balance after: {}", + account_id, balances_before[0].amount, balances_after[0].amount); + }); +} diff --git a/bin/cliain/Cargo.lock b/bin/cliain/Cargo.lock index a32dca162d..cdc07271be 100644 --- a/bin/cliain/Cargo.lock +++ b/bin/cliain/Cargo.lock @@ -13,61 +13,21 @@ dependencies = [ ] [[package]] -name = "ac-compose-macros" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "log", - "parity-scale-codec", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-node-api" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "derive_more", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-primitives" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "hex", - "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "gimli 0.26.2", ] [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.2", ] [[package]] @@ -87,42 +47,47 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph_client" -version = "1.11.0" +version = "2.13.0" dependencies = [ - "ac-node-api", - "ac-primitives", "anyhow", - "contract-metadata 1.5.0", - "contract-transcode", - "frame-support", + "async-trait", + "contract-metadata 2.0.1", + "contract-transcode 2.0.0-beta.1", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "futures", "hex", "ink_metadata", "log", - "pallet-aleph", - "pallet-balances", - "pallet-elections", - "pallet-multisig", - "pallet-staking", - "pallet-treasury", - "pallet-vesting", + "pallet-contracts-primitives", "parity-scale-codec", "primitives", - "rayon", + "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "subxt", "thiserror", ] @@ -141,14 +106,14 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -160,19 +125,16 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "arrayref" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" @@ -186,11 +148,21 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -203,9 +175,9 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -216,16 +188,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -247,6 +219,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -267,21 +269,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -334,15 +326,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -358,31 +350,24 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -392,21 +377,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", "num-traits", - "winapi 0.3.9", + "winapi", ] [[package]] name = "clap" -version = "3.2.21" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -443,13 +428,13 @@ dependencies = [ [[package]] name = "cliain" -version = "0.5.3" +version = "0.11.0" dependencies = [ "aleph_client", "anyhow", "clap", - "contract-metadata 0.6.0 (git+https://github.com/paritytech/cargo-contract.git?tag=v1.4.0)", - "contract-transcode", + "contract-metadata 0.6.0", + "contract-transcode 2.0.0-beta", "dialoguer", "env_logger 0.8.4", "hex", @@ -460,8 +445,9 @@ dependencies = [ "primitives", "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "subxt", + "tokio", ] [[package]] @@ -476,37 +462,29 @@ dependencies = [ [[package]] name = "console" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" dependencies = [ "encode_unicode", "lazy_static", "libc", - "terminal_size", "unicode-width", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "contract-metadata" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36318b44d658ee23a2daf66811822bdf6ac686aa534ea87eb9e16e7430ca6928" +source = "git+https://github.com/paritytech/cargo-contract.git?tag=v1.4.0#4e3a1981012999d310bd6e171aba4c5ffc7beaca" dependencies = [ - "impl-serde", + "impl-serde 0.3.2", "semver", "serde", "serde_json", @@ -515,10 +493,11 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "0.6.0" -source = "git+https://github.com/paritytech/cargo-contract.git?tag=v1.4.0#4e3a1981012999d310bd6e171aba4c5ffc7beaca" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ - "impl-serde", + "anyhow", + "impl-serde 0.4.0", "semver", "serde", "serde_json", @@ -527,11 +506,12 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f25bdb57a728064a0e4909dfbb29957ebb06d205307e337d3b5596c7e67dd3a" +checksum = "f5997814dd5d45804757a616e938c28586875ac793ffc140e57e7ae9f421a066" dependencies = [ - "impl-serde", + "anyhow", + "impl-serde 0.4.0", "semver", "serde", "serde_json", @@ -540,35 +520,63 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "0.1.0" +version = "2.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa6db9d18dd5ef92d29c52d30c8503c857d390d9e4043e12466f1490c43c05e" +checksum = "61159f8e266d4892be25f2b1e7ff2c4c6dd4338ca26498d907e5532a52a28e5f" dependencies = [ "anyhow", - "contract-metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.9.1", + "contract-metadata 2.0.1", + "env_logger 0.9.3", "escape8259", "hex", "indexmap", "ink_env", "ink_metadata", "itertools", - "log", "nom", "nom-supreme", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "contract-transcode" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" +dependencies = [ + "anyhow", + "contract-metadata 2.0.0-beta.1", + "escape8259", + "hex", + "indexmap", + "ink_env", + "ink_metadata", + "itertools", + "nom", + "nom-supreme", + "parity-scale-codec", + "scale-info", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation-sys" @@ -577,55 +585,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.6" +name = "cpp_demangle" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if", ] [[package]] -name = "crossbeam-deque" -version = "0.8.2" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "libc", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.11" +name = "cranelift-entity" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset", - "scopeguard", + "serde", ] [[package]] -name = "crossbeam-utils" -version = "0.8.12" +name = "crc32fast" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -636,9 +628,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -704,9 +696,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -716,9 +708,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -731,28 +723,86 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", "syn", ] [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -761,20 +811,19 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", ] [[package]] name = "dialoguer" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92e7e37ecef6857fdc0c0c5d42fd5b0938e46590c2183cc92dd310a6d078eb1" +checksum = "af3c796f3b0b408d9fd581611b47fa850821fcb84aa640b83a3c1a5be2d691f2" dependencies = [ "console", + "shell-words", "tempfile", "zeroize", ] @@ -799,9 +848,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -837,15 +886,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -855,9 +904,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -870,27 +919,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -921,9 +983,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -934,9 +996,30 @@ dependencies = [ [[package]] name = "environmental" -version = "1.1.3" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "escape8259" @@ -947,26 +1030,38 @@ dependencies = [ "rustversion", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -974,9 +1069,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -985,19 +1080,10 @@ dependencies = [ ] [[package]] -name = "foreign-types" -version = "0.3.2" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" @@ -1011,9 +1097,10 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "frame-support-procedural 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "linregress", "log", @@ -1021,19 +1108,21 @@ dependencies = [ "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", ] [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1044,17 +1133,18 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-election-provider-solution-type", - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-npos-elections", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] @@ -1063,31 +1153,52 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "parity-scale-codec", "scale-info", "serde", ] [[package]] -name = "frame-metadata" -version = "15.0.0" -source = "git+https://github.com/integritee-network/frame-metadata#3b43da9821238681f9431276d55b92a079142083" +name = "frame-support" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "cfg-if 1.0.0", + "bitflags", + "frame-metadata", + "frame-support-procedural 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "impl-trait-for-tuples", + "k256", + "log", + "once_cell", "parity-scale-codec", + "paste", "scale-info", "serde", + "smallvec", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-inherents 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "tt-call", ] [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "bitflags", - "frame-metadata 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "frame-support-procedural", + "frame-metadata", + "frame-support-procedural 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "impl-trait-for-tuples", "k256", "log", @@ -1097,27 +1208,58 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-api", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core-hashing-proc-macro", - "sp-inherents", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-inherents 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "Inflector", + "cfg-expr", + "derive-syn-parse", + "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "Inflector", - "frame-support-procedural-tools", + "cfg-expr", + "derive-syn-parse", + "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "proc-macro-crate", "proc-macro2", "quote", "syn", @@ -1126,9 +1268,9 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "frame-support-procedural-tools-derive", + "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "proc-macro-crate", "proc-macro2", "quote", @@ -1138,7 +1280,17 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "3.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", @@ -1148,36 +1300,21 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "2.0.0" @@ -1186,9 +1323,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1201,9 +1338,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1211,15 +1348,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1229,15 +1366,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-lite" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1246,15 +1398,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1264,9 +1416,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1305,7 +1457,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -1318,9 +1470,11 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1328,18 +1482,47 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1361,14 +1544,20 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1379,6 +1568,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -1405,6 +1603,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1416,30 +1623,98 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1452,6 +1727,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1480,6 +1761,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -1499,60 +1789,61 @@ checksum = "0cfe9645a18782869361d9c8732246be7b410ad4e919d3609ebabdac00ba12c3" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] name = "ink_allocator" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9588a59a0e8997c0b2153cd11b5aaa77c06a0537a6b18f3811d1f1aa098b12" +checksum = "5323d4f43900266f2d5462cbe2a96d4182d634da0cfc1078d26c74d4117e0ce9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_engine" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487c3b390b7feb0620496b0cd38683433c7d7e6946b1caabda51e1f23eb24b30" +checksum = "de001b0907475ab10211093569d8b92726ef7a37d04b6e90c8a2864fbe14d050" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand 0.8.5", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", ] [[package]] name = "ink_env" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a891d34301a3dbb1c7b7424c49ae184282b163491c54f9acd17fcbe14a80447b" +checksum = "b0354567725e4f635a5c5694e4e4cac105e3e78cefd948ca5ab6cc92ea3d8231" dependencies = [ "arrayref", "blake2", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "ink_allocator", "ink_engine", "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", "static_assertions", @@ -1560,12 +1851,12 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74913aaed5751f5615af4631b7559328b8ed56c9cb821b89e14af0706176e849" +checksum = "9dfb4d5448446656ebf83d800c06effeffc063967ef5986d7d1a277e3e507dae" dependencies = [ "derive_more", - "impl-serde", + "impl-serde 0.4.0", "ink_prelude", "ink_primitives", "scale-info", @@ -1574,23 +1865,38 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f031e6b8495594a7288b089bf4122e76c26b994959d1b2b693bdfe846b14c0e" +checksum = "c2626fb0c922f923965774cdd8cddeaaa204931d0ed19e0bf43702b033924173" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.4.0" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91066af898fe4c59b2ed0aca678238928b551dc75f5284bf1422e9f1bb6b2204" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage_traits" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12cf42dce81d060401c7cec95a392ad6d3c2f18661fa3083f619ce135133c33" +checksum = "da15ceaef6bdbece3e8b6338df899ef94e3921d03387fa941af8df3b38803523" dependencies = [ - "cfg-if 1.0.0", + "ink_metadata", "ink_prelude", + "ink_primitives", "parity-scale-codec", "scale-info", + "syn", ] [[package]] @@ -1599,7 +1905,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1612,13 +1918,10 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "io-lifetimes" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "itertools" @@ -1631,9 +1934,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "joinery" @@ -1643,39 +1946,121 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "cpufeatures", ] [[package]] @@ -1684,23 +2069,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.135" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1709,7 +2088,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1752,9 +2131,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -1769,6 +2148,12 @@ dependencies = [ "statrs", ] +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + [[package]] name = "lock_api" version = "0.4.9" @@ -1785,7 +2170,25 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown 0.12.3", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", ] [[package]] @@ -1823,20 +2226,30 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown 0.12.3", +] + [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1858,54 +2271,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.6.23" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", ] [[package]] @@ -1918,7 +2300,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -1938,27 +2320,16 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1977,11 +2348,20 @@ dependencies = [ "nom", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -1990,18 +2370,18 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -2017,18 +2397,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2036,6 +2404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -2052,11 +2421,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -2065,15 +2434,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -2088,161 +2469,72 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "openssl" -version = "0.10.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-sys" -version = "0.9.77" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" - -[[package]] -name = "pallet-aleph" -version = "0.5.0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "pallet-session", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "serde", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] -name = "pallet-elections" -version = "0.5.0" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-balances", - "pallet-session", - "pallet-staking", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "pallet-contracts-primitives" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "frame-support", - "frame-system", + "bitflags", "parity-scale-codec", - "scale-info", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "impl-trait-for-tuples", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-session", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "log", "pallet-authorship", @@ -2250,93 +2542,41 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-inherents 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-timestamp", ] -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "serde", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallets-support" -version = "0.1.0" -dependencies = [ - "frame-support", -] - [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2344,9 +2584,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2356,17 +2596,17 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", - "hashbrown", + "cfg-if", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", "primitive-types", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2382,9 +2622,15 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -2398,22 +2644,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -2433,12 +2679,41 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -2452,54 +2727,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkg-config" -version = "0.3.25" +name = "pkcs8" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", - "impl-serde", + "impl-serde 0.4.0", "scale-info", "uint", ] [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2528,18 +2806,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2647,30 +2934,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2682,18 +2945,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2702,9 +2965,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2722,9 +2985,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -2732,28 +2995,43 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] [[package]] -name = "rlibc" -version = "1.0.0" +name = "ring" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" - -[[package]] -name = "rustc-demangle" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rlibc" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" + +[[package]] +name = "rustc-demangle" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" @@ -2771,34 +3049,95 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "semver", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -2807,9 +3146,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2817,6 +3156,43 @@ dependencies = [ "syn", ] +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2843,54 +3219,66 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.6.1", ] [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "secp256k1-sys 0.6.1", + "secp256k1-sys 0.8.0", ] [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "642a62736682fdd8c71da0eb273e453c8ac74e33b9fb310e22ba5b03ec7651ff" dependencies = [ "cc", ] @@ -2904,29 +3292,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2935,9 +3346,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -2946,14 +3357,15 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2975,7 +3387,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -2987,9 +3399,9 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2998,7 +3410,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -3011,13 +3423,28 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] @@ -3035,9 +3462,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -3048,27 +3475,83 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "hash-db", "log", "parity-scale-codec", - "sp-api-proc-macro", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "blake2", "proc-macro-crate", @@ -3079,211 +3562,288 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-application-crypto" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] [[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-arithmetic" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", + "integer-sqrt", + "num-traits", "parity-scale-codec", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "scale-info", + "serde", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "static_assertions", ] [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1", "log", "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core-hashing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", + "tiny-bip39 0.8.2", "wasmi", "zeroize", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.0", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", - "wasmi", + "tiny-bip39 1.0.0", + "zeroize", +] + +[[package]] +name = "sp-core" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "array-bytes", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde 0.4.0", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1 0.24.3", + "secrecy", + "serde", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39 1.0.0", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ - "blake2-rfc", + "blake2", "byteorder", - "sha2 0.9.9", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "twox-hash", ] [[package]] -name = "sp-core-hashing-proc-macro" +name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "syn", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "syn", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3292,8 +3852,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", @@ -3302,98 +3872,148 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-inherents" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-keystore 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-state-machine 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-state-machine 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "bytes", + "ed25519", + "ed25519-dalek", + "futures", + "libsecp256k1", + "log", + "parity-scale-codec", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "bytes 1.2.1", + "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "secp256k1 0.24.0", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-keystore 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3401,15 +4021,15 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures", @@ -3417,30 +4037,46 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-keystore" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", @@ -3449,8 +4085,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", @@ -3458,20 +4094,20 @@ dependencies = [ ] [[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-panic-handler" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "rustc-hash", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "backtrace", + "lazy_static", + "regex", ] [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3483,76 +4119,118 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-application-crypto 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-runtime" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3563,8 +4241,20 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "Inflector", "proc-macro-crate", @@ -3576,33 +4266,46 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3611,101 +4314,135 @@ dependencies = [ "parking_lot", "rand 0.7.3", "smallvec", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-panic-handler 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-panic-handler 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-panic-handler 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", +] + +[[package]] +name = "sp-state-machine" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand 0.8.5", + "smallvec", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "impl-serde 0.4.0", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures-timer", "log", "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-inherents 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", "tracing-subscriber", @@ -3713,44 +4450,94 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", "tracing-subscriber", ] [[package]] -name = "sp-trie" +name = "sp-tracing" version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash 0.7.6", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "lru", + "memory-db 0.30.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "ahash 0.8.3", + "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ + "ahash 0.8.3", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3758,24 +4545,52 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "impl-serde 0.4.0", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "parity-wasm", "scale-info", "serde", - "sp-core-hashing-proc-macro", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version-proc-macro", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3785,34 +4600,111 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3823,6 +4715,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3848,36 +4746,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "substrate-api-client" -version = "0.6.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-compose-macros", - "ac-node-api", - "ac-primitives", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "pallet-balances", - "pallet-staking", - "pallet-transaction-payment", - "parity-scale-codec", - "primitive-types", - "serde", - "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-rpc", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", - "thiserror", - "ws", -] - [[package]] name = "substrate-bip39" version = "0.4.4" @@ -3897,11 +4765,84 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subxt" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +dependencies = [ + "bitvec", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tracing", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +dependencies = [ + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3926,59 +4867,149 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + [[package]] name = "tempfile" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] -name = "terminal_size" -version = "0.1.17" +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + +[[package]] +name = "thiserror" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ - "libc", - "winapi 0.3.9", + "thiserror-impl", ] [[package]] -name = "textwrap" -version = "0.15.0" +name = "thiserror-impl" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] -name = "thiserror" -version = "1.0.37" +name = "thread_local" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "thiserror-impl", + "cfg-if", + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", ] [[package]] -name = "thiserror-impl" -version = "1.0.37" +name = "tokio-macros" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3986,65 +5017,53 @@ dependencies = [ ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "tokio-rustls" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "once_cell", + "rustls", + "tokio", + "webpki", ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "tokio-util" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" [[package]] -name = "tinyvec" -version = "1.6.0" +name = "toml_edit" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "tinyvec_macros", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "toml" -version = "0.5.9" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -4052,7 +5071,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4124,12 +5143,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -4144,11 +5163,17 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -4156,23 +5181,23 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", - "digest 0.10.5", + "cfg-if", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -4182,15 +5207,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -4213,6 +5238,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -4231,18 +5262,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4257,19 +5298,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -4282,9 +5323,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4292,9 +5333,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4305,39 +5346,202 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -4349,12 +5553,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4367,7 +5565,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4376,6 +5574,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4383,94 +5594,131 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" +name = "windows_x86_64_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" +name = "windows_x86_64_gnullvm" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] -name = "ws" -version = "0.9.2" +name = "windows_x86_64_msvc" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fe90c75f236a0a00247d5900226aea4f2d7b05ccc34da9e7a8880ff59b5848" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio", - "mio-extras", - "openssl", - "rand 0.7.3", - "sha-1", - "slab", - "url", -] +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "windows_x86_64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + [[package]] name = "zeroize" version = "1.5.7" @@ -4482,9 +5730,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/bin/cliain/Cargo.toml b/bin/cliain/Cargo.toml index 35f5d78ffc..802a1191d7 100644 --- a/bin/cliain/Cargo.toml +++ b/bin/cliain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cliain" -version = "0.5.3" +version = "0.11.0" edition = "2021" license = "GPL-3.0-or-later" @@ -10,18 +10,19 @@ anyhow = "1.0" clap = { version = "3.0", features = ["derive"] } codec = { package = 'parity-scale-codec', version = "3.0.0", features = ['derive'] } contract-metadata = { git = "https://github.com/paritytech/cargo-contract.git", tag = "v1.4.0"} -contract-transcode = { version = "0.1.0" } +contract-transcode = { version = "=2.0.0-beta" } dialoguer = "0.10.0" env_logger = "0.8" hex = "0.4.3" -ink_metadata = { version = "3.0", features = ["derive"] } +ink_metadata = { version = "4.0.0-beta", features = ["derive"] } log = "0.4" -pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } primitives = { path = "../../primitives" } serde = { version = "1.0.137", features = ["derive"] } serde_json = "1.0.81" -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["full_crypto"] } -substrate-api-client = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28", features = ["staking-xt"] } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", features = ["full_crypto"] } +tokio = { version = "1.21.2", features = ["full"] } +subxt = "0.25.0" [features] default = ["std"] diff --git a/bin/cliain/Dockerfile b/bin/cliain/Dockerfile index 9c123ed38c..afd520a97e 100644 --- a/bin/cliain/Dockerfile +++ b/bin/cliain/Dockerfile @@ -11,8 +11,8 @@ RUN apt update && \ RUN update-ca-certificates -RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb -RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb +RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb +RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb COPY target/release/cliain /usr/local/bin RUN chmod +x /usr/local/bin/cliain diff --git a/bin/cliain/src/commands.rs b/bin/cliain/src/commands.rs index 63ac4a22ec..029f4a527f 100644 --- a/bin/cliain/src/commands.rs +++ b/bin/cliain/src/commands.rs @@ -3,24 +3,23 @@ use std::{ path::{Path, PathBuf}, }; -use aleph_client::BlockNumber; -use clap::{Args, Subcommand}; -use primitives::{Balance, CommitteeSeats}; +use aleph_client::{AccountId, Balance, TxStatus}; +use clap::{clap_derive::ValueEnum, Args, Subcommand}; +use primitives::{BlockNumber, CommitteeSeats, SessionIndex}; use serde::{Deserialize, Serialize}; use sp_core::H256; -use substrate_api_client::AccountId; #[derive(Debug, Clone, Args)] pub struct ContractOptions { /// balance to transfer from the call origin to the contract #[clap(long, default_value = "0")] - pub balance: u128, + pub balance: Balance, /// The gas limit enforced when executing the constructor #[clap(long, default_value = "1000000000")] pub gas_limit: u64, /// The maximum amount of balance that can be charged/reserved from the caller to pay for the storage consumed #[clap(long)] - pub storage_deposit_limit: Option, + pub storage_deposit_limit: Option, } #[derive(Debug, Clone, Args)] @@ -30,7 +29,7 @@ pub struct ContractUploadCode { pub wasm_path: PathBuf, /// The maximum amount of balance that can be charged/reserved from the caller to pay for the storage consumed #[clap(long)] - pub storage_deposit_limit: Option, + pub storage_deposit_limit: Option, } #[derive(Debug, Clone, Args)] @@ -111,19 +110,36 @@ pub struct ChangeValidatorArgs { pub committee_size: Option, } +pub type Version = u32; + impl std::str::FromStr for ChangeValidatorArgs { type Err = serde_json::Error; fn from_str(change_validator_args: &str) -> Result { let path = Path::new(change_validator_args); if path.exists() { - let file = File::open(&path).expect("Failed to open metadata file"); + let file = File::open(path).expect("Failed to open metadata file"); return serde_json::from_reader(file); } serde_json::from_str(change_validator_args) } } +#[derive(Debug, Clone, ValueEnum)] +pub enum ExtrinsicState { + InBlock, + Finalized, +} + +impl From for TxStatus { + fn from(state: ExtrinsicState) -> Self { + match state { + ExtrinsicState::InBlock => TxStatus::InBlock, + ExtrinsicState::Finalized => TxStatus::Finalized, + } + } +} + #[derive(Debug, Clone, Subcommand)] pub enum Command { /// Staking call to bond stash with controller @@ -304,9 +320,6 @@ pub enum Command { starting_block: BlockNumber, }, - /// Print debug info of storage - DebugStorage, - /// Deploys a new contract, returns its code hash and the AccountId of the instance. /// /// Contract cannot already exist on-chain @@ -336,4 +349,16 @@ pub enum Command { /// Code can only be removed by its original uploader (its owner) and only if it is not used by any contract. /// API signature: https://polkadot.js.org/docs/substrate/extrinsics/#removecodecode_hash-h256 ContractRemoveCode(ContractRemoveCode), + + /// Schedules a version upgrade of the network. + VersionUpgradeSchedule { + #[clap(long)] + version: Version, + + #[clap(long)] + session: SessionIndex, + + #[clap(long, value_enum, default_value_t=ExtrinsicState::Finalized)] + expected_state: ExtrinsicState, + }, } diff --git a/bin/cliain/src/contracts.rs b/bin/cliain/src/contracts.rs index cd2332989d..3b5599aa46 100644 --- a/bin/cliain/src/contracts.rs +++ b/bin/cliain/src/contracts.rs @@ -3,103 +3,77 @@ use std::{ path::Path, }; -use aleph_client::{send_xt, wait_for_event, AnyConnection, Balance, Connection, SignedConnection}; -use anyhow::anyhow; -use codec::{Compact, Decode, Encode}; +use aleph_client::{ + api::contracts::events::{CodeRemoved, CodeStored, Instantiated}, + pallet_contracts::wasm::OwnerInfo, + pallets::contract::{ContractsApi, ContractsUserApi}, + sp_weights::weight_v2::Weight, + waiting::{AlephWaiting, BlockStatus}, + AccountId, Balance, CodeHash, Connection, SignedConnection, SignedConnectionApi, TxStatus, +}; +use codec::{Compact, Decode}; use contract_metadata::ContractMetadata; use contract_transcode::ContractMessageTranscoder; use log::{debug, info}; use serde::{Deserialize, Serialize}; -use sp_core::{Pair, H256}; -use substrate_api_client::{ - compose_extrinsic, utils::storage_key, AccountId, GenericAddress, StorageKey, XtStatus, -}; use crate::commands::{ ContractCall, ContractInstantiate, ContractInstantiateWithCode, ContractOptions, ContractOwnerInfo, ContractRemoveCode, ContractUploadCode, }; -#[derive(Debug, Decode, Encode, Clone)] -pub struct OwnerInfo { - /// The account that has deployed the contract and hence is allowed to remove it. - pub owner: AccountId, - /// The amount of balance that was deposited by the owner in order to deploy the contract. - #[codec(compact)] - pub deposit: Balance, - /// The number of contracts that share (use) this code. - #[codec(compact)] - pub refcount: u64, -} - -#[derive(Debug, Decode, Clone)] -pub struct ContractCodeRemovedEvent { - code_hash: H256, -} - -#[derive(Debug, Decode, Clone)] -pub struct ContractInstantiatedEvent { - deployer: AccountId, - contract: AccountId, -} - -#[derive(Debug, Decode, Clone)] -pub struct ContractCodeStoredEvent { - code_hash: H256, -} - #[derive(Debug, Decode, Clone, Serialize, Deserialize)] pub struct InstantiateWithCodeReturnValue { pub contract: AccountId, - pub code_hash: H256, + pub code_hash: CodeHash, } -fn storage_deposit(storage_deposit_limit: Option) -> Option> { +fn storage_deposit(storage_deposit_limit: Option) -> Option> { storage_deposit_limit.map(Compact) } -pub fn upload_code( +pub async fn upload_code( signed_connection: SignedConnection, command: ContractUploadCode, -) -> anyhow::Result { +) -> anyhow::Result { let ContractUploadCode { wasm_path, storage_deposit_limit, } = command; - let connection = signed_connection.as_connection(); - let wasm = fs::read(wasm_path).expect("WASM artifact not found"); debug!(target: "contracts", "Found WASM contract code {:?}", wasm); - let xt = compose_extrinsic!( - connection, - "Contracts", - "upload_code", - wasm, // code - storage_deposit(storage_deposit_limit) - ); - - debug!(target: "contracts", "Prepared `upload_code` extrinsic {:?}", xt); - - let _block_hash = send_xt(&connection, xt, Some("upload_code"), XtStatus::InBlock); - - let code_stored_event: ContractCodeStoredEvent = wait_for_event( - &connection, - ("Contracts", "CodeStored"), - |e: ContractCodeStoredEvent| { - info!(target : "contracts", "Received CodeStored event {:?}", e); - true - }, - )?; + let connection = signed_connection.clone(); + let event_handler = tokio::spawn(async move { + connection + .wait_for_event( + |e: &CodeStored| { + info!(target : "contracts", "Received CodeStored event {:?}", e); + true + }, + BlockStatus::Finalized, + ) + .await + }); + + let _tx_info = signed_connection + .upload_code( + wasm, + storage_deposit(storage_deposit_limit), + aleph_client::pallet_contracts::wasm::Determinism::Deterministic, + TxStatus::InBlock, + ) + .await?; + let code_stored_event = event_handler.await?; Ok(code_stored_event) } -pub fn instantiate( +pub async fn instantiate( signed_connection: SignedConnection, command: ContractInstantiate, -) -> anyhow::Result { +) -> anyhow::Result { let ContractInstantiate { code_hash, metadata_path, @@ -114,46 +88,45 @@ pub fn instantiate( storage_deposit_limit, } = options; - let connection = signed_connection.as_connection(); - let metadata = load_metadata(&metadata_path)?; - let transcoder = ContractMessageTranscoder::new(&metadata); - let data = transcoder.encode(&constructor, &args.unwrap_or_default())?; + let transcoder = ContractMessageTranscoder::new(metadata); + let data = transcoder.encode(&constructor, args.unwrap_or_default())?; debug!("Encoded constructor data {:?}", data); - let xt = compose_extrinsic!( - connection, - "Contracts", - "instantiate", - Compact(balance), - Compact(gas_limit), - storage_deposit(storage_deposit_limit), - code_hash, - data, // The input data to pass to the contract constructor - Vec::::new() // salt used for the address derivation - ); - - debug!(target: "contracts", "Prepared `instantiate` extrinsic {:?}", xt); - - let _block_hash = send_xt(&connection, xt, Some("instantiate"), XtStatus::InBlock); - - let contract_instantiated_event: ContractInstantiatedEvent = wait_for_event( - &connection, - ("Contracts", "Instantiated"), - |e: ContractInstantiatedEvent| { - info!(target : "contracts", "Received ContractInstantiated event {:?}", e); - match &connection.signer { - Some(signer) => AccountId::from(signer.public()).eq(&e.deployer), - None => panic!("Should never get here"), - } - }, - )?; + let connection = signed_connection.clone(); + let signer_id = signed_connection.account_id().clone(); + + let event_handler = tokio::spawn(async move { + connection + .wait_for_event( + |e: &Instantiated| { + info!(target : "contracts", "Received ContractInstantiated event {:?}", e); + signer_id.eq(&e.deployer) + }, + BlockStatus::Finalized, + ) + .await + }); + + let _tx_info = signed_connection + .instantiate( + code_hash, + balance, + Weight::new(gas_limit, u64::MAX), + storage_deposit(storage_deposit_limit), + data, + vec![], + TxStatus::InBlock, + ) + .await?; + + let contract_instantiated_event = event_handler.await?; Ok(contract_instantiated_event) } -pub fn instantiate_with_code( +pub async fn instantiate_with_code( signed_connection: SignedConnection, command: ContractInstantiateWithCode, ) -> anyhow::Result { @@ -171,59 +144,58 @@ pub fn instantiate_with_code( storage_deposit_limit, } = options; - let connection = signed_connection.as_connection(); - let wasm = fs::read(wasm_path).expect("WASM artifact not found"); debug!(target: "contracts", "Found WASM contract code {:?}", wasm); let metadata = load_metadata(&metadata_path)?; - let transcoder = ContractMessageTranscoder::new(&metadata); - let data = transcoder.encode(&constructor, &args.unwrap_or_default())?; + let transcoder = ContractMessageTranscoder::new(metadata); + let data = transcoder.encode(&constructor, args.unwrap_or_default())?; debug!("Encoded constructor data {:?}", data); - let xt = compose_extrinsic!( - connection, - "Contracts", - "instantiate_with_code", - Compact(balance), - Compact(gas_limit), - storage_deposit(storage_deposit_limit), - wasm, // code - data, // The input data to pass to the contract constructor - Vec::::new() // salt used for the address derivation - ); - - debug!(target: "contracts", "Prepared `instantiate_with_code` extrinsic {:?}", xt); - - let _block_hash = send_xt( - &connection, - xt, - Some("instantiate_with_code"), - XtStatus::InBlock, - ); - - let code_stored_event: ContractCodeStoredEvent = wait_for_event( - &connection, - ("Contracts", "CodeStored"), - |e: ContractCodeStoredEvent| { - info!(target : "contracts", "Received CodeStored event {:?}", e); - // TODO : can we pre-calculate what the code hash will be? - true - }, - )?; - - let contract_instantiated_event: ContractInstantiatedEvent = wait_for_event( - &connection, - ("Contracts", "Instantiated"), - |e: ContractInstantiatedEvent| { - info!(target : "contracts", "Received ContractInstantiated event {:?}", e); - match &connection.signer { - Some(signer) => AccountId::from(signer.public()).eq(&e.deployer), - None => panic!("Should never get here"), - } - }, - )?; + let signer_id = signed_connection.account_id().clone(); + let connection_0 = signed_connection.clone(); + let connection_1 = signed_connection.clone(); + + let event_handler_0 = tokio::spawn(async move { + connection_0 + .wait_for_event( + |e: &CodeStored| { + info!(target : "contracts", "Received CodeStored event {:?}", e); + // TODO : can we pre-calculate what the code hash will be? + true + }, + BlockStatus::Finalized, + ) + .await + }); + + let event_handler_1 = tokio::spawn(async move { + connection_1 + .wait_for_event( + |e: &Instantiated| { + info!(target : "contracts", "Received ContractInstantiated event {:?}", e); + signer_id.eq(&e.deployer) + }, + BlockStatus::Finalized, + ) + .await + }); + + let _tx_info = signed_connection + .instantiate_with_code( + wasm, + balance, + Weight::new(gas_limit, u64::MAX), + storage_deposit(storage_deposit_limit), + data, + vec![], + TxStatus::InBlock, + ) + .await?; + + let code_stored_event = event_handler_0.await?; + let contract_instantiated_event = event_handler_1.await?; Ok(InstantiateWithCodeReturnValue { contract: contract_instantiated_event.contract, @@ -231,7 +203,10 @@ pub fn instantiate_with_code( }) } -pub fn call(signed_connection: SignedConnection, command: ContractCall) -> anyhow::Result<()> { +pub async fn call( + signed_connection: SignedConnection, + command: ContractCall, +) -> anyhow::Result<()> { let ContractCall { destination, message, @@ -246,78 +221,67 @@ pub fn call(signed_connection: SignedConnection, command: ContractCall) -> anyho storage_deposit_limit, } = options; - let connection = signed_connection.as_connection(); - let metadata = load_metadata(&metadata_path)?; - let transcoder = ContractMessageTranscoder::new(&metadata); - let data = transcoder.encode(&message, &args.unwrap_or_default())?; + let transcoder = ContractMessageTranscoder::new(metadata); + let data = transcoder.encode(&message, args.unwrap_or_default())?; debug!("Encoded call data {:?}", data); - let xt = compose_extrinsic!( - connection, - "Contracts", - "call", - GenericAddress::Id(destination), - Compact(balance), - Compact(gas_limit), - storage_deposit(storage_deposit_limit), - data // The input data to pass to the contract message - ); + let _tx_info = signed_connection + .call( + destination, + balance, + Weight::new(gas_limit, u64::MAX), + storage_deposit(storage_deposit_limit), + data, + TxStatus::InBlock, + ) + .await?; - debug!(target: "contracts", "Prepared `call` extrinsic {:?}", xt); - - let _block_hash = send_xt(&connection, xt, Some("call"), XtStatus::Finalized); Ok(()) } -pub fn owner_info(connection: Connection, command: ContractOwnerInfo) -> Option { +pub async fn owner_info(connection: Connection, command: ContractOwnerInfo) -> Option { let ContractOwnerInfo { code_hash } = command; - let mut code_hash_bytes: Vec = Vec::from(code_hash.0); - let mut bytes = storage_key("Contracts", "OwnerInfoOf").0; - bytes.append(&mut code_hash_bytes); - let storage_key = StorageKey(bytes); - - connection - .get_storage_by_key_hash::(storage_key, None) - .ok()? + + connection.get_owner_info(code_hash, None).await } -pub fn remove_code( +pub async fn remove_code( signed_connection: SignedConnection, command: ContractRemoveCode, -) -> anyhow::Result { +) -> anyhow::Result { let ContractRemoveCode { code_hash } = command; - let connection = signed_connection.as_connection(); - let xt = compose_extrinsic!(connection, "Contracts", "remove_code", code_hash); + let connection = signed_connection.clone(); - debug!(target: "contracts", "Prepared `remove_code` extrinsic {:?}", xt); + let event_handler = tokio::spawn(async move { + connection + .wait_for_event( + |e: &CodeRemoved| { + info!(target : "contracts", "Received ContractCodeRemoved event {:?}", e); + e.code_hash.eq(&code_hash) + }, + BlockStatus::Finalized, + ) + .await + }); - let _block_hash = send_xt(&connection, xt, Some("remove_code"), XtStatus::InBlock); + let _tx_info = signed_connection + .remove_code(code_hash, TxStatus::InBlock) + .await?; - let contract_removed_event: ContractCodeRemovedEvent = wait_for_event( - &connection, - ("Contracts", "CodeRemoved"), - |e: ContractCodeRemovedEvent| { - info!(target : "contracts", "Received ContractCodeRemoved event {:?}", e); - e.code_hash.eq(&code_hash) - }, - )?; + let contract_removed_event = event_handler.await?; Ok(contract_removed_event) } fn load_metadata(path: &Path) -> anyhow::Result { - let file = File::open(&path).expect("Failed to open metadata file"); + let file = File::open(path).expect("Failed to open metadata file"); let metadata: ContractMetadata = serde_json::from_reader(file).expect("Failed to deserialize metadata file"); let ink_metadata = serde_json::from_value(serde_json::Value::Object(metadata.abi)) .expect("Failed to deserialize ink project metadata"); - if let ink_metadata::MetadataVersioned::V3(ink_project) = ink_metadata { - Ok(ink_project) - } else { - Err(anyhow!("Unsupported ink metadata version. Expected V3")) - } + Ok(ink_metadata) } diff --git a/bin/cliain/src/finalization.rs b/bin/cliain/src/finalization.rs index 278f007858..9f3833c313 100644 --- a/bin/cliain/src/finalization.rs +++ b/bin/cliain/src/finalization.rs @@ -1,25 +1,31 @@ use std::str::FromStr; use aleph_client::{ - emergency_finalize, finalization_set_emergency_finalizer, AlephKeyPair, BlockHash, BlockNumber, - SignedConnection, + pallets::aleph::{AlephRpc, AlephSudoApi}, + AccountId, AlephKeyPair, Connection, TxStatus, }; -use substrate_api_client::{AccountId, XtStatus}; +use primitives::{BlockHash, BlockNumber}; use crate::RootConnection; /// Sets the emergency finalized, the provided string should be the seed phrase of the desired finalizer. -pub fn set_emergency_finalizer(connection: RootConnection, finalizer: AccountId) { - finalization_set_emergency_finalizer(&connection, finalizer, XtStatus::Finalized) +pub async fn set_emergency_finalizer(connection: RootConnection, finalizer: AccountId) { + connection + .set_emergency_finalizer(finalizer, TxStatus::Finalized) + .await + .unwrap(); } /// Finalizes the given block using the key pair from provided seed as emergency finalizer. -pub fn finalize( - connection: SignedConnection, +pub async fn finalize( + connection: Connection, number: BlockNumber, hash: String, key_pair: AlephKeyPair, ) { let hash = BlockHash::from_str(&hash).expect("Hash is properly hex encoded"); - emergency_finalize(&connection, number, hash, key_pair).unwrap(); + connection + .emergency_finalize(number, hash, key_pair) + .await + .unwrap(); } diff --git a/bin/cliain/src/keys.rs b/bin/cliain/src/keys.rs index 9bfdad0f19..ae341fccbd 100644 --- a/bin/cliain/src/keys.rs +++ b/bin/cliain/src/keys.rs @@ -1,45 +1,55 @@ use aleph_client::{ - get_next_session_keys, rotate_keys as rotate, rotate_keys_raw_result, set_keys as set, - staking_bond, Connection, RootConnection, SessionKeys, SignedConnection, + aleph_runtime::SessionKeys, + pallets::{ + author::AuthorRpc, + session::{SessionApi, SessionUserApi}, + staking::StakingUserApi, + }, + AccountId, Connection, RootConnection, SignedConnection, TxStatus, }; use hex::ToHex; use log::{error, info}; use primitives::staking::MIN_VALIDATOR_BOND; use serde_json::json; -use sp_core::crypto::Ss58Codec; -use substrate_api_client::{AccountId, XtStatus}; +use subxt::ext::sp_core::crypto::Ss58Codec; -pub fn prepare_keys(connection: RootConnection, controller_account_id: AccountId) { - staking_bond( - &connection.as_signed(), - MIN_VALIDATOR_BOND, - &controller_account_id, - XtStatus::Finalized, - ); - let new_keys = rotate(&connection).expect("Failed to retrieve keys"); - set(&connection.as_signed(), new_keys, XtStatus::Finalized); +pub async fn prepare_keys( + connection: RootConnection, + controller_account_id: AccountId, +) -> anyhow::Result<()> { + connection + .bond( + MIN_VALIDATOR_BOND, + controller_account_id, + TxStatus::Finalized, + ) + .await + .unwrap(); + let new_keys = connection.author_rotate_keys().await?; + connection.set_keys(new_keys, TxStatus::Finalized).await?; + Ok(()) } -pub fn set_keys(connection: SignedConnection, new_keys: String) { - set( - &connection, - SessionKeys::try_from(new_keys).expect("Failed to parse keys"), - XtStatus::InBlock, - ); +pub async fn set_keys(connection: SignedConnection, new_keys: String) { + connection + .set_keys(SessionKeys::try_from(new_keys).unwrap(), TxStatus::InBlock) + .await + .unwrap(); } -pub fn rotate_keys(connection: Connection) { - let new_keys = rotate_keys_raw_result(&connection).expect("Failed to retrieve keys"); +pub async fn rotate_keys(connection: Connection) { + let new_keys = connection.author_rotate_keys().await; + info!("Rotated keys: {:?}", new_keys); } -pub fn next_session_keys(connection: &Connection, account_id: String) { +pub async fn next_session_keys(connection: Connection, account_id: String) { let account_id = AccountId::from_ss58check(&account_id).expect("Address is valid"); - match get_next_session_keys(connection, account_id) { + match connection.get_next_session_keys(account_id, None).await { Some(keys) => { let keys_json = json!({ - "aura": "0x".to_owned() + keys.aura.encode_hex::().as_str(), - "aleph": "0x".to_owned() + keys.aleph.encode_hex::().as_str(), + "aura": "0x".to_owned() + keys.aura.0.0.encode_hex::().as_str(), + "aleph": "0x".to_owned() + keys.aleph.0.0.encode_hex::().as_str(), }); println!("{}", serde_json::to_string_pretty(&keys_json).unwrap()); } diff --git a/bin/cliain/src/lib.rs b/bin/cliain/src/lib.rs index b69fea25fd..f246fd341b 100644 --- a/bin/cliain/src/lib.rs +++ b/bin/cliain/src/lib.rs @@ -1,3 +1,5 @@ +extern crate core; + mod commands; mod contracts; mod finalization; @@ -8,11 +10,10 @@ mod staking; mod transfer; mod treasury; mod validators; +mod version_upgrade; mod vesting; -use aleph_client::{ - create_connection, keypair_from_string, Connection, RootConnection, SignedConnection, -}; +use aleph_client::{keypair_from_string, Connection, RootConnection, SignedConnection}; pub use commands::Command; pub use contracts::{ call, instantiate, instantiate_with_code, owner_info, remove_code, upload_code, @@ -27,6 +28,7 @@ pub use treasury::{ approve as treasury_approve, propose as treasury_propose, reject as treasury_reject, }; pub use validators::change_validators; +pub use version_upgrade::schedule_upgrade; pub use vesting::{vest, vest_other, vested_transfer}; pub struct ConnectionConfig { @@ -41,23 +43,18 @@ impl ConnectionConfig { signer_seed, } } -} -impl From for Connection { - fn from(cfg: ConnectionConfig) -> Self { - create_connection(cfg.node_endpoint.as_str()) + pub async fn get_connection(&self) -> Connection { + Connection::new(&self.node_endpoint).await } -} -impl From for SignedConnection { - fn from(cfg: ConnectionConfig) -> Self { - let key = keypair_from_string(&cfg.signer_seed); - SignedConnection::new(cfg.node_endpoint.as_str(), key) + pub async fn get_signed_connection(&self) -> SignedConnection { + SignedConnection::new(&self.node_endpoint, keypair_from_string(&self.signer_seed)).await } -} -impl From for RootConnection { - fn from(cfg: ConnectionConfig) -> Self { - RootConnection::from(Into::::into(cfg)) + pub async fn get_root_connection(&self) -> RootConnection { + RootConnection::new(&self.node_endpoint, keypair_from_string(&self.signer_seed)) + .await + .expect("signer should be root") } } diff --git a/bin/cliain/src/main.rs b/bin/cliain/src/main.rs index 74338c9384..ff06959770 100644 --- a/bin/cliain/src/main.rs +++ b/bin/cliain/src/main.rs @@ -1,25 +1,21 @@ use std::env; -use aleph_client::{ - account_from_keypair, aleph_keypair_from_string, keypair_from_string, print_storages, - Connection, -}; +use aleph_client::{account_from_keypair, aleph_keypair_from_string, keypair_from_string, Pair}; use clap::Parser; use cliain::{ bond, call, change_validators, finalize, force_new_era, instantiate, instantiate_with_code, next_session_keys, nominate, owner_info, prepare_keys, prompt_password_hidden, remove_code, - rotate_keys, set_emergency_finalizer, set_keys, set_staking_limits, transfer, treasury_approve, - treasury_propose, treasury_reject, update_runtime, upload_code, validate, vest, vest_other, - vested_transfer, Command, ConnectionConfig, + rotate_keys, schedule_upgrade, set_emergency_finalizer, set_keys, set_staking_limits, transfer, + treasury_approve, treasury_propose, treasury_reject, update_runtime, upload_code, validate, + vest, vest_other, vested_transfer, Command, ConnectionConfig, }; use log::{error, info}; -use sp_core::Pair; #[derive(Debug, Parser, Clone)] #[clap(version = "1.0")] struct Config { /// WS endpoint address of the node to connect to - #[clap(long, default_value = "127.0.0.1:9944")] + #[clap(long, default_value = "ws://127.0.0.1:9944")] pub node: String, /// The seed of the key to use for signing calls. @@ -42,7 +38,6 @@ fn read_seed(command: &Command, seed: Option) -> String { } | Command::NextSessionKeys { account_id: _ } | Command::RotateKeys - | Command::DebugStorage | Command::SeedToSS58 { input: _ } | Command::ContractOwnerInfo { .. } => String::new(), _ => read_secret(seed, "Provide seed for the signer account:"), @@ -62,7 +57,8 @@ fn read_secret(secret: Option, message: &str) -> String { } } -fn main() { +#[tokio::main] +async fn main() -> anyhow::Result<()> { init_env(); let Config { @@ -76,16 +72,23 @@ fn main() { match command { Command::ChangeValidators { change_validators_args, - } => change_validators(cfg.into(), change_validators_args), + } => change_validators(cfg.get_root_connection().await, change_validators_args).await, Command::PrepareKeys => { let key = keypair_from_string(&seed); - let controller_account_id = account_from_keypair(&key); - prepare_keys(cfg.into(), controller_account_id); + let controller_account_id = account_from_keypair(key.signer()); + prepare_keys(cfg.get_root_connection().await, controller_account_id).await? } Command::Bond { controller_account, initial_stake_tokens, - } => bond(cfg.into(), initial_stake_tokens, controller_account), + } => { + bond( + cfg.get_signed_connection().await, + initial_stake_tokens, + controller_account, + ) + .await + } Command::Finalize { block, hash, @@ -93,71 +96,102 @@ fn main() { } => { let finalizer_seed = read_secret(finalizer_seed, "Provide finalizer seed:"); let finalizer = aleph_keypair_from_string(&finalizer_seed); - finalize(cfg.into(), block, hash, finalizer); + finalize(cfg.get_connection().await, block, hash, finalizer).await; } Command::SetEmergencyFinalizer { finalizer_seed } => { let finalizer_seed = read_secret(finalizer_seed, "Provide finalizer seed:"); let finalizer = aleph_keypair_from_string(&finalizer_seed); let finalizer = account_from_keypair(&finalizer); - set_emergency_finalizer(cfg.into(), finalizer); + set_emergency_finalizer(cfg.get_root_connection().await, finalizer).await; + } + Command::SetKeys { new_keys } => { + set_keys(cfg.get_signed_connection().await, new_keys).await } - Command::SetKeys { new_keys } => set_keys(cfg.into(), new_keys), Command::Validate { commission_percentage, - } => validate(cfg.into(), commission_percentage), + } => validate(cfg.get_signed_connection().await, commission_percentage).await, Command::Transfer { amount_in_tokens, to_account, - } => transfer(cfg.into(), amount_in_tokens, to_account), + } => { + transfer( + cfg.get_signed_connection().await, + amount_in_tokens, + to_account, + ) + .await + } Command::TreasuryPropose { amount_in_tokens, beneficiary, - } => treasury_propose(cfg.into(), amount_in_tokens, beneficiary), - Command::TreasuryApprove { proposal_id } => treasury_approve(cfg.into(), proposal_id), - Command::TreasuryReject { proposal_id } => treasury_reject(cfg.into(), proposal_id), - Command::RotateKeys => rotate_keys(cfg.into()), - Command::NextSessionKeys { account_id } => next_session_keys(&cfg.into(), account_id), + } => { + treasury_propose( + cfg.get_signed_connection().await, + amount_in_tokens, + beneficiary, + ) + .await + } + Command::TreasuryApprove { proposal_id } => { + treasury_approve(cfg.get_root_connection().await, proposal_id).await + } + Command::TreasuryReject { proposal_id } => { + treasury_reject(cfg.get_root_connection().await, proposal_id).await + } + Command::RotateKeys => rotate_keys(cfg.get_connection().await).await, + Command::NextSessionKeys { account_id } => { + next_session_keys(cfg.get_connection().await, account_id).await + } Command::SetStakingLimits { minimal_nominator_stake, minimal_validator_stake, max_nominators_count, max_validators_count, - } => set_staking_limits( - cfg.into(), - minimal_nominator_stake, - minimal_validator_stake, - max_nominators_count, - max_validators_count, - ), + } => { + set_staking_limits( + cfg.get_root_connection().await, + minimal_nominator_stake, + minimal_validator_stake, + max_nominators_count, + max_validators_count, + ) + .await + } Command::ForceNewEra => { - force_new_era(cfg.into()); + force_new_era(cfg.get_root_connection().await).await; } Command::SeedToSS58 { input } => { let input = read_secret(input, "Provide seed:"); info!( "SS58 Address: {}", - keypair_from_string(&input).public().to_string() + keypair_from_string(&input).signer().public().to_string() ) } - Command::DebugStorage => print_storages::(&cfg.into()), - Command::UpdateRuntime { runtime } => update_runtime(cfg.into(), runtime), - Command::Vest => vest(cfg.into()), - Command::VestOther { vesting_account } => vest_other(cfg.into(), vesting_account), + Command::UpdateRuntime { runtime } => { + update_runtime(cfg.get_root_connection().await, runtime).await + } + Command::Vest => vest(cfg.get_signed_connection().await).await, + Command::VestOther { vesting_account } => { + vest_other(cfg.get_signed_connection().await, vesting_account).await + } Command::VestedTransfer { to_account, amount_in_tokens, per_block, starting_block, - } => vested_transfer( - cfg.into(), - to_account, - amount_in_tokens, - per_block, - starting_block, - ), - Command::Nominate { nominee } => nominate(cfg.into(), nominee), + } => { + vested_transfer( + cfg.get_signed_connection().await, + to_account, + amount_in_tokens, + per_block, + starting_block, + ) + .await + } + Command::Nominate { nominee } => nominate(cfg.get_signed_connection().await, nominee).await, Command::ContractInstantiateWithCode(command) => { - match instantiate_with_code(cfg.into(), command) { + match instantiate_with_code(cfg.get_signed_connection().await, command).await { Ok(result) => println!( "{}", serde_json::to_string(&result).expect("Can't encode the result as JSON") @@ -165,24 +199,53 @@ fn main() { Err(why) => error!("Contract deployment failed {:?}", why), }; } - Command::ContractUploadCode(command) => match upload_code(cfg.into(), command) { - Ok(result) => println!("{:?}", result), - Err(why) => error!("Contract upload failed {:?}", why), - }, - Command::ContractCall(command) => match call(cfg.into(), command) { - Ok(result) => println!("{:?}", result), - Err(why) => error!("Contract call failed {:?}", why), - }, - Command::ContractInstantiate(command) => match instantiate(cfg.into(), command) { - Ok(result) => println!("{:?}", result), - Err(why) => error!("Contract instantiate failed {:?}", why), - }, - Command::ContractOwnerInfo(command) => println!("{:#?}", owner_info(cfg.into(), command)), - Command::ContractRemoveCode(command) => match remove_code(cfg.into(), command) { - Ok(result) => println!("{:?}", result), - Err(why) => error!("Contract remove code failed {:?}", why), + Command::ContractUploadCode(command) => { + match upload_code(cfg.get_signed_connection().await, command).await { + Ok(result) => println!("{:?}", result), + Err(why) => error!("Contract upload failed {:?}", why), + } + } + Command::ContractCall(command) => { + match call(cfg.get_signed_connection().await, command).await { + Ok(result) => println!("{:?}", result), + Err(why) => error!("Contract call failed {:?}", why), + } + } + Command::ContractInstantiate(command) => { + match instantiate(cfg.get_signed_connection().await, command).await { + Ok(result) => println!("{:?}", result), + Err(why) => error!("Contract instantiate failed {:?}", why), + } + } + Command::ContractOwnerInfo(command) => { + println!( + "{:#?}", + owner_info(cfg.get_connection().await, command).await + ) + } + Command::ContractRemoveCode(command) => { + match remove_code(cfg.get_signed_connection().await, command).await { + Ok(result) => println!("{:?}", result), + Err(why) => error!("Contract remove code failed {:?}", why), + } + } + Command::VersionUpgradeSchedule { + version, + session: session_for_upgrade, + expected_state, + } => match schedule_upgrade( + cfg.get_root_connection().await, + version, + session_for_upgrade, + expected_state, + ) + .await + { + Ok(_) => {} + Err(why) => error!("Unable to schedule an upgrade {:?}", why), }, } + Ok(()) } fn init_env() { diff --git a/bin/cliain/src/runtime.rs b/bin/cliain/src/runtime.rs index b1628ae715..5ce32a3727 100644 --- a/bin/cliain/src/runtime.rs +++ b/bin/cliain/src/runtime.rs @@ -1,9 +1,11 @@ use std::fs; -use aleph_client::{set_code, RootConnection}; -use substrate_api_client::XtStatus; +use aleph_client::{pallets::system::SystemSudoApi, RootConnection, TxStatus}; -pub fn update_runtime(connection: RootConnection, runtime: String) { +pub async fn update_runtime(connection: RootConnection, runtime: String) { let runtime = fs::read(runtime).expect("Runtime file not found"); - set_code(&connection, runtime, XtStatus::InBlock); + connection + .set_code(runtime, TxStatus::InBlock) + .await + .unwrap(); } diff --git a/bin/cliain/src/staking.rs b/bin/cliain/src/staking.rs index f1daa139e4..f5670f135d 100644 --- a/bin/cliain/src/staking.rs +++ b/bin/cliain/src/staking.rs @@ -1,12 +1,11 @@ use aleph_client::{ - staking_bond, staking_force_new_era, staking_nominate, staking_set_staking_limits, - staking_validate, RootConnection, SignedConnection, + pallets::staking::{StakingSudoApi, StakingUserApi}, + AccountId, Balance, RootConnection, SignedConnection, TxStatus, }; use primitives::TOKEN; -use sp_core::crypto::Ss58Codec; -use substrate_api_client::{AccountId, XtStatus}; +use subxt::ext::sp_core::crypto::Ss58Codec; -pub fn bond( +pub async fn bond( stash_connection: SignedConnection, initial_stake_in_tokens: u32, controller_account: String, @@ -14,41 +13,50 @@ pub fn bond( let controller_account = AccountId::from_ss58check(&controller_account).expect("Address is valid"); - let initial_stake = initial_stake_in_tokens as u128 * TOKEN; - staking_bond( - &stash_connection, - initial_stake, - &controller_account, - XtStatus::Finalized, - ); + let initial_stake = initial_stake_in_tokens as Balance * TOKEN; + stash_connection + .bond(initial_stake, controller_account, TxStatus::Finalized) + .await + .unwrap(); } -pub fn validate(connection: SignedConnection, commission_percentage: u8) { - staking_validate(&connection, commission_percentage, XtStatus::Finalized); +pub async fn validate(connection: SignedConnection, commission_percentage: u8) { + connection + .validate(commission_percentage, TxStatus::Finalized) + .await + .unwrap(); } -pub fn nominate(connection: SignedConnection, nominee: String) { +pub async fn nominate(connection: SignedConnection, nominee: String) { let nominee_account = AccountId::from_ss58check(&nominee).expect("Address is valid"); - staking_nominate(&connection, &nominee_account); + connection + .nominate(nominee_account, TxStatus::InBlock) + .await + .unwrap(); } -pub fn set_staking_limits( +pub async fn set_staking_limits( root_connection: RootConnection, minimal_nominator_stake_tokens: u64, minimal_validator_stake_tokens: u64, max_nominators_count: Option, max_validators_count: Option, ) { - staking_set_staking_limits( - &root_connection, - minimal_nominator_stake_tokens as u128 * TOKEN, - minimal_validator_stake_tokens as u128 * TOKEN, - max_nominators_count, - max_validators_count, - XtStatus::Finalized, - ); + root_connection + .set_staking_config( + Some(minimal_nominator_stake_tokens as Balance * TOKEN), + Some(minimal_validator_stake_tokens as Balance * TOKEN), + max_nominators_count, + max_validators_count, + TxStatus::Finalized, + ) + .await + .unwrap(); } -pub fn force_new_era(root_connection: RootConnection) { - staking_force_new_era(&root_connection, XtStatus::Finalized); +pub async fn force_new_era(root_connection: RootConnection) { + root_connection + .force_new_era(TxStatus::Finalized) + .await + .unwrap(); } diff --git a/bin/cliain/src/transfer.rs b/bin/cliain/src/transfer.rs index 565fab1940..9b0d607b19 100644 --- a/bin/cliain/src/transfer.rs +++ b/bin/cliain/src/transfer.rs @@ -1,14 +1,17 @@ -use aleph_client::{balances_transfer, SignedConnection}; +use aleph_client::{ + pallets::balances::BalanceUserApi, AccountId, Balance, SignedConnection, TxStatus, +}; use primitives::TOKEN; -use sp_core::crypto::Ss58Codec; -use substrate_api_client::{AccountId, XtStatus}; +use subxt::ext::sp_core::crypto::Ss58Codec; -pub fn transfer(connection: SignedConnection, amount_in_tokens: u64, to_account: String) { +pub async fn transfer(connection: SignedConnection, amount_in_tokens: u64, to_account: String) { let to_account = AccountId::from_ss58check(&to_account).expect("Address is valid"); - balances_transfer( - &connection, - &to_account, - amount_in_tokens as u128 * TOKEN, - XtStatus::Finalized, - ); + connection + .transfer( + to_account, + amount_in_tokens as Balance * TOKEN, + TxStatus::Finalized, + ) + .await + .unwrap(); } diff --git a/bin/cliain/src/treasury.rs b/bin/cliain/src/treasury.rs index 51b1948d9c..f62f463cc9 100644 --- a/bin/cliain/src/treasury.rs +++ b/bin/cliain/src/treasury.rs @@ -1,28 +1,31 @@ use aleph_client::{ - approve_treasury_proposal, make_treasury_proposal, reject_treasury_proposal, RootConnection, - SignedConnection, + pallets::treasury::{TreasurySudoApi, TreasuryUserApi}, + AccountId, RootConnection, SignedConnection, TxStatus, }; use primitives::{Balance, TOKEN}; -use sp_core::crypto::Ss58Codec; -use substrate_api_client::AccountId; +use subxt::ext::sp_core::crypto::Ss58Codec; /// Delegates to `aleph_client::make_treasury_proposal`. -pub fn propose(connection: SignedConnection, amount_in_tokens: u64, beneficiary: String) { +pub async fn propose(connection: SignedConnection, amount_in_tokens: u64, beneficiary: String) { let beneficiary = AccountId::from_ss58check(&beneficiary).expect("Address should be valid"); let endowment = amount_in_tokens as Balance * TOKEN; - make_treasury_proposal(&connection, endowment, &beneficiary) - .expect("Should successfully make a proposal"); + connection + .propose_spend(endowment, beneficiary, TxStatus::Finalized) + .await + .unwrap(); } /// Delegates to `aleph_client::approve_treasury_proposal`. -pub fn approve(connection: RootConnection, proposal_id: u32) { - approve_treasury_proposal(&connection, proposal_id) - .expect("Should successfully approve the proposal") +pub async fn approve(connection: RootConnection, proposal_id: u32) { + TreasurySudoApi::approve(&connection, proposal_id, TxStatus::Finalized) + .await + .unwrap(); } /// Delegates to `aleph_client::reject_treasury_proposal`. -pub fn reject(connection: RootConnection, proposal_id: u32) { - reject_treasury_proposal(&connection, proposal_id) - .expect("Should successfully reject the proposal") +pub async fn reject(connection: RootConnection, proposal_id: u32) { + TreasurySudoApi::reject(&connection, proposal_id, TxStatus::Finalized) + .await + .unwrap(); } diff --git a/bin/cliain/src/validators.rs b/bin/cliain/src/validators.rs index 0f735ff4f8..966df1c245 100644 --- a/bin/cliain/src/validators.rs +++ b/bin/cliain/src/validators.rs @@ -1,20 +1,28 @@ -use aleph_client::RootConnection; -use substrate_api_client::XtStatus; +use aleph_client::{ + pallets::elections::ElectionsSudoApi, primitives::CommitteeSeats, RootConnection, TxStatus, +}; use crate::commands::ChangeValidatorArgs; /// Change validators to the provided list by calling the provided node. -pub fn change_validators( +pub async fn change_validators( root_connection: RootConnection, change_validator_args: ChangeValidatorArgs, ) { - aleph_client::change_validators( - &root_connection, - change_validator_args.reserved_validators, - change_validator_args.non_reserved_validators, - change_validator_args.committee_size, - XtStatus::Finalized, - ); + root_connection + .change_validators( + change_validator_args.reserved_validators, + change_validator_args.non_reserved_validators, + change_validator_args + .committee_size + .map(|s| CommitteeSeats { + reserved_seats: s.reserved_seats, + non_reserved_seats: s.non_reserved_seats, + }), + TxStatus::Finalized, + ) + .await + .unwrap(); // TODO we need to check state here whether change members actually succeed // not only here, but for all cliain commands // see https://cardinal-cryptography.atlassian.net/browse/AZ-699 diff --git a/bin/cliain/src/version_upgrade.rs b/bin/cliain/src/version_upgrade.rs new file mode 100644 index 0000000000..011041ac13 --- /dev/null +++ b/bin/cliain/src/version_upgrade.rs @@ -0,0 +1,17 @@ +use aleph_client::{pallets::aleph::AlephSudoApi, RootConnection}; +use primitives::SessionIndex; + +use crate::commands::{ExtrinsicState, Version}; + +pub async fn schedule_upgrade( + connection: RootConnection, + version: Version, + session_for_upgrade: SessionIndex, + expected_state: ExtrinsicState, +) -> anyhow::Result<()> { + connection + .schedule_finality_version_change(version, session_for_upgrade, expected_state.into()) + .await?; + + Ok(()) +} diff --git a/bin/cliain/src/vesting.rs b/bin/cliain/src/vesting.rs index 2c8a73967f..a39a563cc5 100644 --- a/bin/cliain/src/vesting.rs +++ b/bin/cliain/src/vesting.rs @@ -1,14 +1,15 @@ use aleph_client::{ - account_from_keypair, keypair_from_string, BlockNumber, SignedConnection, VestingSchedule, + account_from_keypair, keypair_from_string, pallet_vesting::vesting_info::VestingInfo, + pallets::vesting::VestingUserApi, SignedConnection, TxStatus, }; use log::{error, info}; -use primitives::{Balance, TOKEN}; +use primitives::{Balance, BlockNumber, TOKEN}; /// Delegates to `aleph_client::vest`. /// /// Vesting is performed for the signer of `connection`. -pub fn vest(connection: SignedConnection) { - match aleph_client::vest(connection) { +pub async fn vest(connection: SignedConnection) { + match connection.vest(TxStatus::Finalized).await { Ok(_) => info!("Vesting has succeeded"), Err(e) => error!("Vesting has failed with:\n {:?}", e), } @@ -17,9 +18,9 @@ pub fn vest(connection: SignedConnection) { /// Delegates to `aleph_client::vest_other`. /// /// Vesting is performed by the signer of `connection` for `vesting_account_seed`. -pub fn vest_other(connection: SignedConnection, vesting_account_seed: String) { - let vester = account_from_keypair(&keypair_from_string(vesting_account_seed.as_str())); - match aleph_client::vest_other(connection, vester) { +pub async fn vest_other(connection: SignedConnection, vesting_account_seed: String) { + let vester = account_from_keypair(keypair_from_string(vesting_account_seed.as_str()).signer()); + match connection.vest_other(TxStatus::Finalized, vester).await { Ok(_) => info!("Vesting on behalf has succeeded"), Err(e) => error!("Vesting on behalf has failed with:\n {:?}", e), } @@ -30,17 +31,23 @@ pub fn vest_other(connection: SignedConnection, vesting_account_seed: String) { /// The transfer is performed from the signer of `connection` to `target_seed`. /// `amount_in_tokens`, `per_block` and `starting_block` corresponds to the fields of /// `aleph_client::VestingSchedule` struct. -pub fn vested_transfer( +pub async fn vested_transfer( connection: SignedConnection, target_seed: String, amount_in_tokens: u64, per_block: Balance, starting_block: BlockNumber, ) { - let receiver = account_from_keypair(&keypair_from_string(target_seed.as_str())); - let schedule = - VestingSchedule::new(amount_in_tokens as u128 * TOKEN, per_block, starting_block); - match aleph_client::vested_transfer(connection, receiver, schedule) { + let receiver = account_from_keypair(keypair_from_string(target_seed.as_str()).signer()); + let schedule = VestingInfo { + locked: amount_in_tokens as Balance * TOKEN, + per_block, + starting_block, + }; + match connection + .vested_transfer(receiver, schedule, TxStatus::Finalized) + .await + { Ok(_) => info!("Vested transfer has succeeded"), Err(e) => error!("Vested transfer has failed with:\n {:?}", e), } diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index 502a01c86c..debd6bfd77 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-node" -version = "0.8.0" +version = "0.9.0" authors = ["Cardinal Cryptography"] description = "Aleph node binary" edition = "2021" @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"] name = "aleph-node" [dependencies] -clap = { version = "3.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } log = "0.4" serde = "1.0" @@ -24,52 +23,54 @@ serde_json = "1.0" futures = "0.3" hex = "0.4" hex-literal = "0.3" -libp2p = "0.44" +libp2p = "0.49.0" thiserror = "1.0" -sp-application-crypto = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-chain-spec = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28"} -sc-cli = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["wasmtime"] } -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-executor = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["wasmtime"] } -sc-service = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["wasmtime"] } -sc-telemetry = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-inherents = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-basic-authorship = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-network = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-transaction-pool-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-client-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-timestamp = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -try-runtime-cli = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", optional = true } +sp-application-crypto = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-chain-spec = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38"} +sc-cli = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-executor = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-service = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-telemetry = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-inherents = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-basic-authorship = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-network = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-transaction-pool-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-client-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-timestamp = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +try-runtime-cli = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", optional = true } +sc-consensus-slots = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-arithmetic = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-io = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } aleph-runtime = { path = "../runtime" } finality-aleph = { path = "../../finality-aleph" } aleph-primitives = { package = "primitives", path = "../../primitives" } # These dependencies are used for the node's RPCs -jsonrpsee = { version = "0.15.1", features = ["server"] } -sc-rpc = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-rpc-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-blockchain = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -substrate-frame-rpc-system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-contracts-rpc = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-transaction-payment-rpc = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +jsonrpsee = { version = "0.16.2", features = ["server"] } +sc-rpc = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-rpc-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-blockchain = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +substrate-frame-rpc-system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-transaction-payment-rpc = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +substrate-build-script-utils = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [features] default = [] @@ -79,7 +80,7 @@ short_session = [ ] try-runtime = [ "aleph-runtime/try-runtime", - "try-runtime-cli", + "try-runtime-cli/try-runtime", ] enable_treasury_proposals = [ "aleph-runtime/enable_treasury_proposals" diff --git a/bin/node/src/aleph_cli.rs b/bin/node/src/aleph_cli.rs index c43c3e336f..76d3a0539b 100644 --- a/bin/node/src/aleph_cli.rs +++ b/bin/node/src/aleph_cli.rs @@ -1,8 +1,9 @@ use std::path::PathBuf; use aleph_primitives::DEFAULT_UNIT_CREATION_DELAY; -use clap::{ArgGroup, Parser}; use finality_aleph::UnitCreationDelay; +use log::warn; +use sc_cli::clap::{self, ArgGroup, Parser}; #[derive(Debug, Parser, Clone)] #[clap(group(ArgGroup::new("backup")))] @@ -33,6 +34,18 @@ pub struct AlephCli { /// with `--no-backup`, but note that that limits crash recoverability. #[clap(long, value_name = "PATH", group = "backup")] backup_path: Option, + + /// The maximum number of nonfinalized blocks, after which block production should be locally + /// stopped. DO NOT CHANGE THIS, PRODUCING MORE OR FEWER BLOCKS MIGHT BE CONSIDERED MALICIOUS + /// BEHAVIOUR AND PUNISHED ACCORDINGLY! + #[clap(long, default_value_t = 20)] + max_nonfinalized_blocks: u32, + + /// Experimental flag, allows pruning + /// + /// TURNING THIS FLAG ON, CAN LEAD TO MALICIOUS BEHAVIOUR AND CAN BE PUNISHED ACCORDINGLY! + #[clap(long, default_value_t = false)] + experimental_pruning: bool, } impl AlephCli { @@ -55,4 +68,15 @@ impl AlephCli { pub fn no_backup(&self) -> bool { self.no_backup } + + pub fn max_nonfinalized_blocks(&self) -> u32 { + if self.max_nonfinalized_blocks != 20 { + warn!("Running block production with a value of max-nonfinalized-blocks {}, which is not the default of 20. THIS MIGHT BE CONSIDERED MALICIOUS BEHAVIOUR AND RESULT IN PENALTIES!", self.max_nonfinalized_blocks); + } + self.max_nonfinalized_blocks + } + + pub fn experimental_pruning(&self) -> bool { + self.experimental_pruning + } } diff --git a/bin/node/src/chain_spec.rs b/bin/node/src/chain_spec.rs index d654ebb794..269b57208b 100644 --- a/bin/node/src/chain_spec.rs +++ b/bin/node/src/chain_spec.rs @@ -1,16 +1,21 @@ -use std::{collections::HashSet, str::FromStr}; +use std::{collections::HashSet, str::FromStr, string::ToString}; use aleph_primitives::{ staking::{MIN_NOMINATOR_BOND, MIN_VALIDATOR_BOND}, - AuthorityId as AlephId, ADDRESSES_ENCODING, TOKEN, TOKEN_DECIMALS, + AuthorityId as AlephId, Version as FinalityVersion, ADDRESSES_ENCODING, + LEGACY_FINALITY_VERSION, TOKEN, TOKEN_DECIMALS, }; use aleph_runtime::{ - AccountId, AuraConfig, BalancesConfig, ElectionsConfig, GenesisConfig, Perbill, SessionConfig, - SessionKeys, StakingConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, + AccountId, AlephConfig, AuraConfig, BalancesConfig, ElectionsConfig, GenesisConfig, Perbill, + SessionConfig, SessionKeys, StakingConfig, SudoConfig, SystemConfig, VestingConfig, + WASM_BINARY, }; -use clap::Args; use libp2p::PeerId; use pallet_staking::{Forcing, StakerStatus}; +use sc_cli::{ + clap::{self, Args}, + Error as CliError, +}; use sc_service::ChainType; use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; use serde_json::{Number, Value}; @@ -75,17 +80,17 @@ pub fn account_id_from_string(seed: &str) -> AccountId { } /// Generate AccountId based on string command line argument. -fn parse_account_id(s: &str) -> AccountId { - AccountId::from_string(s).expect("Passed string is not a hex encoding of a public key") +fn parse_account_id(s: &str) -> Result { + Ok(AccountId::from_string(s).expect("Passed string is not a hex encoding of a public key")) } -fn parse_chaintype(s: &str) -> ChainType { - match s { +fn parse_chaintype(s: &str) -> Result { + Ok(match s { CHAINTYPE_DEV => ChainType::Development, CHAINTYPE_LOCAL => ChainType::Local, CHAINTYPE_LIVE => ChainType::Live, s => panic!("Wrong chain type {} Possible values: dev local live", s), - } + }) } #[derive(Clone, Deserialize, Serialize)] @@ -103,36 +108,40 @@ fn to_account_ids(authorities: &[AuthorityKeys]) -> impl Iterator, /// AccountId of the sudo account - #[clap(long, parse(from_str = parse_account_id), default_value(DEFAULT_SUDO_ACCOUNT))] + #[arg(long, value_parser = parse_account_id, default_value(DEFAULT_SUDO_ACCOUNT))] sudo_account_id: AccountId, /// AccountId of the optional faucet account - #[clap(long, parse(from_str = parse_account_id))] + #[arg(long, value_parser = parse_account_id)] faucet_account_id: Option, /// Minimum number of stakers before chain enters emergency state. - #[clap(long, default_value = "4")] + #[arg(long, default_value = "4")] min_validator_count: u32, + + /// Finality version at chain inception. + #[arg(long, default_value = LEGACY_FINALITY_VERSION.to_string())] + finality_version: FinalityVersion, } impl ChainParams { @@ -167,6 +176,10 @@ impl ChainParams { pub fn min_validator_count(&self) -> u32 { self.min_validator_count } + + pub fn finality_version(&self) -> FinalityVersion { + self.finality_version + } } fn system_properties(token_symbol: String) -> serde_json::map::Map { @@ -215,6 +228,7 @@ fn generate_chain_spec_config( let sudo_account = chain_params.sudo_account_id(); let faucet_account = chain_params.faucet_account_id(); let min_validator_count = chain_params.min_validator_count(); + let finality_version = chain_params.finality_version(); Ok(ChainSpec::from_genesis( // Name @@ -230,6 +244,7 @@ fn generate_chain_spec_config( faucet_account.clone(), // Pre-funded faucet account controller_accounts.clone(), // Controller accounts for staking. min_validator_count, + finality_version, ) }, // Bootnodes @@ -332,6 +347,7 @@ fn generate_genesis_config( faucet_account: Option, controller_accounts: Vec, min_validator_count: u32, + finality_version: FinalityVersion, ) -> GenesisConfig { let special_accounts = match faucet_account { Some(faucet_id) => vec![sudo_account.clone(), faucet_id], @@ -395,6 +411,10 @@ fn generate_genesis_config( min_nominator_bond: MIN_NOMINATOR_BOND, ..Default::default() }, + aleph: AlephConfig { + finality_version, + ..Default::default() + }, treasury: Default::default(), vesting: VestingConfig { vesting: vec![] }, nomination_pools: Default::default(), diff --git a/bin/node/src/cli.rs b/bin/node/src/cli.rs index 09ab6d54f5..3284875b6a 100644 --- a/bin/node/src/cli.rs +++ b/bin/node/src/cli.rs @@ -1,5 +1,7 @@ -use clap::{Parser, Subcommand as ClapSubcommand}; -use sc_cli::{ChainSpec, RunCmd, RuntimeVersion, SubstrateCli}; +use sc_cli::{ + clap::{self, Parser, Subcommand as ClapSubcommand}, + ChainSpec, RunCmd, RuntimeVersion, SubstrateCli, +}; use crate::{ aleph_cli::AlephCli, @@ -10,13 +12,13 @@ use crate::{ #[derive(Debug, Parser)] #[clap(subcommand_negates_reqs(true), version(env!("SUBSTRATE_CLI_IMPL_VERSION")))] pub struct Cli { - #[clap(subcommand)] + #[command(subcommand)] pub subcommand: Option, - #[clap(flatten)] + #[command(flatten)] pub aleph: AlephCli, - #[clap(flatten)] + #[command(flatten)] pub run: RunCmd, } @@ -67,7 +69,7 @@ impl SubstrateCli for Cli { #[derive(Debug, ClapSubcommand)] pub enum Subcommand { /// Key management cli utilities - #[clap(subcommand)] + #[command(subcommand)] Key(sc_cli::KeySubcommand), /// Populate authorities keystore and generate chainspec in JSON format (printed to stdout) diff --git a/bin/node/src/commands.rs b/bin/node/src/commands.rs index 046eee368f..3d9af7179a 100644 --- a/bin/node/src/commands.rs +++ b/bin/node/src/commands.rs @@ -1,5 +1,4 @@ use std::{ - ffi::OsStr, fs, io::{self, Write}, path::{Path, PathBuf}, @@ -7,9 +6,11 @@ use std::{ use aleph_primitives::AuthorityId as AlephId; use aleph_runtime::AccountId; -use clap::{Args, Parser}; use libp2p::identity::{ed25519 as libp2p_ed25519, PublicKey}; -use sc_cli::{CliConfiguration, DatabaseParams, Error, KeystoreParams, SharedParams}; +use sc_cli::{ + clap::{self, Args, Parser}, + CliConfiguration, DatabaseParams, Error, KeystoreParams, SharedParams, +}; use sc_keystore::LocalKeystore; use sc_service::{ config::{BasePath, KeystoreConfig}, @@ -28,22 +29,22 @@ use crate::chain_spec::{ pub struct NodeParams { /// For `bootstrap-node` and `purge-chain` it works with this directory as base. /// For `bootstrap-chain` the base path is appended with an account id for each node. - #[clap(long, short = 'd', value_name = "PATH", parse(from_os_str = parse_base_path))] - base_path: BasePath, + #[arg(long, short = 'd', value_name = "PATH")] + base_path: PathBuf, /// Specify filename to write node private p2p keys to /// Resulting keys will be stored at: base_path/account_id/node_key_file for each node - #[clap(long, default_value = "p2p_secret")] + #[arg(long, default_value = "p2p_secret")] node_key_file: String, /// Directory under which AlephBFT backup is stored - #[clap(long, default_value = DEFAULT_BACKUP_FOLDER)] + #[arg(long, default_value = DEFAULT_BACKUP_FOLDER)] backup_dir: String, } impl NodeParams { - pub fn base_path(&self) -> &BasePath { - &self.base_path + pub fn base_path(&self) -> BasePath { + BasePath::new(&self.base_path) } pub fn node_key_file(&self) -> &str { @@ -55,10 +56,6 @@ impl NodeParams { } } -fn parse_base_path(path: &OsStr) -> BasePath { - BasePath::new(path) -} - /// returns Aura key, if absent a new key is generated fn aura_key(keystore: &impl SyncCryptoStore) -> AuraId { SyncCryptoStore::sr25519_public_keys(keystore, key_types::AURA) @@ -85,7 +82,7 @@ fn aleph_key(keystore: &impl SyncCryptoStore) -> AlephId { fn p2p_key(node_key_path: &Path) -> SerializablePeerId { if node_key_path.exists() { let mut file_content = - hex::decode(fs::read(&node_key_path).unwrap()).expect("Failed to decode secret as hex"); + hex::decode(fs::read(node_key_path).unwrap()).expect("Failed to decode secret as hex"); let secret = libp2p_ed25519::SecretKey::from_bytes(&mut file_content).expect("Bad node key file"); let keypair = libp2p_ed25519::Keypair::from(secret); @@ -160,7 +157,7 @@ fn authority_keys( #[derive(Debug, Parser)] pub struct BootstrapChainCmd { /// Force raw genesis storage output. - #[clap(long = "raw")] + #[arg(long = "raw")] pub raw: bool, #[clap(flatten)] @@ -217,11 +214,11 @@ pub struct BootstrapNodeCmd { /// /// Expects a string with an account id (hex encoding of an sr2559 public key) /// If this argument is not passed a random account id will be generated using account-seed argument as a seed - #[clap(long)] + #[arg(long)] account_id: Option, /// Pass seed used to generate the account private key (sr2559) and the corresponding AccountId - #[clap(long, required_unless_present = "account-id")] + #[arg(long, required_unless_present = "account_id")] pub account_seed: Option, #[clap(flatten)] @@ -243,7 +240,7 @@ impl BootstrapNodeCmd { bootstrap_backup(base_path.path(), backup_dir); let chain_id = self.chain_params.chain_id(); - let keystore = open_keystore(&self.keystore_params, chain_id, base_path); + let keystore = open_keystore(&self.keystore_params, chain_id, &base_path); // Does not rely on the account id in the path let account_id = self.account_id(); @@ -272,7 +269,7 @@ impl BootstrapNodeCmd { #[derive(Debug, Parser)] pub struct ConvertChainspecToRawCmd { /// Specify path to JSON chainspec - #[clap(long, parse(from_os_str))] + #[arg(long)] pub chain: PathBuf, } @@ -305,8 +302,14 @@ pub struct PurgeChainCmd { impl PurgeChainCmd { pub fn run(&self, database_config: DatabaseSource) -> Result<(), Error> { - self.purge_chain.run(database_config)?; - self.purge_backup.run() + self.purge_backup.run( + self.purge_chain.yes, + self.purge_chain + .shared_params + .base_path()? + .ok_or_else(|| Error::Input("need base-path to be provided".to_string()))?, + )?; + self.purge_chain.run(database_config) } } @@ -322,21 +325,16 @@ impl CliConfiguration for PurgeChainCmd { #[derive(Debug, Parser)] pub struct PurgeBackupCmd { - /// Skip interactive prompt by answering yes automatically. - #[clap(short = 'y')] - pub yes: bool, - #[clap(flatten)] - pub node_params: NodeParams, + /// Directory under which AlephBFT backup is stored + #[arg(long, default_value = DEFAULT_BACKUP_FOLDER)] + pub backup_dir: String, } impl PurgeBackupCmd { - pub fn run(&self) -> Result<(), Error> { - let backup_path = backup_path( - self.node_params.base_path().path(), - self.node_params.backup_dir(), - ); + pub fn run(&self, skip_prompt: bool, base_path: BasePath) -> Result<(), Error> { + let backup_path = backup_path(base_path.path(), &self.backup_dir); - if !self.yes { + if !skip_prompt { print!( "Are you sure you want to remove {:?}? [y/N]: ", &backup_path diff --git a/bin/node/src/main.rs b/bin/node/src/main.rs index c2455165a7..6dedebc943 100644 --- a/bin/node/src/main.rs +++ b/bin/node/src/main.rs @@ -1,28 +1,41 @@ #[cfg(feature = "try-runtime")] use aleph_node::ExecutorDispatch; use aleph_node::{new_authority, new_full, new_partial, Cli, Subcommand}; +use aleph_primitives::HEAP_PAGES; #[cfg(feature = "try-runtime")] use aleph_runtime::Block; -use clap::Parser; use log::warn; -use sc_cli::SubstrateCli; +use sc_cli::{clap::Parser, CliConfiguration, DatabasePruningMode, PruningParams, SubstrateCli}; use sc_network::config::Role; -use sc_service::PartialComponents; +use sc_service::{Configuration, PartialComponents}; + +fn default_state_pruning() -> Option { + Some(DatabasePruningMode::Archive) +} + +fn default_blocks_pruning() -> DatabasePruningMode { + DatabasePruningMode::ArchiveCanonical +} + +fn pruning_changed(params: &PruningParams) -> bool { + let state_pruning_changed = + params.state_pruning.is_some() && (params.state_pruning != default_state_pruning()); + + let blocks_pruning_changed = params.blocks_pruning != default_blocks_pruning(); + + state_pruning_changed || blocks_pruning_changed +} + +fn enforce_heap_pages(config: &mut Configuration) { + config.default_heap_pages = Some(HEAP_PAGES); +} fn main() -> sc_cli::Result<()> { let mut cli = Cli::parse(); - - if cli - .run - .import_params - .pruning_params - .blocks_pruning - .is_some() - || cli.run.import_params.pruning_params.state_pruning != Some("archive".into()) - { - warn!("Pruning not supported. Switching to keeping all block bodies and states."); - cli.run.import_params.pruning_params.blocks_pruning = None; - cli.run.import_params.pruning_params.state_pruning = Some("archive".into()); + let overwritten_pruning = pruning_changed(&cli.run.import_params.pruning_params); + if !cli.aleph.experimental_pruning() { + cli.run.import_params.pruning_params.state_pruning = default_state_pruning(); + cli.run.import_params.pruning_params.blocks_pruning = default_blocks_pruning(); } match &cli.subcommand { @@ -94,6 +107,7 @@ fn main() -> sc_cli::Result<()> { } #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { + use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; let runner = cli.create_runner(cmd)?; runner.async_run(|config| { let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry); @@ -101,7 +115,13 @@ fn main() -> sc_cli::Result<()> { sc_service::TaskManager::new(config.tokio_handle.clone(), registry) .map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?; - Ok((cmd.run::(config), task_manager)) + Ok(( + cmd.run::::ExtendHostFunctions, + >>(), + task_manager, + )) }) } #[cfg(not(feature = "try-runtime"))] @@ -110,8 +130,19 @@ fn main() -> sc_cli::Result<()> { .into()), None => { let runner = cli.create_runner(&cli.run)?; + if cli.aleph.experimental_pruning() { + warn!("Experimental_pruning was turned on. Usage of this flag can lead to misbehaviour, which can be punished. State pruning: {:?}; Blocks pruning: {:?};", + cli.run.state_pruning()?.unwrap_or_default(), + cli.run.blocks_pruning()?, + ); + } else if overwritten_pruning { + warn!("Pruning not supported. Switching to keeping all block bodies and states."); + } + let aleph_cli_config = cli.aleph; - runner.run_node_until_exit(|config| async move { + runner.run_node_until_exit(|mut config| async move { + enforce_heap_pages(&mut config); + match config.role { Role::Authority => { new_authority(config, aleph_cli_config).map_err(sc_cli::Error::Service) @@ -124,3 +155,28 @@ fn main() -> sc_cli::Result<()> { } } } + +#[cfg(test)] +mod tests { + use sc_service::{BlocksPruning, PruningMode}; + + use super::{default_blocks_pruning, default_state_pruning, PruningParams}; + + #[test] + fn pruning_sanity_check() { + let pruning_params = PruningParams { + state_pruning: default_state_pruning(), + blocks_pruning: default_blocks_pruning(), + }; + + assert_eq!( + pruning_params.blocks_pruning().unwrap(), + BlocksPruning::KeepFinalized + ); + + assert_eq!( + pruning_params.state_pruning().unwrap().unwrap(), + PruningMode::ArchiveAll + ); + } +} diff --git a/bin/node/src/rpc.rs b/bin/node/src/rpc.rs index 9749b60c62..892afcb386 100644 --- a/bin/node/src/rpc.rs +++ b/bin/node/src/rpc.rs @@ -7,7 +7,7 @@ use std::sync::Arc; -use aleph_runtime::{opaque::Block, AccountId, Balance, BlockNumber, Hash, Index}; +use aleph_runtime::{opaque::Block, AccountId, Balance, Index}; use finality_aleph::JustificationNotification; use futures::channel::mpsc; use jsonrpsee::RpcModule; @@ -36,14 +36,12 @@ where C: ProvideRuntimeApi, C: HeaderBackend + HeaderMetadata + 'static, C: Send + Sync + 'static, - C::Api: pallet_contracts_rpc::ContractsRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BlockBuilder, P: TransactionPool + 'static, B: BlockT, { - use pallet_contracts_rpc::{Contracts, ContractsApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; @@ -57,9 +55,7 @@ where module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; - module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - - module.merge(Contracts::new(client).into_rpc())?; + module.merge(TransactionPayment::new(client).into_rpc())?; use crate::aleph_node_rpc::{AlephNode, AlephNodeApiServer}; module.merge(AlephNode::new(import_justification_tx).into_rpc())?; diff --git a/bin/node/src/service.rs b/bin/node/src/service.rs index 4d0ad4ed2f..e31cef1f2c 100644 --- a/bin/node/src/service.rs +++ b/bin/node/src/service.rs @@ -5,16 +5,17 @@ use std::{ sync::Arc, }; -use aleph_primitives::AlephSessionApi; -use aleph_runtime::{self, opaque::Block, RuntimeApi, MAX_BLOCK_SIZE}; +use aleph_primitives::{AlephSessionApi, MAX_BLOCK_SIZE}; +use aleph_runtime::{self, opaque::Block, RuntimeApi}; use finality_aleph::{ run_nonvalidator_node, run_validator_node, AlephBlockImport, AlephConfig, - JustificationNotification, Metrics, MillisecsPerBlock, Protocol, SessionPeriod, + JustificationNotification, Metrics, MillisecsPerBlock, Protocol, ProtocolNaming, SessionPeriod, }; use futures::channel::mpsc; use log::warn; -use sc_client_api::ExecutorProvider; +use sc_client_api::{Backend, BlockBackend, HeaderBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; +use sc_consensus_slots::BackoffAuthoringBlocksStrategy; use sc_network::NetworkService; use sc_service::{ error::Error as ServiceError, Configuration, KeystoreContainer, NetworkStarter, RpcHandlers, @@ -22,10 +23,12 @@ use sc_service::{ }; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_api::ProvideRuntimeApi; -use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; +use sp_arithmetic::traits::BaseArithmetic; +use sp_blockchain::Backend as _; +use sp_consensus_aura::{sr25519::AuthorityPair as AuraPair, Slot}; use sp_runtime::{ generic::BlockId, - traits::{Block as BlockT, Header as HeaderT, Zero}, + traits::{Block as BlockT, Header as HeaderT}, }; use crate::{aleph_cli::AlephCli, chain_spec::DEFAULT_BACKUP_FOLDER, executor::AlephExecutor}; @@ -34,7 +37,31 @@ type FullClient = sc_service::TFullClient; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; -fn get_backup_path(aleph_config: &AlephCli, base_path: &Path) -> Option { +struct LimitNonfinalized(u32); + +impl BackoffAuthoringBlocksStrategy for LimitNonfinalized { + fn should_backoff( + &self, + chain_head_number: N, + _chain_head_slot: Slot, + finalized_number: N, + _slow_now: Slot, + _logging_target: &str, + ) -> bool { + let nonfinalized_blocks: u32 = chain_head_number + .saturating_sub(finalized_number) + .unique_saturated_into(); + match nonfinalized_blocks >= self.0 { + true => { + warn!("We have {} nonfinalized blocks, with the limit being {}, delaying block production.", nonfinalized_blocks, self.0); + true + } + false => false, + } + } +} + +fn backup_path(aleph_config: &AlephCli, base_path: &Path) -> Option { if aleph_config.no_backup() { return None; } @@ -128,7 +155,7 @@ pub fn new_partial( let slot_duration = sc_consensus_aura::slot_duration(&*client)?; - let import_queue = sc_consensus_aura::import_queue::( + let import_queue = sc_consensus_aura::import_queue::( ImportQueueParams { block_import: aleph_block_import.clone(), justification_import: Some(Box::new(aleph_block_import.clone())), @@ -142,15 +169,13 @@ pub fn new_partial( slot_duration, ); - Ok((timestamp, slot)) + Ok((slot, timestamp)) }, spawner: &task_manager.spawn_essential_handle(), registry: config.prometheus_registry(), - can_author_with: sp_consensus::CanAuthorWithNativeVersion::new( - client.executor().clone(), - ), check_for_equivocation: Default::default(), telemetry: telemetry.as_ref().map(|x| x.handle()), + compatibility_mode: Default::default(), }, )?; @@ -188,20 +213,37 @@ fn setup( ( RpcHandlers, Arc::Hash>>, + ProtocolNaming, NetworkStarter, ), ServiceError, > { + let genesis_hash = client + .block_hash(0) + .ok() + .flatten() + .expect("we should have a hash"); + let chain_prefix = match config.chain_spec.fork_id() { + Some(fork_id) => format!("/{}/{}", genesis_hash, fork_id), + None => format!("/{}", genesis_hash), + }; + let protocol_naming = ProtocolNaming::new(chain_prefix); config .network .extra_sets - .push(finality_aleph::peers_set_config(Protocol::Generic)); + .push(finality_aleph::peers_set_config( + protocol_naming.clone(), + Protocol::Authentication, + )); config .network .extra_sets - .push(finality_aleph::peers_set_config(Protocol::Authentication)); + .push(finality_aleph::peers_set_config( + protocol_naming.clone(), + Protocol::BlockSync, + )); - let (network, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, tx_handler_controller, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -237,16 +279,17 @@ fn setup( rpc_builder, backend, system_rpc_tx, + tx_handler_controller, config, telemetry: telemetry.as_mut(), })?; - Ok((rpc_handlers, network, network_starter)) + Ok((rpc_handlers, network, protocol_naming, network_starter)) } /// Builds a new service for a full client. pub fn new_authority( - mut config: Configuration, + config: Configuration, aleph_config: AlephCli, ) -> Result { let sc_service::PartialComponents { @@ -259,12 +302,8 @@ pub fn new_authority( transaction_pool, other: (block_import, justification_tx, justification_rx, mut telemetry, metrics), } = new_partial(&config)?; - config - .network - .extra_sets - .push(finality_aleph::peers_set_config(Protocol::Validator)); - let backup_path = get_backup_path( + let backup_path = backup_path( &aleph_config, config .base_path @@ -273,27 +312,29 @@ pub fn new_authority( .path(), ); + let finalized = client.info().finalized_number; + let session_period = SessionPeriod( client .runtime_api() - .session_period(&BlockId::Number(Zero::zero())) + .session_period(&BlockId::Number(finalized)) .unwrap(), ); let millisecs_per_block = MillisecsPerBlock( client .runtime_api() - .millisecs_per_block(&BlockId::Number(Zero::zero())) + .millisecs_per_block(&BlockId::Number(finalized)) .unwrap(), ); let force_authoring = config.force_authoring; - let backoff_authoring_blocks: Option<()> = None; + let backoff_authoring_blocks = Some(LimitNonfinalized(aleph_config.max_nonfinalized_blocks())); let prometheus_registry = config.prometheus_registry().cloned(); - let (_rpc_handlers, network, network_starter) = setup( + let (_rpc_handlers, network, protocol_naming, network_starter) = setup( config, - backend, + backend.clone(), &keystore_container, import_queue, transaction_pool.clone(), @@ -312,11 +353,9 @@ pub fn new_authority( ); proposer_factory.set_default_block_size_limit(MAX_BLOCK_SIZE as usize); - let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - let slot_duration = sc_consensus_aura::slot_duration(&*client)?; - let aura = sc_consensus_aura::start_aura::( + let aura = sc_consensus_aura::start_aura::( StartAuraParams { slot_duration, client: client.clone(), @@ -332,17 +371,17 @@ pub fn new_authority( slot_duration, ); - Ok((timestamp, slot)) + Ok((slot, timestamp)) }, force_authoring, backoff_authoring_blocks, keystore: keystore_container.sync_keystore(), - can_author_with, sync_oracle: network.clone(), justification_sync_link: network.clone(), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), max_block_proposal_slot_portion: None, telemetry: telemetry.as_ref().map(|x| x.handle()), + compatibility_mode: Default::default(), }, )?; @@ -353,9 +392,11 @@ pub fn new_authority( if aleph_config.external_addresses().is_empty() { panic!("Cannot run a validator node without external addresses, stopping."); } + let blockchain_backend = BlockchainBackendImpl { backend }; let aleph_config = AlephConfig { network, client, + blockchain_backend, select_chain, session_period, millisecs_per_block, @@ -367,6 +408,7 @@ pub fn new_authority( backup_saving_path: backup_path, external_addresses: aleph_config.external_addresses(), validator_port: aleph_config.validator_port(), + protocol_naming, }; task_manager.spawn_essential_handle().spawn_blocking( "aleph", @@ -393,7 +435,7 @@ pub fn new_full( other: (_, justification_tx, justification_rx, mut telemetry, metrics), } = new_partial(&config)?; - let backup_path = get_backup_path( + let backup_path = backup_path( &aleph_config, config .base_path @@ -402,9 +444,9 @@ pub fn new_full( .path(), ); - let (_rpc_handlers, network, network_starter) = setup( + let (_rpc_handlers, network, protocol_naming, network_starter) = setup( config, - backend, + backend.clone(), &keystore_container, import_queue, transaction_pool, @@ -414,23 +456,27 @@ pub fn new_full( justification_tx, )?; + let finalized = client.info().finalized_number; + let session_period = SessionPeriod( client .runtime_api() - .session_period(&BlockId::Number(Zero::zero())) + .session_period(&BlockId::Number(finalized)) .unwrap(), ); let millisecs_per_block = MillisecsPerBlock( client .runtime_api() - .millisecs_per_block(&BlockId::Number(Zero::zero())) + .millisecs_per_block(&BlockId::Number(finalized)) .unwrap(), ); + let blockchain_backend = BlockchainBackendImpl { backend }; let aleph_config = AlephConfig { network, client, + blockchain_backend, select_chain, session_period, millisecs_per_block, @@ -442,6 +488,7 @@ pub fn new_full( backup_saving_path: backup_path, external_addresses: aleph_config.external_addresses(), validator_port: aleph_config.validator_port(), + protocol_naming, }; task_manager.spawn_essential_handle().spawn_blocking( @@ -453,3 +500,36 @@ pub fn new_full( network_starter.start_network(); Ok(task_manager) } + +struct BlockchainBackendImpl { + backend: Arc, +} +impl finality_aleph::BlockchainBackend for BlockchainBackendImpl { + fn children(&self, parent_hash: ::Hash) -> Vec<::Hash> { + self.backend + .blockchain() + .children(parent_hash) + .unwrap_or_default() + } + fn info(&self) -> sp_blockchain::Info { + self.backend.blockchain().info() + } + fn header( + &self, + block_id: BlockId, + ) -> sp_blockchain::Result::Header>> { + let hash = match block_id { + BlockId::Hash(h) => h, + BlockId::Number(n) => { + let maybe_hash = self.backend.blockchain().hash(n)?; + + if let Some(h) = maybe_hash { + h + } else { + return Ok(None); + } + } + }; + self.backend.blockchain().header(hash) + } +} diff --git a/bin/runtime/Cargo.toml b/bin/runtime/Cargo.toml index 9318bed26b..534b538757 100644 --- a/bin/runtime/Cargo.toml +++ b/bin/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-runtime" -version = "0.8.0" +version = "0.9.1" authors = ["Cardinal Cryptography"] edition = "2021" homepage = "https://alephzero.org" @@ -15,54 +15,57 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa scale-info = { version = "2.0", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } -frame-executive = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-try-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", optional = true } +frame-executive = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-try-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", optional = true } -pallet-aura = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-authorship = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-contracts = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.28" } -pallet-contracts-primitives = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.28" } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.28" } -pallet-identity = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.28" } -pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-scheduler = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-sudo = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-timestamp = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-treasury = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-vesting = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-multisig = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-utility = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-nomination-pools = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +pallet-aura = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-authorship = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-contracts = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.38" } +pallet-contracts-primitives = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.38" } +pallet-identity = { git = "https://github.com/Cardinal-Cryptography/substrate", default-features = false, branch = "aleph-v0.9.38" } +pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-scheduler = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-sudo = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-timestamp = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-treasury = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-vesting = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-multisig = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-utility = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-nomination-pools = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-nomination-pools-runtime-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } -sp-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-block-builder = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-consensus-aura = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-inherents = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-offchain = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-transaction-pool = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-version = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-block-builder = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-consensus-aura = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-inherents = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-offchain = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-transaction-pool = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-version = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } # NOTE: these two disabled features collide with std in wasm -sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } primitives = { path = "../../primitives", default-features = false } pallet-aleph = { path = "../../pallets/aleph", default-features = false } pallet-elections = { path = "../../pallets/elections", default-features = false } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +substrate-wasm-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } + +[dev-dependencies] +smallvec = { version = "1", default-features = false} [features] default = ["std"] @@ -83,6 +86,7 @@ std = [ "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment/std", + "pallet-transaction-payment-rpc-runtime-api/std", "pallet-treasury/std", "pallet-vesting/std", "pallet-multisig/std", @@ -102,17 +106,17 @@ std = [ "sp-version/std", "frame-system/std", "sp-offchain/std", - "pallet-transaction-payment-rpc-runtime-api/std", "frame-system-rpc-runtime-api/std", "primitives/std", "pallet-contracts-primitives/std", - "pallet-contracts-rpc-runtime-api/std", "pallet-contracts/std", "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", ] short_session = ["primitives/short_session"] try-runtime = [ "frame-executive/try-runtime", + "frame-support/try-runtime", "frame-try-runtime", "frame-system/try-runtime", "pallet-contracts/try-runtime", @@ -128,6 +132,7 @@ try-runtime = [ "pallet-staking/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", + "pallet-scheduler/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-vesting/try-runtime", diff --git a/bin/runtime/src/lib.rs b/bin/runtime/src/lib.rs index b929d4b36b..9d39a5b047 100644 --- a/bin/runtime/src/lib.rs +++ b/bin/runtime/src/lib.rs @@ -13,31 +13,33 @@ pub use frame_support::{ OnUnbalanced, Randomness, ValidatorSet, }, weights::{ - constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, + constants::{ + BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND, + }, IdentityFee, Weight, }, StorageValue, }; use frame_support::{ sp_runtime::Perquintill, - traits::{ConstU32, ConstU64, EqualPrivilegeOnly, SortedMembers, U128CurrencyToVote}, - weights::constants::WEIGHT_PER_MILLIS, + traits::{ + ConstBool, ConstU32, EqualPrivilegeOnly, SortedMembers, U128CurrencyToVote, WithdrawReasons, + }, + weights::constants::WEIGHT_REF_TIME_PER_MILLIS, PalletId, }; use frame_system::{EnsureRoot, EnsureSignedBy}; +#[cfg(feature = "try-runtime")] +use frame_try_runtime::UpgradeCheckSelect; pub use pallet_balances::Call as BalancesCall; -use pallet_contracts::weights::WeightInfo; -use pallet_contracts_primitives::{ - CodeUploadResult, ContractExecResult, ContractInstantiateResult, GetStorageResult, -}; pub use pallet_timestamp::Call as TimestampCall; use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment}; pub use primitives::Balance; use primitives::{ staking::MAX_NOMINATORS_REWARDED_PER_VALIDATOR, wrap_methods, ApiError as AlephApiError, AuthorityId as AlephId, SessionAuthorityData, Version as FinalityVersion, ADDRESSES_ENCODING, - DEFAULT_BAN_REASON_LENGTH, DEFAULT_SESSIONS_PER_ERA, DEFAULT_SESSION_PERIOD, - MILLISECS_PER_BLOCK, TOKEN, + DEFAULT_BAN_REASON_LENGTH, DEFAULT_MAX_WINNERS, DEFAULT_SESSIONS_PER_ERA, + DEFAULT_SESSION_PERIOD, MAX_BLOCK_SIZE, MILLISECS_PER_BLOCK, TOKEN, }; use sp_api::impl_runtime_apis; use sp_consensus_aura::{sr25519::AuthorityId as AuraId, SlotDuration}; @@ -47,11 +49,11 @@ pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, IdentifyAccount, One, + AccountIdLookup, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, IdentifyAccount, One, OpaqueKeys, Verify, }, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, FixedU128, MultiSignature, RuntimeAppPublic, + ApplyExtrinsicResult, FixedU128, MultiSignature, }; pub use sp_runtime::{FixedPointNumber, Perbill, Permill}; use sp_staking::EraIndex; @@ -108,10 +110,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("aleph-node"), impl_name: create_runtime_str!("aleph-node"), authoring_version: 1, - spec_version: 38, + spec_version: 56, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 13, + transaction_version: 14, state_version: 0, }; @@ -135,18 +137,20 @@ pub const PICO_AZERO: Balance = NANO_AZERO / 1000; pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); // The whole process for a single block should take 1s, of which 400ms is for creation, // 200ms for propagation and 400ms for validation. Hence the block weight should be within 400ms. -pub const MAX_BLOCK_WEIGHT: Weight = 400 * WEIGHT_PER_MILLIS; -// We agreed to 5MB as the block size limit. -pub const MAX_BLOCK_SIZE: u32 = 5 * 1024 * 1024; +pub const MAX_BLOCK_WEIGHT: Weight = + Weight::from_ref_time(WEIGHT_REF_TIME_PER_MILLIS.saturating_mul(400)); + +// The storage deposit is roughly 1 TOKEN per 1kB -- this is the legacy value, used for pallet Identity and Multisig. +pub const LEGACY_DEPOSIT_PER_BYTE: Balance = MILLI_AZERO; -// The storage deposit is roughly 1 TOKEN per 1kB -pub const DEPOSIT_PER_BYTE: Balance = MILLI_AZERO; +// The storage per one byte of contract storage: 4*10^{-5} AZERO per byte. +pub const CONTRACT_DEPOSIT_PER_BYTE: Balance = 4 * (TOKEN / 100_000); parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const BlockHashCount: BlockNumber = 2400; pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights - ::with_sensible_defaults(MAX_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); + ::with_sensible_defaults(MAX_BLOCK_WEIGHT.set_proof_size(u64::MAX), NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(MAX_BLOCK_SIZE, NORMAL_DISPATCH_RATIO); pub const SS58Prefix: u8 = ADDRESSES_ENCODING; @@ -164,7 +168,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; + type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. @@ -178,9 +182,9 @@ impl frame_system::Config for Runtime { /// The header type. type Header = generic::Header; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; /// The weight of database operations that the runtime can invoke. @@ -222,8 +226,6 @@ parameter_types! { impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = UncleGenerations; - type FilterUncle = (); type EventHandler = (Elections,); } @@ -239,7 +241,7 @@ impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -274,15 +276,21 @@ parameter_types! { pub FeeVariability: Multiplier = Multiplier::saturating_from_rational(67, 1000); // Fee should never be lower than the computational cost. pub MinimumMultiplier: Multiplier = Multiplier::one(); + pub MaximumMultiplier: Multiplier = Bounded::max_value(); } impl pallet_transaction_payment::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnChargeTransaction = CurrencyAdapter; type LengthToFee = IdentityFee; type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = - TargetedFeeAdjustment; + type FeeMultiplierUpdate = TargetedFeeAdjustment< + Self, + TargetSaturationLevel, + FeeVariability, + MinimumMultiplier, + MaximumMultiplier, + >; type OperationalFeeMultiplier = OperationalFeeMultiplier; } @@ -292,29 +300,29 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type Event = Event; - type Origin = Origin; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; - type Call = Call; + type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = frame_system::EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = pallet_scheduler::weights::SubstrateWeight; type OriginPrivilegeCmp = EqualPrivilegeOnly; - type PreimageProvider = (); - type NoPreimagePostponement = (); + type Preimages = (); } impl pallet_sudo::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; } impl pallet_aleph::Config for Runtime { type AuthorityId = AlephId; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SessionInfoProvider = Session; type SessionManager = Elections; + type NextSessionAuthorityProvider = Session; } impl_opaque_keys! { @@ -327,17 +335,20 @@ impl_opaque_keys! { parameter_types! { pub const SessionPeriod: u32 = DEFAULT_SESSION_PERIOD; pub const MaximumBanReasonLength: u32 = DEFAULT_BAN_REASON_LENGTH; + pub const MaxWinners: u32 = DEFAULT_MAX_WINNERS; } impl pallet_elections::Config for Runtime { type EraInfoProvider = Staking; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DataProvider = Staking; type SessionInfoProvider = Session; type SessionPeriod = SessionPeriod; type SessionManager = pallet_session::historical::NoteHistoricalRoot; type ValidatorRewardsHandler = Staking; + type ValidatorExtractor = Staking; type MaximumBanReasonLength = MaximumBanReasonLength; + type MaxWinners = MaxWinners; } impl pallet_randomness_collective_flip::Config for Runtime {} @@ -347,7 +358,7 @@ parameter_types! { } impl pallet_session::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = pallet_session::PeriodicSessions; @@ -370,13 +381,17 @@ parameter_types! { } use sp_runtime::traits::Convert; + pub struct BalanceToU256; + impl Convert for BalanceToU256 { fn convert(balance: Balance) -> sp_core::U256 { sp_core::U256::from(balance) } } + pub struct U256ToBalance; + impl Convert for U256ToBalance { fn convert(n: sp_core::U256) -> Balance { n.try_into().unwrap_or(Balance::max_value()) @@ -385,13 +400,12 @@ impl Convert for U256ToBalance { impl pallet_nomination_pools::Config for Runtime { type WeightInfo = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type CurrencyBalance = Balance; type RewardCounter = FixedU128; type BalanceToU256 = BalanceToU256; type U256ToBalance = U256ToBalance; - type StakingInterface = pallet_staking::Pallet; + type Staking = pallet_staking::Pallet; type PostUnbondingPoolsWindow = PostUnbondPoolsWindow; type MaxMetadataLen = ConstU32<256>; type MaxUnbonding = ConstU32<8>; @@ -407,6 +421,7 @@ parameter_types! { pub const MaxNominatorRewardedPerValidator: u32 = MAX_NOMINATORS_REWARDED_PER_VALIDATOR; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(33); pub const SessionsPerEra: EraIndex = DEFAULT_SESSIONS_PER_ERA; + pub HistoryDepth: u32 = 84; } pub struct UniformEraPayout; @@ -420,6 +435,7 @@ impl pallet_staking::EraPayout for UniformEraPayout { type SubstrateStakingWeights = pallet_staking::weights::SubstrateWeight; pub struct PayoutStakersDecreasedWeightInfo; + impl pallet_staking::WeightInfo for PayoutStakersDecreasedWeightInfo { // To make possible to change nominators per validator we need to decrease weight for payout_stakers fn payout_stakers_alive_staked(n: u32) -> Weight { @@ -462,11 +478,10 @@ impl pallet_staking::WeightInfo for PayoutStakersDecreasedWeightInfo { Weight ), (rebond(l: u32), SubstrateStakingWeights, Weight), - (set_history_depth(e: u32), SubstrateStakingWeights, Weight), (reap_stash(s: u32), SubstrateStakingWeights, Weight), (new_era(v: u32, n: u32), SubstrateStakingWeights, Weight), ( - get_npos_voters(v: u32, n: u32, s: u32), + get_npos_voters(v: u32, n: u32), SubstrateStakingWeights, Weight ), @@ -486,11 +501,13 @@ impl pallet_staking::WeightInfo for PayoutStakersDecreasedWeightInfo { force_apply_min_commission(), SubstrateStakingWeights, Weight - ) + ), + (set_min_commission(), SubstrateStakingWeights, Weight) ); } pub struct StakingBenchmarkingConfig; + impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { type MaxValidators = ConstU32<1000>; type MaxNominators = ConstU32<1000>; @@ -505,13 +522,12 @@ impl pallet_staking::Config for Runtime { type GenesisElectionProvider = Elections; type MaxNominations = ConstU32<1>; type RewardRemainder = Treasury; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Slash = Treasury; type Reward = (); type SessionsPerEra = SessionsPerEra; type BondingDuration = BondingDuration; type SlashDeferDuration = SlashDeferDuration; - type SlashCancelOrigin = EnsureRoot; type SessionInterface = Self; type EraPayout = UniformEraPayout; type NextNewSession = Session; @@ -523,6 +539,9 @@ impl pallet_staking::Config for Runtime { type WeightInfo = PayoutStakersDecreasedWeightInfo; type CurrencyBalance = Balance; type OnStakerSlash = NominationPools; + type HistoryDepth = HistoryDepth; + type TargetList = pallet_staking::UseValidatorsMap; + type AdminOrigin = EnsureRoot; } parameter_types! { @@ -539,22 +558,24 @@ impl pallet_timestamp::Config for Runtime { impl frame_system::offchain::SendTransactionTypes for Runtime where - Call: From, + RuntimeCall: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; } parameter_types! { pub const MinVestedTransfer: Balance = MICRO_AZERO; + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); } impl pallet_vesting::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; type WeightInfo = pallet_vesting::weights::SubstrateWeight; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; // Maximum number of vesting schedules an account may have at a given moment // follows polkadot https://github.com/paritytech/polkadot/blob/9ce5f7ef5abb1a4291454e8c9911b304d80679f9/runtime/polkadot/src/lib.rs#L980 const MAX_VESTING_SCHEDULES: u32 = 28; @@ -562,15 +583,15 @@ impl pallet_vesting::Config for Runtime { parameter_types! { // One storage item; key size is 32+32; value is size 4+4+16+32 bytes = 56 bytes. - pub const DepositBase: Balance = 120 * DEPOSIT_PER_BYTE; + pub const DepositBase: Balance = 120 * LEGACY_DEPOSIT_PER_BYTE; // Additional storage item size of 32 bytes. - pub const DepositFactor: Balance = 32 * DEPOSIT_PER_BYTE; + pub const DepositFactor: Balance = 32 * LEGACY_DEPOSIT_PER_BYTE; pub const MaxSignatories: u16 = 100; } impl pallet_multisig::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; @@ -603,6 +624,7 @@ parameter_types! { } pub struct TreasuryGovernance; + impl SortedMembers for TreasuryGovernance { fn sorted_members() -> Vec { pallet_sudo::Pallet::::key().into_iter().collect() @@ -614,7 +636,7 @@ impl pallet_treasury::Config for Runtime { type Burn = Burn; type BurnDestination = (); type Currency = Balances; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MaxApprovals = MaxApprovals; type OnSlash = (); type PalletId = TreasuryPalletId; @@ -629,8 +651,8 @@ impl pallet_treasury::Config for Runtime { } impl pallet_utility::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; type WeightInfo = pallet_utility::weights::SubstrateWeight; type PalletsOrigin = OriginCaller; } @@ -640,18 +662,13 @@ const CONTRACTS_DEBUG_OUTPUT: bool = true; parameter_types! { // Refundable deposit per storage item - pub const DepositPerItem: Balance = 32 * DEPOSIT_PER_BYTE; + pub const DepositPerItem: Balance = 32 * CONTRACT_DEPOSIT_PER_BYTE; // Refundable deposit per byte of storage - pub const DepositPerByte: Balance = DEPOSIT_PER_BYTE; + pub const DepositPerByte: Balance = CONTRACT_DEPOSIT_PER_BYTE; // How much weight of each block can be spent on the lazy deletion queue of terminated contracts pub DeletionWeightLimit: Weight = Perbill::from_percent(10) * BlockWeights::get().max_block; // 40ms // Maximum size of the lazy deletion queue of terminated contracts. - // The weight needed for decoding the queue should be less or equal than a tenth - // of the overall weight dedicated to the lazy deletion. - pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / ( - ::WeightInfo::on_initialize_per_queue_item(1) - - ::WeightInfo::on_initialize_per_queue_item(0) - )) / 10) as u32; // 2228 + pub const DeletionQueueDepth: u32 = 128; pub Schedule: pallet_contracts::Schedule = Default::default(); } @@ -659,8 +676,8 @@ impl pallet_contracts::Config for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; // The safest default is to allow no calls at all. This is unsafe experimental feature with no support in ink! type CallFilter = Nothing; type DepositPerItem = DepositPerItem; @@ -671,27 +688,27 @@ impl pallet_contracts::Config for Runtime { type DeletionQueueDepth = DeletionQueueDepth; type DeletionWeightLimit = DeletionWeightLimit; type Schedule = Schedule; - type CallStack = [pallet_contracts::Frame; 31]; + type CallStack = [pallet_contracts::Frame; 16]; type AddressGenerator = pallet_contracts::DefaultAddressGenerator; - type ContractAccessWeight = ConstU64<0>; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; - type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; + type UnsafeUnstableInterface = ConstBool; + type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; } parameter_types! { // bytes count taken from: // https://github.com/paritytech/polkadot/blob/016dc7297101710db0483ab6ef199e244dff711d/runtime/kusama/src/lib.rs#L995 - pub const BasicDeposit: Balance = 258 * DEPOSIT_PER_BYTE; - pub const FieldDeposit: Balance = 66 * DEPOSIT_PER_BYTE; - pub const SubAccountDeposit: Balance = 53 * DEPOSIT_PER_BYTE; + pub const BasicDeposit: Balance = 258 * LEGACY_DEPOSIT_PER_BYTE; + pub const FieldDeposit: Balance = 66 * LEGACY_DEPOSIT_PER_BYTE; + pub const SubAccountDeposit: Balance = 53 * LEGACY_DEPOSIT_PER_BYTE; pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; pub const MaxRegistrars: u32 = 20; } impl pallet_identity::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BasicDeposit = BasicDeposit; type FieldDeposit = FieldDeposit; @@ -757,9 +774,10 @@ pub type SignedExtra = ( pallet_transaction_payment::ChargeTransactionPayment, ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -868,6 +886,12 @@ impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl primitives::AlephSessionApi for Runtime { @@ -884,10 +908,12 @@ impl_runtime_apis! { } fn next_session_authorities() -> Result, AlephApiError> { - Session::queued_keys() - .iter() - .map(|(_, key)| key.get(AlephId::ID).ok_or(AlephApiError::DecodeKey)) - .collect::, AlephApiError>>() + let next_authorities = Aleph::next_authorities(); + if next_authorities.is_empty() { + return Err(AlephApiError::DecodeKey) + } + + Ok(next_authorities) } fn authority_data() -> SessionAuthorityData { @@ -895,10 +921,8 @@ impl_runtime_apis! { } fn next_session_authority_data() -> Result { - Ok(SessionAuthorityData::new(Session::queued_keys() - .iter() - .map(|(_, key)| key.get(AlephId::ID).ok_or(AlephApiError::DecodeKey)) - .collect::, AlephApiError>>()?, + Ok(SessionAuthorityData::new( + Self::next_session_authorities()?, Aleph::queued_emergency_finalizer(), )) } @@ -912,70 +936,129 @@ impl_runtime_apis! { } } - impl pallet_contracts_rpc_runtime_api::ContractsApi for Runtime { + impl pallet_nomination_pools_runtime_api::NominationPoolsApi for Runtime { + fn pending_rewards(member_account: AccountId) -> Balance { + NominationPools::pending_rewards(member_account).unwrap_or_default() + } + } + impl pallet_contracts::ContractsApi + for Runtime + { fn call( origin: AccountId, dest: AccountId, value: Balance, - gas_limit: u64, + gas_limit: Option, storage_deposit_limit: Option, input_data: Vec, - ) -> ContractExecResult { - Contracts::bare_call(origin, dest, value, gas_limit, storage_deposit_limit, input_data, CONTRACTS_DEBUG_OUTPUT) + ) -> pallet_contracts_primitives::ContractExecResult { + let gas_limit = gas_limit.unwrap_or(BlockWeights::get().max_block); + Contracts::bare_call( + origin, + dest, + value, + gas_limit, + storage_deposit_limit, + input_data, + CONTRACTS_DEBUG_OUTPUT, + pallet_contracts::Determinism::Deterministic, + ) } fn instantiate( origin: AccountId, value: Balance, - gas_limit: u64, + gas_limit: Option, storage_deposit_limit: Option, code: pallet_contracts_primitives::Code, data: Vec, salt: Vec, - ) -> ContractInstantiateResult + ) -> pallet_contracts_primitives::ContractInstantiateResult { - Contracts::bare_instantiate(origin, value, gas_limit, storage_deposit_limit, code, data, salt, CONTRACTS_DEBUG_OUTPUT) + let gas_limit = gas_limit.unwrap_or(BlockWeights::get().max_block); + Contracts::bare_instantiate( + origin, + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + CONTRACTS_DEBUG_OUTPUT + ) } fn upload_code( origin: AccountId, code: Vec, storage_deposit_limit: Option, - ) -> CodeUploadResult + determinism: pallet_contracts::Determinism, + ) -> pallet_contracts_primitives::CodeUploadResult { - Contracts::bare_upload_code(origin, code, storage_deposit_limit) + Contracts::bare_upload_code(origin, code, storage_deposit_limit, determinism) } fn get_storage( address: AccountId, key: Vec, - ) -> GetStorageResult { + ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } - } #[cfg(feature = "try-runtime")] - impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> (frame_support::weights::Weight, frame_support::weights::Weight) { - log::info!(target: "aleph-runtime", "try-runtime::on_runtime_upgrade"); - let weight = Executive::try_runtime_upgrade().unwrap(); - (weight, BlockWeights::get().max_block) - } - - fn execute_block_no_check(block: Block) -> frame_support::weights::Weight { - Executive::execute_block_no_check(block) + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade(checks: UpgradeCheckSelect) -> (Weight, Weight) { + let weight = Executive::try_runtime_upgrade(checks).unwrap(); + (weight, BlockWeights::get().max_block) + } + + fn execute_block( + block: Block, + state_root_check: bool, + checks: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + Executive::try_execute_block(block, state_root_check, checks, select).unwrap() } - } + } } #[cfg(test)] mod tests { - use crate::VERSION; + use frame_support::traits::Get; + use primitives::HEAP_PAGES; + use smallvec::Array; + + use super::*; #[test] fn state_version_must_be_zero() { assert_eq!(0, VERSION.state_version); } + + #[test] + fn check_contracts_memory_parameters() { + // Memory limit of one instance of a runtime + const MAX_RUNTIME_MEM: u32 = HEAP_PAGES as u32 * 64 * 1024; + // Max stack size defined by wasmi - 1MB + const MAX_STACK_SIZE: u32 = 1024 * 1024; + // Max heap size is 16 mempages of 64KB each - 1MB + let max_heap_size = ::Schedule::get() + .limits + .max_memory_size(); + // Max call depth is CallStack::size() + 1 + let max_call_depth = ::CallStack::size() as u32 + 1; + // Max code len + let max_code_len: u32 = ::MaxCodeLen::get(); + + // The factor comes from allocator, contracts representation, and wasmi + let lhs = max_call_depth * (72 * max_code_len + max_heap_size + MAX_STACK_SIZE); + // We allocate only 75% of all runtime memory to contracts execution. Important: it's not + // enforeced in wasmtime + let rhs = MAX_RUNTIME_MEM * 3 / 4; + + assert!(lhs < rhs); + } } diff --git a/contracts/README.md b/contracts/README.md index 66d902fc25..6648605ee8 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -54,7 +54,7 @@ Game continues in perpetuity (but in practice as long as there are accounts that ## Prerequisites - Rust nightly -- cargo-contract with bug fixes around URL parsing: `cargo install --git https://github.com/paritytech/cargo-contract.git --rev 2b1758756de59bd81e7bed5f8429d364f281cb9a --force` +- cargo-contract compatible with current node: `cargo install cargo-contract --version 2.0.1` ## Instructions diff --git a/contracts/access_control/Cargo.lock b/contracts/access_control/Cargo.lock index 59450d4d86..210372b28d 100644 --- a/contracts/access_control/Cargo.lock +++ b/contracts/access_control/Cargo.lock @@ -6,16 +6,20 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", "scale-info", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "array-init" version = "2.0.1" @@ -40,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -135,6 +145,40 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "funty" version = "2.0.0" @@ -152,27 +196,31 @@ dependencies = [ ] [[package]] -name = "getrandom" -version = "0.2.7" +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ - "cfg-if", "libc", - "wasi", ] [[package]] -name = "heck" -version = "0.4.0" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -188,25 +236,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed249de74298ed051ebcf6d3082b8d3dbd19cbc448d9ed3235d8a7b92713049" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2", + "derive_more", + "either", + "env_logger", + "heck", + "impl-serde", + "ink_ir", + "ink_primitives", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb9d32ec27d71fefb3f2b6a26bae82a2c6509d7ad61e8a5107b6291a1b03ecb" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -214,9 +298,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1549f5966167387c89fb3dfcdc59973bfb396cc3a7110d7a31ad5fdea56db0cf" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2", @@ -227,10 +310,10 @@ dependencies = [ "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -240,72 +323,37 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5282f2722ac6dca469e7f223a7b38b2a6d20fbca6b974497e630d5dc8934e9" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3a5de33b59450adc3f61c5eb05b768067c7ab8af9d00f33e284310598168dc" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2", - "derive_more", "either", - "heck", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d4d614462280fa06e15b9ca5725d7c8440dde93c8dae1c6f15422f7756cacb" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "blake2", - "either", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ink_lang_macro" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f85f64141957c5db7cbabbb97a9c16c489e5e9d363e9f147d132a43c71cd29" -dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", + "ink_codegen", + "ink_ir", "ink_primitives", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca6c159a2774f07437c6fd9ea710eb73a6b5e9a031a932bddf08742bf2c081a" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", @@ -317,30 +365,28 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f7f4dec15e573496c9d2af353e78bde84add391251608f25b5adcf175dc777" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3296dd1c4f4fe12ede7c92d60e6fcb94d46a959ec19c701e4ac588b09e0b4a6" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "cfg-if", + "derive_more", "ink_prelude", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff9b503995a7b41fe201a7a2643ce22f5a11e0b67db7b685424b6d5fe0ecf0b" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", @@ -349,21 +395,44 @@ dependencies = [ "ink_metadata", "ink_prelude", "ink_primitives", - "ink_storage_derive", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb68e24e93e8327dda1924868d7ee4dbe01e1ed2b392f28583caa96809b585c" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -375,6 +444,12 @@ dependencies = [ "either", ] +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + [[package]] name = "keccak" version = "0.1.2" @@ -383,9 +458,30 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "num-traits" @@ -428,12 +524,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.1.3" @@ -469,46 +559,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "rlibc" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" [[package]] -name = "rand_core" -version = "0.6.3" +name = "rustix" +version = "0.36.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" dependencies = [ - "getrandom", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", ] [[package]] -name = "rlibc" -version = "1.0.0" +name = "ryu" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "scale-info" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -520,9 +617,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -532,18 +629,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -568,6 +665,17 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_json" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.10.2" @@ -630,6 +738,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.31" @@ -684,10 +801,92 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "wyz" @@ -697,3 +896,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/access_control/Cargo.toml b/contracts/access_control/Cargo.toml index 28e7cb8614..04b059180a 100644 --- a/contracts/access_control/Cargo.toml +++ b/contracts/access_control/Cargo.toml @@ -7,15 +7,10 @@ publish = false license = "Apache 2.0" [dependencies] -ink_env = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_lang_codegen = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_primitives = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } [lib] name = "access_control" @@ -30,11 +25,7 @@ crate-type = [ [features] default = ["std"] std = [ - "ink_metadata/std", - "ink_env/std", - "ink_storage/std", - "ink_primitives/std", - "ink_lang_codegen/std", + "ink/std", "scale/std", "scale-info/std", ] diff --git a/contracts/access_control/lib.rs b/contracts/access_control/lib.rs index 24d36840db..47f0219538 100644 --- a/contracts/access_control/lib.rs +++ b/contracts/access_control/lib.rs @@ -2,17 +2,19 @@ #![allow(clippy::let_unit_value)] pub use crate::access_control::{ - AccessControlError, ACCESS_CONTROL_PUBKEY, CHECK_ROLE_SELECTOR, HAS_ROLE_SELECTOR, + AccessControl, AccessControlError, AccessControlRef, ACCESS_CONTROL_PUBKEY, + CHECK_ROLE_SELECTOR, HAS_ROLE_SELECTOR, }; pub mod roles; -pub mod traits; -use ink_lang as ink; + +use ink::env::{DefaultEnvironment, Environment}; + +type AccountId = ::AccountId; +type Hash = ::Hash; #[ink::contract] mod access_control { - - use ink_lang::{codegen::EmitEvent, reflect::ContractEventBase}; - use ink_storage::{traits::SpreadAllocate, Mapping}; + use ink::{codegen::EmitEvent, reflect::ContractEventBase, storage::Mapping}; use scale::{Decode, Encode}; use crate::roles::Role; @@ -24,7 +26,6 @@ mod access_control { pub const CHECK_ROLE_SELECTOR: [u8; 4] = [0, 0, 0, 5]; #[ink(storage)] - #[derive(SpreadAllocate)] pub struct AccessControl { /// Stores a de-facto hashset of user accounts and their roles pub privileges: Mapping<(AccountId, Role), ()>, @@ -67,19 +68,13 @@ mod access_control { /// Creates a new contract. #[ink(constructor)] pub fn new() -> Self { - // This call is required in order to correctly initialize the - // `Mapping`s of our contract. - ink_lang::utils::initialize_contract(Self::new_init) - } - - /// Initializes the contract. - /// - /// caller is granted admin and owner privileges - fn new_init(&mut self) { + let mut privileges = Mapping::default(); let caller = Self::env().caller(); let this = Self::env().account_id(); - self.privileges.insert((caller, Role::Admin(this)), &()); - self.privileges.insert((caller, Role::Owner(this)), &()); + privileges.insert((caller, Role::Admin(this)), &()); + privileges.insert((caller, Role::Owner(this)), &()); + + Self { privileges } } /// Gives a role to an account @@ -166,13 +161,11 @@ mod access_control { #[cfg(test)] mod tests { - use ink_lang as ink; - use super::*; #[ink::test] fn access_control() { - let accounts = ink_env::test::default_accounts::(); + let accounts = ink::env::test::default_accounts::(); let alice = accounts.alice; let bob = accounts.bob; @@ -180,9 +173,9 @@ mod access_control { let contract_address = accounts.django; // alice deploys the access control contract - ink_env::test::set_caller::(alice); - ink_env::test::set_callee::(contract_address); - ink_env::test::set_account_balance::( + ink::env::test::set_caller::(alice); + ink::env::test::set_callee::(contract_address); + ink::env::test::set_account_balance::( contract_address, 100, ); @@ -213,8 +206,8 @@ mod access_control { "Bob is not admin" ); - ink_env::test::set_caller::(charlie); - ink_env::test::set_callee::(contract_address); + ink::env::test::set_caller::(charlie); + ink::env::test::set_callee::(contract_address); // charlie tries granting admin rights to himself assert!( @@ -225,8 +218,8 @@ mod access_control { ); // test terminating - ink_env::test::set_caller::(alice); - ink_env::test::set_callee::(contract_address); + ink::env::test::set_caller::(alice); + ink::env::test::set_callee::(contract_address); let should_terminate = move || { access_control @@ -234,7 +227,7 @@ mod access_control { .expect("Calling terminate failed") }; - ink_env::test::assert_contract_termination::( + ink::env::test::assert_contract_termination::( should_terminate, alice, 100, diff --git a/contracts/access_control/roles.rs b/contracts/access_control/roles.rs index b8019d7e0e..13ee5586e1 100644 --- a/contracts/access_control/roles.rs +++ b/contracts/access_control/roles.rs @@ -1,12 +1,9 @@ -use ink_env::{AccountId, Hash}; -use ink_storage::traits::{PackedLayout, SpreadLayout}; use scale::{Decode, Encode}; -#[derive(Debug, Encode, Decode, Clone, Copy, SpreadLayout, PackedLayout, PartialEq, Eq)] -#[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink_storage::traits::StorageLayout) -)] +use crate::{AccountId, Hash}; + +#[derive(Debug, Encode, Decode, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub enum Role { /// Indicates a superuser. Admin(AccountId), diff --git a/contracts/access_control/traits.rs b/contracts/access_control/traits.rs deleted file mode 100644 index 51f5b4b795..0000000000 --- a/contracts/access_control/traits.rs +++ /dev/null @@ -1,41 +0,0 @@ -use ink_env::{ - call::{build_call, Call, ExecutionInput, Selector}, - AccountId, DefaultEnvironment, Error as InkEnvError, -}; - -use crate::{access_control::HAS_ROLE_SELECTOR, roles::Role}; - -/// Convenience trait for contracts that have methods that need to be under access control -/// -/// Such contracts should implement this trait and pass their error enum as associated type: -/// impl AccessControlled for MyContract { -/// type ContractError = MyContractError; -/// } -pub trait AccessControlled { - type ContractError; - - fn check_role( - access_control: AccountId, - account: AccountId, - role: Role, - contract_call_error_handler: fn(why: InkEnvError) -> ContractError, - access_control_error_handler: fn(role: Role) -> ContractError, - ) -> Result<(), ContractError> { - match build_call::() - .call_type(Call::new().callee(access_control)) - .exec_input( - ExecutionInput::new(Selector::new(HAS_ROLE_SELECTOR)) - .push_arg(account) - .push_arg(role), - ) - .returns::() - .fire() - { - Ok(has_role) => match has_role { - true => Ok(()), - false => Err(access_control_error_handler(role)), - }, - Err(why) => Err(contract_call_error_handler(why)), - } - } -} diff --git a/contracts/adder/.gitignore b/contracts/adder/.gitignore new file mode 100755 index 0000000000..8de8f877e4 --- /dev/null +++ b/contracts/adder/.gitignore @@ -0,0 +1,9 @@ +# Ignore build artifacts from the local tests sub-crate. +/target/ + +# Ignore backup files creates by cargo fmt. +**/*.rs.bk + +# Remove Cargo.lock when creating an executable, leave it for libraries +# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock +Cargo.lock diff --git a/contracts/adder/Cargo.toml b/contracts/adder/Cargo.toml new file mode 100644 index 0000000000..b55dd2fac2 --- /dev/null +++ b/contracts/adder/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "adder" +version = "0.1.0" +authors = ["[your_name] <[your_email]>"] +edition = "2021" + +[dependencies] +anyhow = "*" +ink = { version = "4.0.0-beta", default-features = false } + +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } + +[lib] +name = "adder" +path = "lib.rs" +crate-type = [ + # Used for normal contract Wasm blobs. + "cdylib", +] + +[features] +default = ["std"] +std = [ + "ink/std", + "scale/std", + "scale-info/std", +] +ink-as-dependency = [] diff --git a/contracts/adder/deploy.sh b/contracts/adder/deploy.sh new file mode 100755 index 0000000000..477935cc56 --- /dev/null +++ b/contracts/adder/deploy.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -euox pipefail + +NODE_URL="${NODE_URL:-ws://localhost:9944}" +AUTHORITY="${AUTHORITY:-//Alice}" + +function run_ink_builder() { + docker start ink_builder 1>&2 || docker run \ + --network host \ + -v "${PWD}/../..:/code" \ + -u "$(id -u):$(id -g)" \ + --name ink_builder \ + --platform linux/amd64 \ + --detach \ + --rm public.ecr.aws/p6e8q1z1/ink-dev:1.0.0 sleep 1d 1>&2 +} + +function ink_build() { + docker exec \ + -u "$(id -u):$(id -g)" \ + -w "/code/contracts/adder" \ + ink_builder "$@" +} + +run_ink_builder +ink_build rustup target add wasm32-unknown-unknown +ink_build rustup component add rust-src +ink_build cargo contract build --release --quiet 1>&2 + +export ADDER + +ADDER=$( + ink_build cargo contract instantiate --url "$NODE_URL" --suri "$AUTHORITY" --skip-confirm --output-json \ + | jq -r ".contract" +) +echo "$ADDER" diff --git a/contracts/adder/lib.rs b/contracts/adder/lib.rs new file mode 100755 index 0000000000..7e86049c66 --- /dev/null +++ b/contracts/adder/lib.rs @@ -0,0 +1,65 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +//! This is a simple example contract for use with e2e tests of the aleph-client contract interaction. + +#[ink::contract] +mod adder { + #[ink(storage)] + pub struct Adder { + name: Option<[u8; 20]>, + value: u32, + } + + #[ink(event)] + pub struct ValueChanged { + new_value: u32, + } + + #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)] + #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] + pub enum Error { + Overflow, + } + + impl Adder { + #[ink(constructor)] + pub fn new() -> Self { + Self { + value: 0, + name: None, + } + } + + #[ink(message)] + pub fn add(&mut self, value: u32) -> Result<(), Error> { + self.value = self.value.checked_add(value).ok_or(Error::Overflow)?; + + Self::env().emit_event(ValueChanged { + new_value: self.value, + }); + + Ok(()) + } + + #[ink(message)] + pub fn get(&self) -> u32 { + self.value + } + + #[ink(message)] + pub fn set_name(&mut self, name: Option<[u8; 20]>) { + self.name = name; + } + + #[ink(message)] + pub fn get_name(&self) -> Option<[u8; 20]> { + self.name + } + } + + impl Default for Adder { + fn default() -> Self { + Self::new() + } + } +} diff --git a/contracts/button/Cargo.lock b/contracts/button/Cargo.lock index 6657041546..e9d200c2fe 100644 --- a/contracts/button/Cargo.lock +++ b/contracts/button/Cargo.lock @@ -6,16 +6,20 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", "scale-info", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "array-init" version = "2.0.1" @@ -40,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -87,12 +97,7 @@ version = "0.1.0" dependencies = [ "access_control", "game_token", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "marketplace", "openbrush", "parity-scale-codec", @@ -236,6 +241,40 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fs2" version = "0.4.3" @@ -257,12 +296,7 @@ name = "game_token" version = "2.1.0" dependencies = [ "access_control", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -278,17 +312,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.3.3" @@ -304,11 +327,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -324,25 +362,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a291f411e310b7a3bb01ce21102b8c0aea5b7b523e4bad0b40a8e55a76c58906" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075eab468da2937288ec484be920cb18614147003d7f1afbdfcfb190ed771c46" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -350,9 +424,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271689b643d7ccf2bcd09d7ef07eda79cd3366ee042d5bbfcebf534b08da79d7" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -361,12 +434,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -376,45 +449,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.1" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cf662fe6a130ea1ada3520142405e3ed521b79c35b7274cc95dd37bc833571" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94dc22732ced2557f0411de5fa31d6fddc3878968041b699ae16ed1c390d2660" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a089bcac8d7e6a487b7a18ea8a1d20eb540ed26657706ac221cc0e8239047e45" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -425,82 +476,124 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1330da0b8007b86de94f95fbc74769c0461d3b078b291af5497771598db1c5b4" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d442f4f5dcbf120aa84cae9e399065ad99d143d5a920b06d3da286e91c03ec70" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38d71af62cfec3425727d28665a947d636c3be6ae71ac3a79868ef8a08633f3" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea7afd5330a9d3be1533222a48b8ab44b3a3356a5e6bb090bff0790aa562b418" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be827b98c102c413b2309075f0835a9bb8c6325fc6aa09e66963424db7a8bcb5" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ced452d5d0b2268b1257ffd2ec73cf9c3b4fba5f3632f185a03aafec8888439" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -526,9 +619,24 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] [[package]] name = "marketplace" @@ -536,19 +644,19 @@ version = "0.1.0" dependencies = [ "access_control", "game_token", - "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", "ticket_token", ] +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "num-traits" version = "0.2.15" @@ -561,15 +669,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -578,7 +681,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -589,7 +692,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -611,15 +714,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -628,15 +726,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -645,32 +738,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -682,8 +771,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -694,11 +783,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#83ff37cb0d19d15a881ecab2c922596039c8358d" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -746,12 +833,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -788,34 +869,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rlibc" @@ -823,6 +891,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.11" @@ -831,9 +913,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -845,9 +927,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -857,18 +939,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -934,12 +1016,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.4" @@ -991,6 +1067,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.35" @@ -1016,12 +1101,7 @@ name = "ticket_token" version = "2.1.0" dependencies = [ "access_control", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -1078,12 +1158,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" @@ -1100,12 +1174,78 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wyz" version = "0.5.0" @@ -1114,3 +1254,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/button/Cargo.toml b/contracts/button/Cargo.toml index b8be127954..a8468f8320 100644 --- a/contracts/button/Cargo.toml +++ b/contracts/button/Cargo.toml @@ -5,21 +5,17 @@ authors = ["Cardinal Cryptography"] edition = "2021" [dependencies] -ink_env = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_primitives = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } + +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } game_token = { path = "../game_token", default-features = false, features = ["ink-as-dependency"] } ticket_token = { path = "../ticket_token", default-features = false, features = ["ink-as-dependency"] } marketplace = { path = "../marketplace", default-features = false, features = ["ink-as-dependency"] } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } [lib] name = "button" @@ -32,12 +28,7 @@ crate-type = [ [features] default = ["std"] std = [ - "ink_env/std", - "ink_lang/std", - "ink_metadata/std", - "ink_prelude/std", - "ink_primitives/std", - "ink_storage/std", + "ink/std", "scale-info/std", "scale/std", "access_control/std", diff --git a/contracts/button/errors.rs b/contracts/button/errors.rs index 81047085f4..c2799aeadf 100644 --- a/contracts/button/errors.rs +++ b/contracts/button/errors.rs @@ -1,6 +1,10 @@ use access_control::roles::Role; -use ink_env::Error as InkEnvError; -use ink_prelude::{format, string::String}; +use ink::{ + env::Error as InkEnvError, + prelude::{format, string::String}, + LangError, +}; +use marketplace::marketplace::Error as MarketplaceError; use openbrush::contracts::psp22::PSP22Error; /// GameError types @@ -21,6 +25,10 @@ pub enum GameError { CantRetrieveOwnCodeHash, /// Overflow error Arithmethic, + /// Error from the marketplace contract + MarketplaceError(MarketplaceError), + /// Error while calling another contract + ContractCall(LangError), } impl From for GameError { @@ -34,3 +42,15 @@ impl From for GameError { GameError::InkEnvError(format!("{:?}", e)) } } + +impl From for GameError { + fn from(e: MarketplaceError) -> Self { + GameError::MarketplaceError(e) + } +} + +impl From for GameError { + fn from(e: LangError) -> Self { + GameError::ContractCall(e) + } +} diff --git a/contracts/button/lib.rs b/contracts/button/lib.rs index a4d6fd97e7..10aeea5a14 100644 --- a/contracts/button/lib.rs +++ b/contracts/button/lib.rs @@ -3,23 +3,21 @@ mod errors; -use ink_lang as ink; - #[ink::contract] pub mod button_game { - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use game_token::MINT_SELECTOR; - use ink_env::{ - call::{build_call, Call, ExecutionInput, Selector}, - CallFlags, DefaultEnvironment, Error as InkEnvError, + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + #[cfg(feature = "std")] + use ink::storage::traits::StorageLayout; + use ink::{ + codegen::EmitEvent, + env::{call::FromAccountId, CallFlags}, + prelude::vec, + reflect::ContractEventBase, + ToAccountId, }; - use ink_lang::{codegen::EmitEvent, reflect::ContractEventBase}; - use ink_prelude::{format, vec}; - use ink_storage::traits::{PackedLayout, SpreadLayout}; - use marketplace::RESET_SELECTOR as MARKETPLACE_RESET_SELECTOR; - use openbrush::contracts::psp22::PSP22Error; + use marketplace::marketplace::MarketplaceRef; + use openbrush::contracts::psp22::{extensions::mintable::PSP22MintableRef, PSP22Ref}; use scale::{Decode, Encode}; - use ticket_token::{BALANCE_OF_SELECTOR, TRANSFER_FROM_SELECTOR, TRANSFER_SELECTOR}; use crate::errors::GameError; @@ -59,11 +57,8 @@ pub mod button_game { } /// Scoring strategy indicating what kind of reward users get for pressing the button - #[derive(Debug, Encode, Decode, Clone, Copy, SpreadLayout, PackedLayout, PartialEq, Eq)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink_storage::traits::StorageLayout) - )] + #[derive(Debug, Encode, Decode, Clone, Copy, PartialEq, Eq)] + #[cfg_attr(feature = "std", derive(scale_info::TypeInfo, StorageLayout))] pub enum Scoring { /// Pressing the button as soon as possible gives the highest reward EarlyBirdSpecial, @@ -91,19 +86,15 @@ pub mod button_game { /// Account ID of the ticket token pub ticket_token: AccountId, /// access control contract - pub access_control: AccountId, + pub access_control: AccessControlRef, /// ticket marketplace contract - pub marketplace: AccountId, + pub marketplace: MarketplaceRef, /// scoring strategy pub scoring: Scoring, /// current round number pub round: u64, } - impl AccessControlled for ButtonGame { - type ContractError = GameError; - } - impl ButtonGame { #[ink(constructor)] pub fn new( @@ -119,9 +110,11 @@ pub mod button_game { .expect("Called new on a contract with no code hash"); let required_role = Role::Initializer(code_hash); let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); + let access_control = AccessControlRef::from_account_id(access_control); - match ButtonGame::check_role(access_control, caller, required_role) { + match ButtonGame::check_role(&access_control, caller, required_role) { Ok(_) => Self::init( + access_control, ticket_token, reward_token, marketplace, @@ -162,7 +155,7 @@ pub mod button_game { /// Returns the current access control contract address #[ink(message)] pub fn access_control(&self) -> AccountId { - self.access_control + self.access_control.to_account_id() } /// Returns address of the game's reward token @@ -180,7 +173,7 @@ pub mod button_game { /// Returns the address of the marketplace for exchanging this game's rewards for tickets. #[ink(message)] pub fn marketplace(&self) -> AccountId { - self.marketplace + self.marketplace.to_account_id() } /// Returns own code hash @@ -207,13 +200,13 @@ pub mod button_game { // transfers 1 ticket token from the caller to self // tx will fail if user did not give allowance to the game contract // or does not have enough balance - self.transfer_ticket(caller, this, 1u128)??; + self.transfer_ticket(caller, this, 1u128)?; let score = self.score(now); // mints reward tokens to pay out the reward // contract needs to have a Minter role on the reward token contract - self.mint_reward(caller, score)??; + self.mint_reward(caller, score)?; self.presses += 1; self.last_presser = Some(caller); @@ -255,8 +248,8 @@ pub mod button_game { let caller = self.env().caller(); let this = self.env().account_id(); let required_role = Role::Owner(this); - ButtonGame::check_role(self.access_control, caller, required_role)?; - self.access_control = new_access_control; + ButtonGame::check_role(&self.access_control, caller, required_role)?; + self.access_control = AccessControlRef::from_account_id(new_access_control); Ok(()) } @@ -268,13 +261,14 @@ pub mod button_game { let caller = self.env().caller(); let this = self.env().account_id(); let required_role = Role::Owner(this); - ButtonGame::check_role(self.access_control, caller, required_role)?; + ButtonGame::check_role(&self.access_control, caller, required_role)?; self.env().terminate_contract(caller) } //=================================================================================================== fn init( + access_control: AccessControlRef, ticket_token: AccountId, reward_token: AccountId, marketplace: AccountId, @@ -285,11 +279,11 @@ pub mod button_game { let deadline = now + button_lifetime; let contract = Self { - access_control: AccountId::from(ACCESS_CONTROL_PUBKEY), + access_control, button_lifetime, reward_token, ticket_token, - marketplace, + marketplace: MarketplaceRef::from_account_id(marketplace), last_press: now, scoring, last_presser: None, @@ -327,7 +321,7 @@ pub mod button_game { fn reward_pressiah(&self) -> ButtonResult<()> { if let Some(pressiah) = self.last_presser { let reward = self.pressiah_score(); - self.mint_reward(pressiah, reward)??; + self.mint_reward(pressiah, reward)?; }; Ok(()) @@ -342,59 +336,38 @@ pub mod button_game { } fn transfer_tickets_to_marketplace(&self) -> ButtonResult<()> { - build_call::() - .call_type(Call::new().callee(self.ticket_token)) - .exec_input( - ExecutionInput::new(Selector::new(TRANSFER_SELECTOR)) - .push_arg(self.marketplace) - .push_arg(self.held_tickets()?) - .push_arg::>(vec![]), - ) - .call_flags(CallFlags::default().set_allow_reentry(true)) - .returns::>() - .fire()??; + PSP22Ref::transfer_builder( + &self.ticket_token, + self.marketplace.to_account_id(), + self.held_tickets(), + vec![], + ) + .call_flags(CallFlags::default().set_allow_reentry(true)) + .fire()???; Ok(()) } - fn held_tickets(&self) -> ButtonResult { - let result = build_call::() - .call_type(Call::new().callee(self.ticket_token)) - .exec_input( - ExecutionInput::new(Selector::new(BALANCE_OF_SELECTOR)) - .push_arg(self.env().account_id()), - ) - .returns::() - .fire()?; - - Ok(result) + fn held_tickets(&self) -> Balance { + PSP22Ref::balance_of(&self.ticket_token, self.env().account_id()) } - fn reset_marketplace(&self) -> ButtonResult<()> { - build_call::() - .call_type(Call::new().callee(self.marketplace)) - .exec_input(ExecutionInput::new(Selector::new( - MARKETPLACE_RESET_SELECTOR, - ))) - .returns::>() - .fire()??; + fn reset_marketplace(&mut self) -> ButtonResult<()> { + self.marketplace.reset()?; Ok(()) } - fn check_role(access_control: AccountId, account: AccountId, role: Role) -> ButtonResult<()> - where - Self: AccessControlled, - { - ::check_role( - access_control, - account, - role, - |why: InkEnvError| { - GameError::InkEnvError(format!("Calling access control has failed: {:?}", why)) - }, - GameError::MissingRole, - ) + fn check_role( + access_control: &AccessControlRef, + account: AccountId, + role: Role, + ) -> ButtonResult<()> { + if access_control.has_role(account, role) { + Ok(()) + } else { + Err(GameError::MissingRole(role)) + } } fn score(&self, now: BlockNumber) -> Balance { @@ -414,35 +387,18 @@ pub mod button_game { from: AccountId, to: AccountId, value: Balance, - ) -> Result, InkEnvError> { - build_call::() - .call_type(Call::new().callee(self.ticket_token)) - .exec_input( - ExecutionInput::new(Selector::new(TRANSFER_FROM_SELECTOR)) - .push_arg(from) - .push_arg(to) - .push_arg(value) - .push_arg::>(vec![]), - ) + ) -> ButtonResult<()> { + PSP22Ref::transfer_from_builder(&self.ticket_token, from, to, value, vec![]) .call_flags(CallFlags::default().set_allow_reentry(true)) - .returns::>() - .fire() + .fire()???; + + Ok(()) } - fn mint_reward( - &self, - to: AccountId, - amount: Balance, - ) -> Result, InkEnvError> { - build_call::() - .call_type(Call::new().callee(self.reward_token)) - .exec_input( - ExecutionInput::new(Selector::new(MINT_SELECTOR)) - .push_arg(to) - .push_arg(amount), - ) - .returns::>() - .fire() + fn mint_reward(&self, to: AccountId, amount: Balance) -> ButtonResult<()> { + PSP22MintableRef::mint(&self.reward_token, to, amount)?; + + Ok(()) } fn emit_event(emitter: EE, event: Event) diff --git a/contracts/env/dev b/contracts/env/dev index acb2ca9f90..6c3f7f3bd7 100644 --- a/contracts/env/dev +++ b/contracts/env/dev @@ -1,4 +1,4 @@ -export NODE=ws://127.0.0.1:9943 +export NODE=ws://127.0.0.1:9944 # authority is a joint name for the account that is an INITIALIZER, OWNER and ADMIN of the game contracts for the purposes of the deployment export AUTHORITY=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY diff --git a/contracts/game_token/Cargo.lock b/contracts/game_token/Cargo.lock index 3f322fe996..844a60cb54 100644 --- a/contracts/game_token/Cargo.lock +++ b/contracts/game_token/Cargo.lock @@ -6,12 +6,18 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", ] [[package]] @@ -38,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -215,6 +227,40 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fs2" version = "0.4.3" @@ -236,13 +282,7 @@ name = "game_token" version = "2.1.0" dependencies = [ "access_control", - "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -258,17 +298,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.3.3" @@ -284,11 +313,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -304,25 +348,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed249de74298ed051ebcf6d3082b8d3dbd19cbc448d9ed3235d8a7b92713049" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb9d32ec27d71fefb3f2b6a26bae82a2c6509d7ad61e8a5107b6291a1b03ecb" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -330,9 +410,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1549f5966167387c89fb3dfcdc59973bfb396cc3a7110d7a31ad5fdea56db0cf" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -341,12 +420,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -356,45 +435,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5282f2722ac6dca469e7f223a7b38b2a6d20fbca6b974497e630d5dc8934e9" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.0" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3a5de33b59450adc3f61c5eb05b768067c7ab8af9d00f33e284310598168dc" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d4d614462280fa06e15b9ca5725d7c8440dde93c8dae1c6f15422f7756cacb" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -405,82 +462,124 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f85f64141957c5db7cbabbb97a9c16c489e5e9d363e9f147d132a43c71cd29" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca6c159a2774f07437c6fd9ea710eb73a6b5e9a031a932bddf08742bf2c081a" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f7f4dec15e573496c9d2af353e78bde84add391251608f25b5adcf175dc777" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3296dd1c4f4fe12ede7c92d60e6fcb94d46a959ec19c701e4ac588b09e0b4a6" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff9b503995a7b41fe201a7a2643ce22f5a11e0b67db7b685424b6d5fe0ecf0b" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb68e24e93e8327dda1924868d7ee4dbe01e1ed2b392f28583caa96809b585c" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -506,9 +605,30 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "num-traits" @@ -522,15 +642,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -539,7 +654,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -550,7 +665,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -566,15 +681,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -583,15 +693,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -600,32 +705,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -637,8 +738,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -649,11 +750,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#83ff37cb0d19d15a881ecab2c922596039c8358d" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -700,12 +799,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.1.3" @@ -741,34 +834,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rlibc" @@ -776,6 +856,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.10" @@ -784,9 +878,9 @@ checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "scale-info" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -798,9 +892,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -810,18 +904,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -887,12 +981,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.1" @@ -944,6 +1032,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.31" @@ -1015,12 +1112,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" @@ -1037,12 +1128,78 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wyz" version = "0.5.0" @@ -1051,3 +1208,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/game_token/Cargo.toml b/contracts/game_token/Cargo.toml index a13dbaefc8..7555a656c7 100644 --- a/contracts/game_token/Cargo.toml +++ b/contracts/game_token/Cargo.toml @@ -6,18 +6,12 @@ edition = "2021" license = "Apache 2.0" [dependencies] -ink_primitives = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_engine = { version = "~3.3.0", default-features = false, optional = true } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } [lib] @@ -27,22 +21,18 @@ crate-type = [ # Used for normal contract Wasm blobs. "cdylib", # Used for ABI generation. - "rlib", + "rlib", ] [features] default = ["std"] std = [ - "ink_env/std", - "ink_lang/std", - "ink_metadata", - "ink_metadata/std", - "ink_primitives/std", - "ink_storage/std", + "ink/std", "openbrush/std", "scale-info", "scale-info/std", "scale/std", + "access_control/std" ] ink-as-dependency = [] diff --git a/contracts/game_token/lib.rs b/contracts/game_token/lib.rs index 2e602ee812..57827b3080 100644 --- a/contracts/game_token/lib.rs +++ b/contracts/game_token/lib.rs @@ -9,14 +9,14 @@ pub use crate::game_token::{ #[openbrush::contract] pub mod game_token { - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use ink_env::Error as InkEnvError; - use ink_lang::{ + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + use ink::{ codegen::{EmitEvent, Env}, + env::call::FromAccountId, + prelude::{format, string::String}, reflect::ContractEventBase, + ToAccountId, }; - use ink_prelude::{format, string::String}; - use ink_storage::traits::SpreadAllocate; use openbrush::{ contracts::psp22::{ extensions::{burnable::*, metadata::*, mintable::*}, @@ -33,14 +33,13 @@ pub mod game_token { pub const BURN_SELECTOR: [u8; 4] = [0x7a, 0x9d, 0xa5, 0x10]; #[ink(storage)] - #[derive(Default, SpreadAllocate, Storage)] + #[derive(Storage)] pub struct GameToken { #[storage_field] psp22: psp22::Data, #[storage_field] metadata: metadata::Data, - /// access control contract - access_control: AccountId, + access_control: AccessControlRef, } impl PSP22 for GameToken {} @@ -102,10 +101,6 @@ pub mod game_token { } } - impl AccessControlled for GameToken { - type ContractError = PSP22Error; - } - /// Result type pub type Result = core::result::Result; /// Event type @@ -147,28 +142,26 @@ pub mod game_token { let code_hash = Self::env() .own_code_hash() .expect("Called new on a contract with no code hash"); - let required_role = Role::Initializer(code_hash); - - let role_check = ::check_role( - AccountId::from(ACCESS_CONTROL_PUBKEY), - caller, - required_role, - |why: InkEnvError| { - PSP22Error::Custom( - format!("Calling access control has failed: {:?}", why).into(), - ) - }, - |role: Role| PSP22Error::Custom(format!("MissingRole:{:?}", role).into()), - ); - match role_check { - Ok(_) => ink_lang::codegen::initialize_contract(|instance: &mut GameToken| { - instance.metadata.name = Some(name.into()); - instance.metadata.symbol = Some(symbol.into()); - instance.metadata.decimals = 12; - instance.access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); - }), - Err(why) => panic!("Could not initialize the contract {:?}", why), + let required_role = Role::Initializer(code_hash); + let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); + let access_control = AccessControlRef::from_account_id(access_control); + + if access_control.has_role(caller, required_role) { + let metadata = metadata::Data { + name: Some(name.into()), + symbol: Some(symbol.into()), + decimals: 12, + ..Default::default() + }; + + Self { + metadata, + access_control, + psp22: psp22::Data::default(), + } + } else { + panic!("Caller is not allowed to initialize this contract"); } } @@ -192,21 +185,15 @@ pub mod game_token { /// Returns the contract's access control contract address #[ink(message, selector = 8)] pub fn access_control(&self) -> AccountId { - self.access_control + self.access_control.to_account_id() } fn check_role(&self, account: AccountId, role: Role) -> Result<()> { - ::check_role( - self.access_control, - account, - role, - |why: InkEnvError| { - PSP22Error::Custom( - format!("Calling access control has failed: {:?}", why).into(), - ) - }, - |role: Role| PSP22Error::Custom(format!("MissingRole:{:?}", role).into()), - ) + if self.access_control.has_role(account, role) { + Ok(()) + } else { + Err(PSP22Error::Custom(format!("MissingRole:{:?}", role).into())) + } } /// Sets new access control contract address @@ -219,7 +206,7 @@ pub mod game_token { let required_role = Role::Owner(this); self.check_role(caller, required_role)?; - self.access_control = access_control; + self.access_control = AccessControlRef::from_account_id(access_control); Ok(()) } diff --git a/contracts/marketplace/Cargo.lock b/contracts/marketplace/Cargo.lock index 65dde5f2d6..23ca8455ca 100644 --- a/contracts/marketplace/Cargo.lock +++ b/contracts/marketplace/Cargo.lock @@ -6,16 +6,20 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", "scale-info", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "array-init" version = "2.0.1" @@ -40,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -217,6 +227,40 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fs2" version = "0.4.3" @@ -238,12 +282,7 @@ name = "game_token" version = "2.1.0" dependencies = [ "access_control", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -259,17 +298,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.3.3" @@ -285,11 +313,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -305,25 +348,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed249de74298ed051ebcf6d3082b8d3dbd19cbc448d9ed3235d8a7b92713049" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb9d32ec27d71fefb3f2b6a26bae82a2c6509d7ad61e8a5107b6291a1b03ecb" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -331,9 +410,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1549f5966167387c89fb3dfcdc59973bfb396cc3a7110d7a31ad5fdea56db0cf" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -342,12 +420,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -357,45 +435,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5282f2722ac6dca469e7f223a7b38b2a6d20fbca6b974497e630d5dc8934e9" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.0" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3a5de33b59450adc3f61c5eb05b768067c7ab8af9d00f33e284310598168dc" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d4d614462280fa06e15b9ca5725d7c8440dde93c8dae1c6f15422f7756cacb" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -406,82 +462,124 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f85f64141957c5db7cbabbb97a9c16c489e5e9d363e9f147d132a43c71cd29" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca6c159a2774f07437c6fd9ea710eb73a6b5e9a031a932bddf08742bf2c081a" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f7f4dec15e573496c9d2af353e78bde84add391251608f25b5adcf175dc777" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3296dd1c4f4fe12ede7c92d60e6fcb94d46a959ec19c701e4ac588b09e0b4a6" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff9b503995a7b41fe201a7a2643ce22f5a11e0b67db7b685424b6d5fe0ecf0b" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb68e24e93e8327dda1924868d7ee4dbe01e1ed2b392f28583caa96809b585c" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -507,9 +605,24 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] [[package]] name = "marketplace" @@ -517,19 +630,19 @@ version = "0.1.0" dependencies = [ "access_control", "game_token", - "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", "ticket_token", ] +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "num-traits" version = "0.2.15" @@ -542,15 +655,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -559,7 +667,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -570,7 +678,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -586,15 +694,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -603,15 +706,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -620,32 +718,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -657,8 +751,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -669,11 +763,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#83ff37cb0d19d15a881ecab2c922596039c8358d" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -720,12 +812,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.1.3" @@ -761,34 +847,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rlibc" @@ -796,6 +869,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.10" @@ -804,9 +891,9 @@ checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "scale-info" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -818,9 +905,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -830,18 +917,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -907,12 +994,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.1" @@ -964,6 +1045,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.31" @@ -989,12 +1079,7 @@ name = "ticket_token" version = "2.1.0" dependencies = [ "access_control", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -1051,12 +1136,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" @@ -1073,12 +1152,78 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wyz" version = "0.5.0" @@ -1087,3 +1232,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/marketplace/Cargo.toml b/contracts/marketplace/Cargo.toml index 3baab06bc8..97d96fc6b8 100644 --- a/contracts/marketplace/Cargo.toml +++ b/contracts/marketplace/Cargo.toml @@ -6,18 +6,13 @@ edition = "2021" license = "Apache 2.0" [dependencies] -ink_primitives = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_engine = { version = "~3.3.0", default-features = false, optional = true } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } + +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } game_token = { path = "../game_token", default-features = false, features = ["ink-as-dependency"] } ticket_token = { path = "../ticket_token", default-features = false, features = ["ink-as-dependency"] } @@ -26,23 +21,14 @@ ticket_token = { path = "../ticket_token", default-features = false, features = name = "marketplace" path = "lib.rs" crate-type = [ - # Used for normal contract Wasm blobs. "cdylib", - # Used for ABI generation. "rlib", ] [features] default = ["std"] std = [ - "ink_env/std", - "ink_lang/std", - "ink_metadata", - "ink_metadata/std", - "ink_primitives/std", - "ink_storage/std", - "ink_prelude/std", - "ink_engine/std", + "ink/std", "openbrush/std", "scale-info", "scale-info/std", diff --git a/contracts/marketplace/lib.rs b/contracts/marketplace/lib.rs index 64a49ef8ac..48038531da 100644 --- a/contracts/marketplace/lib.rs +++ b/contracts/marketplace/lib.rs @@ -1,4 +1,4 @@ -//! Implement a Dutch auction of one token for another. +//! Implements a Dutch auction of one token for another. //! //! This contract will auction off units of one token (referred to as `tickets`), accepting payment //! in another token (`reward token`). The auction keeps track of the average price over all sales @@ -20,30 +20,24 @@ #![feature(min_specialization)] #![allow(clippy::let_unit_value)] -use ink_lang as ink; - pub const RESET_SELECTOR: [u8; 4] = [0x00, 0x00, 0x00, 0x01]; #[ink::contract] pub mod marketplace { - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use game_token::BURN_SELECTOR as REWARD_BURN_SELECTOR; - use ink_env::{ - call::{build_call, Call, ExecutionInput, Selector}, - CallFlags, + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + use ink::{ + codegen::EmitEvent, + env::call::FromAccountId, + prelude::{format, string::String, vec}, + reflect::ContractEventBase, + LangError, }; - use ink_lang::{codegen::EmitEvent, reflect::ContractEventBase}; - use ink_prelude::{format, string::String}; - use openbrush::contracts::psp22::PSP22Error; - use ticket_token::{ - BALANCE_OF_SELECTOR as TICKET_BALANCE_SELECTOR, - TRANSFER_SELECTOR as TRANSFER_TICKET_SELECTOR, + use openbrush::contracts::psp22::{ + extensions::burnable::PSP22BurnableRef, PSP22Error, PSP22Ref, }; type Event = ::Type; - const DUMMY_DATA: &[u8] = &[0x0]; - #[ink(storage)] pub struct Marketplace { total_proceeds: Balance, @@ -54,6 +48,7 @@ pub mod marketplace { sale_multiplier: Balance, ticket_token: AccountId, reward_token: AccountId, + access_control: AccessControlRef, } #[derive(Eq, PartialEq, Debug, scale::Encode, scale::Decode)] @@ -78,8 +73,8 @@ pub mod marketplace { #[derive(Clone, Eq, PartialEq, Debug)] pub struct Reset; - impl From for Error { - fn from(inner: ink_env::Error) -> Self { + impl From for Error { + fn from(inner: ink::env::Error) -> Self { Error::ContractCall(format!("{:?}", inner)) } } @@ -90,8 +85,10 @@ pub mod marketplace { } } - impl AccessControlled for Marketplace { - type ContractError = Error; + impl From for Error { + fn from(inner: LangError) -> Self { + Error::ContractCall(format!("{:?}", inner)) + } } impl Marketplace { @@ -104,18 +101,22 @@ pub mod marketplace { sale_multiplier: Balance, auction_length: BlockNumber, ) -> Self { - Self::ensure_role(Self::initializer()) - .unwrap_or_else(|e| panic!("Failed to initialize the contract {:?}", e)); - - Marketplace { - ticket_token, - reward_token, - min_price, - sale_multiplier, - auction_length, - current_start_block: Self::env().block_number(), - total_proceeds: starting_price.saturating_div(sale_multiplier), - tickets_sold: 1, + let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); + let access_control = AccessControlRef::from_account_id(access_control); + if access_control.has_role(Self::env().caller(), Self::initializer()) { + Marketplace { + ticket_token, + reward_token, + min_price, + sale_multiplier, + auction_length, + current_start_block: Self::env().block_number(), + total_proceeds: starting_price.saturating_div(sale_multiplier), + tickets_sold: 1, + access_control, + } + } else { + panic!("Caller is not allowed to initialize this contract"); } } @@ -160,7 +161,7 @@ pub mod marketplace { /// /// The tickets will be auctioned off one by one. #[ink(message)] - pub fn available_tickets(&self) -> Result { + pub fn available_tickets(&self) -> Balance { self.ticket_balance() } @@ -173,7 +174,7 @@ pub mod marketplace { /// Update the minimal price. #[ink(message)] pub fn set_min_price(&mut self, value: Balance) -> Result<(), Error> { - Self::ensure_role(self.admin())?; + self.ensure_role(self.admin())?; self.min_price = value; @@ -199,7 +200,7 @@ pub mod marketplace { /// current price is greater than that. #[ink(message)] pub fn buy(&mut self, max_price: Option) -> Result<(), Error> { - if self.ticket_balance()? == 0 { + if self.ticket_balance() == 0 { return Err(Error::MarketplaceEmpty); } @@ -230,7 +231,7 @@ pub mod marketplace { /// Requires `Role::Admin`. #[ink(message, selector = 0x00000001)] pub fn reset(&mut self) -> Result<(), Error> { - Self::ensure_role(self.admin())?; + self.ensure_role(self.admin())?; self.current_start_block = self.env().block_number(); Self::emit_event(self.env(), Event::Reset(Reset {})); @@ -245,7 +246,7 @@ pub mod marketplace { pub fn terminate(&mut self) -> Result<(), Error> { let caller = self.env().caller(); let this = self.env().account_id(); - Self::ensure_role(Role::Owner(this))?; + self.ensure_role(Role::Owner(this))?; self.env().terminate_contract(caller) } @@ -265,56 +266,29 @@ pub mod marketplace { } fn take_payment(&self, from: AccountId, amount: Balance) -> Result<(), Error> { - build_call::() - .call_type(Call::new().callee(self.reward_token)) - .exec_input( - ExecutionInput::new(Selector::new(REWARD_BURN_SELECTOR)) - .push_arg(from) - .push_arg(amount), - ) - .call_flags(CallFlags::default().set_allow_reentry(true)) - .returns::>() - .fire()??; + PSP22BurnableRef::burn_builder(&self.reward_token, from, amount) + .call_flags(ink::env::CallFlags::default().set_allow_reentry(true)) + .fire()???; Ok(()) } fn give_ticket(&self, to: AccountId) -> Result<(), Error> { - build_call::() - .call_type(Call::new().callee(self.ticket_token)) - .exec_input( - ExecutionInput::new(Selector::new(TRANSFER_TICKET_SELECTOR)) - .push_arg(to) - .push_arg(1u128) - .push_arg(DUMMY_DATA), - ) - .returns::>() - .fire()??; + PSP22Ref::transfer(&self.ticket_token, to, 1, vec![])?; Ok(()) } - fn ticket_balance(&self) -> Result { - let balance = build_call::() - .call_type(Call::new().callee(self.ticket_token)) - .exec_input( - ExecutionInput::new(Selector::new(TICKET_BALANCE_SELECTOR)) - .push_arg(self.env().account_id()), - ) - .returns::() - .fire()?; - - Ok(balance) + fn ticket_balance(&self) -> Balance { + PSP22Ref::balance_of(&self.ticket_token, self.env().account_id()) } - fn ensure_role(role: Role) -> Result<(), Error> { - ::check_role( - AccountId::from(ACCESS_CONTROL_PUBKEY), - Self::env().caller(), - role, - |reason| reason.into(), - Error::MissingRole, - ) + fn ensure_role(&self, role: Role) -> Result<(), Error> { + if self.access_control.has_role(self.env().caller(), role) { + Ok(()) + } else { + Err(Error::MissingRole(role)) + } } fn initializer() -> Role { diff --git a/contracts/scripts/deploy.sh b/contracts/scripts/deploy.sh index ecdd343570..2f4bed7d99 100755 --- a/contracts/scripts/deploy.sh +++ b/contracts/scripts/deploy.sh @@ -1,9 +1,33 @@ #!/bin/bash -set -euo pipefail +set -euox pipefail # --- FUNCTIONS +function run_ink_builder() { + docker start ink_builder || docker run \ + --network host \ + -v "${PWD}:/code" \ + -u "$(id -u):$(id -g)" \ + --name ink_builder \ + --platform linux/amd64 \ + --detach \ + --rm public.ecr.aws/p6e8q1z1/ink-dev:1.0.0 sleep 1d +} + +function ink_build() { + contract_dir=$(basename "${PWD}") + + docker exec \ + -u "$(id -u):$(id -g)" \ + -w "/code/contracts/$contract_dir" \ + ink_builder "$@" +} + +function cargo_contract() { + ink_build cargo contract "$@" +} + function upload_contract { local __resultvar=$1 @@ -23,16 +47,14 @@ function upload_contract { # --- UPLOAD CONTRACT CODE - code_hash=$(cargo contract upload --url "$NODE" --suri "$AUTHORITY_SEED") - echo "$code_hash" - code_hash=$(echo "$code_hash" | grep hash | tail -1 | cut -c 14-) + code_hash=$(cargo_contract upload --url "$NODE" --suri "$AUTHORITY_SEED" --output-json | jq -r '.code_hash') echo "$contract_name code hash: $code_hash" cd "$CONTRACTS_PATH"/access_control # Set the initializer of the contract - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Initializer('"$code_hash"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Initializer('$code_hash')' --suri "$AUTHORITY_SEED" --skip-confirm eval $__resultvar="'$code_hash'" } @@ -48,8 +70,8 @@ function deploy_ticket_token { cd "$CONTRACTS_PATH"/ticket_token - local contract_address=$(cargo contract instantiate --url "$NODE" --constructor new --args \"$token_name\" \"$token_symbol\" "$TICKET_BALANCE" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm) - local contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + local contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new --args \"$token_name\" \"$token_symbol\" "$TICKET_BALANCE" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm --output-json) + local contract_address=$(echo "$contract_address" | jq -r '.contract') echo "$token_symbol ticket contract instance address: $contract_address" @@ -58,7 +80,7 @@ function deploy_ticket_token { cd "$CONTRACTS_PATH"/access_control # set the admin and the owner of the contract instance - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm eval $__resultvar="'$contract_address'" } @@ -74,8 +96,8 @@ function deploy_game_token { cd "$CONTRACTS_PATH"/game_token - local contract_address=$(cargo contract instantiate --url "$NODE" --constructor new --args \"$token_name\" \"$token_symbol\" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm) - local contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + local contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new --args \"$token_name\" \"$token_symbol\" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm --output-json) + local contract_address=$(echo "$contract_address" | jq -r '.contract') echo "$token_symbol token contract instance address: $contract_address" @@ -84,7 +106,7 @@ function deploy_game_token { cd "$CONTRACTS_PATH"/access_control # set the owner of the contract instance - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm eval "$__resultvar='$contract_address'" } @@ -102,20 +124,20 @@ function deploy_button_game { cd "$CONTRACTS_PATH"/button - local contract_address=$(cargo contract instantiate --url "$NODE" --constructor new --args "$ticket_token" "$game_token" "$marketplace" "$LIFETIME" "$game_type" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm) - local contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + local contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new --args "$ticket_token" "$game_token" "$marketplace" "$LIFETIME" "$game_type" --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm --output-json) + local contract_address=$(echo "$contract_address" | jq -r '.contract') echo "$game_type contract instance address: $contract_address" # --- GRANT PRIVILEGES ON THE CONTRACT cd "$CONTRACTS_PATH"/access_control - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm if [ "$ENV_NAME" = "dev" ]; then - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Minter('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Minter('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm fi - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Admin('"$marketplace"')' --suri "$AUTHORITY_SEED" --skip-confirm - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Minter('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Admin('"$marketplace"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Minter('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm eval "$__resultvar='$contract_address'" } @@ -138,10 +160,10 @@ function deploy_marketplace { local sale_price_multiplier=2 local contract_address - contract_address=$(cargo contract instantiate --url "$NODE" --constructor new \ + contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new \ --args "$ticket_token" "$game_token" "$initial_price" "$min_price" "$sale_price_multiplier" "$blocks_per_hour" \ - --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm) - contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + --suri "$AUTHORITY_SEED" --salt "$salt" --skip-confirm --output-json) + contract_address=$(echo "$contract_address" | jq -r '.contract') echo "Marketplace for $contract_name instance address: $contract_address" @@ -149,9 +171,9 @@ function deploy_marketplace { cd "$CONTRACTS_PATH"/access_control - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Admin('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Burner('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Admin('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$contract_address" 'Burner('"$game_token"')' --suri "$AUTHORITY_SEED" --skip-confirm eval "$__resultvar='$contract_address'" } @@ -164,8 +186,8 @@ function deploy_simple_dex { cd "$CONTRACTS_PATH"/simple_dex local contract_address - contract_address=$(cargo contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm) - contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm --output-json) + contract_address=$(echo "$contract_address" | jq -r '.contract') echo "Simple dex contract instance address: $contract_address" @@ -173,9 +195,9 @@ function deploy_simple_dex { cd "$CONTRACTS_PATH"/access_control - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Admin('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'LiquidityProvider('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Admin('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'LiquidityProvider('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm eval "$__resultvar='$contract_address'" } @@ -186,7 +208,7 @@ function whitelist_swap_pair() { cd "$CONTRACTS_PATH"/simple_dex - cargo contract call --url "$NODE" --contract "$SIMPLE_DEX" --message add_swap_pair --args "$from_address" "$to_address" --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$SIMPLE_DEX" --message add_swap_pair --args "$from_address" "$to_address" --suri "$AUTHORITY_SEED" --skip-confirm } function deploy_wrapped_azero { @@ -197,8 +219,8 @@ function deploy_wrapped_azero { cd "$CONTRACTS_PATH"/wrapped_azero local contract_address - contract_address=$(cargo contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm) - contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 14-) + contract_address=$(cargo_contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm --output-json) + contract_address=$(echo "$contract_address" | jq -r '.contract') echo "wrapped Azero contract instance address: $contract_address" @@ -206,7 +228,7 @@ function deploy_wrapped_azero { cd "$CONTRACTS_PATH"/access_control - cargo contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm + cargo_contract call --url "$NODE" --contract "$ACCESS_CONTROL" --message grant_role --args "$AUTHORITY" 'Owner('"$contract_address"')' --suri "$AUTHORITY_SEED" --skip-confirm eval "$__resultvar='$contract_address'" } @@ -227,35 +249,39 @@ CONTRACTS_PATH=$(pwd)/contracts # --- COMPILE CONTRACTS +run_ink_builder + cd "$CONTRACTS_PATH"/access_control -cargo contract build --release +ink_build rustup target add wasm32-unknown-unknown +ink_build rustup component add rust-src +cargo_contract build --release cd "$CONTRACTS_PATH"/ticket_token -cargo contract build --release +cargo_contract build --release cd "$CONTRACTS_PATH"/game_token -cargo contract build --release +cargo_contract build --release cd "$CONTRACTS_PATH"/button -cargo contract build --release +cargo_contract build --release cd "$CONTRACTS_PATH"/marketplace -cargo contract build --release +cargo_contract build --release cd "$CONTRACTS_PATH"/simple_dex -cargo contract build --release +cargo_contract build --release cd "$CONTRACTS_PATH"/wrapped_azero -cargo contract build --release +cargo_contract build --release -# --- DEPLOY ACCESS CONTROL CONTRACT +# # --- DEPLOY ACCESS CONTROL CONTRACT cd "$CONTRACTS_PATH"/access_control -ACCESS_CONTROL_CODE_HASH=$(cargo contract upload --url "$NODE" --suri "$AUTHORITY_SEED") +ACCESS_CONTROL_CODE_HASH=$(cargo_contract upload --url "$NODE" --suri "$AUTHORITY_SEED") ACCESS_CONTROL_CODE_HASH=$(echo "$ACCESS_CONTROL_CODE_HASH" | grep hash | tail -1 | cut -c 14-) -ACCESS_CONTROL=$(cargo contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm) -ACCESS_CONTROL=$(echo "$ACCESS_CONTROL" | grep Contract | tail -1 | cut -c 14-) +ACCESS_CONTROL=$(cargo_contract instantiate --url "$NODE" --constructor new --suri "$AUTHORITY_SEED" --skip-confirm --output-json) +ACCESS_CONTROL=$(echo "$ACCESS_CONTROL" | jq -r '.contract') ACCESS_CONTROL_PUBKEY=$(docker run --rm --entrypoint "/bin/sh" "${NODE_IMAGE}" -c "aleph-node key inspect $ACCESS_CONTROL" | grep hex | cut -c 23- | cut -c 3-) echo "access control contract address: $ACCESS_CONTROL" diff --git a/contracts/scripts/test.sh b/contracts/scripts/test.sh index aa69af279e..1f2549db06 100755 --- a/contracts/scripts/test.sh +++ b/contracts/scripts/test.sh @@ -4,32 +4,12 @@ set -euo pipefail E2E_PATH=$(pwd)/e2e-tests CONTRACTS_PATH=$(pwd)/contracts -EARLY_BIRD_SPECIAL=$(jq --raw-output ".early_bird_special" < "$CONTRACTS_PATH"/addresses.json) -THE_PRESSIAH_COMETH=$(jq --raw-output ".the_pressiah_cometh" < "$CONTRACTS_PATH"/addresses.json) -BACK_TO_THE_FUTURE=$(jq --raw-output ".back_to_the_future" < "$CONTRACTS_PATH"/addresses.json) -SIMPLE_DEX=$(jq --raw-output ".simple_dex" < "$CONTRACTS_PATH"/addresses.json) -WRAPPED_AZERO=$(jq --raw-output ".wrapped_azero" < "$CONTRACTS_PATH"/addresses.json) -pushd "$E2E_PATH" +# shellcheck source=contracts/scripts/test_env.sh +. "$CONTRACTS_PATH/scripts/test_env.sh" -RUST_LOG="aleph_e2e_client=info" cargo run --release -- \ - --test-cases wrapped_azero \ - --test-cases simple_dex \ - --test-cases marketplace \ - --test-cases button_game_reset \ - --test-cases early_bird_special \ - --test-cases the_pressiah_cometh \ - --test-cases back_to_the_future \ - --early-bird-special "$EARLY_BIRD_SPECIAL" \ - --the-pressiah-cometh "$THE_PRESSIAH_COMETH" \ - --back-to-the-future "$BACK_TO_THE_FUTURE" \ - --simple-dex "$SIMPLE_DEX" \ - --wrapped-azero "$WRAPPED_AZERO" \ - --button-game-metadata ../contracts/button/target/ink/metadata.json \ - --ticket-token-metadata ../contracts/ticket_token/target/ink/metadata.json \ - --reward-token-metadata ../contracts/game_token/target/ink/metadata.json \ - --marketplace-metadata ../contracts/marketplace/target/ink/metadata.json \ - --simple-dex-metadata ../contracts/simple_dex/target/ink/metadata.json \ - --wrapped-azero-metadata ../contracts/wrapped_azero/target/ink/metadata.json +pushd "$E2E_PATH" +cargo test button -- --test-threads 1 --nocapture +popd exit $? diff --git a/contracts/scripts/test_env.sh b/contracts/scripts/test_env.sh new file mode 100755 index 0000000000..65a3ca2a55 --- /dev/null +++ b/contracts/scripts/test_env.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euo pipefail + +export CONTRACTS_PATH +CONTRACTS_PATH=$(pwd)/contracts + +export EARLY_BIRD_SPECIAL +EARLY_BIRD_SPECIAL=$(jq --raw-output ".early_bird_special" < "$CONTRACTS_PATH"/addresses.json) +export THE_PRESSIAH_COMETH +THE_PRESSIAH_COMETH=$(jq --raw-output ".the_pressiah_cometh" < "$CONTRACTS_PATH"/addresses.json) +export BACK_TO_THE_FUTURE +BACK_TO_THE_FUTURE=$(jq --raw-output ".back_to_the_future" < "$CONTRACTS_PATH"/addresses.json) +export SIMPLE_DEX +SIMPLE_DEX=$(jq --raw-output ".simple_dex" < "$CONTRACTS_PATH"/addresses.json) +export WRAPPED_AZERO +WRAPPED_AZERO=$(jq --raw-output ".wrapped_azero" < "$CONTRACTS_PATH"/addresses.json) + +export BUTTON_GAME_METADATA=$CONTRACTS_PATH/button/target/ink/button.json +export TICKET_TOKEN_METADATA=$CONTRACTS_PATH/ticket_token/target/ink/ticket_token.json +export REWARD_TOKEN_METADATA=$CONTRACTS_PATH/game_token/target/ink/game_token.json +export MARKETPLACE_METADATA=$CONTRACTS_PATH/marketplace/target/ink/marketplace.json +export SIMPLE_DEX_METADATA=$CONTRACTS_PATH/simple_dex/target/ink/simple_dex.json +export WRAPPED_AZERO_METADATA=$CONTRACTS_PATH/wrapped_azero/target/ink/wrapped_azero.json +export RUST_LOG="aleph_e2e_client=info" diff --git a/contracts/simple_dex/Cargo.lock b/contracts/simple_dex/Cargo.lock index 0ce3811097..20779f141d 100644 --- a/contracts/simple_dex/Cargo.lock +++ b/contracts/simple_dex/Cargo.lock @@ -6,16 +6,20 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", "scale-info", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "array-init" version = "2.0.1" @@ -244,6 +248,40 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -280,12 +318,7 @@ name = "game_token" version = "2.1.0" dependencies = [ "access_control", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -327,11 +360,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -347,25 +395,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a291f411e310b7a3bb01ce21102b8c0aea5b7b523e4bad0b40a8e55a76c58906" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075eab468da2937288ec484be920cb18614147003d7f1afbdfcfb190ed771c46" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -373,9 +457,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271689b643d7ccf2bcd09d7ef07eda79cd3366ee042d5bbfcebf534b08da79d7" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -384,12 +467,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -399,45 +482,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.1" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cf662fe6a130ea1ada3520142405e3ed521b79c35b7274cc95dd37bc833571" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94dc22732ced2557f0411de5fa31d6fddc3878968041b699ae16ed1c390d2660" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a089bcac8d7e6a487b7a18ea8a1d20eb540ed26657706ac221cc0e8239047e45" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -448,82 +509,102 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1330da0b8007b86de94f95fbc74769c0461d3b078b291af5497771598db1c5b4" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d442f4f5dcbf120aa84cae9e399065ad99d143d5a920b06d3da286e91c03ec70" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38d71af62cfec3425727d28665a947d636c3be6ae71ac3a79868ef8a08633f3" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea7afd5330a9d3be1533222a48b8ab44b3a3356a5e6bb090bff0790aa562b418" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be827b98c102c413b2309075f0835a9bb8c6325fc6aa09e66963424db7a8bcb5" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ced452d5d0b2268b1257ffd2ec73cf9c3b4fba5f3632f185a03aafec8888439" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", ] [[package]] @@ -535,6 +616,28 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.3" @@ -564,9 +667,30 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "num-traits" @@ -580,15 +704,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.32#163c456e79d2ed084b29e47637f0ec9fd9ac4376" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -597,7 +716,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.32#163c456e79d2ed084b29e47637f0ec9fd9ac4376" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -608,7 +727,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.32#163c456e79d2ed084b29e47637f0ec9fd9ac4376" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -630,15 +749,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -647,15 +761,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -664,32 +773,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -701,8 +806,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -713,11 +818,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#a5a99eca8a37c295b8170321605c8f06906f6aff" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -886,6 +989,17 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + [[package]] name = "regex-syntax" version = "0.6.28" @@ -907,6 +1021,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rusty-fork" version = "0.3.0" @@ -927,9 +1055,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scale-info" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -941,9 +1069,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -953,18 +1081,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -1030,12 +1158,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.4" @@ -1052,13 +1174,7 @@ version = "0.1.0" dependencies = [ "access_control", "game_token", - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "proptest", @@ -1120,6 +1236,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.34" @@ -1222,12 +1347,78 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wyz" version = "0.5.0" @@ -1236,3 +1427,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/simple_dex/Cargo.toml b/contracts/simple_dex/Cargo.toml index cfca965111..8abc3a0098 100644 --- a/contracts/simple_dex/Cargo.toml +++ b/contracts/simple_dex/Cargo.toml @@ -6,18 +6,12 @@ edition = "2021" license = "Apache 2.0" [dependencies] -ink_env = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_lang_codegen = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_primitives = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } game_token = { path = "../game_token", default-features = false, features = ["ink-as-dependency"] } @@ -37,12 +31,7 @@ default = ["std"] std = [ "access_control/std", "game_token/std", - "ink_env/std", - "ink_lang_codegen/std", - "ink_metadata/std", - "ink_prelude/std", - "ink_primitives/std", - "ink_storage/std", + "ink/std", "openbrush/std", "scale-info/std", "scale/std", diff --git a/contracts/simple_dex/lib.rs b/contracts/simple_dex/lib.rs index 933c6a8208..f774b7bbd9 100644 --- a/contracts/simple_dex/lib.rs +++ b/contracts/simple_dex/lib.rs @@ -1,8 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::let_unit_value)] -use ink_lang as ink; - /// Simple DEX contract /// /// This contract is based on Balancer multi asset LP design and all formulas are taken from the Balancer's whitepaper (https://balancer.fi/whitepaper.pdf) @@ -13,26 +11,23 @@ use ink_lang as ink; #[ink::contract] mod simple_dex { - - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use game_token::{ - ALLOWANCE_SELECTOR, BALANCE_OF_SELECTOR, TRANSFER_FROM_SELECTOR, TRANSFER_SELECTOR, - }; - use ink_env::{ - call::{build_call, Call, ExecutionInput, Selector}, - CallFlags, DefaultEnvironment, Error as InkEnvError, - }; - use ink_lang::{ - codegen::{initialize_contract, EmitEvent}, + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + use ink::{ + codegen::EmitEvent, + env::{call::FromAccountId, CallFlags, Error as InkEnvError}, + prelude::{format, string::String, vec, vec::Vec}, reflect::ContractEventBase, + LangError, ToAccountId, + }; + use openbrush::{ + contracts::{psp22::PSP22Ref, traits::errors::PSP22Error}, + storage::Mapping, + traits::Storage, }; - use ink_prelude::{format, string::String, vec, vec::Vec}; - use ink_storage::traits::{PackedLayout, SpreadAllocate, SpreadLayout}; - use openbrush::{contracts::traits::errors::PSP22Error, storage::Mapping}; type Event = ::Type; - #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode, SpreadLayout, PackedLayout)] + #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)] #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub struct SwapPair { pub from: AccountId, @@ -52,7 +47,7 @@ mod simple_dex { InsufficientAllowanceOf(AccountId), Arithmethic, WrongParameterValue, - MissingRole(Role), + MissingRole(AccountId, Role), InkEnv(String), CrossContractCall(String), TooMuchSlippage, @@ -72,6 +67,20 @@ mod simple_dex { } } + impl From for DexError { + fn from(why: LangError) -> Self { + DexError::CrossContractCall(format!("{:?}", why)) + } + } + + #[ink(event)] + pub struct Deposited { + caller: AccountId, + #[ink(topic)] + token: AccountId, + amount: Balance, + } + #[ink(event)] pub struct SwapPairAdded { #[ink(topic)] @@ -103,18 +112,14 @@ mod simple_dex { } #[ink(storage)] - #[derive(SpreadAllocate)] + #[derive(Storage)] pub struct SimpleDex { pub swap_fee_percentage: u128, - pub access_control: AccountId, + pub access_control: AccessControlRef, // a set of pairs that are availiable for swapping between pub swap_pairs: Mapping, } - impl AccessControlled for SimpleDex { - type ContractError = DexError; - } - impl SimpleDex { #[ink(constructor)] pub fn new() -> Self { @@ -124,18 +129,16 @@ mod simple_dex { .expect("Called new on a contract with no code hash"); let required_role = Role::Initializer(code_hash); let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); - - let role_check = ::check_role( - access_control, - caller, - required_role, - Self::cross_contract_call_error_handler, - Self::access_control_error_handler, - ); - - match role_check { - Ok(_) => initialize_contract(Self::new_init), - Err(why) => panic!("Could not initialize the contract {:?}", why), + let access_control = AccessControlRef::from_account_id(access_control); + + if access_control.has_role(caller, required_role) { + Self { + swap_fee_percentage: 0, + access_control, + swap_pairs: Mapping::default(), + } + } else { + panic!("Caller is not allowed to initialize this contract"); } } @@ -153,7 +156,7 @@ mod simple_dex { let this = self.env().account_id(); let caller = self.env().caller(); - let balance_token_out = self.balance_of(token_out, this)?; + let balance_token_out = self.balance_of(token_out, this); if balance_token_out < min_amount_token_out { // throw early if we cannot support this swap anyway due to liquidity being too low return Err(DexError::NotEnoughLiquidityOf(token_out)); @@ -165,7 +168,7 @@ mod simple_dex { } // check allowance - if self.allowance(token_in, caller, this)? < amount_token_in { + if self.allowance(token_in, caller, this) < amount_token_in { return Err(DexError::InsufficientAllowanceOf(token_in)); } @@ -178,9 +181,9 @@ mod simple_dex { } // transfer token_in from user to the contract - self.transfer_from_tx(token_in, caller, this, amount_token_in)??; + self.transfer_from_tx(token_in, caller, this, amount_token_in)?; // transfer token_out from contract to user - self.transfer_tx(token_out, caller, amount_token_out)??; + self.transfer_tx(token_out, caller, amount_token_out)?; // emit event Self::emit_event( @@ -216,7 +219,17 @@ mod simple_dex { // transfer token_in from the caller to the contract // will revert if the contract does not have enough allowance from the caller // in which case the whole tx is reverted - self.transfer_from_tx(token_in, caller, this, amount)??; + self.transfer_from_tx(token_in, caller, this, amount)?; + + Self::emit_event( + self.env(), + Event::Deposited(Deposited { + caller, + token: token_in, + amount, + }), + ); + Ok(()) })?; @@ -237,7 +250,7 @@ mod simple_dex { withdrawals.into_iter().try_for_each( |(token_out, amount)| -> Result<(), DexError> { // transfer token_out from the contract to the caller - self.transfer_tx(token_out, caller, amount)??; + self.transfer_tx(token_out, caller, amount)?; Ok(()) }, )?; @@ -294,14 +307,14 @@ mod simple_dex { self.check_role(caller, Role::Owner(this))?; - self.access_control = access_control; + self.access_control = AccessControlRef::from_account_id(access_control); Ok(()) } /// Returns current address of the AccessControl contract that holds the account priviledges for this DEX #[ink(message)] pub fn access_control(&self) -> AccountId { - self.access_control + self.access_control.to_account_id() } /// Whitelists a token pair for swapping between @@ -378,8 +391,8 @@ mod simple_dex { amount_token_in: Balance, ) -> Result { let this = self.env().account_id(); - let balance_token_in = self.balance_of(token_in, this)?; - let balance_token_out = self.balance_of(token_out, this)?; + let balance_token_in = self.balance_of(token_in, this); + let balance_token_out = self.balance_of(token_out, this); Self::_out_given_in( amount_token_in, @@ -416,32 +429,20 @@ mod simple_dex { balance_token_out .checked_sub(op4) // If the division is not even, leave the 1 unit of dust in the exchange instead of paying it out. - .and_then(|result| result.checked_sub(if op3 % op2 > 0 { 1 } else { 0 })) + .and_then(|result| result.checked_sub((op3 % op2 > 0).into())) .ok_or(DexError::Arithmethic) } - fn new_init(&mut self) { - self.access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); - self.swap_fee_percentage = 0; - } - /// Transfers a given amount of a PSP22 token to a specified using the callers own balance fn transfer_tx( &self, token: AccountId, to: AccountId, amount: Balance, - ) -> Result, InkEnvError> { - build_call::() - .call_type(Call::new().callee(token)) - .exec_input( - ExecutionInput::new(Selector::new(TRANSFER_SELECTOR)) - .push_arg(to) - .push_arg(amount) - .push_arg(vec![0x0]), - ) - .returns::>() - .fire() + ) -> Result<(), PSP22Error> { + PSP22Ref::transfer(&token, to, amount, vec![])?; + + Ok(()) } /// Transfers a given amount of a PSP22 token on behalf of a specified account to another account @@ -453,69 +454,30 @@ mod simple_dex { from: AccountId, to: AccountId, amount: Balance, - ) -> Result, InkEnvError> { - build_call::() - .call_type(Call::new().callee(token)) - .exec_input( - ExecutionInput::new(Selector::new(TRANSFER_FROM_SELECTOR)) - .push_arg(from) - .push_arg(to) - .push_arg(amount) - .push_arg(vec![0x0]), - ) - .call_flags(CallFlags::default().set_allow_reentry(true)) // needed for checking allowance before the actual tx - .returns::>() - .fire() + ) -> Result<(), DexError> { + PSP22Ref::transfer_from_builder(&token, from, to, amount, vec![0x0]) + .call_flags(CallFlags::default().set_allow_reentry(true)) + .fire()???; + + Ok(()) } /// Returns the amount of unused allowance that the token owner has given to the spender - fn allowance( - &self, - token: AccountId, - owner: AccountId, - spender: AccountId, - ) -> Result { - build_call::() - .call_type(Call::new().callee(token)) - .exec_input( - ExecutionInput::new(Selector::new(ALLOWANCE_SELECTOR)) - .push_arg(owner) - .push_arg(spender), - ) - .returns::() - .fire() + fn allowance(&self, token: AccountId, owner: AccountId, spender: AccountId) -> Balance { + PSP22Ref::allowance(&token, owner, spender) } /// Returns DEX balance of a PSP22 token for an account - fn balance_of(&self, token: AccountId, account: AccountId) -> Result { - build_call::() - .call_type(Call::new().callee(token)) - .exec_input( - ExecutionInput::new(Selector::new(BALANCE_OF_SELECTOR)).push_arg(account), - ) - .returns::() - .fire() + fn balance_of(&self, token: AccountId, account: AccountId) -> Balance { + PSP22Ref::balance_of(&token, account) } - fn access_control_error_handler(role: Role) -> DexError { - DexError::MissingRole(role) - } - - fn cross_contract_call_error_handler(why: InkEnvError) -> DexError { - DexError::CrossContractCall(format!("Calling access control has failed: {:?}", why)) - } - - fn check_role(&self, account: AccountId, role: Role) -> Result<(), DexError> - where - Self: AccessControlled, - { - ::check_role( - self.access_control, - account, - role, - Self::cross_contract_call_error_handler, - Self::access_control_error_handler, - ) + fn check_role(&self, account: AccountId, role: Role) -> Result<(), DexError> { + if self.access_control.has_role(account, role) { + Ok(()) + } else { + Err(DexError::MissingRole(account, role)) + } } fn emit_event(emitter: EE, event: Event) diff --git a/contracts/ticket_token/Cargo.lock b/contracts/ticket_token/Cargo.lock index 2005b0aa6d..5690c9f6df 100644 --- a/contracts/ticket_token/Cargo.lock +++ b/contracts/ticket_token/Cargo.lock @@ -6,12 +6,18 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", ] [[package]] @@ -38,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -215,6 +227,40 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fs2" version = "0.4.3" @@ -241,17 +287,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.3.3" @@ -267,11 +302,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -287,25 +337,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed249de74298ed051ebcf6d3082b8d3dbd19cbc448d9ed3235d8a7b92713049" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb9d32ec27d71fefb3f2b6a26bae82a2c6509d7ad61e8a5107b6291a1b03ecb" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -313,9 +399,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1549f5966167387c89fb3dfcdc59973bfb396cc3a7110d7a31ad5fdea56db0cf" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -324,12 +409,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -339,45 +424,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.0" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5282f2722ac6dca469e7f223a7b38b2a6d20fbca6b974497e630d5dc8934e9" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3a5de33b59450adc3f61c5eb05b768067c7ab8af9d00f33e284310598168dc" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d4d614462280fa06e15b9ca5725d7c8440dde93c8dae1c6f15422f7756cacb" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -388,82 +451,124 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f85f64141957c5db7cbabbb97a9c16c489e5e9d363e9f147d132a43c71cd29" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca6c159a2774f07437c6fd9ea710eb73a6b5e9a031a932bddf08742bf2c081a" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f7f4dec15e573496c9d2af353e78bde84add391251608f25b5adcf175dc777" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.0" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3296dd1c4f4fe12ede7c92d60e6fcb94d46a959ec19c701e4ac588b09e0b4a6" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff9b503995a7b41fe201a7a2643ce22f5a11e0b67db7b685424b6d5fe0ecf0b" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb68e24e93e8327dda1924868d7ee4dbe01e1ed2b392f28583caa96809b585c" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -489,9 +594,30 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.127" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "num-traits" @@ -505,15 +631,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -522,7 +643,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -533,7 +654,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -555,15 +676,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -572,15 +688,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -589,32 +700,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -626,8 +733,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -638,11 +745,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#83ff37cb0d19d15a881ecab2c922596039c8358d" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -690,12 +795,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.2.0" @@ -732,34 +831,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "ppv-lite86", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_core" -version = "0.6.3" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rlibc" @@ -767,6 +853,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.11" @@ -775,9 +875,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scale-info" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -789,9 +889,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -801,18 +901,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.22.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -878,12 +978,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.2" @@ -935,6 +1029,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.32" @@ -960,13 +1063,7 @@ name = "ticket_token" version = "2.1.0" dependencies = [ "access_control", - "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush", "parity-scale-codec", "scale-info", @@ -1023,12 +1120,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" @@ -1045,12 +1136,78 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wyz" version = "0.5.0" @@ -1059,3 +1216,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/ticket_token/Cargo.toml b/contracts/ticket_token/Cargo.toml index da17e16ccc..53fde6ec00 100644 --- a/contracts/ticket_token/Cargo.toml +++ b/contracts/ticket_token/Cargo.toml @@ -6,18 +6,12 @@ edition = "2021" license = "Apache 2.0" [dependencies] -ink_primitives = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_engine = { version = "~3.3.0", default-features = false, optional = true } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } [lib] @@ -27,22 +21,17 @@ crate-type = [ # Used for normal contract Wasm blobs. "cdylib", # Used for ABI generation. - "rlib", + "rlib", ] [features] default = ["std"] std = [ - "ink_env/std", - "ink_lang/std", - "ink_metadata", - "ink_metadata/std", - "ink_primitives/std", - "ink_storage/std", + "ink/std", "openbrush/std", - "scale-info", "scale-info/std", "scale/std", + "access_control/std", ] ink-as-dependency = [] diff --git a/contracts/ticket_token/lib.rs b/contracts/ticket_token/lib.rs index 1b9e7a6625..40717faa19 100644 --- a/contracts/ticket_token/lib.rs +++ b/contracts/ticket_token/lib.rs @@ -6,14 +6,14 @@ pub use crate::ticket_token::{BALANCE_OF_SELECTOR, TRANSFER_FROM_SELECTOR, TRANS #[openbrush::contract] pub mod ticket_token { - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use ink_env::Error as InkEnvError; - use ink_lang::{ + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + use ink::{ codegen::{EmitEvent, Env}, + env::call::FromAccountId, + prelude::{format, string::String}, reflect::ContractEventBase, + ToAccountId, }; - use ink_prelude::{format, string::String}; - use ink_storage::traits::SpreadAllocate; use openbrush::{ contracts::psp22::{extensions::metadata::*, Internal}, traits::Storage, @@ -24,14 +24,13 @@ pub mod ticket_token { pub const TRANSFER_FROM_SELECTOR: [u8; 4] = [0x54, 0xb3, 0xc7, 0x6e]; #[ink(storage)] - #[derive(Default, SpreadAllocate, Storage)] + #[derive(Storage)] pub struct TicketToken { #[storage_field] psp22: psp22::Data, #[storage_field] metadata: metadata::Data, - /// access control contract - access_control: AccountId, + access_control: AccessControlRef, } impl PSP22 for TicketToken {} @@ -67,10 +66,6 @@ pub mod ticket_token { } } - impl AccessControlled for TicketToken { - type ContractError = PSP22Error; - } - /// Result type pub type Result = core::result::Result; /// Event type @@ -102,39 +97,39 @@ pub mod ticket_token { impl TicketToken { /// Creates a new contract with the specified initial supply. /// - /// Will revert if called from an account without a proper role + /// Will revert if called from an account without a proper role #[ink(constructor)] pub fn new(name: String, symbol: String, total_supply: Balance) -> Self { let caller = Self::env().caller(); let code_hash = Self::env() .own_code_hash() .expect("Called new on a contract with no code hash"); - let required_role = Role::Initializer(code_hash); - - let role_check = ::check_role( - AccountId::from(ACCESS_CONTROL_PUBKEY), - caller, - required_role, - |why: InkEnvError| { - PSP22Error::Custom( - format!("Calling access control has failed: {:?}", why).into(), - ) - }, - |role: Role| PSP22Error::Custom(format!("MissingRole:{:?}", role).into()), - ); - match role_check { - Ok(_) => ink_lang::codegen::initialize_contract(|instance: &mut TicketToken| { - instance.access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); - instance.metadata.name = Some(name.into()); - instance.metadata.symbol = Some(symbol.into()); - instance.metadata.decimals = 0; - - instance - ._mint_to(instance.env().caller(), total_supply) - .expect("Should mint"); - }), - Err(why) => panic!("Could not initialize the contract {:?}", why), + let required_role = Role::Initializer(code_hash); + let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); + let access_control = AccessControlRef::from_account_id(access_control); + + if access_control.has_role(caller, required_role) { + let metadata = metadata::Data { + name: Some(name.into()), + symbol: Some(symbol.into()), + decimals: 0, + ..Default::default() + }; + + let mut instance = TicketToken { + access_control, + metadata, + psp22: psp22::Data::default(), + }; + + instance + ._mint_to(instance.env().caller(), total_supply) + .expect("Should mint"); + + instance + } else { + panic!("Caller is not allowed to initialize this contract"); } } @@ -158,21 +153,17 @@ pub mod ticket_token { /// Returns the contract's access control contract address #[ink(message, selector = 8)] pub fn access_control(&self) -> AccountId { - self.access_control + self.access_control.to_account_id() } fn check_role(&self, account: AccountId, role: Role) -> Result<()> { - ::check_role( - self.access_control, - account, - role, - |why: InkEnvError| { - PSP22Error::Custom( - format!("Calling access control has failed: {:?}", why).into(), - ) - }, - |role: Role| PSP22Error::Custom(format!("MissingRole:{:?}", role).into()), - ) + if self.access_control.has_role(account, role) { + Ok(()) + } else { + Err(PSP22Error::Custom( + format!("Role missing: {:?}", role).into(), + )) + } } /// Sets new access control contract address @@ -185,7 +176,8 @@ pub mod ticket_token { let required_role = Role::Owner(this); self.check_role(caller, required_role)?; - self.access_control = access_control; + self.access_control = AccessControlRef::from_account_id(access_control); + Ok(()) } diff --git a/contracts/wrapped_azero/Cargo.lock b/contracts/wrapped_azero/Cargo.lock index 49d07f6356..a5a01058dd 100644 --- a/contracts/wrapped_azero/Cargo.lock +++ b/contracts/wrapped_azero/Cargo.lock @@ -6,12 +6,18 @@ version = 3 name = "access_control" version = "0.2.0" dependencies = [ - "ink_env", - "ink_lang", - "ink_lang_codegen", - "ink_primitives", - "ink_storage", + "ink", "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", ] [[package]] @@ -38,6 +44,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -215,6 +227,40 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fs2" version = "0.4.3" @@ -241,17 +287,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.3.3" @@ -267,11 +302,26 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -287,25 +337,61 @@ dependencies = [ "syn", ] +[[package]] +name = "ink" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage", + "parity-scale-codec", +] + [[package]] name = "ink_allocator" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a291f411e310b7a3bb01ce21102b8c0aea5b7b523e4bad0b40a8e55a76c58906" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] +[[package]] +name = "ink_codegen" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "blake2 0.10.4", + "derive_more", + "either", + "env_logger", + "heck 0.4.0", + "impl-serde", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "itertools", + "log", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + [[package]] name = "ink_engine" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075eab468da2937288ec484be920cb18614147003d7f1afbdfcfb190ed771c46" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "derive_more", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", - "rand", "secp256k1", "sha2", "sha3", @@ -313,9 +399,8 @@ dependencies = [ [[package]] name = "ink_env" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271689b643d7ccf2bcd09d7ef07eda79cd3366ee042d5bbfcebf534b08da79d7" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "arrayref", "blake2 0.10.4", @@ -324,12 +409,12 @@ dependencies = [ "ink_allocator", "ink_engine", "ink_metadata", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand", "rlibc", "scale-info", "secp256k1", @@ -339,45 +424,23 @@ dependencies = [ ] [[package]] -name = "ink_lang" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cf662fe6a130ea1ada3520142405e3ed521b79c35b7274cc95dd37bc833571" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.3.1" +name = "ink_ir" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94dc22732ced2557f0411de5fa31d6fddc3878968041b699ae16ed1c390d2660" +checksum = "faf2ee9acbf86d5b2b6342266972217b61117c6468c81bdefe23e052beb05af1" dependencies = [ "blake2 0.10.4", - "derive_more", "either", - "heck 0.4.0", - "impl-serde", - "ink_lang_ir", "itertools", - "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "ink_lang_ir" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a089bcac8d7e6a487b7a18ea8a1d20eb540ed26657706ac221cc0e8239047e45" +name = "ink_ir" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "blake2 0.10.4", "either", @@ -388,82 +451,124 @@ dependencies = [ ] [[package]] -name = "ink_lang_macro" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1330da0b8007b86de94f95fbc74769c0461d3b078b291af5497771598db1c5b4" +name = "ink_macro" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", + "ink_codegen", + "ink_ir 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "proc-macro2", + "quote", "syn", + "synstructure", ] [[package]] name = "ink_metadata" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d442f4f5dcbf120aa84cae9e399065ad99d143d5a920b06d3da286e91c03ec70" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "derive_more", "impl-serde", - "ink_prelude", - "ink_primitives", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "scale-info", "serde", ] [[package]] name = "ink_prelude" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38d71af62cfec3425727d28665a947d636c3be6ae71ac3a79868ef8a08633f3" +checksum = "5962125f78304bc2b3083391cbd579125c64ce17e61b019034094faf772c915a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_prelude" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.3.1" +version = "4.0.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea7afd5330a9d3be1533222a48b8ab44b3a3356a5e6bb090bff0790aa562b418" +checksum = "90f4f26208fe23e12d436917697b951252519484134a3561fe8b65a5abc97aa9" dependencies = [ - "cfg-if", - "ink_prelude", + "derive_more", + "ink_prelude 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "xxhash-rust", +] + +[[package]] +name = "ink_primitives" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" +dependencies = [ + "derive_more", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", "parity-scale-codec", "scale-info", + "xxhash-rust", ] [[package]] name = "ink_storage" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be827b98c102c413b2309075f0835a9bb8c6325fc6aa09e66963424db7a8bcb5" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ "array-init", "cfg-if", "derive_more", "ink_env", "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_storage_traits", "parity-scale-codec", "scale-info", ] [[package]] -name = "ink_storage_derive" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ced452d5d0b2268b1257ffd2ec73cf9c3b4fba5f3632f185a03aafec8888439" +name = "ink_storage_traits" +version = "4.0.0-beta" +source = "git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde#4655a8b4413cb50cbc38d1b7c173ad426ab06cde" dependencies = [ - "proc-macro2", - "quote", + "ink_metadata", + "ink_prelude 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "ink_primitives 4.0.0-beta (git+https://github.com/paritytech/ink?rev=4655a8b4413cb50cbc38d1b7c173ad426ab06cde)", + "parity-scale-codec", + "scale-info", "syn", - "synstructure", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -489,9 +594,30 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "num-traits" @@ -505,15 +631,10 @@ dependencies = [ [[package]] name = "obce" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ + "ink", "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", "obce-macro", "parity-scale-codec", "scale-info", @@ -522,7 +643,7 @@ dependencies = [ [[package]] name = "obce-codegen" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "blake2 0.10.4", "proc-macro2", @@ -533,7 +654,7 @@ dependencies = [ [[package]] name = "obce-macro" version = "0.1.0" -source = "git+https://github.com/Supercolony-net/obce?branch=polkadot-v0.9.29#9843e2a3e91e7c29a9b21dde7ead3299e9d3c0fb" +source = "git+https://github.com/727-Ventures/obce?tag=3.0.0-beta#e4d93be5ea31ea39fd5c692e93ebe319b51cd604" dependencies = [ "obce-codegen", "proc-macro2", @@ -555,15 +676,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openbrush" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_contracts", "openbrush_lang", "parity-scale-codec", @@ -572,15 +688,10 @@ dependencies = [ [[package]] name = "openbrush_contracts" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang", "pallet-assets-chain-extension", "parity-scale-codec", @@ -589,32 +700,28 @@ dependencies = [ [[package]] name = "openbrush_lang" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "const_format", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "openbrush_lang_macro", "parity-scale-codec", "scale-info", - "sha2-const", + "xxhash-rust", ] [[package]] name = "openbrush_lang_codegen" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "blake2 0.9.2", "cargo_metadata", "fs2", "heck 0.3.3", - "ink_lang_ir", + "ink_ir 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "ink_primitives 4.0.0-beta (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -626,8 +733,8 @@ dependencies = [ [[package]] name = "openbrush_lang_macro" -version = "2.2.0" -source = "git+https://github.com/Supercolony-net/openbrush-contracts.git?rev=15e6366#15e63664d87124f4cc0e7ba55b21a71222983677" +version = "3.0.0-beta" +source = "git+https://github.com/727-Ventures/openbrush-contracts.git?rev=3.0.0-beta#14ff655a0d83440f40c57c82d9a33e4c5b981da7" dependencies = [ "openbrush_lang_codegen", "proc-macro2", @@ -638,11 +745,9 @@ dependencies = [ [[package]] name = "pallet-assets-chain-extension" version = "0.1.1" -source = "git+https://github.com/Supercolony-net/pallet-assets-chain-extension#83ff37cb0d19d15a881ecab2c922596039c8358d" +source = "git+https://github.com/727-ventures/pallet-assets-chain-extension?tag=3.0.0-beta#7e553468e9c0fbd4f543ccb950b3d17b548237f1" dependencies = [ - "ink_metadata", - "ink_primitives", - "ink_storage", + "ink", "obce", "parity-scale-codec", "scale-info", @@ -690,12 +795,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -732,34 +831,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "ppv-lite86", - "rand_core", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "rand_core" -version = "0.6.3" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rlibc" @@ -767,6 +853,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +[[package]] +name = "rustix" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.11" @@ -775,9 +875,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if", @@ -789,9 +889,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -801,18 +901,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22" dependencies = [ "cc", ] @@ -878,12 +978,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "sha2-const" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edcd790916d95ff81bdc1505b09c74d30d47a755929cc8c71c59cbbfa99f91b" - [[package]] name = "sha3" version = "0.10.4" @@ -935,6 +1029,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.35" @@ -1006,12 +1109,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" @@ -1028,24 +1125,84 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "wrapped_azero" version = "1.0.0" dependencies = [ "access_control", - "ink_engine", - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", + "ink", "num-traits", "openbrush", "parity-scale-codec", @@ -1060,3 +1217,9 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" diff --git a/contracts/wrapped_azero/Cargo.toml b/contracts/wrapped_azero/Cargo.toml index 5ba8900b32..14638f56fc 100644 --- a/contracts/wrapped_azero/Cargo.toml +++ b/contracts/wrapped_azero/Cargo.toml @@ -6,19 +6,14 @@ edition = "2021" license = "Apache 2.0" [dependencies] -ink_primitives = { version = "~3.3.0", default-features = false } -ink_metadata = { version = "~3.3.0", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "~3.3.0", default-features = false } -ink_storage = { version = "~3.3.0", default-features = false } -ink_lang = { version = "~3.3.0", default-features = false } -ink_prelude = { version = "~3.3.0", default-features = false } -ink_engine = { version = "~3.3.0", default-features = false, optional = true } +ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } + +openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts.git", rev = "3.0.0-beta", default-features = false, features = ["psp22"] } num-traits = { version = "0.2", default-features = false } -openbrush = { git = "https://github.com/Supercolony-net/openbrush-contracts.git", rev = "15e6366", default-features = false, features = ["psp22"] } access_control = { path = "../access_control", default-features = false, features = ["ink-as-dependency"] } [lib] @@ -28,23 +23,19 @@ crate-type = [ # Used for normal contract Wasm blobs. "cdylib", # Used for ABI generation. - # "rlib", + "rlib", ] [features] default = ["std"] std = [ - "num-traits/std", - "ink_env/std", - "ink_lang/std", - "ink_metadata", - "ink_metadata/std", - "ink_primitives/std", - "ink_storage/std", + "num-traits/std", + "ink/std", "openbrush/std", "scale-info", "scale-info/std", "scale/std", + "access_control/std", ] ink-as-dependency = [] diff --git a/contracts/wrapped_azero/lib.rs b/contracts/wrapped_azero/lib.rs index b0f5d5005c..f59dd61c91 100644 --- a/contracts/wrapped_azero/lib.rs +++ b/contracts/wrapped_azero/lib.rs @@ -8,14 +8,14 @@ pub use crate::wrapped_azero::{ #[openbrush::contract] pub mod wrapped_azero { - use access_control::{roles::Role, traits::AccessControlled, ACCESS_CONTROL_PUBKEY}; - use ink_env::Error as InkEnvError; - use ink_lang::{ + use access_control::{roles::Role, AccessControlRef, ACCESS_CONTROL_PUBKEY}; + use ink::{ codegen::{EmitEvent, Env}, + env::call::FromAccountId, + prelude::format, reflect::ContractEventBase, + ToAccountId, }; - use ink_prelude::format; - use ink_storage::traits::SpreadAllocate; use num_traits::identities::Zero; use openbrush::{ contracts::psp22::{extensions::metadata::*, Internal}, @@ -28,14 +28,19 @@ pub mod wrapped_azero { pub const ALLOWANCE_SELECTOR: [u8; 4] = [0x4d, 0x47, 0xd9, 0x21]; #[ink(storage)] - #[derive(Default, SpreadAllocate, Storage)] + #[derive(Storage)] pub struct WrappedAzero { #[storage_field] psp22: psp22::Data, #[storage_field] metadata: metadata::Data, - /// access control contract - access_control: AccountId, + access_control: AccessControlRef, + } + + impl Default for WrappedAzero { + fn default() -> Self { + Self::new() + } } impl PSP22 for WrappedAzero {} @@ -73,10 +78,6 @@ pub mod wrapped_azero { } } - impl AccessControlled for WrappedAzero { - type ContractError = PSP22Error; - } - /// Result type pub type Result = core::result::Result; /// Event type @@ -133,23 +134,23 @@ pub mod wrapped_azero { .own_code_hash() .expect("Called new on a contract with no code hash"); - let role_check = ::check_role( - AccountId::from(ACCESS_CONTROL_PUBKEY), - caller, - Role::Initializer(code_hash), - Self::cross_contract_call_error_handler, - Self::access_control_error_handler, - ); - - match role_check { - Ok(_) => ink_lang::codegen::initialize_contract(|instance: &mut WrappedAzero| { - instance.metadata.name = Some("wAzero".into()); - instance.metadata.symbol = Some("wA0".into()); - instance.metadata.decimals = 12; // same as AZERO - - instance.access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); - }), - Err(why) => panic!("Could not initialize the contract {:?}", why), + let access_control = AccountId::from(ACCESS_CONTROL_PUBKEY); + let access_control = AccessControlRef::from_account_id(access_control); + if access_control.has_role(caller, Role::Initializer(code_hash)) { + let metadata = metadata::Data { + name: Some("wAzero".into()), + symbol: Some("wA0".into()), + decimals: 12, // same as AZERO + ..Default::default() + }; + + Self { + psp22: psp22::Data::default(), + metadata, + access_control, + } + } else { + panic!("Caller is not allowed to initialize this contract"); } } @@ -203,7 +204,7 @@ pub mod wrapped_azero { /// Returns the contract's access control contract address #[ink(message)] pub fn access_control(&self) -> AccountId { - self.access_control + self.access_control.to_account_id() } /// Sets new access control contract address @@ -216,7 +217,7 @@ pub mod wrapped_azero { self.check_role(caller, Role::Owner(this))?; - self.access_control = access_control; + self.access_control = AccessControlRef::from_account_id(access_control); Ok(()) } @@ -232,22 +233,12 @@ pub mod wrapped_azero { emitter.emit_event(event); } - fn access_control_error_handler(role: Role) -> PSP22Error { - PSP22Error::Custom(format!("MissingRole:{:?}", role).into()) - } - - fn cross_contract_call_error_handler(why: InkEnvError) -> PSP22Error { - PSP22Error::Custom(format!("Calling access control has failed: {:?}", why).into()) - } - fn check_role(&self, account: AccountId, role: Role) -> Result<()> { - ::check_role( - self.access_control, - account, - role, - Self::cross_contract_call_error_handler, - Self::access_control_error_handler, - ) + if self.access_control.has_role(account, role) { + Ok(()) + } else { + Err(PSP22Error::Custom(format!("MissingRole:{:?}", role).into())) + } } } } diff --git a/docker/Dockerfile.network_tests b/docker/Dockerfile.network_tests new file mode 100644 index 0000000000..18741d6f19 --- /dev/null +++ b/docker/Dockerfile.network_tests @@ -0,0 +1,5 @@ +FROM aleph-node:latest + +RUN apt update && \ + apt install curl iproute2 iputils-ping net-tools netwox tcpdump gdb gdbserver -y && \ + apt clean diff --git a/docker/Dockerfile.synthetic_network b/docker/Dockerfile.synthetic_network new file mode 100644 index 0000000000..145b85762f --- /dev/null +++ b/docker/Dockerfile.synthetic_network @@ -0,0 +1,14 @@ +FROM syntheticnet:latest as synthnet + +FROM aleph-node:latest + +# Linux networking tools and node.js +RUN apt update && \ + apt install nodejs curl iproute2 iputils-ping net-tools netwox tcpdump gdb gdbserver stress -y + +COPY --from=synthnet /opt/lib/ /opt/lib/ +WORKDIR /opt/lib +ENTRYPOINT [] +ENV ENTRY="/node/docker_entrypoint.sh" +CMD ["/opt/lib/setup.sh"] + diff --git a/docker/common.yml b/docker/common.yml index d41d7f41b2..3203cd5f9a 100644 --- a/docker/common.yml +++ b/docker/common.yml @@ -1,14 +1,13 @@ services: AlephNodeService: image: aleph-node:latest - network_mode: host environment: - PURGE_BEFORE_START=true - RUST_LOG=info - CHAIN=/data/chainspec.json - ALLOW_PRIVATE_IPV4=true - DISCOVER_LOCAL=true - - UNIT_CREATION_DELAY=50 + - UNIT_CREATION_DELAY=300 volumes: - ./data/:/data/ diff --git a/docker/docker-compose.base.yml b/docker/docker-compose.base.yml new file mode 100644 index 0000000000..ca33551779 --- /dev/null +++ b/docker/docker-compose.base.yml @@ -0,0 +1,95 @@ +# When increasing number of nodes in this file, change default value of --validators-count param in e2e-tests/src/config.rs + +services: + Node0: + extends: + file: common.yml + service: AlephBootNode + container_name: Node0 + environment: + - RPC_PORT=9933 + - WS_PORT=9943 + - PORT=30333 + - VALIDATOR_PORT=30343 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30343 + - NAME=Node0 + + Node1: + extends: + file: common.yml + service: AlephNonBootNode + container_name: Node1 + environment: + - RPC_PORT=9934 + - WS_PORT=9944 + - PORT=30334 + - VALIDATOR_PORT=30344 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30344 + - NAME=Node1 + # key derived from "//1" + - BASE_PATH=/data/5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o + - NODE_KEY_PATH=/data/5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o/p2p_secret + + Node2: + extends: + file: common.yml + service: AlephNonBootNode + container_name: Node2 + environment: + - RPC_PORT=9935 + - WS_PORT=9945 + - PORT=30335 + - VALIDATOR_PORT=30345 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30345 + - NAME=Node2 + # key derived from "//2" + - BASE_PATH=/data/5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9 + - NODE_KEY_PATH=/data/5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9/p2p_secret + + Node3: + extends: + file: common.yml + service: AlephNonBootNode + container_name: Node3 + environment: + - RPC_PORT=9936 + - WS_PORT=9946 + - PORT=30336 + - VALIDATOR_PORT=30346 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30346 + - NAME=Node3 + # key derived from "//3" + - BASE_PATH=/data/5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK + - NODE_KEY_PATH=/data/5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK/p2p_secret + + Node4: + extends: + file: common.yml + service: AlephNonBootNode + container_name: Node4 + environment: + - RPC_PORT=9937 + - WS_PORT=9947 + - PORT=30337 + - VALIDATOR_PORT=30347 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30347 + - NAME=Node4 + # key derived from "//4" + - BASE_PATH=/data/5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW + - NODE_KEY_PATH=/data/5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW/p2p_secret + + Node5: + extends: + file: common.yml + service: AlephNonBootNode + container_name: Node5 + environment: + - RPC_PORT=9938 + - WS_PORT=9948 + - PORT=30338 + - VALIDATOR_PORT=30348 + - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30348 + - NAME=Node5 + # key derived from "//5" + - BASE_PATH=/data/5EFb84yH9tpcFuiKUcsmdoF7xeeY3ajG1ZLQimxQoFt9HMKR + - NODE_KEY_PATH=/data/5EFb84yH9tpcFuiKUcsmdoF7xeeY3ajG1ZLQimxQoFt9HMKR/p2p_secret diff --git a/docker/docker-compose.bridged.yml b/docker/docker-compose.bridged.yml new file mode 100644 index 0000000000..0f81315058 --- /dev/null +++ b/docker/docker-compose.bridged.yml @@ -0,0 +1,81 @@ +services: + Node0: + extends: + file: docker-compose.base.yml + service: Node0 + networks: + - main + - Node0 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node0:30343 + + Node1: + extends: + file: docker-compose.base.yml + service: Node1 + networks: + - main + - Node1 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node1:30344 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + + Node2: + extends: + file: docker-compose.base.yml + service: Node2 + networks: + - main + - Node2 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node2:30345 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + + Node3: + extends: + file: docker-compose.base.yml + service: Node3 + networks: + - main + - Node3 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node3:30346 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + + Node4: + extends: + file: docker-compose.base.yml + service: Node4 + networks: + - main + - Node4 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node4:30347 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + + Node5: + extends: + file: docker-compose.base.yml + service: Node5 + networks: + - main + - Node5 + environment: + - PUBLIC_VALIDATOR_ADDRESS=Node4:30348 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + +networks: + main: + name: main-network + Node0: + name: Node0-network + Node1: + name: Node1-network + Node2: + name: Node2-network + Node3: + name: Node3-network + Node4: + name: Node4-network + Node5: + name: Node5-network diff --git a/docker/docker-compose.network_tests.yml b/docker/docker-compose.network_tests.yml new file mode 100644 index 0000000000..c437d05bc1 --- /dev/null +++ b/docker/docker-compose.network_tests.yml @@ -0,0 +1,50 @@ +services: + Node0: + image: aleph-node:network_tests + networks: + - main + environment: + - PURGE_BEFORE_START=false + cap_add: + - NET_ADMIN + - SYS_PTRACE + + Node1: + image: aleph-node:network_tests + networks: + - main + environment: + - PURGE_BEFORE_START=false + cap_add: + - NET_ADMIN + - SYS_PTRACE + + Node2: + image: aleph-node:network_tests + networks: + - main + environment: + - PURGE_BEFORE_START=false + cap_add: + - NET_ADMIN + - SYS_PTRACE + + Node3: + image: aleph-node:network_tests + networks: + - main + environment: + - PURGE_BEFORE_START=false + cap_add: + - NET_ADMIN + - SYS_PTRACE + + Node4: + image: aleph-node:network_tests + networks: + - main + environment: + - PURGE_BEFORE_START=false + cap_add: + - NET_ADMIN + - SYS_PTRACE diff --git a/docker/docker-compose.synthetic-network.yml b/docker/docker-compose.synthetic-network.yml new file mode 100644 index 0000000000..a9438eddaa --- /dev/null +++ b/docker/docker-compose.synthetic-network.yml @@ -0,0 +1,96 @@ +services: + Node0: + extends: + file: docker-compose.base.yml + service: Node0 + image: aleph-node:syntheticnet + networks: + - synthetic-network + cap_add: + - NET_ADMIN + - NET_RAW + - SYS_PTRACE + environment: + - SYNTHETIC_NETWORK=10.77.0.0/16 + - PUBLIC_VALIDATOR_ADDRESS=Node0:30343 + ports: + - 3000:80 + + Node1: + extends: + file: docker-compose.base.yml + service: Node1 + image: aleph-node:syntheticnet + networks: + - synthetic-network + cap_add: + - NET_ADMIN + - NET_RAW + - SYS_PTRACE + environment: + - SYNTHETIC_NETWORK=10.77.0.0/16 + - PUBLIC_VALIDATOR_ADDRESS=Node1:30344 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + ports: + - 3001:80 + + Node2: + extends: + file: docker-compose.base.yml + service: Node2 + image: aleph-node:syntheticnet + networks: + - synthetic-network + cap_add: + - NET_ADMIN + - NET_RAW + - SYS_PTRACE + environment: + - SYNTHETIC_NETWORK=10.77.0.0/16 + - PUBLIC_VALIDATOR_ADDRESS=Node2:30345 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + ports: + - 3002:80 + + Node3: + extends: + file: docker-compose.base.yml + service: Node3 + image: aleph-node:syntheticnet + networks: + - synthetic-network + cap_add: + - NET_ADMIN + - NET_RAW + - SYS_PTRACE + environment: + - SYNTHETIC_NETWORK=10.77.0.0/16 + - PUBLIC_VALIDATOR_ADDRESS=Node3:30346 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + ports: + - 3003:80 + + Node4: + extends: + file: docker-compose.base.yml + service: Node4 + image: aleph-node:syntheticnet + networks: + - synthetic-network + cap_add: + - NET_ADMIN + - NET_RAW + - SYS_PTRACE + environment: + - SYNTHETIC_NETWORK=10.77.0.0/16 + - PUBLIC_VALIDATOR_ADDRESS=Node4:30347 + - BOOT_NODES=/dns4/Node0/tcp/30333/p2p/$BOOTNODE_PEER_ID + ports: + - 3004:80 + +networks: + synthetic-network: + ipam: + config: + - subnet: 10.77.0.0/16 + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c2957f7be7..e07f6dfb98 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,73 +3,36 @@ services: Node0: extends: - file: common.yml - service: AlephBootNode - container_name: Node0 - environment: - - RPC_PORT=9933 - - WS_PORT=9943 - - PORT=30333 - - VALIDATOR_PORT=30343 - - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30343 - - NAME=Node0 + file: docker-compose.base.yml + service: Node0 + network_mode: host Node1: extends: - file: common.yml - service: AlephNonBootNode - container_name: Node1 - environment: - - RPC_PORT=9934 - - WS_PORT=9944 - - PORT=30334 - - VALIDATOR_PORT=30344 - - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30344 - - NAME=Node1 - - BASE_PATH=/data/5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o - - NODE_KEY_PATH=/data/5GBNeWRhZc2jXu7D55rBimKYDk8PGk8itRYFTPfC8RJLKG5o/p2p_secret + file: docker-compose.base.yml + service: Node1 + network_mode: host Node2: extends: - file: common.yml - service: AlephNonBootNode - container_name: Node2 - environment: - - RPC_PORT=9935 - - WS_PORT=9945 - - PORT=30335 - - VALIDATOR_PORT=30345 - - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30345 - - NAME=Node2 - - BASE_PATH=/data/5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9 - - NODE_KEY_PATH=/data/5Dfis6XL8J2P6JHUnUtArnFWndn62SydeP8ee8sG2ky9nfm9/p2p_secret + file: docker-compose.base.yml + service: Node2 + network_mode: host Node3: extends: - file: common.yml - service: AlephNonBootNode - container_name: Node3 - environment: - - RPC_PORT=9936 - - WS_PORT=9946 - - PORT=30336 - - VALIDATOR_PORT=30346 - - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30346 - - NAME=Node3 - - BASE_PATH=/data/5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK - - NODE_KEY_PATH=/data/5F4H97f7nQovyrbiq4ZetaaviNwThSVcFobcA5aGab6167dK/p2p_secret + file: docker-compose.base.yml + service: Node3 + network_mode: host Node4: extends: - file: common.yml - service: AlephNonBootNode - container_name: Node4 - environment: - - RPC_PORT=9937 - - WS_PORT=9947 - - PORT=30337 - - VALIDATOR_PORT=30347 - - PUBLIC_VALIDATOR_ADDRESS=127.0.0.1:30347 - - NAME=Node4 - - BASE_PATH=/data/5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW - - NODE_KEY_PATH=/data/5DiDShBWa1fQx6gLzpf3SFBhMinCoyvHM1BWjPNsmXS8hkrW/p2p_secret + file: docker-compose.base.yml + service: Node4 + network_mode: host + + Node5: + extends: + file: docker-compose.base.yml + service: Node5 + network_mode: host diff --git a/docker/docker_entrypoint.sh b/docker/docker_entrypoint.sh index 159a734172..7982c6ac4a 100644 --- a/docker/docker_entrypoint.sh +++ b/docker/docker_entrypoint.sh @@ -31,6 +31,8 @@ TELEMETRY_URL=${TELEMETRY_URL:-'wss://telemetry.polkadot.io/submit/'} TELEMETRY_VERBOSITY_LVL=${TELEMETRY_VERBOSITY_LVL:-'0'} UNIT_CREATION_DELAY=${UNIT_CREATION_DELAY:-300} DB_CACHE=${DB_CACHE:-1024} +RUNTIME_CACHE_SIZE=${RUNTIME_CACHE_SIZE:-2} +MAX_RUNTIME_INSTANCES=${MAX_RUNTIME_INSTANCES:-8} BACKUP_PATH=${BACKUP_PATH:-${BASE_PATH}/backup-stash} if [[ "true" == "$PURGE_BEFORE_START" ]]; then @@ -40,7 +42,6 @@ fi ARGS=( --validator - --state-pruning archive --execution Native --name "${NAME}" --base-path "${BASE_PATH}" @@ -58,6 +59,8 @@ ARGS=( --unsafe-ws-external --unsafe-rpc-external --enable-log-reloading --db-cache "${DB_CACHE}" + --runtime-cache-size "${RUNTIME_CACHE_SIZE}" + --max-runtime-instances "${MAX_RUNTIME_INSTANCES}" ) if [[ -n "${BOOT_NODES:-}" ]]; then @@ -73,7 +76,7 @@ if [[ -n "${RESERVED_ONLY:-}" ]]; then fi if [[ -n "${FLAG_LAFA:-}" ]]; then - ARGS+=(-laleph-party=debug -laleph-network=debug -laleph-finality=debug -laleph-justification=debug -laleph-data-store=debug -laleph-metrics=debug) + ARGS+=(-laleph-party=debug -laleph-network=debug -lclique-network=debug -laleph-finality=debug -laleph-justification=debug -laleph-data-store=debug -laleph-metrics=debug) fi if [[ -n "${FLAG_L_ALEPH_BFT:-}" ]]; then diff --git a/docker/smartnet-compose.yml b/docker/smartnet-compose.yml index bee3b91850..0dc1148ccc 100644 --- a/docker/smartnet-compose.yml +++ b/docker/smartnet-compose.yml @@ -16,7 +16,7 @@ services: - PURGE_BEFORE_START=true - RPC_PORT=9933 - RUST_LOG=info - - UNIT_CREATION_DELAY=50 + - UNIT_CREATION_DELAY=300 - WS_PORT=9943 - BOOT_NODES=/ip4/127.0.0.1/tcp/30333/p2p/$BOOTNODE_PEER_ID - PUBLIC_ADDR=/ip4/127.0.0.1/tcp/30333 diff --git a/e2e-tests/.dockerignore b/e2e-tests/.dockerignore new file mode 100644 index 0000000000..9b2ec2d766 --- /dev/null +++ b/e2e-tests/.dockerignore @@ -0,0 +1,2 @@ +target +!target/release/aleph-e2e-client diff --git a/e2e-tests/Cargo.lock b/e2e-tests/Cargo.lock index 1989a98336..b898b1f71a 100644 --- a/e2e-tests/Cargo.lock +++ b/e2e-tests/Cargo.lock @@ -13,61 +13,21 @@ dependencies = [ ] [[package]] -name = "ac-compose-macros" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "log", - "parity-scale-codec", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-node-api" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "derive_more", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-primitives" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "hex", - "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "gimli 0.26.2", ] [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.2", ] [[package]] @@ -87,29 +47,42 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph-e2e-client" -version = "0.7.0" +version = "0.11.0" dependencies = [ "aleph_client", "anyhow", "assert2", - "clap", "env_logger 0.8.4", "frame-support", "frame-system", + "futures", "hex", "itertools", "log", + "once_cell", "pallet-balances", "pallet-elections", "pallet-staking", @@ -118,37 +91,32 @@ dependencies = [ "rand 0.8.5", "rayon", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "synthetic-link", + "tokio", ] [[package]] name = "aleph_client" -version = "1.11.0" +version = "2.13.0" dependencies = [ - "ac-node-api", - "ac-primitives", "anyhow", - "contract-metadata 1.5.0", + "async-trait", + "contract-metadata 2.0.1", "contract-transcode", "frame-support", + "futures", "hex", "ink_metadata", "log", - "pallet-aleph", - "pallet-balances", - "pallet-elections", - "pallet-multisig", - "pallet-staking", - "pallet-treasury", - "pallet-vesting", + "pallet-contracts-primitives", "parity-scale-codec", "primitives", - "rayon", + "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "subxt", "thiserror", ] @@ -167,14 +135,14 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -186,19 +154,16 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "arrayref" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" @@ -214,32 +179,41 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "assert2" -version = "0.3.6" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1b167af16149cd41ff2b784bf511bb4208b21c3b05f3f61e30823ce3986361" +checksum = "b08f101feec0a9ef4ef850105353c3726da5db058e19b8c53a6ab1fc4b7f7e33" dependencies = [ "assert2-macros", - "atty", + "is-terminal", "yansi", ] [[package]] name = "assert2-macros" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ac27dd1c8f16b282d1c22a8a5ae17119acc757101dec79054458fef62c447e" +checksum = "7fabe93976c52f6ab5c8c356335953880c1030093b067500b13bd33ec0ea6377" dependencies = [ "proc-macro2", "quote", - "rustc_version", "syn", ] +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -252,9 +226,9 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -265,16 +239,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -296,6 +270,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -316,21 +320,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -383,9 +377,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -407,31 +401,24 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.74" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -441,38 +428,36 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", "num-traits", - "winapi 0.3.9", + "winapi", ] [[package]] name = "clap" -version = "3.2.23" +version = "4.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", + "is-terminal", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" dependencies = [ "heck", "proc-macro-error", @@ -483,9 +468,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" dependencies = [ "os_str_bytes", ] @@ -502,22 +487,16 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "contract-metadata" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36318b44d658ee23a2daf66811822bdf6ac686aa534ea87eb9e16e7430ca6928" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -527,10 +506,11 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f25bdb57a728064a0e4909dfbb29957ebb06d205307e337d3b5596c7e67dd3a" +checksum = "f5997814dd5d45804757a616e938c28586875ac793ffc140e57e7ae9f421a066" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -540,35 +520,37 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa6db9d18dd5ef92d29c52d30c8503c857d390d9e4043e12466f1490c43c05e" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ "anyhow", - "contract-metadata 0.6.0", - "env_logger 0.9.2", + "contract-metadata 2.0.0-beta.1", "escape8259", "hex", "indexmap", "ink_env", "ink_metadata", "itertools", - "log", "nom", "nom-supreme", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "core-foundation" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation-sys" @@ -576,6 +558,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.5" @@ -585,13 +576,31 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-entity" +version = "0.88.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +dependencies = [ + "serde", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -601,31 +610,31 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -636,9 +645,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -704,9 +713,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -716,9 +725,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -731,28 +740,86 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", "syn", ] [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -761,10 +828,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", ] @@ -788,9 +853,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -826,15 +891,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -844,9 +909,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -859,27 +924,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -889,6 +967,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -904,12 +991,12 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae4f45fe23a1cad99d61617b3c9dbc19c905f2671b25d1e2714b4b221dc3605" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", @@ -917,9 +1004,30 @@ dependencies = [ [[package]] name = "environmental" -version = "1.1.3" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "escape8259" @@ -930,17 +1038,38 @@ dependencies = [ "rustversion", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -948,9 +1077,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -959,8 +1088,14 @@ dependencies = [ ] [[package]] -name = "foreign-types" -version = "0.3.2" +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ @@ -985,9 +1120,10 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log", @@ -995,19 +1131,21 @@ dependencies = [ "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", ] [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1018,17 +1156,18 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-election-provider-solution-type", "frame-support", "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-npos-elections", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] @@ -1037,18 +1176,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "git+https://github.com/integritee-network/frame-metadata#3b43da9821238681f9431276d55b92a079142083" -dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "parity-scale-codec", "scale-info", "serde", @@ -1057,10 +1185,10 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "bitflags", - "frame-metadata 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -1071,27 +1199,31 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-api", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core-hashing-proc-macro", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-inherents", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -1100,7 +1232,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1112,7 +1244,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", @@ -1122,36 +1254,21 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "2.0.0" @@ -1160,9 +1277,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1175,9 +1292,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1185,15 +1302,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1203,15 +1320,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-lite" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1220,15 +1352,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1238,9 +1370,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1279,7 +1411,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -1292,9 +1424,11 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1302,18 +1436,47 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1335,14 +1498,20 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1353,6 +1522,21 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -1379,6 +1563,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1390,18 +1583,99 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.53" @@ -1413,7 +1687,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1426,6 +1700,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1447,9 +1727,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -1473,60 +1753,61 @@ checksum = "0cfe9645a18782869361d9c8732246be7b410ad4e919d3609ebabdac00ba12c3" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] name = "ink_allocator" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9588a59a0e8997c0b2153cd11b5aaa77c06a0537a6b18f3811d1f1aa098b12" +checksum = "5323d4f43900266f2d5462cbe2a96d4182d634da0cfc1078d26c74d4117e0ce9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_engine" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487c3b390b7feb0620496b0cd38683433c7d7e6946b1caabda51e1f23eb24b30" +checksum = "de001b0907475ab10211093569d8b92726ef7a37d04b6e90c8a2864fbe14d050" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand 0.8.5", - "secp256k1 0.24.1", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", ] [[package]] name = "ink_env" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a891d34301a3dbb1c7b7424c49ae184282b163491c54f9acd17fcbe14a80447b" +checksum = "b0354567725e4f635a5c5694e4e4cac105e3e78cefd948ca5ab6cc92ea3d8231" dependencies = [ "arrayref", "blake2", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "ink_allocator", "ink_engine", "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.1", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", "static_assertions", @@ -1534,9 +1815,9 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74913aaed5751f5615af4631b7559328b8ed56c9cb821b89e14af0706176e849" +checksum = "9dfb4d5448446656ebf83d800c06effeffc063967ef5986d7d1a277e3e507dae" dependencies = [ "derive_more", "impl-serde", @@ -1548,23 +1829,47 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f031e6b8495594a7288b089bf4122e76c26b994959d1b2b693bdfe846b14c0e" +checksum = "c2626fb0c922f923965774cdd8cddeaaa204931d0ed19e0bf43702b033924173" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ink_primitives" -version = "3.4.0" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91066af898fe4c59b2ed0aca678238928b551dc75f5284bf1422e9f1bb6b2204" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage_traits" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12cf42dce81d060401c7cec95a392ad6d3c2f18661fa3083f619ce135133c33" +checksum = "da15ceaef6bdbece3e8b6338df899ef94e3921d03387fa941af8df3b38803523" dependencies = [ - "cfg-if 1.0.0", + "ink_metadata", "ink_prelude", + "ink_primitives", "parity-scale-codec", "scale-info", + "syn", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] @@ -1577,12 +1882,37 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + +[[package]] +name = "io-lifetimes" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "ipnet" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + +[[package]] +name = "is-terminal" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes 1.0.5", + "rustix 0.36.8", + "windows-sys 0.45.0", ] [[package]] @@ -1596,9 +1926,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "joinery" @@ -1608,39 +1938,121 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "cpufeatures", ] [[package]] @@ -1649,23 +2061,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1674,7 +2080,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1717,9 +2123,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -1735,8 +2141,20 @@ dependencies = [ ] [[package]] -name = "lock_api" -version = "0.4.9" +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "lock_api" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ @@ -1750,7 +2168,25 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown 0.12.3", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", ] [[package]] @@ -1786,22 +2222,41 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown 0.12.3", +] + [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1815,6 +2270,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1823,54 +2284,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.6.23" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", ] [[package]] @@ -1883,7 +2313,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -1903,27 +2333,34 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.38" +name = "native-tls" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ - "cfg-if 0.1.10", + "lazy_static", "libc", - "winapi 0.3.9", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1942,11 +2379,20 @@ dependencies = [ "nom", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -1955,18 +2401,18 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -1982,18 +2428,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2001,6 +2435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -2017,11 +2452,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -2030,15 +2465,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -2054,12 +2501,12 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2078,11 +2525,17 @@ dependencies = [ "syn", ] +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -2093,46 +2546,28 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.1" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" - -[[package]] -name = "pallet-aleph" -version = "0.5.0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "pallet-session", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "serde", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-benchmarking", "frame-support", @@ -2140,13 +2575,25 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "pallet-contracts-primitives" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "bitflags", + "parity-scale-codec", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-elections" -version = "0.5.0" +version = "0.5.4" dependencies = [ "frame-election-provider-support", "frame-support", @@ -2159,31 +2606,17 @@ dependencies = [ "parity-scale-codec", "primitives", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", "frame-system", @@ -2192,20 +2625,21 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-session", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", @@ -2215,17 +2649,17 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-benchmarking", "frame-support", @@ -2234,74 +2668,30 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "sp-timestamp", ] -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "serde", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - [[package]] name = "pallets-support" -version = "0.1.0" +version = "0.1.4" dependencies = [ "frame-support", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2309,9 +2699,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2321,17 +2711,17 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", - "hashbrown", + "cfg-if", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", "primitive-types", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2347,9 +2737,15 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -2363,22 +2759,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -2398,12 +2794,41 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -2416,6 +2841,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.26" @@ -2430,9 +2865,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -2443,28 +2878,27 @@ dependencies = [ [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2493,18 +2927,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2614,21 +3057,19 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2647,18 +3088,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2667,9 +3108,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2691,17 +3132,78 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +dependencies = [ + "base64 0.21.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rlibc" version = "1.0.0" @@ -2727,34 +3229,109 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "semver", + "bitflags", + "errno", + "io-lifetimes 0.7.5", + "libc", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustix" +version = "0.36.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 1.0.5", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] [[package]] name = "scale-info" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -2763,9 +3340,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2773,6 +3350,43 @@ dependencies = [ "syn", ] +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2799,54 +3413,66 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.6.1", ] [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "secp256k1-sys 0.6.1", + "secp256k1-sys 0.8.0", ] [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "642a62736682fdd8c71da0eb273e453c8ac74e33b9fb310e22ba5b03ec7651ff" dependencies = [ "cc", ] @@ -2860,29 +3486,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2891,10 +3540,33 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ + "form_urlencoded", "itoa", "ryu", "serde", @@ -2902,14 +3574,15 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2931,7 +3604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -2943,9 +3616,9 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2954,7 +3627,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -2967,13 +3640,22 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] @@ -2991,9 +3673,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -3004,27 +3686,83 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "hash-db", "log", "parity-scale-codec", - "sp-api-proc-macro", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "blake2", "proc-macro-crate", @@ -3035,90 +3773,104 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-application-crypto" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] [[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-arithmetic" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", + "integer-sqrt", + "num-traits", "parity-scale-codec", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "scale-info", + "serde", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "static_assertions", ] [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -3126,120 +3878,183 @@ dependencies = [ "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core-hashing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", + "tiny-bip39 0.8.2", "wasmi", "zeroize", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.1", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", - "wasmi", + "tiny-bip39 1.0.0", "zeroize", ] [[package]] -name = "sp-core-hashing" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +name = "sp-core" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "blake2-rfc", - "byteorder", - "sha2 0.9.9", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", - "twox-hash", + "array-bytes", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1 0.24.3", + "secrecy", + "serde", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39 1.0.0", + "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash", ] +[[package]] +name = "sp-core-hashing" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "syn", +] + [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "syn", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3248,8 +4063,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", @@ -3258,98 +4083,134 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-keystore 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-state-machine 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-state-machine 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "secp256k1 0.24.1", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-keystore 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes", + "ed25519", + "ed25519-dalek", + "futures", + "libsecp256k1", + "log", + "parity-scale-codec", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3357,15 +4218,31 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-keystore" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "async-trait", "futures", @@ -3373,30 +4250,30 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", @@ -3405,8 +4282,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", @@ -3414,20 +4291,20 @@ dependencies = [ ] [[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-panic-handler" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "rustc-hash", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "backtrace", + "lazy_static", + "regex", ] [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3439,76 +4316,118 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-application-crypto 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-runtime" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3519,8 +4438,20 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "Inflector", "proc-macro-crate", @@ -3532,33 +4463,46 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-api 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-staking 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3567,101 +4511,135 @@ dependencies = [ "parking_lot", "rand 0.7.3", "smallvec", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-panic-handler 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-panic-handler 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-panic-handler 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", +] + +[[package]] +name = "sp-state-machine" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand 0.8.5", + "smallvec", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures-timer", "log", "parity-scale-codec", - "sp-api", "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", "tracing-subscriber", @@ -3669,44 +4647,94 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", "tracing-subscriber", ] [[package]] -name = "sp-trie" +name = "sp-tracing" version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash 0.7.6", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "lru", + "memory-db 0.30.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "ahash 0.8.3", + "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ + "ahash 0.8.3", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3714,24 +4742,52 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", +] + +[[package]] +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm", "scale-info", "serde", - "sp-core-hashing-proc-macro", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version-proc-macro", + "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3741,34 +4797,111 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3779,6 +4912,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3804,36 +4943,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "substrate-api-client" -version = "0.6.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-compose-macros", - "ac-node-api", - "ac-primitives", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "pallet-balances", - "pallet-staking", - "pallet-transaction-payment", - "parity-scale-codec", - "primitive-types", - "serde", - "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-rpc", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", - "thiserror", - "ws", -] - [[package]] name = "substrate-bip39" version = "0.4.4" @@ -3853,11 +4962,84 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subxt" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +dependencies = [ + "bitvec", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tracing", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +dependencies = [ + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3876,6 +5058,21 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "synthetic-link" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "env_logger 0.10.0", + "log", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "tokio", +] + [[package]] name = "tap" version = "1.0.1" @@ -3883,34 +5080,142 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "termcolor" -version = "1.1.3" +name = "target-lexicon" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", ] [[package]] -name = "textwrap" -version = "0.16.0" +name = "termcolor" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] -name = "thiserror-impl" -version = "1.0.37" +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3918,65 +5223,63 @@ dependencies = [ ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "once_cell", + "native-tls", + "tokio", ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "tokio-rustls" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "rustls", + "tokio", + "webpki", ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "tokio-util" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ - "crunchy", + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" [[package]] -name = "tinyvec_macros" -version = "0.1.0" +name = "toml_edit" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] [[package]] -name = "toml" -version = "0.5.9" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -3984,7 +5287,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4056,12 +5359,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -4076,11 +5379,17 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -4088,23 +5397,23 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", - "digest 0.10.5", + "cfg-if", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -4114,15 +5423,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -4145,6 +5454,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -4175,6 +5490,22 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4189,19 +5520,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -4212,11 +5543,23 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4224,9 +5567,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4237,39 +5580,202 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix 0.35.13", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset 0.6.5", + "paste", + "rand 0.8.5", + "rustix 0.35.13", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -4281,12 +5787,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4299,7 +5799,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4308,6 +5808,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4315,100 +5828,146 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] -name = "ws" -version = "0.9.2" +name = "windows_x86_64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fe90c75f236a0a00247d5900226aea4f2d7b05ccc34da9e7a8880ff59b5848" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio", - "mio-extras", - "openssl", - "rand 0.7.3", - "sha-1", - "slab", - "url", -] +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "winreg" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + [[package]] name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + [[package]] name = "zeroize" version = "1.5.7" @@ -4420,9 +5979,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/e2e-tests/Cargo.toml b/e2e-tests/Cargo.toml index 98ff16ddf3..a390cdfcb0 100644 --- a/e2e-tests/Cargo.toml +++ b/e2e-tests/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "aleph-e2e-client" -version = "0.7.0" +version = "0.11.0" edition = "2021" license = "Apache 2.0" [dependencies] anyhow = "1.0" -clap = { version = "3.0", features = ["derive"] } env_logger = "0.8" hex = "0.4.3" log = "0.4" @@ -16,17 +15,21 @@ rayon = "1.5" rand = "0.8" itertools = "0.10" assert2 = "0.3" +tokio = { version = "1.21.2", features = ["full"] } +futures = "0.3.25" +once_cell = "1.16" -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false, features = ["full_crypto"] } -sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false } -frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false } -system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", package = "frame-system" } -pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false } -pallet-balances = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", default-features = false, features = ["full_crypto"] } +sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", default-features = false } +frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", default-features = false } +system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", package = "frame-system" } +pallet-staking = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", default-features = false } +pallet-balances = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", default-features = false } aleph_client = { path = "../aleph-client" } primitives = { path = "../primitives", features = ["short_session"], default-features = false } pallet-elections = { path = "../pallets/elections" } +synthetic-link = { path = "../scripts/synthetic-network/synthetic-link" } [features] default = ["std"] diff --git a/e2e-tests/README.md b/e2e-tests/README.md new file mode 100644 index 0000000000..113c56ee0f --- /dev/null +++ b/e2e-tests/README.md @@ -0,0 +1,35 @@ +# e2e-tests + +This crate contains e2e test scenarios for the aleph-node. + +## Running + +The most basic way to run (assuming a local node is listening on 9944) is: + +```bash +$ NODE_URL=ws://127.0.0.1:9944 cargo test name_of_one_test +``` + +Note that the particular test cases might require different numbers of launched nodes, validators, or a particular +configuration of the launched nodes, see the documentation for a particular test case for details. + +Additional options are passed to the tests via env variables. See `src/config.rs` for docs on available options. + +## Running on devnet (or other-net) + +You can also run the tests on some other network. For example, to run the contract test for the `adder` contract on +devnet: + +1. Prepare an account with some money, note the seed of the account. +2. Deploy the contract to devnet: + +```bash +contracts/adder$ NODE_URL=wss://ws.dev.azero.dev AUTHORITY="$THE_SEED" ./deploy.sh +``` + +3. Run the tests: + +```bash +e2e-tests$ RUST_BACKTRACE=1 SUDO_SEED="$THE_SEED" NODE_URL=wss://ws.dev.azero.dev:443 \ + ADDER=$DEPLOY_ADDRESS ADDER_METADATA=../contracts/adder/target/ink/metadata.json cargo test adder -- --nocapture +``` diff --git a/e2e-tests/docker_entrypoint.sh b/e2e-tests/docker_entrypoint.sh index 3ab44def91..783e0e1036 100644 --- a/e2e-tests/docker_entrypoint.sh +++ b/e2e-tests/docker_entrypoint.sh @@ -1,30 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -ARGS=( - --node "${NODE_URL}" -) - -if [[ -n "${TEST_CASES:-}" ]]; then - ARGS+=(--test-cases "${TEST_CASES}") -fi - -# If test case params are both not empty, run client with them. Otherwise, run without params. -if [[ -n "${RESERVED_SEATS:-}" && -n "${NON_RESERVED_SEATS:-}" ]]; then - ARGS+=( - --reserved-seats "${RESERVED_SEATS}" - --non-reserved-seats "${NON_RESERVED_SEATS}" - ) -fi - -if [[ -n "${UPGRADE_VERSION:-}" && -n "${UPGRADE_SESSION:-}" && -n "${UPGRADE_FINALIZATION_WAIT_SESSIONS:-}" ]]; then - ARGS+=( - --upgrade-to-version "${UPGRADE_VERSION}" - --upgrade-session "${UPGRADE_SESSION}" - --upgrade-finalization-wait-sessions "${UPGRADE_FINALIZATION_WAIT_SESSIONS}" - ) -fi - -aleph-e2e-client "${ARGS[@]}" +aleph-e2e-client $TEST_CASES --nocapture --test-threads 1 echo "Done!" diff --git a/e2e-tests/src/accounts.rs b/e2e-tests/src/accounts.rs index 0292319366..31c8a6fa7e 100644 --- a/e2e-tests/src/accounts.rs +++ b/e2e-tests/src/accounts.rs @@ -1,5 +1,6 @@ -use aleph_client::{keypair_from_string, AccountId, KeyPair}; -use sp_core::Pair; +use aleph_client::{ + keypair_from_string, raw_keypair_from_string, AccountId, KeyPair, Pair, RawKeyPair, +}; use crate::config::Config; @@ -20,6 +21,9 @@ pub fn get_validators_seeds(config: &Config) -> Vec { pub fn get_validators_keys(config: &Config) -> Vec { accounts_seeds_to_keys(&get_validators_seeds(config)) } +pub fn get_validators_raw_keys(config: &Config) -> Vec { + accounts_seeds_to_raw_keys(&get_validators_seeds(config)) +} pub fn accounts_seeds_to_keys(seeds: &[String]) -> Vec { seeds @@ -28,6 +32,13 @@ pub fn accounts_seeds_to_keys(seeds: &[String]) -> Vec { .map(keypair_from_string) .collect() } +pub fn accounts_seeds_to_raw_keys(seeds: &[String]) -> Vec { + seeds + .iter() + .map(String::as_str) + .map(raw_keypair_from_string) + .collect() +} pub fn get_sudo_key(config: &Config) -> KeyPair { keypair_from_string(&config.sudo_seed) @@ -53,6 +64,6 @@ fn get_validators_controller_seed(seed: &str) -> String { pub fn account_ids_from_keys(keys: &[KeyPair]) -> Vec { keys.iter() - .map(|pair| AccountId::from(pair.public())) + .map(|pair| AccountId::from(pair.signer().public())) .collect() } diff --git a/e2e-tests/src/ban.rs b/e2e-tests/src/ban.rs index b8b45ba2e0..e0a92c662f 100644 --- a/e2e-tests/src/ban.rs +++ b/e2e-tests/src/ban.rs @@ -1,71 +1,84 @@ use aleph_client::{ - change_validators, get_ban_config, get_ban_reason_for_validator, - get_underperformed_validator_session_count, wait_for_event, wait_for_full_era_completion, - AccountId, AnyConnection, RootConnection, XtStatus, + api::elections::events::BanValidators, + pallets::elections::{ElectionsApi, ElectionsSudoApi}, + primitives::{BanConfig, BanInfo, CommitteeSeats, EraValidators}, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + AccountId, RootConnection, TxStatus, }; -use codec::Decode; +use codec::Encode; use log::info; -use primitives::{BanConfig, BanInfo, CommitteeSeats, EraValidators, SessionCount}; +use primitives::{SessionCount, SessionIndex}; use sp_runtime::Perbill; -use crate::{accounts::account_ids_from_keys, validators::get_test_validators, Config}; +use crate::{ + accounts::account_ids_from_keys, config::Config, elections::get_members_subset_for_session, + validators::get_test_validators, +}; + +const RESERVED_SEATS: u32 = 2; +const NON_RESERVED_SEATS: u32 = 2; -pub fn setup_test( +pub async fn setup_test( config: &Config, -) -> anyhow::Result<(RootConnection, Vec, Vec)> { - let root_connection = config.create_root_connection(); +) -> anyhow::Result<( + RootConnection, + Vec, + Vec, + CommitteeSeats, +)> { + let root_connection = config.create_root_connection().await; let validator_keys = get_test_validators(config); let reserved_validators = account_ids_from_keys(&validator_keys.reserved); let non_reserved_validators = account_ids_from_keys(&validator_keys.non_reserved); let seats = CommitteeSeats { - reserved_seats: 2, - non_reserved_seats: 2, + reserved_seats: RESERVED_SEATS, + non_reserved_seats: NON_RESERVED_SEATS, }; - change_validators( - &root_connection, - Some(reserved_validators.clone()), - Some(non_reserved_validators.clone()), - Some(seats), - XtStatus::InBlock, - ); + root_connection + .change_validators( + Some(reserved_validators.clone()), + Some(non_reserved_validators.clone()), + Some(seats.clone()), + TxStatus::InBlock, + ) + .await?; - wait_for_full_era_completion(&root_connection)?; + root_connection.wait_for_n_eras(2, BlockStatus::Best).await; Ok(( root_connection, reserved_validators, non_reserved_validators, + seats, )) } -pub fn check_validators( - connection: &C, +pub fn check_validators( expected_reserved: &[AccountId], expected_non_reserved: &[AccountId], - actual_validators_source: fn(&C) -> EraValidators, + era_validators: EraValidators, ) -> EraValidators { - let era_validators = actual_validators_source(connection); - assert_eq!(era_validators.reserved, expected_reserved); assert_eq!(era_validators.non_reserved, expected_non_reserved); era_validators } -pub fn check_ban_config( - connection: &RootConnection, +pub async fn check_ban_config( + connection: &C, expected_minimal_expected_performance: Perbill, expected_session_count_threshold: SessionCount, expected_clean_session_counter_delay: SessionCount, ) -> BanConfig { - let ban_config = get_ban_config(connection); + let ban_config = connection.get_ban_config(None).await; assert_eq!( - ban_config.minimal_expected_performance, - expected_minimal_expected_performance + ban_config.minimal_expected_performance.0, + expected_minimal_expected_performance.deconstruct() ); assert_eq!( ban_config.underperformed_session_count_threshold, @@ -79,48 +92,154 @@ pub fn check_ban_config( ban_config } -pub fn check_underperformed_validator_session_count( +pub async fn check_underperformed_validator_session_count( connection: &C, validator: &AccountId, - expected_session_count: &SessionCount, + expected_session_count: SessionCount, ) -> SessionCount { - let underperformed_validator_session_count = - get_underperformed_validator_session_count(connection, validator); + let underperformed_validator_session_count = connection + .get_underperformed_validator_session_count(validator.clone(), None) + .await + .unwrap_or_default(); assert_eq!( - &underperformed_validator_session_count, + underperformed_validator_session_count, expected_session_count ); underperformed_validator_session_count } -pub fn check_ban_info_for_validator( +pub async fn check_underperformed_validator_reason( connection: &C, validator: &AccountId, expected_info: Option<&BanInfo>, ) -> Option { - let validator_ban_info = get_ban_reason_for_validator(connection, validator); + let validator_ban_info = connection + .get_ban_info_for_validator(validator.clone(), None) + .await; assert_eq!(validator_ban_info.as_ref(), expected_info); - validator_ban_info } -#[derive(Debug, Decode, Clone)] -pub struct BanEvent { - banned_validators: Vec<(AccountId, BanInfo)>, +pub async fn check_ban_info_for_validator( + connection: &C, + validator: &AccountId, + expected_info: Option<&BanInfo>, +) -> Option { + let validator_ban_info = connection + .get_ban_info_for_validator(validator.clone(), None) + .await; + + assert_eq!(validator_ban_info.as_ref(), expected_info); + + validator_ban_info } -pub fn check_ban_event( +pub async fn check_ban_event( connection: &C, expected_banned_validators: &[(AccountId, BanInfo)], -) -> anyhow::Result { - let event = wait_for_event(connection, ("Elections", "BanValidators"), |e: BanEvent| { - info!("Received BanValidators event: {:?}", e.banned_validators); - assert_eq!(e.banned_validators, expected_banned_validators); - true - })?; +) -> anyhow::Result { + let event = connection + .wait_for_event( + |event: &BanValidators| { + info!("Received BanValidators event: {:?}", event.0); + true + }, + BlockStatus::Best, + ) + .await; + assert_eq!(event.0.encode(), expected_banned_validators.encode()); Ok(event) } + +pub fn get_members_for_session( + reserved_validators: &[AccountId], + non_reserved_validators: &[AccountId], + seats: &CommitteeSeats, + session: SessionIndex, +) -> Vec { + let reserved_members = + get_members_subset_for_session(seats.reserved_seats, reserved_validators, session); + let non_reserved_members = + get_members_subset_for_session(seats.non_reserved_seats, non_reserved_validators, session); + reserved_members + .into_iter() + .chain(non_reserved_members.into_iter()) + .collect() +} + +/// Checks whether underperformed counts for validators change predictably. Assumes: (a) that the +/// sessions checked are in the past, (b) that all the checked validators are underperforming in +/// those sessions (e.g. due to a prohibitively high performance threshold). +pub async fn check_underperformed_count_for_sessions( + connection: &C, + reserved_validators: &[AccountId], + non_reserved_validators: &[AccountId], + seats: &CommitteeSeats, + start_session: SessionIndex, + end_session: SessionIndex, + ban_session_threshold: SessionCount, +) -> anyhow::Result<()> { + let session_period = connection.get_session_period().await?; + + let validators: Vec<_> = reserved_validators + .iter() + .chain(non_reserved_validators.iter()) + .collect(); + + for session in start_session..end_session { + let session_end_block = (session + 1) * session_period; + let session_end_block_hash = connection.get_block_hash(session_end_block).await?; + + let previous_session_end_block = session_end_block - session_period; + let previous_session_end_block_hash = connection + .get_block_hash(previous_session_end_block) + .await?; + + let members = + get_members_for_session(reserved_validators, non_reserved_validators, seats, session); + + for &val in validators.iter() { + info!( + "Checking session count | session {} | validator {}", + session, val + ); + let session_underperformed_count = connection + .get_underperformed_validator_session_count(val.clone(), session_end_block_hash) + .await + .unwrap_or_default(); + let previous_session_underperformed_count = connection + .get_underperformed_validator_session_count( + val.clone(), + previous_session_end_block_hash, + ) + .await + .unwrap_or_default(); + + let underperformed_diff = + session_underperformed_count.abs_diff(previous_session_underperformed_count); + + if members.contains(val) { + // Counter for committee members legally incremented by 1 or reset to 0 (decremented + // by ban_session_threshold - 1). + if underperformed_diff != 1 && underperformed_diff != (ban_session_threshold - 1) { + panic!( + "Underperformed session count for committee validator {} for session {} changed from {} to {}.", + val, session, previous_session_underperformed_count, session_underperformed_count + ); + } + } else if underperformed_diff != 0 { + // Counter for validators on the bench should stay the same. + panic!( + "Underperformed session count for non-committee validator {} for session {} changed from {} to {}.", + val, session, previous_session_underperformed_count, session_underperformed_count + ); + } + } + } + + Ok(()) +} diff --git a/e2e-tests/src/cases.rs b/e2e-tests/src/cases.rs deleted file mode 100644 index 36263c0074..0000000000 --- a/e2e-tests/src/cases.rs +++ /dev/null @@ -1,85 +0,0 @@ -use crate::{ - config::Config, - test::{ - authorities_are_staking as test_authorities_are_staking, - back_to_the_future as test_back_to_the_future, ban_automatic as test_ban_automatic, - ban_manual as test_ban_manual, batch_transactions as test_batch_transactions, - button_game_reset as test_button_game_reset, - change_stake_and_force_new_era as test_change_stake_and_force_new_era, - change_validators as test_change_validators, - channeling_fee_and_tip as test_channeling_fee_and_tip, - clearing_session_count as test_clearing_session_count, disable_node as test_disable_node, - early_bird_special as test_early_bird_special, - era_payouts_calculated_correctly as test_era_payout, era_validators as test_era_validators, - fee_calculation as test_fee_calculation, finalization as test_finalization, - force_new_era as test_force_new_era, marketplace as test_marketplace, - points_basic as test_points_basic, points_stake_change as test_points_stake_change, - schedule_doomed_version_change_and_verify_finalization_stopped as test_schedule_doomed_version_change_and_verify_finalization_stopped, - schedule_version_change as test_schedule_version_change, simple_dex as test_simple_dex, - staking_era_payouts as test_staking_era_payouts, - staking_new_validator as test_staking_new_validator, - the_pressiah_cometh as test_the_pressiah_cometh, token_transfer as test_token_transfer, - treasury_access as test_treasury_access, validators_rotate as test_validators_rotate, - wrapped_azero as test_wrapped_azero, - }, -}; - -pub type TestCase = fn(&Config) -> anyhow::Result<()>; - -pub type PossibleTestCases = Vec<(&'static str, TestCase)>; - -/// Get a Vec with test cases that the e2e suite is able to handle. -/// The order of items is important for tests when more than one case is handled in order. -/// This comes up in local tests. -pub fn possible_test_cases() -> PossibleTestCases { - vec![ - ("finalization", test_finalization as TestCase), - ("version_upgrade", test_schedule_version_change), - ( - "doomed_version_upgrade", - test_schedule_doomed_version_change_and_verify_finalization_stopped, - ), - ("rewards_disable_node", test_disable_node as TestCase), - ("token_transfer", test_token_transfer as TestCase), - ( - "channeling_fee_and_tip", - test_channeling_fee_and_tip as TestCase, - ), - ("treasury_access", test_treasury_access as TestCase), - ("batch_transactions", test_batch_transactions as TestCase), - ("staking_era_payouts", test_staking_era_payouts as TestCase), - ("validators_rotate", test_validators_rotate as TestCase), - ( - "staking_new_validator", - test_staking_new_validator as TestCase, - ), - ("change_validators", test_change_validators as TestCase), - ("fee_calculation", test_fee_calculation as TestCase), - ("era_payout", test_era_payout as TestCase), - ("era_validators", test_era_validators as TestCase), - ( - "rewards_change_stake_and_force_new_era", - test_change_stake_and_force_new_era as TestCase, - ), - ("points_basic", test_points_basic as TestCase), - ("rewards_force_new_era", test_force_new_era as TestCase), - ("rewards_stake_change", test_points_stake_change as TestCase), - ( - "authorities_are_staking", - test_authorities_are_staking as TestCase, - ), - ("button_game_reset", test_button_game_reset as TestCase), - ("early_bird_special", test_early_bird_special as TestCase), - ("back_to_the_future", test_back_to_the_future as TestCase), - ("the_pressiah_cometh", test_the_pressiah_cometh as TestCase), - ("marketplace", test_marketplace as TestCase), - ("simple_dex", test_simple_dex as TestCase), - ("wrapped_azero", test_wrapped_azero as TestCase), - ("ban_automatic", test_ban_automatic as TestCase), - ("ban_manual", test_ban_manual as TestCase), - ( - "clearing_session_count", - test_clearing_session_count as TestCase, - ), - ] -} diff --git a/e2e-tests/src/config.rs b/e2e-tests/src/config.rs index 527f2e5a05..6c81087569 100644 --- a/e2e-tests/src/config.rs +++ b/e2e-tests/src/config.rs @@ -1,35 +1,83 @@ +use std::{env, str::FromStr}; + use aleph_client::{RootConnection, SignedConnection}; -use clap::{Args, Parser}; +use once_cell::sync::Lazy; use primitives::SessionIndex; use crate::accounts::{get_sudo_key, get_validators_keys, get_validators_seeds, NodeKeys}; -#[derive(Debug, Parser, Clone)] -#[clap(version = "1.0")] +static GLOBAL_CONFIG: Lazy = Lazy::new(|| { + let node = get_env("NODE_URL").unwrap_or_else(|| "ws://127.0.0.1:9944".to_string()); + let validator_count = get_env("VALIDATOR_COUNT").unwrap_or(5); + let validators_seeds = env::var("VALIDATORS_SEEDS") + .ok() + .map(|s| s.split(',').map(|s| s.to_string()).collect()); + let sudo_seed = get_env("SUDO_SEED").unwrap_or_else(|| "//Alice".to_string()); + + Config { + node, + validator_count, + validators_seeds, + sudo_seed, + test_case_params: TestCaseParams { + reserved_seats: get_env("RESERVED_SEATS"), + non_reserved_seats: get_env("NON_RESERVED_SEATS"), + upgrade_to_version: get_env("UPGRADE_VERSION"), + upgrade_session: get_env("UPGRADE_SESSION"), + upgrade_finalization_wait_sessions: get_env("UPGRADE_FINALIZATION_WAIT_SESSIONS"), + adder: get_env("ADDER"), + back_to_the_future: get_env("BACK_TO_THE_FUTURE"), + early_bird_special: get_env("EARLY_BIRD_SPECIAL"), + the_pressiah_cometh: get_env("THE_PRESSIAH_COMETH"), + wrapped_azero: get_env("WRAPPED_AZERO"), + simple_dex: get_env("SIMPLE_DEX"), + adder_metadata: get_env("ADDER_METADATA"), + button_game_metadata: get_env("BUTTON_GAME_METADATA"), + marketplace_metadata: get_env("MARKETPLACE_METADATA"), + reward_token_metadata: get_env("REWARD_TOKEN_METADATA"), + ticket_token_metadata: get_env("TICKET_TOKEN_METADATA"), + simple_dex_metadata: get_env("SIMPLE_DEX_METADATA"), + wrapped_azero_metadata: get_env("WRAPPED_AZERO_METADATA"), + out_latency: get_env("OUT_LATENCY"), + synthetic_network_urls: env::var("SYNTHETIC_URLS") + .ok() + .map(|s| s.split(',').map(|s| s.to_string()).collect()), + }, + } +}); + +fn get_env(name: &str) -> Option +where + T: FromStr, + T::Err: std::fmt::Debug, +{ + env::var(name).ok().map(|v| { + v.parse() + .unwrap_or_else(|_| panic!("Failed to parse env var {}", name)) + }) +} + +pub fn setup_test() -> &'static Config { + let _ = env_logger::builder().is_test(true).try_init(); + &GLOBAL_CONFIG +} + +#[derive(Debug, Clone)] pub struct Config { /// WS endpoint address of the node to connect to - #[clap(long, default_value = "127.0.0.1:9943")] pub node: String, - /// Test cases to run. - #[clap(long)] - pub test_cases: Option>, - /// Number of //0, //1, ... validators to run e2e tests on - #[clap(long, default_value = "5")] pub validator_count: u32, /// Seed values to create accounts /// Optional: by default we use //0, //1, ... seeds for validators - #[clap(long)] pub validators_seeds: Option>, /// Seed value of sudo account - #[clap(long, default_value = "//Alice")] pub sudo_seed: String, /// Test case parameters, used for test setup. - #[clap(flatten)] pub test_case_params: TestCaseParams, } @@ -44,84 +92,106 @@ impl Config { NodeKeys::from(validator_seed) } - pub fn create_root_connection(&self) -> RootConnection { + pub async fn create_root_connection(&self) -> RootConnection { let sudo_keypair = get_sudo_key(self); - RootConnection::new(&self.node, sudo_keypair) + RootConnection::new(&self.node, sudo_keypair).await.unwrap() + } + + pub fn validator_names(&self) -> Vec { + (0..self.validator_count) + .map(|id| format!("Node{}", id)) + .collect() + } + + pub fn synthetic_network_urls(&self) -> Vec { + match &self.test_case_params.synthetic_network_urls { + Some(urls) => urls.clone(), + None => self + .validator_names() + .into_iter() + .map(|node_name| format!("http://{}:80/qos", node_name)) + .collect(), + } } /// Get a `SignedConnection` where the signer is the first validator. - pub fn get_first_signed_connection(&self) -> SignedConnection { + pub async fn get_first_signed_connection(&self) -> SignedConnection { let node = &self.node; - let accounts = get_validators_keys(self); - let sender = accounts.first().expect("Using default accounts").to_owned(); - SignedConnection::new(node, sender) + let mut accounts = get_validators_keys(self); + let sender = accounts.remove(0); + SignedConnection::new(node, sender).await + } + + pub async fn create_signed_connections(&self) -> Vec { + futures::future::join_all( + get_validators_keys(self) + .into_iter() + .map(|account| async { SignedConnection::new(&self.node, account).await }), + ) + .await } } /// Parameters which can be passed to test cases. -#[derive(Args, Clone, Debug)] +#[derive(Clone, Debug)] pub struct TestCaseParams { /// Desired number of reserved seats for validators, may be set within the test. - #[clap(long)] pub reserved_seats: Option, /// Desired number of non-reserved seats for validators, may be set within the test. - #[clap(long)] pub non_reserved_seats: Option, /// Address of the Early Bird Special game contract, only used by button game tests. - #[clap(long)] pub early_bird_special: Option, /// Address of the Back to the Future game contract, only used by button game tests. - #[clap(long)] pub back_to_the_future: Option, /// Address of the The Pressiah Cometh game contract, only used by button game tests. - #[clap(long)] pub the_pressiah_cometh: Option, /// Address of the simple dex contract. Only used by button tests. - #[clap(long)] pub simple_dex: Option, /// Address of the wrapped azero contract. Only used by button tests. - #[clap(long)] pub wrapped_azero: Option, /// Path to the button game metadata file. Only used by button tests. - #[clap(long)] pub button_game_metadata: Option, /// Path to the ticket token metadata file. Only used by button tests. - #[clap(long)] pub ticket_token_metadata: Option, /// Path to the reward token metadata file. Only used by button tests. - #[clap(long)] pub reward_token_metadata: Option, /// Path to the marketplace metadata file. Only used by button tests. - #[clap(long)] pub marketplace_metadata: Option, /// Path to the simple_dex metadata file. Only used by button tests. - #[clap(long)] pub simple_dex_metadata: Option, /// Path to wrapped_azero metadata file. Only used by button tests. - #[clap(long)] pub wrapped_azero_metadata: Option, /// Version for the VersionUpgrade test. - #[clap(long)] pub upgrade_to_version: Option, /// Session in which we should schedule an upgrade in VersionUpgrade test. - #[clap(long)] pub upgrade_session: Option, /// How many sessions we should wait after upgrade in VersionUpgrade test. - #[clap(long)] pub upgrade_finalization_wait_sessions: Option, + + /// Adder contract address. + pub adder: Option, + + /// Adder contract metadata. + pub adder_metadata: Option, + + /// Milliseconds of network latency + pub out_latency: Option, + + /// List of URLs for the configuration endpoints of the synthetic-network + pub synthetic_network_urls: Option>, } diff --git a/e2e-tests/src/elections.rs b/e2e-tests/src/elections.rs index 0d60c3f2f7..5640b5ae28 100644 --- a/e2e-tests/src/elections.rs +++ b/e2e-tests/src/elections.rs @@ -1,15 +1,20 @@ use std::{collections::HashSet, iter::empty}; -use aleph_client::{get_validators_for_session, AccountId, ReadStorage}; +use aleph_client::{ + pallets::session::SessionApi, + primitives::{CommitteeSeats, EraValidators}, + utility::BlocksApi, + AccountId, +}; use log::debug; -use primitives::{CommitteeSeats, EraValidators, SessionIndex}; +use primitives::SessionIndex; -pub fn get_and_test_members_for_session( +pub async fn get_and_test_members_for_session( connection: &C, seats: CommitteeSeats, era_validators: &EraValidators, session: SessionIndex, -) -> (Vec, Vec) { +) -> anyhow::Result<(Vec, Vec)> { let reserved_members_for_session = get_members_subset_for_session(seats.reserved_seats, &era_validators.reserved, session); let non_reserved_members_for_session = get_members_subset_for_session( @@ -35,9 +40,8 @@ pub fn get_and_test_members_for_session( .collect(); let members_active_set: HashSet<_> = members_active.iter().cloned().collect(); - let network_members: HashSet<_> = get_validators_for_session(connection, session) - .into_iter() - .collect(); + let block = connection.first_block_of_session(session).await?; + let network_members: HashSet<_> = connection.get_validators(block).await.into_iter().collect(); debug!( "expected era validators for session {}: reserved - {:?}, non-reserved - {:?}", @@ -51,7 +55,7 @@ pub fn get_and_test_members_for_session( assert_eq!(members_active_set, network_members); - (members_active, members_bench) + Ok((members_active, members_bench)) } /// Computes a list of validators that should be elected for a given session, based on description in our elections pallet. diff --git a/e2e-tests/src/finality_version.rs b/e2e-tests/src/finality_version.rs new file mode 100644 index 0000000000..68d4b9fffe --- /dev/null +++ b/e2e-tests/src/finality_version.rs @@ -0,0 +1,37 @@ +use aleph_client::{pallets::aleph::AlephApi, utility::BlocksApi, Connection}; +use log::info; +use primitives::{BlockNumber, Version}; + +pub async fn check_finality_version_at_block( + connection: &Connection, + block_number: BlockNumber, + expected_version: Version, +) { + info!( + "Checking current session finality version for block {}", + block_number + ); + let block_hash = connection + .get_block_hash(block_number) + .await + .expect("Should have been able to get a block hash!"); + let finality_version = connection.finality_version(block_hash).await; + assert_eq!(finality_version, expected_version); +} + +pub async fn check_next_session_finality_version_at_block( + connection: &Connection, + block_number: BlockNumber, + expected_version: Version, +) { + info!( + "Checking next session finality version for block {}", + block_number + ); + let block_hash = connection + .get_block_hash(block_number) + .await + .expect("Should have been able to get a block hash!"); + let next_finality_version = connection.next_session_finality_version(block_hash).await; + assert_eq!(next_finality_version, expected_version); +} diff --git a/e2e-tests/src/lib.rs b/e2e-tests/src/lib.rs index 8a6e9c6423..f4341b200b 100644 --- a/e2e-tests/src/lib.rs +++ b/e2e-tests/src/lib.rs @@ -1,16 +1,22 @@ #![feature(pattern)] -extern crate core; - -pub use cases::{possible_test_cases, PossibleTestCases}; -pub use config::Config; - +#[cfg(test)] mod accounts; +#[cfg(test)] mod ban; -mod cases; +#[cfg(test)] mod config; +#[cfg(test)] mod elections; +#[cfg(test)] +mod finality_version; +#[cfg(test)] mod rewards; +#[cfg(test)] +mod synthetic_network; +#[cfg(test)] mod test; +#[cfg(test)] mod transfer; +#[cfg(test)] mod validators; diff --git a/e2e-tests/src/main.rs b/e2e-tests/src/main.rs deleted file mode 100644 index acba54a517..0000000000 --- a/e2e-tests/src/main.rs +++ /dev/null @@ -1,83 +0,0 @@ -use std::{env, time::Instant}; - -use aleph_e2e_client::{possible_test_cases, Config, PossibleTestCases}; -use clap::Parser; -use log::info; - -fn main() -> anyhow::Result<()> { - init_env(); - - let config: Config = Config::parse(); - let test_cases = config.test_cases.clone(); - - let possible_test_cases = possible_test_cases(); - // Possibility to handle specified vs. default test cases - // is helpful to parallelize e2e tests. - match test_cases { - Some(cases) => { - info!("Running specified test cases."); - run_specified_test_cases(cases, possible_test_cases, &config)?; - } - None => { - info!("Running all handled test cases."); - run_all_test_cases(possible_test_cases, &config)?; - } - }; - Ok(()) -} - -fn init_env() { - if env::var(env_logger::DEFAULT_FILTER_ENV).is_err() { - env::set_var(env_logger::DEFAULT_FILTER_ENV, "warn"); - } - env_logger::init(); -} - -/// Runs all handled test cases in sequence. -fn run_all_test_cases( - possible_test_cases: PossibleTestCases, - config: &Config, -) -> anyhow::Result<()> { - for (test_name, test_case) in possible_test_cases { - run(test_case, test_name, config)?; - } - Ok(()) -} - -/// Runs specified test cases in sequence. -/// Checks whether each provided test case is valid. -fn run_specified_test_cases( - test_names: Vec, - possible_test_cases: PossibleTestCases, - config: &Config, -) -> anyhow::Result<()> { - for test_name in test_names { - if let Some(idx) = possible_test_cases - .iter() - .position(|&(name, _)| name == test_name) - { - let (_, case) = possible_test_cases[idx]; - run(case, test_name.as_str(), config)?; - } else { - return Err(anyhow::anyhow!(format!( - "Provided test case '{}' is not handled.", - test_name - ))); - } - } - Ok(()) -} - -/// Runs single test case. Allows for a generic return type. -fn run( - testcase: fn(&Config) -> anyhow::Result, - name: &str, - config: &Config, -) -> anyhow::Result<()> { - info!("Running test: {}", name); - let start = Instant::now(); - testcase(config).map(|_| { - let elapsed = Instant::now().duration_since(start); - println!("Ok! Elapsed time {}ms", elapsed.as_millis()); - }) -} diff --git a/e2e-tests/src/rewards.rs b/e2e-tests/src/rewards.rs index 132175b169..3e49b81538 100644 --- a/e2e-tests/src/rewards.rs +++ b/e2e-tests/src/rewards.rs @@ -1,74 +1,82 @@ use std::collections::{HashMap, HashSet}; use aleph_client::{ - account_from_keypair, balances_batch_transfer, balances_transfer, bond_extra_stake, - change_validators, get_block_hash, get_committee_seats, get_current_session, get_era, - get_era_reward_points, get_era_validators, get_exposure, get_session_first_block, - get_session_period, get_validator_block_count, rotate_keys, set_keys, wait_for_at_least_era, - wait_for_at_least_session, wait_for_finalized_block, wait_for_next_era, AccountId, ReadStorage, - RewardPoint, SessionKeys, SignedConnection, XtStatus, + account_from_keypair, + pallets::{ + author::AuthorRpc, + balances::{BalanceUserApi, BalanceUserBatchExtApi}, + elections::{ElectionsApi, ElectionsSudoApi}, + session::{SessionApi, SessionUserApi}, + staking::{StakingApi, StakingUserApi}, + }, + primitives::{CommitteeSeats, EraValidators}, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + AccountId, SignedConnection, TxStatus, }; +use anyhow::anyhow; use log::{debug, info}; use pallet_elections::LENIENT_THRESHOLD; -use pallet_staking::Exposure; -use primitives::{ - Balance, BlockHash, CommitteeSeats, EraIndex, EraValidators, SessionIndex, TOKEN, -}; +use primitives::{Balance, BlockHash, EraIndex, SessionIndex, TOKEN}; use sp_runtime::Perquintill; use crate::{ accounts::{get_validators_keys, get_validators_seeds, NodeKeys}, - Config, + config::Config, }; const COMMITTEE_SEATS: CommitteeSeats = CommitteeSeats { reserved_seats: 2, non_reserved_seats: 2, }; +type RewardPoint = u32; /// Changes session_keys used by a given `controller` to some `zero`/invalid value, /// making it impossible to create new legal blocks. -pub fn set_invalid_keys_for_validator( - controller_connection: &SignedConnection, +pub async fn set_invalid_keys_for_validator( + controller_connection: &S, ) -> anyhow::Result<()> { - const ZERO_SESSION_KEYS: SessionKeys = SessionKeys { - aura: [0; 32], - aleph: [0; 32], - }; + let zero_session_keys = [0; 64].to_vec().into(); - set_keys(controller_connection, ZERO_SESSION_KEYS, XtStatus::InBlock); // wait until our node is forced to use new keys, i.e. current session + 2 - let current_session = get_current_session(controller_connection); - wait_for_at_least_session(controller_connection, current_session + 2)?; + controller_connection + .set_keys(zero_session_keys, TxStatus::InBlock) + .await + .unwrap(); + controller_connection + .wait_for_n_sessions(2, BlockStatus::Best) + .await; Ok(()) } /// Rotates session_keys of a given `controller`, making it able to rejoin the `consensus`. -pub fn reset_validator_keys(controller_connection: &SignedConnection) -> anyhow::Result<()> { - let validator_keys = - rotate_keys(controller_connection).expect("Failed to retrieve keys from chain"); - set_keys(controller_connection, validator_keys, XtStatus::InBlock); +pub(super) async fn reset_validator_keys( + controller_connection: &S, +) -> anyhow::Result<()> { + let validator_keys = controller_connection.author_rotate_keys().await?; + controller_connection + .set_keys(validator_keys, TxStatus::InBlock) + .await + .unwrap(); // wait until our node is forced to use new keys, i.e. current session + 2 - let current_session = get_current_session(controller_connection); - wait_for_at_least_session(controller_connection, current_session + 2)?; + controller_connection + .wait_for_n_sessions(2, BlockStatus::Best) + .await; Ok(()) } -pub fn download_exposure( - connection: &SignedConnection, +pub async fn download_exposure( + connection: &S, era: EraIndex, account_id: &AccountId, beginning_of_session_block_hash: BlockHash, ) -> Balance { - let exposure: Exposure = get_exposure( - connection, - era, - account_id, - Some(beginning_of_session_block_hash), - ); + let exposure = connection + .get_exposure(era, account_id, Some(beginning_of_session_block_hash)) + .await; info!( "Validator {} has own exposure of {} and total of {}.", account_id, exposure.own, exposure.total @@ -87,20 +95,15 @@ fn check_rewards( retrieved_reward_points: HashMap, max_relative_difference: f64, ) -> anyhow::Result<()> { - let our_sum: f64 = validator_reward_points - .iter() - .map(|(_, reward)| reward) - .sum(); - let retrieved_sum: u32 = retrieved_reward_points - .iter() - .map(|(_, reward)| reward) - .sum(); + let our_sum: f64 = validator_reward_points.values().sum(); + let retrieved_sum: u32 = retrieved_reward_points.values().sum(); - for (account, reward) in validator_reward_points { - let retrieved_reward = *retrieved_reward_points.get(&account).unwrap_or_else(|| { + for (account, reward) in &validator_reward_points { + let reward = *reward; + let retrieved_reward = *retrieved_reward_points.get(account).unwrap_or_else(|| { panic!( - "missing account={} in retrieved collection of reward points", - account + "missing account={} in retrieved collection of reward points {:?}", + account, validator_reward_points ) }); @@ -121,18 +124,17 @@ fn check_rewards( Ok(()) } -fn get_node_performance( - connection: &SignedConnection, +async fn get_node_performance( + connection: &S, account_id: &AccountId, before_end_of_session_block_hash: BlockHash, blocks_to_produce_per_session: u32, ) -> f64 { - let block_count = get_validator_block_count( - connection, - account_id, - Some(before_end_of_session_block_hash), - ) - .unwrap_or(0); + let block_count = connection + .get_validator_block_count(account_id.clone(), Some(before_end_of_session_block_hash)) + .await + .unwrap_or_default(); + info!( "Block count for validator {} is {:?}, block hash is {}.", account_id, block_count, before_end_of_session_block_hash @@ -150,8 +152,8 @@ fn get_node_performance( lenient_performance } -pub fn check_points( - connection: &SignedConnection, +pub async fn check_points( + connection: &S, session: SessionIndex, era: EraIndex, members: impl IntoIterator, @@ -159,19 +161,27 @@ pub fn check_points( members_per_session: u32, max_relative_difference: f64, ) -> anyhow::Result<()> { - let session_period = get_session_period(connection); + let session_period = connection.get_session_period().await?; info!("Era: {} | session: {}.", era, session); - let beggining_of_session_block = session * session_period; - let end_of_session_block = beggining_of_session_block + session_period; + let beginning_of_session_block = session * session_period; + let end_of_session_block = beginning_of_session_block + session_period; info!("Waiting for block: {}.", end_of_session_block); - wait_for_finalized_block(connection, end_of_session_block)?; - - let beggining_of_session_block_hash = get_block_hash(connection, beggining_of_session_block); - let end_of_session_block_hash = get_block_hash(connection, end_of_session_block); - let before_end_of_session_block_hash = get_block_hash(connection, end_of_session_block - 1); - info!("End-of-session block hash: {}.", end_of_session_block_hash); + connection + .wait_for_block(|n| n >= end_of_session_block, BlockStatus::Finalized) + .await; + + let beginning_of_session_block_hash = connection + .get_block_hash(beginning_of_session_block) + .await?; + let end_of_session_block_hash = connection.get_block_hash(end_of_session_block).await?; + let before_end_of_session_block_hash = + connection.get_block_hash(end_of_session_block - 1).await?; + info!( + "End-of-session block hash: {:?}.", + end_of_session_block_hash + ); info!("Members per session: {}.", members_per_session); @@ -182,15 +192,19 @@ pub fn check_points( ); // get points stored by the Staking pallet - let validator_reward_points_current_era = - get_era_reward_points(connection, era, Some(end_of_session_block_hash)) + let validator_reward_points_current_era = connection + .get_era_reward_points(era, end_of_session_block_hash) + .await + .unwrap_or_default() + .individual; + + let validator_reward_points_previous_session = HashMap::::from_iter( + connection + .get_era_reward_points(era, beginning_of_session_block_hash) + .await .unwrap_or_default() - .individual; - - let validator_reward_points_previous_session = - get_era_reward_points(connection, era, Some(beggining_of_session_block_hash)) - .unwrap_or_default() - .individual; + .individual, + ); let validator_reward_points_current_session: HashMap = validator_reward_points_current_era @@ -209,27 +223,38 @@ pub fn check_points( }) .collect(); - let members_uptime = members.into_iter().map(|account_id| { - ( + let mut members_uptime = vec![]; + for account_id in members.into_iter() { + members_uptime.push(( account_id.clone(), get_node_performance( connection, &account_id, - before_end_of_session_block_hash, + before_end_of_session_block_hash.unwrap(), blocks_to_produce_per_session, - ), - ) - }); + ) + .await, + )); + } let members_bench_uptime = members_bench .into_iter() .map(|account_id| (account_id, 1.0)); - let mut reward_points: HashMap<_, _> = members_uptime.chain(members_bench_uptime).collect(); + let mut reward_points: HashMap<_, _> = members_uptime + .into_iter() + .chain(members_bench_uptime) + .collect(); + let members_count = reward_points.len() as f64; for (account_id, reward_points) in reward_points.iter_mut() { - let exposure = - download_exposure(connection, era, account_id, beggining_of_session_block_hash); + let exposure = download_exposure( + connection, + era, + account_id, + beginning_of_session_block_hash.unwrap(), + ) + .await; *reward_points *= exposure as f64 / members_count; } @@ -240,24 +265,19 @@ pub fn check_points( ) } -pub fn get_era_for_session(connection: &C, session: SessionIndex) -> EraIndex { - let session_first_block = get_session_first_block(connection, session); - get_era(connection, Some(session_first_block)) -} - -pub fn setup_validators( +pub async fn setup_validators( config: &Config, ) -> anyhow::Result<(EraValidators, CommitteeSeats, SessionIndex)> { - let root_connection = config.create_root_connection(); + let root_connection = config.create_root_connection().await; // we need to wait for at least era 1 since some of the storage items are not available at era 0 - wait_for_at_least_era(&root_connection, 1)?; + root_connection.wait_for_n_eras(1, BlockStatus::Best).await; let seats = COMMITTEE_SEATS; let members_seats = seats.reserved_seats + seats.non_reserved_seats; let members_seats = members_seats.try_into().unwrap(); let members: Vec<_> = get_validators_keys(config) .iter() - .map(account_from_keypair) + .map(|kp| account_from_keypair(kp.signer())) .collect(); let members_size = members.len(); @@ -270,10 +290,15 @@ pub fn setup_validators( let reserved_members = &members[0..reserved_size]; let non_reserved_members = &members[reserved_size..]; - let session = get_current_session(&root_connection); - let network_validators = get_era_validators(&root_connection, session); - let first_block_in_session = get_session_first_block(&root_connection, session); - let network_seats = get_committee_seats(&root_connection, Some(first_block_in_session)); + let session = root_connection.get_session(None).await; + let network_validators = root_connection.get_current_era_validators(None).await; + let first_block_in_session = root_connection + .first_block_of_session(session) + .await? + .ok_or(anyhow!("First block of session {} is None!", session))?; + let network_seats = root_connection + .get_committee_seats(Some(first_block_in_session)) + .await; let era_validators = EraValidators { reserved: reserved_members.to_vec(), @@ -285,24 +310,30 @@ pub fn setup_validators( return Ok((era_validators, seats, session)); } - change_validators( - &root_connection, - Some(reserved_members.into()), - Some(non_reserved_members.into()), - Some(seats), - XtStatus::Finalized, - ); + info!("changing validators to {:?}", era_validators); + root_connection + .change_validators( + Some(reserved_members.into()), + Some(non_reserved_members.into()), + Some(seats.clone()), + TxStatus::Finalized, + ) + .await?; - wait_for_next_era(&root_connection)?; - let session = get_current_session(&root_connection); + root_connection.wait_for_n_eras(1, BlockStatus::Best).await; + let session = root_connection.get_session(None).await; - let network_validators = get_era_validators(&root_connection, session); + let first_block_in_session = root_connection.first_block_of_session(session).await?; + let network_validators = root_connection + .get_current_era_validators(first_block_in_session) + .await; let reserved: HashSet<_> = era_validators.reserved.iter().cloned().collect(); let network_reserved: HashSet<_> = network_validators.reserved.into_iter().collect(); let non_reserved: HashSet<_> = era_validators.non_reserved.iter().cloned().collect(); let network_non_reserved: HashSet<_> = network_validators.non_reserved.into_iter().collect(); - let first_block_in_session = get_session_first_block(&root_connection, session); - let network_seats = get_committee_seats(&root_connection, Some(first_block_in_session)); + let network_seats = root_connection + .get_committee_seats(first_block_in_session) + .await; assert_eq!(reserved, network_reserved); assert_eq!(non_reserved, network_non_reserved); @@ -311,9 +342,9 @@ pub fn setup_validators( Ok((era_validators, seats, session)) } -pub fn validators_bond_extra_stakes(config: &Config, additional_stakes: &[Balance]) { +pub async fn validators_bond_extra_stakes(config: &Config, additional_stakes: &[Balance]) { let node = &config.node; - let root_connection = config.create_root_connection(); + let root_connection = config.create_root_connection().await; let accounts_keys: Vec = get_validators_seeds(config) .into_iter() @@ -322,25 +353,28 @@ pub fn validators_bond_extra_stakes(config: &Config, additional_stakes: &[Balanc let controller_accounts: Vec = accounts_keys .iter() - .map(|account_keys| account_from_keypair(&account_keys.controller)) + .map(|account_keys| account_from_keypair(account_keys.controller.signer())) .collect(); // funds to cover fees - balances_batch_transfer(&root_connection.as_signed(), controller_accounts, TOKEN); - - accounts_keys.iter().zip(additional_stakes.iter()).for_each( - |(account_keys, additional_stake)| { - let validator_id = account_from_keypair(&account_keys.validator); - - // Additional TOKEN to cover fees - balances_transfer( - &root_connection.as_signed(), - &validator_id, - *additional_stake + TOKEN, - XtStatus::Finalized, - ); - let stash_connection = SignedConnection::new(node, account_keys.validator.clone()); - bond_extra_stake(&stash_connection, *additional_stake); - }, - ); + root_connection + .batch_transfer(&controller_accounts, TOKEN, TxStatus::Finalized) + .await + .unwrap(); + + for (account_keys, additional_stake) in accounts_keys.into_iter().zip(additional_stakes.iter()) + { + let validator_id = account_from_keypair(account_keys.validator.signer()); + + // Additional TOKEN to cover fees + root_connection + .transfer(validator_id, *additional_stake + TOKEN, TxStatus::Finalized) + .await + .unwrap(); + let stash_connection = SignedConnection::new(node, account_keys.validator).await; + stash_connection + .bond_extra_stake(*additional_stake, TxStatus::Finalized) + .await + .unwrap(); + } } diff --git a/e2e-tests/src/synthetic_network.rs b/e2e-tests/src/synthetic_network.rs new file mode 100644 index 0000000000..51692bc591 --- /dev/null +++ b/e2e-tests/src/synthetic_network.rs @@ -0,0 +1,24 @@ +use log::info; +use synthetic_link::SyntheticNetworkClient; + +pub type Milliseconds = u64; + +pub async fn set_out_latency(milliseconds: Milliseconds, synthetic_url: String) { + info!( + "setting out-latency of node {} to {}ms", + synthetic_url, milliseconds + ); + info!("creating an http client for url {}", synthetic_url); + let mut client = SyntheticNetworkClient::new(synthetic_url); + let mut config = client + .load_config() + .await + .expect("we should be able to download config of the synthetic-network "); + + config.default_link.egress.latency = milliseconds; + + client + .commit_config(&config) + .await + .expect("unable to commit network configuration"); +} diff --git a/e2e-tests/src/test/adder.rs b/e2e-tests/src/test/adder.rs new file mode 100644 index 0000000000..5592a8c669 --- /dev/null +++ b/e2e-tests/src/test/adder.rs @@ -0,0 +1,171 @@ +use std::{fmt::Debug, str::FromStr, sync::Arc}; + +use aleph_client::{ + contract::{ + event::{get_contract_events, listen_contract_events}, + ContractInstance, + }, + contract_transcode::Value, + AccountId, ConnectionApi, SignedConnectionApi, TxInfo, +}; +use anyhow::{anyhow, Context, Result}; +use assert2::assert; +use futures::{channel::mpsc::unbounded, StreamExt}; + +use crate::{config::setup_test, test::helpers::basic_test_context}; + +/// This test exercises the aleph-client code for interacting with contracts by testing a simple +/// contract that maintains some state and publishes some events. The events are obtained by +/// listening mechanism. +#[tokio::test] +pub async fn adder_events_listening() -> Result<()> { + let config = setup_test(); + + let (conn, _authority, account) = basic_test_context(config).await?; + + let contract = Arc::new(AdderInstance::new( + &config.test_case_params.adder, + &config.test_case_params.adder_metadata, + )?); + + let listen_conn = conn.clone(); + let listen_contract = contract.clone(); + let (tx, mut rx) = unbounded(); + let listen = || async move { + listen_contract_events(&listen_conn, &[listen_contract.as_ref().into()], tx).await?; + >::Ok(()) + }; + let join = tokio::spawn(listen()); + + let increment = 10; + let before = contract.get(&conn).await?; + + contract.add(&account.sign(&conn), increment).await?; + + let event = rx.next().await.context("No event received")??; + assert!(event.name == Some("ValueChanged".to_string())); + assert!(event.contract == *contract.contract.address()); + assert!(event.data["new_value"] == Value::UInt(before as u128 + 10)); + + let after = contract.get(&conn).await?; + assert!(after == before + increment); + + let new_name = "test"; + contract.set_name(&account.sign(&conn), None).await?; + assert!(contract.get_name(&conn).await?.is_none()); + contract + .set_name(&account.sign(&conn), Some(new_name)) + .await?; + assert!(contract.get_name(&conn).await? == Some(new_name.to_string())); + + rx.close(); + join.await??; + + Ok(()) +} + +/// This test exercises the aleph-client code for interacting with contracts by testing a simple +/// contract that maintains some state and publishes some events. The events are obtained by +/// fetching mechanism. +#[tokio::test] +pub async fn adder_fetching_events() -> Result<()> { + let config = setup_test(); + + let (conn, _authority, account) = basic_test_context(config).await?; + + let contract = AdderInstance::new( + &config.test_case_params.adder, + &config.test_case_params.adder_metadata, + )?; + + let increment = 10; + let before = contract.get(&conn).await?; + + let tx_info = contract.add(&account.sign(&conn), increment).await?; + let events = get_contract_events(&conn, &contract.contract, tx_info).await?; + let event = match &*events { + [event] => event, + _ => return Err(anyhow!("Expected single event, but got {events:?}")), + }; + + assert!(event.name == Some("ValueChanged".to_string())); + assert!(event.contract == *contract.contract.address()); + assert!(event.data["new_value"] == Value::UInt(before as u128 + 10)); + + let after = contract.get(&conn).await?; + assert!(after == before + increment); + + let new_name = "test"; + contract.set_name(&account.sign(&conn), None).await?; + assert!(contract.get_name(&conn).await?.is_none()); + contract + .set_name(&account.sign(&conn), Some(new_name)) + .await?; + assert!(contract.get_name(&conn).await? == Some(new_name.to_string())); + + Ok(()) +} + +#[derive(Debug)] +struct AdderInstance { + contract: ContractInstance, +} + +impl<'a> From<&'a AdderInstance> for &'a ContractInstance { + fn from(instance: &'a AdderInstance) -> Self { + &instance.contract + } +} + +impl<'a> From<&'a AdderInstance> for AccountId { + fn from(instance: &'a AdderInstance) -> Self { + instance.contract.address().clone() + } +} + +impl AdderInstance { + pub fn new(address: &Option, metadata_path: &Option) -> Result { + let address = address.as_ref().context("Adder contract address not set")?; + let metadata_path = metadata_path + .as_ref() + .context("Adder contract metadata not set")?; + + let address = AccountId::from_str(address) + .ok() + .with_context(|| format!("Failed to parse address: {}", address))?; + let contract = ContractInstance::new(address, metadata_path)?; + Ok(Self { contract }) + } + + pub async fn get(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "get").await + } + + pub async fn add(&self, conn: &S, value: u32) -> Result { + self.contract + .contract_exec(conn, "add", &[value.to_string()]) + .await + } + + pub async fn set_name( + &self, + conn: &S, + name: Option<&str>, + ) -> Result { + let name = name.map_or_else( + || "None".to_string(), + |name| { + let mut bytes = name.bytes().take(20).collect::>(); + bytes.extend(std::iter::repeat(0).take(20 - bytes.len())); + format!("Some({:?})", bytes) + }, + ); + + self.contract.contract_exec(conn, "set_name", &[name]).await + } + + pub async fn get_name(&self, conn: &C) -> Result> { + let res: Option = self.contract.contract_read0(conn, "get_name").await?; + Ok(res.map(|name| name.replace('\0', ""))) + } +} diff --git a/e2e-tests/src/test/ban.rs b/e2e-tests/src/test/ban.rs index 51ff27fbe5..fe350e5350 100644 --- a/e2e-tests/src/test/ban.rs +++ b/e2e-tests/src/test/ban.rs @@ -1,58 +1,81 @@ +use std::collections::HashSet; + use aleph_client::{ - ban_from_committee, change_ban_config, get_current_era, get_current_era_validators, - get_current_session, get_next_era_non_reserved_validators, get_next_era_reserved_validators, - get_underperformed_validator_session_count, wait_for_at_least_session, SignedConnection, - XtStatus, + api::runtime_types::sp_core::bounded::bounded_vec::BoundedVec, + pallets::{ + elections::{ElectionsApi, ElectionsSudoApi}, + session::SessionApi, + staking::{StakingApi, StakingUserApi}, + }, + primitives::{BanInfo, BanReason, CommitteeSeats, ElectionOpenness}, + waiting::{BlockStatus, WaitingExt}, + SignedConnection, TxStatus, }; use log::info; use primitives::{ - BanInfo, BanReason, BoundedVec, SessionCount, DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE, - DEFAULT_BAN_SESSION_COUNT_THRESHOLD, DEFAULT_CLEAN_SESSION_COUNTER_DELAY, + SessionCount, DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE, DEFAULT_BAN_SESSION_COUNT_THRESHOLD, + DEFAULT_CLEAN_SESSION_COUNTER_DELAY, }; use crate::{ - accounts::{get_validator_seed, NodeKeys}, + accounts::{account_ids_from_keys, get_validator_seed, NodeKeys}, ban::{ check_ban_config, check_ban_event, check_ban_info_for_validator, + check_underperformed_count_for_sessions, check_underperformed_validator_reason, check_underperformed_validator_session_count, check_validators, setup_test, }, + config, rewards::set_invalid_keys_for_validator, - Config, + validators::get_test_validators, }; +const SESSIONS_TO_CHECK: SessionCount = 5; + const VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX: u32 = 0; const VALIDATOR_TO_DISABLE_OVERALL_INDEX: u32 = 2; // Address for //2 (Node2). Depends on the infrastructure setup. -const NODE_TO_DISABLE_ADDRESS: &str = "127.0.0.1:9945"; +const NODE_TO_DISABLE_ADDRESS: &str = "ws://127.0.0.1:9945"; const SESSIONS_TO_MEET_BAN_THRESHOLD: SessionCount = 4; const VALIDATOR_TO_MANUALLY_BAN_NON_RESERVED_INDEX: u32 = 1; const MANUAL_BAN_REASON: &str = "Manual ban reason"; +const MIN_EXPECTED_PERFORMANCE: u8 = 100; -fn disable_validator(validator_address: &str, validator_seed: u32) -> anyhow::Result<()> { +async fn disable_validator(validator_address: &str, validator_seed: u32) -> anyhow::Result<()> { let validator_seed = get_validator_seed(validator_seed); let stash_controller = NodeKeys::from(validator_seed); let controller_key_to_disable = stash_controller.controller; // This connection has to be set up with the controller key. - let connection_to_disable = SignedConnection::new(validator_address, controller_key_to_disable); + let connection_to_disable = + SignedConnection::new(validator_address, controller_key_to_disable).await; - set_invalid_keys_for_validator(&connection_to_disable) + set_invalid_keys_for_validator(&connection_to_disable).await +} + +async fn signed_connection_for_disabled_controller() -> SignedConnection { + let validator_seed = get_validator_seed(VALIDATOR_TO_DISABLE_OVERALL_INDEX); + let stash_controller = NodeKeys::from(validator_seed); + let controller_key_to_disable = stash_controller.controller; + SignedConnection::new(NODE_TO_DISABLE_ADDRESS, controller_key_to_disable).await } /// Runs a chain, sets up a committee and validators. Sets an incorrect key for one of the /// validators. Waits for the offending validator to hit the ban threshold of sessions without /// producing blocks. Verifies that the offending validator has in fact been banned out for the /// appropriate reason. -pub fn ban_automatic(config: &Config) -> anyhow::Result<()> { - let (root_connection, reserved_validators, non_reserved_validators) = setup_test(config)?; +#[tokio::test] +#[ignore] +pub async fn ban_automatic() -> anyhow::Result<()> { + let config = config::setup_test(); + let (root_connection, reserved_validators, non_reserved_validators, _) = + setup_test(config).await?; // Check current era validators. check_validators( - &root_connection, &reserved_validators, &non_reserved_validators, - get_current_era_validators, + root_connection.get_current_era_validators(None).await, ); check_ban_config( @@ -60,51 +83,49 @@ pub fn ban_automatic(config: &Config) -> anyhow::Result<()> { DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE, DEFAULT_BAN_SESSION_COUNT_THRESHOLD, DEFAULT_CLEAN_SESSION_COUNTER_DELAY, - ); + ) + .await; let validator_to_disable = &non_reserved_validators[VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX as usize]; info!("Validator to disable: {}", validator_to_disable); - check_underperformed_validator_session_count(&root_connection, validator_to_disable, &0); - check_ban_info_for_validator(&root_connection, validator_to_disable, None); - - disable_validator(NODE_TO_DISABLE_ADDRESS, VALIDATOR_TO_DISABLE_OVERALL_INDEX)?; + check_underperformed_validator_session_count(&root_connection, validator_to_disable, 0).await; + check_underperformed_validator_reason(&root_connection, validator_to_disable, None).await; - let current_session = get_current_session(&root_connection); + disable_validator(NODE_TO_DISABLE_ADDRESS, VALIDATOR_TO_DISABLE_OVERALL_INDEX).await?; - wait_for_at_least_session( - &root_connection, - current_session + SESSIONS_TO_MEET_BAN_THRESHOLD, - )?; + root_connection + .wait_for_n_sessions(SESSIONS_TO_MEET_BAN_THRESHOLD, BlockStatus::Best) + .await; // The session count for underperforming validators is reset to 0 immediately on reaching the // threshold. - check_underperformed_validator_session_count(&root_connection, validator_to_disable, &0); + check_underperformed_validator_session_count(&root_connection, validator_to_disable, 0).await; let reason = BanReason::InsufficientUptime(DEFAULT_BAN_SESSION_COUNT_THRESHOLD); - let start = get_current_era(&root_connection) + 1; + let start = root_connection.get_current_era(None).await + 1; let expected_ban_info = BanInfo { reason, start }; - check_ban_info_for_validator( + check_underperformed_validator_reason( &root_connection, validator_to_disable, Some(&expected_ban_info), - ); + ) + .await; let expected_non_reserved = &non_reserved_validators[(VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX + 1) as usize..]; let expected_banned_validators = vec![(validator_to_disable.clone(), expected_ban_info)]; - check_ban_event(&root_connection, &expected_banned_validators)?; + check_ban_event(&root_connection, &expected_banned_validators).await?; // Check current validators. check_validators( - &root_connection, &reserved_validators, expected_non_reserved, - get_current_era_validators, + root_connection.get_current_era_validators(None).await, ); Ok(()) @@ -113,15 +134,17 @@ pub fn ban_automatic(config: &Config) -> anyhow::Result<()> { /// Runs a chain, sets up a committee and validators. Manually bans one of the validators /// from the committee with a specific reason. Verifies that validator marked for ban has in /// fact been banned for the given reason. -pub fn ban_manual(config: &Config) -> anyhow::Result<()> { - let (root_connection, reserved_validators, non_reserved_validators) = setup_test(config)?; +#[tokio::test] +pub async fn ban_manual() -> anyhow::Result<()> { + let config = config::setup_test(); + let (root_connection, reserved_validators, non_reserved_validators, _) = + setup_test(config).await?; // Check current era validators. check_validators( - &root_connection, &reserved_validators, &non_reserved_validators, - get_current_era_validators, + root_connection.get_current_era_validators(None).await, ); check_ban_config( @@ -129,41 +152,41 @@ pub fn ban_manual(config: &Config) -> anyhow::Result<()> { DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE, DEFAULT_BAN_SESSION_COUNT_THRESHOLD, DEFAULT_CLEAN_SESSION_COUNTER_DELAY, - ); + ) + .await; let validator_to_manually_ban = &non_reserved_validators[VALIDATOR_TO_MANUALLY_BAN_NON_RESERVED_INDEX as usize]; info!("Validator to manually ban: {}", validator_to_manually_ban); - check_underperformed_validator_session_count(&root_connection, validator_to_manually_ban, &0); - check_ban_info_for_validator(&root_connection, validator_to_manually_ban, None); + check_underperformed_validator_session_count(&root_connection, validator_to_manually_ban, 0) + .await; + check_ban_info_for_validator(&root_connection, validator_to_manually_ban, None).await; - let bounded_reason: BoundedVec<_, _> = MANUAL_BAN_REASON - .as_bytes() - .to_vec() - .try_into() - .expect("Incorrect manual ban reason format!"); + let bounded_reason = BoundedVec(MANUAL_BAN_REASON.as_bytes().to_vec()); - ban_from_committee( - &root_connection, - validator_to_manually_ban, - &bounded_reason, - XtStatus::InBlock, - ); + root_connection + .ban_from_committee( + validator_to_manually_ban.clone(), + bounded_reason.0.clone(), + TxStatus::InBlock, + ) + .await?; let reason = BanReason::OtherReason(bounded_reason); - let start = get_current_era(&root_connection) + 1; + let start = root_connection.get_current_era(None).await + 1; let expected_ban_info = BanInfo { reason, start }; check_ban_info_for_validator( &root_connection, validator_to_manually_ban, Some(&expected_ban_info), - ); + ) + .await; let expected_banned_validators = vec![(validator_to_manually_ban.clone(), expected_ban_info)]; - check_ban_event(&root_connection, &expected_banned_validators)?; + check_ban_event(&root_connection, &expected_banned_validators).await?; let expected_non_reserved: Vec<_> = non_reserved_validators .clone() @@ -173,10 +196,9 @@ pub fn ban_manual(config: &Config) -> anyhow::Result<()> { // Check current validators. check_validators( - &root_connection, &reserved_validators, &expected_non_reserved, - get_current_era_validators, + root_connection.get_current_era_validators(None).await, ); Ok(()) @@ -186,36 +208,37 @@ pub fn ban_manual(config: &Config) -> anyhow::Result<()> { /// underperformed_session_count_threshold to 3. /// Disable one non_reserved validator. Check if the disabled validator is still in the committee /// and his underperformed session count is less or equal to 2. -pub fn clearing_session_count(config: &Config) -> anyhow::Result<()> { - let (root_connection, reserved_validators, non_reserved_validators) = setup_test(config)?; +#[tokio::test] +pub async fn clearing_session_count() -> anyhow::Result<()> { + let config = config::setup_test(); + let (root_connection, reserved_validators, non_reserved_validators, _) = + setup_test(config).await?; - info!("changing ban config"); - change_ban_config( - &root_connection, - None, - Some(3), - Some(2), - None, - XtStatus::InBlock, - ); + root_connection + .set_ban_config(None, Some(3), Some(2), None, TxStatus::InBlock) + .await?; let validator_to_disable = &non_reserved_validators[VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX as usize]; - disable_validator(NODE_TO_DISABLE_ADDRESS, VALIDATOR_TO_DISABLE_OVERALL_INDEX)?; + info!(target: "aleph-client", "Disabling validator {}", validator_to_disable); + disable_validator(NODE_TO_DISABLE_ADDRESS, VALIDATOR_TO_DISABLE_OVERALL_INDEX).await?; - info!("Disabling validator {}", validator_to_disable); - let current_session = get_current_session(&root_connection); + root_connection + .wait_for_n_sessions(5, BlockStatus::Best) + .await; - wait_for_at_least_session(&root_connection, current_session + 5)?; - - let underperformed_validator_session_count = - get_underperformed_validator_session_count(&root_connection, validator_to_disable); + let underperformed_validator_session_count = root_connection + .get_underperformed_validator_session_count(validator_to_disable.clone(), None) + .await + .unwrap_or_default(); // it only has to be ge than 0 and should be cleared before reaching values larger than 3. assert!(underperformed_validator_session_count <= 2); - let next_era_reserved_validators = get_next_era_reserved_validators(&root_connection); - let next_era_non_reserved_validators = get_next_era_non_reserved_validators(&root_connection); + let next_era_reserved_validators = root_connection.get_next_era_reserved_validators(None).await; + let next_era_non_reserved_validators = root_connection + .get_next_era_non_reserved_validators(None) + .await; // checks no one was banned assert_eq!(next_era_reserved_validators, reserved_validators); @@ -223,3 +246,132 @@ pub fn clearing_session_count(config: &Config) -> anyhow::Result<()> { Ok(()) } + +/// Setup reserved validators, non_reserved are set to empty vec. Set ban config ban_period to 2. +/// Set Openness to Permissionless. +/// Ban manually one validator. Check if the banned validator is out of the non_reserved and is back +/// after ban period. +#[tokio::test] +pub async fn permissionless_ban() -> anyhow::Result<()> { + let config = config::setup_test(); + let root_connection = config.create_root_connection().await; + + let validator_keys = get_test_validators(config); + let reserved_validators = account_ids_from_keys(&validator_keys.reserved); + let non_reserved_validators = account_ids_from_keys(&validator_keys.non_reserved); + + let seats = CommitteeSeats { + reserved_seats: 2, + non_reserved_seats: 2, + }; + + let validator_to_ban = + &non_reserved_validators[VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX as usize]; + let mut non_reserved_without_banned = non_reserved_validators.to_vec(); + non_reserved_without_banned.remove(VALIDATOR_TO_DISABLE_NON_RESERVED_INDEX as usize); + + let ban_period = 2; + root_connection + .change_validators( + Some(reserved_validators), + Some(non_reserved_validators.clone()), + Some(seats), + TxStatus::InBlock, + ) + .await?; + root_connection + .set_election_openness(ElectionOpenness::Permissionless, TxStatus::InBlock) + .await?; + root_connection + .set_ban_config(None, None, None, Some(ban_period), TxStatus::InBlock) + .await?; + root_connection + .ban_from_committee(validator_to_ban.clone(), vec![], TxStatus::InBlock) + .await?; + root_connection + .wait_for_n_eras(2, BlockStatus::Finalized) + .await; + + let without_banned = HashSet::<_>::from_iter(non_reserved_without_banned); + let non_reserved = HashSet::<_>::from_iter( + root_connection + .get_current_era_validators(None) + .await + .non_reserved, + ); + assert_eq!(without_banned, non_reserved); + + let signed_connection = signed_connection_for_disabled_controller().await; + // validate again + signed_connection.validate(0, TxStatus::InBlock).await?; + root_connection + .wait_for_n_eras(2, BlockStatus::Finalized) + .await; + let expected_non_reserved = HashSet::<_>::from_iter(non_reserved_validators); + let non_reserved = HashSet::<_>::from_iter( + root_connection + .get_current_era_validators(None) + .await + .non_reserved, + ); + + assert_eq!(expected_non_reserved, non_reserved); + + Ok(()) +} + +/// Runs a chain, sets up a committee and validators. Changes the ban config to require 100% +/// performance. Checks that each validator has all the sessions in which they were chosen for the +/// committee marked as ones in which they underperformed. +#[tokio::test] +pub async fn ban_threshold() -> anyhow::Result<()> { + let config = config::setup_test(); + let (root_connection, reserved_validators, non_reserved_validators, seats) = + setup_test(config).await?; + + // Check current era validators. + check_validators( + &reserved_validators, + &non_reserved_validators, + root_connection.get_current_era_validators(None).await, + ); + + check_ban_config( + &root_connection, + DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE, + DEFAULT_BAN_SESSION_COUNT_THRESHOLD, + DEFAULT_CLEAN_SESSION_COUNTER_DELAY, + ) + .await; + + // Change ban config to require prohibitively high performance from all validators. + root_connection + .set_ban_config( + Some(MIN_EXPECTED_PERFORMANCE), + None, + None, + None, + TxStatus::InBlock, + ) + .await?; + + let ban_config_change_session = root_connection.get_session(None).await; + let check_start_session = ban_config_change_session + 1; + let check_end_session = check_start_session + SESSIONS_TO_CHECK - 1; + root_connection + .wait_for_n_sessions(SESSIONS_TO_CHECK, BlockStatus::Finalized) + .await; + + check_underperformed_count_for_sessions( + &root_connection, + &reserved_validators, + &non_reserved_validators, + &seats, + check_start_session, + check_end_session, + DEFAULT_BAN_SESSION_COUNT_THRESHOLD, + ) + .await?; + + Ok(()) +} diff --git a/e2e-tests/src/test/button_game/contracts.rs b/e2e-tests/src/test/button_game/contracts.rs index 7d5b2c4949..358b5ff92d 100644 --- a/e2e-tests/src/test/button_game/contracts.rs +++ b/e2e-tests/src/test/button_game/contracts.rs @@ -1,10 +1,12 @@ +use std::{fmt::Debug, str::FromStr}; + use aleph_client::{ - contract::ContractInstance, AnyConnection, Balance, Connection, SignedConnection, + contract::ContractInstance, AccountId, Connection, ConnectionApi, SignedConnection, TxInfo, }; use anyhow::{Context, Result}; -use sp_core::crypto::{AccountId32 as AccountId, Ss58Codec}; +use primitives::Balance; -use crate::Config; +use crate::config::Config; /// A wrapper around the simple dex contract. /// @@ -33,7 +35,9 @@ impl SimpleDexInstance { .simple_dex .clone() .context("Simple dex address not set.")?; - let dex_address = AccountId::from_string(&dex_address)?; + let dex_address = AccountId::from_str(&dex_address) + .ok() + .context("Invalid dex address.")?; let metadata_path = config .test_case_params .simple_dex_metadata @@ -45,47 +49,51 @@ impl SimpleDexInstance { }) } - pub fn add_swap_pair( + pub async fn add_swap_pair( &self, conn: &SignedConnection, from: AccountId, to: AccountId, - ) -> Result<()> { + ) -> Result { self.contract - .contract_exec(conn, "add_swap_pair", &[&from.to_string(), &to.to_string()]) + .contract_exec(conn, "add_swap_pair", &[from.to_string(), to.to_string()]) + .await } - pub fn remove_swap_pair( + pub async fn remove_swap_pair( &self, conn: &SignedConnection, from: AccountId, to: AccountId, - ) -> Result<()> { - self.contract.contract_exec( - conn, - "remove_swap_pair", - &[&from.to_string(), &to.to_string()], - ) + ) -> Result { + self.contract + .contract_exec( + conn, + "remove_swap_pair", + &[&from.to_string(), &to.to_string()], + ) + .await } - pub fn deposit( + pub async fn deposit( &self, conn: &SignedConnection, amounts: &[(&PSP22TokenInstance, Balance)], - ) -> Result<()> { + ) -> Result { let deposits = amounts .iter() .map(|(token, amount)| { let address: AccountId = (*token).try_into()?; - Ok(format!("deposits ({:}, {:})", address, amount)) + Ok(format!("({:}, {:})", address, amount)) }) .collect::>>()?; self.contract .contract_exec(conn, "deposit", &[format!("[{:}]", deposits.join(","))]) + .await } - pub fn out_given_in( + pub async fn out_given_in( &self, conn: &C, token_in: &PSP22TokenInstance, @@ -104,31 +112,33 @@ impl SimpleDexInstance { token_out.to_string(), amount_token_in.to_string(), ], - )? - .try_into()? + ) + .await? } - pub fn swap( + pub async fn swap( &self, conn: &SignedConnection, token_in: &PSP22TokenInstance, amount_token_in: Balance, token_out: &PSP22TokenInstance, min_amount_token_out: Balance, - ) -> Result<()> { + ) -> Result { let token_in: AccountId = token_in.into(); let token_out: AccountId = token_out.into(); - self.contract.contract_exec( - conn, - "swap", - &[ - token_in.to_string(), - token_out.to_string(), - amount_token_in.to_string(), - min_amount_token_out.to_string(), - ], - ) + self.contract + .contract_exec( + conn, + "swap", + &[ + token_in.to_string(), + token_out.to_string(), + amount_token_in.to_string(), + min_amount_token_out.to_string(), + ], + ) + .await } } @@ -145,7 +155,9 @@ impl ButtonInstance { let button_address = button_address .clone() .context("Button game address not set.")?; - let button_address = AccountId::from_string(&button_address)?; + let button_address = AccountId::from_str(&button_address) + .ok() + .context("Invalid button game address")?; let metadata_path = config .test_case_params .button_game_metadata @@ -156,38 +168,32 @@ impl ButtonInstance { }) } - pub fn deadline(&self, conn: &C) -> Result { - self.contract.contract_read0(conn, "deadline")?.try_into() + pub async fn deadline(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "deadline").await } - pub fn is_dead(&self, conn: &C) -> Result { - self.contract.contract_read0(conn, "is_dead")?.try_into() + pub async fn is_dead(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "is_dead").await } - pub fn ticket_token(&self, conn: &C) -> Result { - self.contract - .contract_read0(conn, "ticket_token")? - .try_into() + pub async fn ticket_token(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "ticket_token").await } - pub fn reward_token(&self, conn: &C) -> Result { - self.contract - .contract_read0(conn, "reward_token")? - .try_into() + pub async fn reward_token(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "reward_token").await } - pub fn marketplace(&self, conn: &C) -> Result { - self.contract - .contract_read0(conn, "marketplace")? - .try_into() + pub async fn marketplace(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "marketplace").await } - pub fn press(&self, conn: &SignedConnection) -> Result<()> { - self.contract.contract_exec0(conn, "press") + pub async fn press(&self, conn: &SignedConnection) -> Result { + self.contract.contract_exec0(conn, "press").await } - pub fn reset(&self, conn: &SignedConnection) -> Result<()> { - self.contract.contract_exec0(conn, "reset") + pub async fn reset(&self, conn: &SignedConnection) -> Result { + self.contract.contract_exec0(conn, "reset").await } } @@ -221,39 +227,55 @@ impl PSP22TokenInstance { }) } - pub fn transfer(&self, conn: &SignedConnection, to: &AccountId, amount: Balance) -> Result<()> { - self.contract.contract_exec( - conn, - "PSP22::transfer", - &[to.to_string(), amount.to_string(), "0x00".to_string()], - ) + pub async fn transfer( + &self, + conn: &SignedConnection, + to: &AccountId, + amount: Balance, + ) -> Result { + self.contract + .contract_exec( + conn, + "PSP22::transfer", + &[to.to_string(), amount.to_string(), "0x00".to_string()], + ) + .await } - pub fn mint(&self, conn: &SignedConnection, to: &AccountId, amount: Balance) -> Result<()> { - self.contract.contract_exec( - conn, - "PSP22Mintable::mint", - &[to.to_string(), amount.to_string()], - ) + pub async fn mint( + &self, + conn: &SignedConnection, + to: &AccountId, + amount: Balance, + ) -> Result { + self.contract + .contract_exec( + conn, + "PSP22Mintable::mint", + &[to.to_string(), amount.to_string()], + ) + .await } - pub fn approve( + pub async fn approve( &self, conn: &SignedConnection, spender: &AccountId, value: Balance, - ) -> Result<()> { - self.contract.contract_exec( - conn, - "PSP22::approve", - &[spender.to_string(), value.to_string()], - ) + ) -> Result { + self.contract + .contract_exec( + conn, + "PSP22::approve", + &[spender.to_string(), value.to_string()], + ) + .await } - pub fn balance_of(&self, conn: &Connection, account: &AccountId) -> Result { + pub async fn balance_of(&self, conn: &Connection, account: &AccountId) -> Result { self.contract - .contract_read(conn, "PSP22::balance_of", &[account.to_string()])? - .try_into() + .contract_read(conn, "PSP22::balance_of", &[account.to_string()]) + .await } } @@ -289,19 +311,20 @@ impl MarketplaceInstance { }) } - pub fn reset(&self, conn: &SignedConnection) -> Result<()> { - self.contract.contract_exec0(conn, "reset") + pub async fn reset(&self, conn: &SignedConnection) -> Result { + self.contract.contract_exec0(conn, "reset").await } - pub fn buy(&self, conn: &SignedConnection, max_price: Option) -> Result<()> { + pub async fn buy(&self, conn: &SignedConnection, max_price: Option) -> Result { let max_price = max_price.map_or_else(|| "None".to_string(), |x| format!("Some({})", x)); self.contract .contract_exec(conn, "buy", &[max_price.as_str()]) + .await } - pub fn price(&self, conn: &C) -> Result { - self.contract.contract_read0(conn, "price")?.try_into() + pub async fn price(&self, conn: &C) -> Result { + self.contract.contract_read0(conn, "price").await } } @@ -329,7 +352,9 @@ impl WAzeroInstance { .wrapped_azero .clone() .context("Wrapped AZERO address not set.")?; - let wazero_address = AccountId::from_string(&wazero_address)?; + let wazero_address = AccountId::from_str(&wazero_address) + .ok() + .context("Invalid address.")?; let metadata_path = config .test_case_params .wrapped_azero_metadata @@ -341,19 +366,26 @@ impl WAzeroInstance { }) } - pub fn wrap(&self, conn: &SignedConnection, value: Balance) -> Result<()> { - self.contract.contract_exec_value0(conn, "wrap", value) + pub async fn wrap(&self, conn: &SignedConnection, value: Balance) -> Result { + self.contract + .contract_exec_value0(conn, "wrap", value) + .await } - pub fn unwrap(&self, conn: &SignedConnection, amount: Balance) -> Result<()> { + pub async fn unwrap(&self, conn: &SignedConnection, amount: Balance) -> Result { self.contract .contract_exec(conn, "unwrap", &[amount.to_string()]) + .await } - pub fn balance_of(&self, conn: &C, account: AccountId) -> Result { + pub async fn balance_of( + &self, + conn: &C, + account: &AccountId, + ) -> Result { self.contract - .contract_read(conn, "PSP22::balance_of", &[account.to_string()])? - .try_into() + .contract_read(conn, "PSP22::balance_of", &[account.to_string()]) + .await } } diff --git a/e2e-tests/src/test/button_game/helpers.rs b/e2e-tests/src/test/button_game/helpers.rs index 654fb45173..99d62a84c9 100644 --- a/e2e-tests/src/test/button_game/helpers.rs +++ b/e2e-tests/src/test/button_game/helpers.rs @@ -1,103 +1,92 @@ use std::{ fmt::Debug, - ops::Deref, - sync::{ - mpsc::{channel, Receiver, RecvTimeoutError}, - Arc, - }, - thread, + sync::Arc, time::{Duration, Instant}, }; use aleph_client::{ - contract::event::{listen_contract_events, subscribe_events, ContractEvent}, - AccountId, AnyConnection, Balance, Connection, KeyPair, SignedConnection, XtStatus, + contract::event::{listen_contract_events, ContractEvent}, + pallets::balances::BalanceUserApi, + Connection, ConnectionApi, KeyPair, SignedConnection, TxStatus, }; use anyhow::{bail, Result}; +use futures::{ + channel::mpsc::{unbounded, UnboundedReceiver}, + StreamExt, +}; use itertools::Itertools; use log::{info, warn}; +use primitives::Balance; use rand::Rng; -use sp_core::Pair; +use tokio::time::timeout; use super::contracts::{ ButtonInstance, MarketplaceInstance, PSP22TokenInstance, SimpleDexInstance, WAzeroInstance, }; -use crate::Config; - -/// A wrapper around a KeyPair for purposes of converting to an account id in tests. -pub struct KeyPairWrapper(KeyPair); - -impl Deref for KeyPairWrapper { - type Target = KeyPair; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl From<&KeyPairWrapper> for AccountId { - fn from(keypair: &KeyPairWrapper) -> Self { - keypair.public().into() - } -} +use crate::config::Config; /// Creates a copy of the `connection` signed by `signer` -pub fn sign(conn: &C, signer: &KeyPair) -> SignedConnection { - SignedConnection::from_any_connection(conn, signer.clone()) +pub fn sign(conn: &Connection, signer: &KeyPair) -> SignedConnection { + let signer = KeyPair::new(signer.signer().clone()); + SignedConnection::from_connection(conn.clone(), signer) } /// Returns a ticket token instance for the given button instance -pub(super) fn ticket_token( +pub(super) async fn ticket_token( conn: &C, button: &ButtonInstance, config: &Config, ) -> Result { PSP22TokenInstance::new( - button.ticket_token(conn)?, + button.ticket_token(conn).await?, &config.test_case_params.ticket_token_metadata, ) } /// Returns a reward token instance for the given button instance -pub(super) fn reward_token( +pub(super) async fn reward_token( conn: &C, button: &ButtonInstance, config: &Config, ) -> Result { PSP22TokenInstance::new( - button.reward_token(conn)?, + button.reward_token(conn).await?, &config.test_case_params.reward_token_metadata, ) } /// Returns a marketplace instance for the given button instance -pub(super) fn marketplace( +pub(super) async fn marketplace( conn: &C, button: &ButtonInstance, config: &Config, ) -> Result { MarketplaceInstance::new( - button.marketplace(conn)?, + button.marketplace(conn).await?, &config.test_case_params.marketplace_metadata, ) } /// Derives a test account based on a randomized string -pub fn random_account() -> KeyPairWrapper { - KeyPairWrapper(aleph_client::keypair_from_string(&format!( +pub fn random_account() -> KeyPair { + aleph_client::keypair_from_string(&format!( "//TestAccount/{}", rand::thread_rng().gen::() - ))) + )) } /// Transfer `amount` from `from` to `to` -pub fn transfer(conn: &C, from: &KeyPair, to: &KeyPair, amount: Balance) { - aleph_client::balances_transfer( - &SignedConnection::from_any_connection(conn, from.clone()), - &to.public().into(), - amount, - XtStatus::InBlock, - ); +pub async fn transfer( + conn: &Connection, + from: &KeyPair, + to: &KeyPair, + amount: Balance, +) -> Result<()> { + let from = KeyPair::new(from.signer().clone()); + SignedConnection::from_connection(conn.clone(), from) + .transfer(to.account_id().clone(), amount, TxStatus::Finalized) + .await + .map(|_| ()) } /// Returns a number representing the given amount of alephs (adding decimals) @@ -120,17 +109,17 @@ pub(super) struct ButtonTestContext { /// `marketplace`. pub events: BufferedReceiver>, /// The authority owning the initial supply of tickets and with the power to mint game tokens. - pub authority: KeyPairWrapper, + pub authority: KeyPair, /// A random account with some money for transaction fees. - pub player: KeyPairWrapper, + pub player: KeyPair, } pub(super) struct DexTestContext { pub conn: Connection, /// An authority with the power to mint tokens and manage the dex. - pub authority: KeyPairWrapper, + pub authority: KeyPair, /// A random account with some money for fees. - pub account: KeyPairWrapper, + pub account: KeyPair, pub dex: Arc, pub token1: Arc, pub token2: Arc, @@ -142,29 +131,29 @@ pub(super) struct DexTestContext { pub(super) struct WAzeroTestContext { pub conn: Connection, /// A random account with some money for fees. - pub account: KeyPairWrapper, + pub account: KeyPair, pub wazero: Arc, /// A [BufferedReceiver] preconfigured to listen for events of `wazero`. pub events: BufferedReceiver>, } -pub(super) fn setup_wrapped_azero_test(config: &Config) -> Result { - let (conn, _authority, account) = basic_test_context(config); +pub(super) async fn setup_wrapped_azero_test(config: &Config) -> Result { + let (conn, _authority, account) = basic_test_context(config).await?; let wazero = Arc::new(WAzeroInstance::new(config)?); let contract = wazero.clone(); - let subscription = subscribe_events(&conn)?; - let (events_tx, events_rx) = channel(); + let (events_tx, events_rx) = unbounded(); + let listen_conn = conn.clone(); - thread::spawn(move || { + tokio::spawn(async move { let contract_metadata = vec![contract.as_ref().into()]; - listen_contract_events(subscription, &contract_metadata, None, |event| { - let _ = events_tx.send(event); - }); + listen_contract_events(&listen_conn, &contract_metadata, events_tx) + .await + .unwrap(); }); - let events = BufferedReceiver::new(events_rx, Duration::from_secs(3)); + let events = BufferedReceiver::new(events_rx, Duration::from_secs(10)); Ok(WAzeroTestContext { conn, @@ -174,26 +163,27 @@ pub(super) fn setup_wrapped_azero_test(config: &Config) -> Result Result { - let (conn, authority, account) = basic_test_context(config); +pub(super) async fn setup_dex_test(config: &Config) -> Result { + let (conn, authority, account) = basic_test_context(config).await?; let dex = Arc::new(SimpleDexInstance::new(config)?); let token1 = - reward_token_for_button(config, &conn, &config.test_case_params.early_bird_special)?; + reward_token_for_button(config, &conn, &config.test_case_params.early_bird_special).await?; let token2 = - reward_token_for_button(config, &conn, &config.test_case_params.the_pressiah_cometh)?; + reward_token_for_button(config, &conn, &config.test_case_params.the_pressiah_cometh) + .await?; let token3 = - reward_token_for_button(config, &conn, &config.test_case_params.back_to_the_future)?; + reward_token_for_button(config, &conn, &config.test_case_params.back_to_the_future).await?; let c1 = dex.clone(); let c2 = token1.clone(); let c3 = token2.clone(); let c4 = token3.clone(); - let subscription = subscribe_events(&conn)?; - let (events_tx, events_rx) = channel(); + let (events_tx, events_rx) = unbounded(); + let listen_conn = conn.clone(); - thread::spawn(move || { + tokio::spawn(async move { let contract_metadata = vec![ c1.as_ref().into(), c2.as_ref().into(), @@ -201,12 +191,12 @@ pub(super) fn setup_dex_test(config: &Config) -> Result { c4.as_ref().into(), ]; - listen_contract_events(subscription, &contract_metadata, None, |event| { - let _ = events_tx.send(event); - }); + listen_contract_events(&listen_conn, &contract_metadata, events_tx) + .await + .unwrap(); }); - let events = BufferedReceiver::new(events_rx, Duration::from_secs(3)); + let events = BufferedReceiver::new(events_rx, Duration::from_secs(10)); Ok(DexTestContext { conn, @@ -220,36 +210,36 @@ pub(super) fn setup_dex_test(config: &Config) -> Result { }) } -fn reward_token_for_button( +async fn reward_token_for_button( config: &Config, conn: &Connection, button_contract_address: &Option, ) -> Result> { let button = ButtonInstance::new(config, button_contract_address)?; - Ok(Arc::new(reward_token(conn, &button, config)?)) + Ok(Arc::new(reward_token(conn, &button, config).await?)) } /// Sets up a number of objects commonly used in button game tests. -pub(super) fn setup_button_test( +pub(super) async fn setup_button_test( config: &Config, button_contract_address: &Option, ) -> Result { - let (conn, authority, player) = basic_test_context(config); + let (conn, authority, player) = basic_test_context(config).await?; let button = Arc::new(ButtonInstance::new(config, button_contract_address)?); - let ticket_token = Arc::new(ticket_token(&conn, &button, config)?); - let reward_token = Arc::new(reward_token(&conn, &button, config)?); - let marketplace = Arc::new(marketplace(&conn, &button, config)?); + let ticket_token = Arc::new(ticket_token(&conn, &button, config).await?); + let reward_token = Arc::new(reward_token(&conn, &button, config).await?); + let marketplace = Arc::new(marketplace(&conn, &button, config).await?); let c1 = button.clone(); let c2 = ticket_token.clone(); let c3 = reward_token.clone(); let c4 = marketplace.clone(); - let subscription = subscribe_events(&conn)?; - let (events_tx, events_rx) = channel(); + let (events_tx, events_rx) = unbounded(); + let listen_conn = conn.clone(); - thread::spawn(move || { + tokio::spawn(async move { let contract_metadata = vec![ c1.as_ref().into(), c2.as_ref().into(), @@ -257,12 +247,12 @@ pub(super) fn setup_button_test( c4.as_ref().into(), ]; - listen_contract_events(subscription, &contract_metadata, None, |event| { - let _ = events_tx.send(event); - }); + listen_contract_events(&listen_conn, &contract_metadata, events_tx) + .await + .unwrap(); }); - let events = BufferedReceiver::new(events_rx, Duration::from_secs(3)); + let events = BufferedReceiver::new(events_rx, Duration::from_secs(10)); Ok(ButtonTestContext { button, @@ -277,25 +267,25 @@ pub(super) fn setup_button_test( } /// Prepares a `(conn, authority, account)` triple with some money in `account` for fees. -fn basic_test_context(config: &Config) -> (Connection, KeyPairWrapper, KeyPairWrapper) { - let conn = config.get_first_signed_connection().as_connection(); - let authority = KeyPairWrapper(aleph_client::keypair_from_string(&config.sudo_seed)); +async fn basic_test_context(config: &Config) -> Result<(Connection, KeyPair, KeyPair)> { + let conn = Connection::new(&config.node).await; + let authority = aleph_client::keypair_from_string(&config.sudo_seed); let account = random_account(); - transfer(&conn, &authority, &account, alephs(100)); + transfer(&conn, &authority, &account, alephs(100)).await?; - (conn, authority, account) + Ok((conn, authority, account)) } /// A receiver where it's possible to wait for messages out of order. pub struct BufferedReceiver { buffer: Vec, - receiver: Receiver, + receiver: UnboundedReceiver, default_timeout: Duration, } impl BufferedReceiver { - pub fn new(receiver: Receiver, default_timeout: Duration) -> Self { + pub fn new(receiver: UnboundedReceiver, default_timeout: Duration) -> Self { Self { buffer: Vec::new(), receiver, @@ -308,28 +298,32 @@ impl BufferedReceiver { /// If such a message was received earlier and is waiting in the buffer, returns the message immediately and removes /// it from the buffer. Otherwise, listens for messages for `default_timeout`, storing them in the buffer. If a /// matching message is found during that time, it is returned. If not, `Err(RecvTimeoutError)` is returned. - pub fn recv_timeout bool>(&mut self, filter: F) -> Result { + pub async fn recv_timeout bool>(&mut self, filter: F) -> Result + where + T: Debug, + { match self.buffer.iter().find_position(|m| filter(m)) { Some((i, _)) => Ok(self.buffer.remove(i)), None => { - let mut timeout = self.default_timeout; + let mut remaining_timeout = self.default_timeout; - while timeout > Duration::from_millis(0) { + while remaining_timeout > Duration::from_millis(0) { let start = Instant::now(); - match self.receiver.recv_timeout(timeout) { - Ok(msg) => { + match timeout(remaining_timeout, self.receiver.next()).await? { + Some(msg) => { if filter(&msg) { return Ok(msg); } else { + info!("Buffering {:?}", msg); self.buffer.push(msg); - timeout -= Instant::now().duration_since(start); + remaining_timeout -= Instant::now().duration_since(start); } } - Err(_) => return Err(RecvTimeoutError::Timeout), + None => bail!("Receiver closed while waiting for message"), } } - Err(RecvTimeoutError::Timeout) + bail!("Timeout while waiting for a message") } } } @@ -338,44 +332,58 @@ impl BufferedReceiver { /// Wait until `button` is dead. /// /// Returns `Err(_)` if the button doesn't die within 30 seconds. -pub(super) fn wait_for_death(conn: &C, button: &ButtonInstance) -> Result<()> { +pub(super) async fn wait_for_death( + conn: &C, + button: &ButtonInstance, +) -> Result<()> { info!("Waiting for button to die"); - assert_soon(|| button.is_dead(conn), Duration::from_secs(30)) -} + let mut iters = 0u8; + let mut is_dead = false; -/// Wait until `check` returns true. -/// -/// Repeatedly performs `check` (busy wait) until `timeout` elapses. Returns `Ok(())` if `check` returns true during -/// that time, `Err(_)` otherwise. -pub fn assert_soon Result>(check: F, timeout: Duration) -> Result<()> { - let start = Instant::now(); - while !check()? { - if Instant::now().duration_since(start) > timeout { - bail!("Condition not met within timeout") + while iters <= 10 { + match timeout(Duration::from_secs(2), button.is_dead(conn)).await? { + Err(e) => println!("Error while querying button.is_dead: {:?}", e), + Ok(status) => is_dead = status, + } + + if !is_dead { + let _ = tokio::time::sleep(Duration::from_secs(3)).await; + iters += 1; + } + + if is_dead { + break; } } + + if !is_dead { + bail!("Button didn't die in time") + } + + info!("Button died"); Ok(()) } /// Asserts that a message with `id` is received (within `events.default_timeout`) and returns it. -pub fn assert_recv_id( +pub async fn assert_recv_id( events: &mut BufferedReceiver>, id: &str, ) -> ContractEvent { assert_recv( events, - |event| event.ident == Some(id.to_string()), + |event| event.name == Some(id.to_string()), &format!("Expected {:?} contract event", id), ) + .await } /// Asserts that a message matching `filter` is received (within `events.default_timeout`) and returns it. -pub fn assert_recv bool>( +pub async fn assert_recv bool>( events: &mut BufferedReceiver>, filter: F, context: &str, ) -> T { - let event = recv_timeout_with_log(events, filter); + let event = recv_timeout_with_log(events, filter).await; assert!(event.is_ok(), "{}", context); @@ -383,25 +391,30 @@ pub fn assert_recv bool>( } /// Asserts that a message with `id` is not received (within `events.default_timeout`). -pub fn refute_recv_id(events: &mut BufferedReceiver>, id: &str) { - if let Ok(event) = recv_timeout_with_log(events, |event| event.ident == Some(id.to_string())) { +pub async fn refute_recv_id(events: &mut BufferedReceiver>, id: &str) { + if let Ok(event) = + recv_timeout_with_log(events, |event| event.name == Some(id.to_string())).await + { panic!("Received unexpected event {:?}", event); } } -fn recv_timeout_with_log bool>( +async fn recv_timeout_with_log bool>( events: &mut BufferedReceiver>, filter: F, ) -> Result { - match events.recv_timeout(|event_or_error| { - if event_or_error.is_ok() { - info!("Received contract event {:?}", event_or_error); - } else { - warn!("Contract event error {:?}", event_or_error); - } + match events + .recv_timeout(|event_or_error| { + if event_or_error.is_ok() { + info!("Received contract event {:?}", event_or_error); + } else { + warn!("Contract event error {:?}", event_or_error); + } - event_or_error.as_ref().map(&filter).unwrap_or(false) - }) { + event_or_error.as_ref().map(&filter).unwrap_or(false) + }) + .await + { Ok(event) => Ok(event.unwrap()), Err(err) => bail!(err), } diff --git a/e2e-tests/src/test/button_game/mod.rs b/e2e-tests/src/test/button_game/mod.rs index edd2e88532..812d2bf0ff 100644 --- a/e2e-tests/src/test/button_game/mod.rs +++ b/e2e-tests/src/test/button_game/mod.rs @@ -1,19 +1,19 @@ -use std::{thread, time::Duration}; +use std::time::Duration; -use aleph_client::{contract_transcode::Value, AccountId}; +use aleph_client::{contract_transcode::Value, pallets::system::SystemApi}; use anyhow::Result; use assert2::{assert, let_assert}; use helpers::sign; use log::info; -use sp_core::Pair; +use tokio::time::sleep; use crate::{ + config::{setup_test, Config}, test::button_game::helpers::{ alephs, assert_recv, assert_recv_id, mega, refute_recv_id, setup_button_test, setup_dex_test, setup_wrapped_azero_test, wait_for_death, ButtonTestContext, DexTestContext, WAzeroTestContext, }, - Config, }; mod contracts; @@ -26,36 +26,48 @@ mod helpers; /// 1. Wraps some azero and checks that the PSP22 balance increased accordingly. /// 2. Unwraps half of the amount, checks that some wrapped funds remained while the rest has been returned to azero, /// minus fees. -pub fn wrapped_azero(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn wrapped_azero() -> Result<()> { + let config = setup_test(); let WAzeroTestContext { conn, account, wazero, mut events, .. - } = setup_wrapped_azero_test(config)?; + } = setup_wrapped_azero_test(config).await?; let account_conn = &sign(&conn, &account); - let account_id: AccountId = account.public().into(); + let account_id = account.account_id(); - wazero.wrap(account_conn, alephs(2))?; + wazero.wrap(account_conn, alephs(2)).await?; - let event = assert_recv_id(&mut events, "Wrapped"); + let event = assert_recv_id(&mut events, "Wrapped").await; let_assert!(Some(Value::Literal(acc_id)) = event.data.get("caller")); assert!(*acc_id == account_id.to_string()); assert!(event.data.get("amount") == Some(&Value::UInt(alephs(2)))); - assert!(wazero.balance_of(account_conn, account.public().into())? == alephs(2)); + assert!( + wazero + .balance_of(account_conn, account.account_id()) + .await? + == alephs(2) + ); - let balance_before = aleph_client::get_free_balance(&conn, &account_id); - wazero.unwrap(account_conn, alephs(1))?; + let balance_before = conn.get_free_balance(account_id.clone(), None).await; + wazero.unwrap(account_conn, alephs(1)).await?; - let event = assert_recv_id(&mut events, "UnWrapped"); - let balance_after = aleph_client::get_free_balance(&conn, &account_id); + let event = assert_recv_id(&mut events, "UnWrapped").await; + let balance_after = conn.get_free_balance(account_id.clone(), None).await; let max_fee = alephs(1) / 100; assert!(balance_after - balance_before > alephs(1) - max_fee); let_assert!(Some(Value::Literal(acc_id)) = event.data.get("caller")); assert!(*acc_id == account_id.to_string()); assert!(event.data.get("amount") == Some(&Value::UInt(alephs(1)))); - assert!(wazero.balance_of(account_conn, account.public().into())? == alephs(1)); + assert!( + wazero + .balance_of(account_conn, account.account_id()) + .await? + == alephs(1) + ); Ok(()) } @@ -70,7 +82,9 @@ pub fn wrapped_azero(config: &Config) -> Result<()> { /// 4. Makes a swap A -> B expecting negative slippage (this should fail). /// 5. Checks that the price after the two swaps is the same as before (with a dust allowance of 1 for rounding). /// 6. Checks that it's possible to make an A -> C swap, but impossible to make a C -> A swap. -pub fn simple_dex(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn simple_dex() -> Result<()> { + let config = setup_test(); let DexTestContext { conn, authority, @@ -80,7 +94,8 @@ pub fn simple_dex(config: &Config) -> Result<()> { token2, token3, mut events, - } = setup_dex_test(config)?; + } = setup_dex_test(config).await?; + let authority_conn = &sign(&conn, &authority); let account_conn = &sign(&conn, &account); let token1 = token1.as_ref(); @@ -88,22 +103,44 @@ pub fn simple_dex(config: &Config) -> Result<()> { let token3 = token3.as_ref(); let dex = dex.as_ref(); - dex.add_swap_pair(authority_conn, token1.into(), token2.into())?; - assert_recv_id(&mut events, "SwapPairAdded"); - - dex.add_swap_pair(authority_conn, token2.into(), token1.into())?; - assert_recv_id(&mut events, "SwapPairAdded"); - - dex.add_swap_pair(authority_conn, token1.into(), token3.into())?; - assert_recv_id(&mut events, "SwapPairAdded"); - - token1.mint(authority_conn, &authority.public().into(), mega(3000))?; - token2.mint(authority_conn, &authority.public().into(), mega(5000))?; - token3.mint(authority_conn, &authority.public().into(), mega(10000))?; + dex.add_swap_pair(authority_conn, token1.into(), token2.into()) + .await?; + assert_recv_id(&mut events, "SwapPairAdded").await; + + dex.add_swap_pair(authority_conn, token2.into(), token1.into()) + .await?; + assert_recv_id(&mut events, "SwapPairAdded").await; + + dex.add_swap_pair(authority_conn, token1.into(), token3.into()) + .await?; + assert_recv_id(&mut events, "SwapPairAdded").await; + + token1 + .mint(authority_conn, authority.account_id(), mega(3000)) + .await?; + assert_recv_id(&mut events, "Transfer").await; + token2 + .mint(authority_conn, authority.account_id(), mega(5000)) + .await?; + assert_recv_id(&mut events, "Transfer").await; + token3 + .mint(authority_conn, authority.account_id(), mega(10000)) + .await?; + assert_recv_id(&mut events, "Transfer").await; + + token1 + .approve(authority_conn, &dex.into(), mega(3000)) + .await?; + assert_recv_id(&mut events, "Approval").await; + token2 + .approve(authority_conn, &dex.into(), mega(5000)) + .await?; + assert_recv_id(&mut events, "Approval").await; + token3 + .approve(authority_conn, &dex.into(), mega(10000)) + .await?; + assert_recv_id(&mut events, "Approval").await; - token1.approve(authority_conn, &dex.into(), mega(3000))?; - token2.approve(authority_conn, &dex.into(), mega(5000))?; - token3.approve(authority_conn, &dex.into(), mega(10000))?; dex.deposit( authority_conn, &[ @@ -111,65 +148,95 @@ pub fn simple_dex(config: &Config) -> Result<()> { (token2, mega(5000)), (token3, mega(10000)), ], - )?; + ) + .await?; + assert_recv_id(&mut events, "Deposited").await; let more_than_liquidity = mega(1_000_000); - dex.swap(account_conn, token1, 100, token2, more_than_liquidity)?; - - refute_recv_id(&mut events, "Swapped"); + let res = dex + .swap(account_conn, token1, 100, token2, more_than_liquidity) + .await; + assert!(res.is_err()); + refute_recv_id(&mut events, "Swapped").await; let initial_amount = mega(100); - token1.mint(authority_conn, &account.public().into(), initial_amount)?; - let expected_output = dex.out_given_in(account_conn, token1, token2, initial_amount)?; + token1 + .mint(authority_conn, account.account_id(), initial_amount) + .await?; + let expected_output = dex + .out_given_in(account_conn, token1, token2, initial_amount) + .await?; assert!(expected_output > 0); let at_most_10_percent_slippage = expected_output * 9 / 10; - token1.approve(account_conn, &dex.into(), initial_amount)?; + token1 + .approve(account_conn, &dex.into(), initial_amount) + .await?; dex.swap( account_conn, token1, initial_amount, token2, at_most_10_percent_slippage, - )?; - assert_recv_id(&mut events, "Swapped"); - assert!(token2.balance_of(&conn, &account.public().into())? == expected_output); - - token2.approve(account_conn, &dex.into(), expected_output)?; - dex.swap(account_conn, token2, expected_output, token1, mega(90))?; - assert_recv_id(&mut events, "Swapped"); - - let balance_after = token1.balance_of(&conn, &account.public().into())?; + ) + .await?; + assert_recv_id(&mut events, "Swapped").await; + assert!(token2.balance_of(&conn, account.account_id()).await? == expected_output); + + token2 + .approve(account_conn, &dex.into(), expected_output) + .await?; + dex.swap(account_conn, token2, expected_output, token1, mega(90)) + .await?; + assert_recv_id(&mut events, "Swapped").await; + + let balance_after = token1.balance_of(&conn, account.account_id()).await?; assert!(initial_amount.abs_diff(balance_after) <= 1); assert!( - dex.out_given_in(account_conn, token1, token2, initial_amount)? + dex.out_given_in(account_conn, token1, token2, initial_amount) + .await? .abs_diff(expected_output) <= 1 ); - token1.approve(account_conn, &dex.into(), balance_after)?; + token1 + .approve(account_conn, &dex.into(), balance_after) + .await?; let unreasonable_slippage = expected_output * 11 / 10; - dex.swap( - account_conn, - token1, - balance_after, - token2, - unreasonable_slippage, - )?; - refute_recv_id(&mut events, "Swapped"); + assert!( + dex.swap( + account_conn, + token1, + balance_after, + token2, + unreasonable_slippage, + ) + .await + .is_err(), + "expected swap to fail" + ); + refute_recv_id(&mut events, "Swapped").await; - dex.swap(account_conn, token1, balance_after, token3, mega(90))?; - assert_recv_id(&mut events, "Swapped"); + dex.swap(account_conn, token1, balance_after, token3, mega(90)) + .await?; + assert_recv_id(&mut events, "Swapped").await; // can't swap a pair not on the whitelist - - dex.remove_swap_pair(authority_conn, token3.into(), token1.into())?; - assert_recv_id(&mut events, "SwapPairRemoved"); - - let balance_token3 = token3.balance_of(&conn, &account.public().into())?; - token3.approve(account_conn, &dex.into(), balance_token3)?; - dex.swap(account_conn, token3, balance_token3, token1, mega(90))?; - refute_recv_id(&mut events, "Swapped"); + dex.remove_swap_pair(authority_conn, token3.into(), token1.into()) + .await?; + assert_recv_id(&mut events, "SwapPairRemoved").await; + + let balance_token3 = token3.balance_of(&conn, account.account_id()).await?; + token3 + .approve(account_conn, &dex.into(), balance_token3) + .await?; + assert!( + dex.swap(account_conn, token3, balance_token3, token1, mega(90)) + .await + .is_err(), + "can't swap pair that is not whitelisted" + ); + refute_recv_id(&mut events, "Swapped").await; Ok(()) } @@ -181,7 +248,9 @@ pub fn simple_dex(config: &Config) -> Result<()> { /// 1. Buys a ticket without setting the max price (this should succeed). /// 2. Tries to buy a ticket with setting the max price too low (this should fail). /// 3. Tries to buy a ticket with setting the max price appropriately (this should succeed). -pub fn marketplace(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn marketplace() -> Result<()> { + let config = setup_test(); let ButtonTestContext { conn, authority, @@ -191,55 +260,74 @@ pub fn marketplace(config: &Config) -> Result<()> { reward_token, mut events, .. - } = setup_button_test(config, &config.test_case_params.early_bird_special)?; + } = setup_button_test(config, &config.test_case_params.early_bird_special).await?; let player = &player; - marketplace.reset(&sign(&conn, &authority))?; - assert_recv_id(&mut events, "Reset"); - ticket_token.transfer(&sign(&conn, &authority), &marketplace.as_ref().into(), 2)?; + marketplace.reset(&sign(&conn, &authority)).await?; + assert_recv_id(&mut events, "Reset").await; + ticket_token + .transfer(&sign(&conn, &authority), &marketplace.as_ref().into(), 2) + .await?; - let early_price = marketplace.price(&conn)?; - thread::sleep(Duration::from_secs(2)); - let later_price = marketplace.price(&conn)?; + let early_price = marketplace.price(&conn).await?; + sleep(Duration::from_secs(2)).await; + let later_price = marketplace.price(&conn).await?; assert!(later_price < early_price); let player_balance = 100 * later_price; - reward_token.mint(&sign(&conn, &authority), &player.into(), player_balance)?; - reward_token.approve( - &sign(&conn, player), - &marketplace.as_ref().into(), - later_price, - )?; - marketplace.buy(&sign(&conn, player), None)?; - - let event = assert_recv_id(&mut events, "Bought"); - let player_account: AccountId = player.into(); + reward_token + .mint( + &sign(&conn, &authority), + player.account_id(), + player_balance, + ) + .await?; + reward_token + .approve( + &sign(&conn, player), + &marketplace.as_ref().into(), + later_price, + ) + .await?; + marketplace.buy(&sign(&conn, player), None).await?; + + let event = assert_recv_id(&mut events, "Bought").await; assert!(event.contract == marketplace.as_ref().into()); let_assert!(Some(&Value::UInt(price)) = event.data.get("price")); assert!(price <= later_price); let_assert!(Some(Value::Literal(acc_id)) = event.data.get("account_id")); - assert!(acc_id == &player_account.to_string()); - assert!(ticket_token.balance_of(&conn, &player.into())? == 1); - assert!(reward_token.balance_of(&conn, &player.into())? <= player_balance - price); - assert!(marketplace.price(&conn)? > price); + assert!(acc_id == &player.account_id().to_string()); + assert!(ticket_token.balance_of(&conn, player.account_id()).await? == 1); + assert!(reward_token.balance_of(&conn, player.account_id()).await? <= player_balance - price); + assert!(marketplace.price(&conn).await? > price); - let latest_price = marketplace.price(&conn)?; + let latest_price = marketplace.price(&conn).await?; info!("Setting max price too low"); - marketplace.buy(&sign(&conn, player), Some(latest_price / 2))?; - refute_recv_id(&mut events, "Bought"); - assert!(ticket_token.balance_of(&conn, &player.into())? == 1); + assert!( + marketplace + .buy(&sign(&conn, player), Some(latest_price / 2)) + .await + .is_err(), + "set price too low, should fail" + ); + refute_recv_id(&mut events, "Bought").await; + assert!(ticket_token.balance_of(&conn, player.account_id()).await? == 1); info!("Setting max price high enough"); - marketplace.buy(&sign(&conn, player), Some(latest_price * 2))?; - assert_recv_id(&mut events, "Bought"); - assert!(ticket_token.balance_of(&conn, &player.into())? == 2); + marketplace + .buy(&sign(&conn, player), Some(latest_price * 2)) + .await?; + assert_recv_id(&mut events, "Bought").await; + assert!(ticket_token.balance_of(&conn, player.account_id()).await? == 2); Ok(()) } /// Tests resetting the button game. -pub fn button_game_reset(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn button_game_reset() -> Result<()> { + let config = setup_test(); let ButtonTestContext { conn, button, @@ -248,40 +336,48 @@ pub fn button_game_reset(config: &Config) -> Result<()> { marketplace, ticket_token, .. - } = setup_button_test(config, &config.test_case_params.early_bird_special)?; + } = setup_button_test(config, &config.test_case_params.early_bird_special).await?; - let deadline_old = button.deadline(&conn)?; - let marketplace_initial = ticket_token.balance_of(&conn, &marketplace.as_ref().into())?; - ticket_token.transfer(&sign(&conn, &authority), &button.as_ref().into(), 1)?; + let deadline_old = button.deadline(&conn).await?; + let marketplace_initial = ticket_token + .balance_of(&conn, &marketplace.as_ref().into()) + .await?; + ticket_token + .transfer(&sign(&conn, &authority), &button.as_ref().into(), 1) + .await?; - wait_for_death(&conn, &button)?; - button.reset(&sign(&conn, &authority))?; + wait_for_death(&conn, &button).await?; + button.reset(&sign(&conn, &authority)).await?; let _ = assert_recv( &mut events, |event| { - event.contract == button.as_ref().into() && event.ident == Some("GameReset".to_string()) + event.contract == button.as_ref().into() && event.name == Some("GameReset".to_string()) }, "GameReset event", ); let _ = assert_recv( &mut events, |event| { - event.contract == marketplace.as_ref().into() - && event.ident == Some("Reset".to_string()) + event.contract == marketplace.as_ref().into() && event.name == Some("Reset".to_string()) }, "Marketplace Reset event", ); - let deadline_new = button.deadline(&conn)?; + let deadline_new = button.deadline(&conn).await?; assert!(deadline_new > deadline_old); assert!( - ticket_token.balance_of(&conn, &marketplace.as_ref().into())? == marketplace_initial + 1 + ticket_token + .balance_of(&conn, &marketplace.as_ref().into()) + .await? + == marketplace_initial + 1 ); Ok(()) } -pub fn early_bird_special(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn early_bird_special() -> Result<()> { + let config = setup_test(); button_game_play( config, &config.test_case_params.early_bird_special, @@ -289,9 +385,12 @@ pub fn early_bird_special(config: &Config) -> Result<()> { assert!(early_presser_score > late_presser_score); }, ) + .await } -pub fn back_to_the_future(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn back_to_the_future() -> Result<()> { + let config = setup_test(); button_game_play( config, &config.test_case_params.back_to_the_future, @@ -299,9 +398,12 @@ pub fn back_to_the_future(config: &Config) -> Result<()> { assert!(early_presser_score < late_presser_score); }, ) + .await } -pub fn the_pressiah_cometh(config: &Config) -> Result<()> { +#[tokio::test] +pub async fn the_pressiah_cometh() -> Result<()> { + let config = setup_test(); button_game_play( config, &config.test_case_params.the_pressiah_cometh, @@ -310,6 +412,7 @@ pub fn the_pressiah_cometh(config: &Config) -> Result<()> { assert!(late_presser_score == 2); }, ) + .await } /// Tests a basic scenario of playing the game. @@ -324,7 +427,7 @@ pub fn the_pressiah_cometh(config: &Config) -> Result<()> { /// /// Passes the scores received by an early presser and late presser to `score_check` so that different scoring rules /// can be tested generically. -fn button_game_play( +async fn button_game_play( config: &Config, button_contract_address: &Option, score_check: F, @@ -338,42 +441,54 @@ fn button_game_play( reward_token, player, .. - } = setup_button_test(config, button_contract_address)?; + } = setup_button_test(config, button_contract_address).await?; let player = &player; - ticket_token.transfer(&sign(&conn, &authority), &player.into(), 2)?; - wait_for_death(&conn, &button)?; - button.reset(&sign(&conn, &authority))?; - let old_button_balance = ticket_token.balance_of(&conn, &button.as_ref().into())?; - - ticket_token.approve(&sign(&conn, player), &button.as_ref().into(), 2)?; - button.press(&sign(&conn, player))?; - - let event = assert_recv_id(&mut events, "ButtonPressed"); - let player_account: AccountId = player.into(); + ticket_token + .transfer(&sign(&conn, &authority), player.account_id(), 2) + .await?; + wait_for_death(&conn, &button).await?; + button.reset(&sign(&conn, &authority)).await?; + let old_button_balance = ticket_token + .balance_of(&conn, &button.as_ref().into()) + .await?; + + ticket_token + .approve(&sign(&conn, player), &button.as_ref().into(), 2) + .await?; + button.press(&sign(&conn, player)).await?; + + let event = assert_recv_id(&mut events, "ButtonPressed").await; let_assert!(Some(&Value::UInt(early_presser_score)) = event.data.get("score")); - assert!(event.data.get("by") == Some(&Value::Literal(player_account.to_string()))); - assert!(reward_token.balance_of(&conn, &player.into())? == early_presser_score); + assert!(event.data.get("by") == Some(&Value::Literal(player.account_id().to_string()))); + assert!(reward_token.balance_of(&conn, player.account_id()).await? == early_presser_score); assert!(early_presser_score > 0); - assert!(ticket_token.balance_of(&conn, &player.into())? == 1); - assert!(ticket_token.balance_of(&conn, &button.as_ref().into())? == old_button_balance + 1); + assert!(ticket_token.balance_of(&conn, player.account_id()).await? == 1); + assert!( + ticket_token + .balance_of(&conn, &button.as_ref().into()) + .await? + == old_button_balance + 1 + ); info!("Waiting before pressing again"); - thread::sleep(Duration::from_secs(5)); + sleep(Duration::from_secs(5)).await; - button.press(&sign(&conn, player))?; - let event = assert_recv_id(&mut events, "ButtonPressed"); + button.press(&sign(&conn, player)).await?; + let event = assert_recv_id(&mut events, "ButtonPressed").await; let_assert!(Some(&Value::UInt(late_presser_score)) = event.data.get("score")); score_check(early_presser_score, late_presser_score); let total_score = early_presser_score + late_presser_score; - assert!(reward_token.balance_of(&conn, &player.into())? == total_score); + assert!(reward_token.balance_of(&conn, player.account_id()).await? == total_score); - wait_for_death(&conn, &button)?; - button.reset(&sign(&conn, &authority))?; - assert_recv_id(&mut events, "Reset"); + wait_for_death(&conn, &button).await?; + button.reset(&sign(&conn, &authority)).await?; + assert_recv_id(&mut events, "Reset").await; let pressiah_score = total_score / 4; - assert!(reward_token.balance_of(&conn, &player.into())? == total_score + pressiah_score); + assert!( + reward_token.balance_of(&conn, player.account_id()).await? == total_score + pressiah_score + ); Ok(()) } diff --git a/e2e-tests/src/test/electing_validators.rs b/e2e-tests/src/test/electing_validators.rs index fa5f27164d..d5767ad998 100644 --- a/e2e-tests/src/test/electing_validators.rs +++ b/e2e-tests/src/test/electing_validators.rs @@ -1,39 +1,46 @@ use std::collections::BTreeSet; use aleph_client::{ - change_validators, get_current_session, get_current_validator_count, get_current_validators, - get_eras_stakers_storage_key, get_minimum_validator_count, get_stakers_as_storage_keys, - get_stakers_as_storage_keys_from_storage_key, staking_chill_validators, - wait_for_full_era_completion, wait_for_session, AccountId, AnyConnection, RootConnection, - SignedConnection, XtStatus, + pallets::{ + elections::ElectionsSudoApi, + session::SessionApi, + staking::{StakingApi, StakingRawApi, StakingUserApi}, + }, + primitives::CommitteeSeats, + waiting::{BlockStatus, WaitingExt}, + AccountId, ConnectionApi, KeyPair, Pair, SignedConnection, TxStatus, }; use log::info; -use primitives::{CommitteeSeats, EraIndex}; -use sp_core::storage::StorageKey; +use primitives::EraIndex; use crate::{ - accounts::get_sudo_key, - validators::{prepare_validators, setup_accounts}, - Config, + config::setup_test, + validators::{get_controller_connections_to_nodes, prepare_validators, setup_accounts}, }; /// Verify that `pallet_staking::ErasStakers` contains all target validators. /// /// We have to do it by comparing keys in storage trie. -fn assert_validators_are_elected_stakers( +async fn assert_validators_are_elected_stakers( connection: &C, current_era: EraIndex, - expected_validators_as_keys: &BTreeSet, -) { - let storage_key = get_eras_stakers_storage_key(current_era); - let stakers = - get_stakers_as_storage_keys_from_storage_key(connection, current_era, storage_key); + expected_validators_as_keys: Vec>, +) -> anyhow::Result<()> { + let stakers = connection + .get_stakers_storage_keys(current_era, None) + .await? + .into_iter() + .map(|key| key.0); + let stakers_tree = BTreeSet::from_iter(stakers); + let expected_validators_as_keys = BTreeSet::from_iter(expected_validators_as_keys); assert_eq!( - *expected_validators_as_keys, stakers, + expected_validators_as_keys, stakers_tree, "Expected another set of staking validators.\n\tExpected: {:?}\n\tActual: {:?}", - expected_validators_as_keys, stakers + expected_validators_as_keys, stakers_tree ); + + Ok(()) } // There are v non-reserved validators and s non-reserved seats. We will have seen all @@ -54,7 +61,7 @@ fn min_num_sessions_to_see_all_non_reserved_validators( /// Verify that all target validators are included `pallet_session::Validators` across a few /// consecutive sessions. -fn assert_validators_are_used_as_authorities( +async fn assert_validators_are_used_as_authorities( connection: &C, expected_authorities: &BTreeSet, min_num_sessions: u32, @@ -62,15 +69,15 @@ fn assert_validators_are_used_as_authorities( let mut authorities = BTreeSet::new(); for _ in 0..min_num_sessions { - let current_session = get_current_session(connection); + let current_session = connection.get_session(None).await; info!("Reading authorities in session {}", current_session); - let current_authorities = get_current_validators(connection); + let current_authorities = connection.get_validators(None).await; for ca in current_authorities.into_iter() { authorities.insert(ca); } - wait_for_session(connection, current_session + 1).expect("Couldn't wait for next session"); + connection.wait_for_n_sessions(1, BlockStatus::Best).await; } assert_eq!( @@ -80,8 +87,8 @@ fn assert_validators_are_used_as_authorities( ); } -fn assert_enough_validators(connection: &C, min_validator_count: u32) { - let current_validator_count = get_current_validator_count(connection); +async fn assert_enough_validators(connection: &C, min_validator_count: u32) { + let current_validator_count = connection.get_validators(None).await.len() as u32; assert!( current_validator_count >= min_validator_count, "{} validators present. Staking enforces a minimum of {} validators.", @@ -117,6 +124,14 @@ fn assert_enough_validators_left_after_chilling( ); } +async fn chill_validators(node: &str, chilling: Vec) { + for validator in chilling.into_iter() { + info!("Chilling validator {:?}", validator.signer().public()); + let connection = SignedConnection::new(node, validator).await; + connection.chill(TxStatus::InBlock).await.unwrap(); + } +} + /// 1. Setup `v` brand new validators (e.g. `v=6`) - `r` reserved (e.g. `r=3`) and `n` (e.g. `n=3`) /// non reserved. /// 2. Wait until they are in force. @@ -134,16 +149,18 @@ fn assert_enough_validators_left_after_chilling( /// parameter to set `MinimumValidatorCount` in the chain spec as the chain is set up. /// For this specific test case, we use `node-count = 6` and `min-validator-count = 4`, which /// satisfies the outlined conditions. -pub fn authorities_are_staking(config: &Config) -> anyhow::Result<()> { +#[tokio::test] +pub async fn authorities_are_staking() -> anyhow::Result<()> { + let config = setup_test(); + let node = &config.node; - let sudo = get_sudo_key(config); - let root_connection = RootConnection::new(node, sudo); + let root_connection = config.create_root_connection().await; const RESERVED_SEATS_DEFAULT: u32 = 3; const NON_RESERVED_SEATS_DEFAULT: u32 = 3; // `MinimumValidatorCount` from `pallet_staking`, set in chain spec. - let min_validator_count = get_minimum_validator_count(&root_connection); + let min_validator_count = root_connection.get_minimum_validator_count(None).await; let reserved_seats = match config.test_case_params.reserved_seats { Some(seats) => seats, @@ -158,17 +175,21 @@ pub fn authorities_are_staking(config: &Config) -> anyhow::Result<()> { const RESERVED_TO_CHILL_COUNT: u32 = 1; const NON_RESERVED_TO_CHILL_COUNT: u32 = 1; - assert_enough_validators(&root_connection, min_validator_count); + assert_enough_validators(&root_connection, min_validator_count).await; let desired_validator_count = reserved_seats + non_reserved_seats; let accounts = setup_accounts(desired_validator_count); - prepare_validators(&root_connection.as_signed(), node, &accounts); + let controller_connections = + get_controller_connections_to_nodes(node, accounts.get_controller_raw_keys().clone()) + .await?; + prepare_validators(&root_connection, node, &accounts, controller_connections).await?; info!("New validators are set up"); let reserved_validators = accounts.get_stash_accounts()[..reserved_seats as usize].to_vec(); - let chilling_reserved = accounts.get_controller_keys()[0].clone(); // first reserved validator + let chilling_reserved = KeyPair::new(accounts.get_controller_raw_keys()[0].clone()); // first reserved validator let non_reserved_validators = accounts.get_stash_accounts()[reserved_seats as usize..].to_vec(); - let chilling_non_reserved = accounts.get_controller_keys()[reserved_seats as usize].clone(); // first non-reserved validator + let chilling_non_reserved = + KeyPair::new(accounts.get_controller_raw_keys()[reserved_seats as usize].clone()); // first non-reserved validator let reserved_count = reserved_validators.len() as u32; let non_reserved_count = non_reserved_validators.len() as u32; @@ -192,29 +213,41 @@ pub fn authorities_are_staking(config: &Config) -> anyhow::Result<()> { min_validator_count, ); - change_validators( - &root_connection, - Some(reserved_validators), - Some(non_reserved_validators), - Some(CommitteeSeats { - reserved_seats, - non_reserved_seats, - }), - XtStatus::Finalized, - ); + root_connection + .change_validators( + Some(reserved_validators), + Some(non_reserved_validators), + Some(CommitteeSeats { + reserved_seats, + non_reserved_seats, + }), + TxStatus::Finalized, + ) + .await?; + info!("Changed validators to a new set"); // We need any signed connection. - let connection = SignedConnection::new(node, accounts.get_stash_keys()[0].clone()); - - let current_era = wait_for_full_era_completion(&connection)?; + let connection = root_connection; + connection.wait_for_n_eras(2, BlockStatus::Best).await; + let current_era = connection.get_current_era(None).await; info!("New validators are in force (era: {})", current_era); assert_validators_are_elected_stakers( &connection, current_era, - &get_stakers_as_storage_keys(&connection, accounts.get_stash_accounts(), current_era), - ); + connection + .get_stakers_storage_keys_from_accounts( + current_era, + accounts.get_stash_accounts(), + None, + ) + .await + .into_iter() + .map(|k| k.0) + .collect(), + ) + .await?; let min_num_sessions = min_num_sessions_to_see_all_non_reserved_validators(non_reserved_count, non_reserved_seats); @@ -223,11 +256,13 @@ pub fn authorities_are_staking(config: &Config) -> anyhow::Result<()> { &connection, &BTreeSet::from_iter(accounts.get_stash_accounts().clone().into_iter()), min_num_sessions, - ); + ) + .await; - staking_chill_validators(node, vec![chilling_reserved, chilling_non_reserved]); + chill_validators(node, vec![chilling_reserved, chilling_non_reserved]).await; - let current_era = wait_for_full_era_completion(&connection)?; + connection.wait_for_n_eras(2, BlockStatus::Best).await; + let current_era = connection.get_current_era(None).await; info!( "Subset of validators should be in force (era: {})", current_era @@ -240,13 +275,20 @@ pub fn authorities_are_staking(config: &Config) -> anyhow::Result<()> { assert_validators_are_elected_stakers( &connection, current_era, - &get_stakers_as_storage_keys(&connection, &left_stashes, current_era), - ); + connection + .get_stakers_storage_keys_from_accounts(current_era, &left_stashes, None) + .await + .into_iter() + .map(|k| k.0) + .collect(), + ) + .await?; assert_validators_are_used_as_authorities( &connection, &BTreeSet::from_iter(left_stashes.into_iter()), min_num_sessions, - ); + ) + .await; Ok(()) } diff --git a/e2e-tests/src/test/era_payout.rs b/e2e-tests/src/test/era_payout.rs index 11c3a191b4..a822f716bf 100644 --- a/e2e-tests/src/test/era_payout.rs +++ b/e2e-tests/src/test/era_payout.rs @@ -1,17 +1,20 @@ use aleph_client::{ - create_connection, get_active_era, get_payout_for_era, staking_force_new_era, - wait_for_next_era, wait_for_session, ReadStorage, XtStatus, + pallets::staking::{StakingApi, StakingSudoApi}, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + TxStatus, }; use primitives::{ staking::era_payout, Balance, EraIndex, DEFAULT_SESSIONS_PER_ERA, DEFAULT_SESSION_PERIOD, MILLISECS_PER_BLOCK, }; -use crate::Config; +use crate::config::{setup_test, Config}; -pub fn era_payouts_calculated_correctly(config: &Config) -> anyhow::Result<()> { - normal_era_payout(config)?; - force_era_payout(config)?; +#[tokio::test] +pub async fn era_payouts_calculated_correctly() -> anyhow::Result<()> { + let config = setup_test(); + normal_era_payout(config).await?; + force_era_payout(config).await?; Ok(()) } @@ -29,29 +32,32 @@ fn payout_within_two_block_delta(expected_payout: Balance, payout: Balance) { ); } -fn wait_to_second_era(connection: &C) -> EraIndex { - let active_era = get_active_era(connection); +async fn wait_to_second_era(connection: &C) -> EraIndex { + let active_era = connection.get_active_era(None).await; if active_era < 2 { - wait_for_next_era(connection).expect("Era is active"); - wait_for_next_era(connection).expect("Era is active"); + connection.wait_for_n_eras(2, BlockStatus::Best).await; } - get_active_era(connection) + connection.get_active_era(None).await } -fn force_era_payout(config: &Config) -> anyhow::Result<()> { - let root_connection = config.create_root_connection(); - let active_era = wait_to_second_era(&root_connection); - wait_for_next_era(&root_connection)?; +async fn force_era_payout(config: &Config) -> anyhow::Result<()> { + let root_connection = config.create_root_connection().await; + let active_era = wait_to_second_era(&root_connection).await; + root_connection.wait_for_n_eras(1, BlockStatus::Best).await; let active_era = active_era + 1; let starting_session = active_era * DEFAULT_SESSIONS_PER_ERA; - wait_for_session(&root_connection, starting_session + 1)?; + root_connection + .wait_for_session(starting_session + 1, BlockStatus::Best) + .await; // new era will start in the session `starting_session + 3` - staking_force_new_era(&root_connection, XtStatus::InBlock); - wait_for_session(&root_connection, starting_session + 3)?; + root_connection.force_new_era(TxStatus::InBlock).await?; + root_connection + .wait_for_session(starting_session + 3, BlockStatus::Best) + .await; - let payout = get_payout_for_era(&root_connection, active_era); + let payout = root_connection.get_payout_for_era(active_era, None).await; let expected_payout = era_payout((3 * DEFAULT_SESSION_PERIOD) as u64 * MILLISECS_PER_BLOCK).0; payout_within_two_block_delta(expected_payout, payout); @@ -59,11 +65,13 @@ fn force_era_payout(config: &Config) -> anyhow::Result<()> { Ok(()) } -fn normal_era_payout(config: &Config) -> anyhow::Result<()> { - let connection = create_connection(&config.node); +async fn normal_era_payout(config: &Config) -> anyhow::Result<()> { + let root_connection = config.create_root_connection().await; - let active_era = wait_to_second_era(&connection); - let payout = get_payout_for_era(&connection, active_era - 1); + let active_era = wait_to_second_era(&root_connection).await; + let payout = root_connection + .get_payout_for_era(active_era - 1, None) + .await; let expected_payout = era_payout( (DEFAULT_SESSIONS_PER_ERA * DEFAULT_SESSION_PERIOD) as u64 * MILLISECS_PER_BLOCK, ) diff --git a/e2e-tests/src/test/era_validators.rs b/e2e-tests/src/test/era_validators.rs index d5707f67fc..c3b20d8195 100644 --- a/e2e-tests/src/test/era_validators.rs +++ b/e2e-tests/src/test/era_validators.rs @@ -1,51 +1,69 @@ use aleph_client::{ - change_validators, get_current_block_number, get_current_era_non_reserved_validators, - get_current_era_reserved_validators, get_current_session, get_next_era_non_reserved_validators, - get_next_era_reserved_validators, wait_for_finalized_block, wait_for_full_era_completion, - wait_for_next_era, wait_for_session, AccountId, KeyPair, SignedConnection, XtStatus, + pallets::elections::{ElectionsApi, ElectionsSudoApi}, + primitives::CommitteeSeats, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + AccountId, KeyPair, TxStatus, }; -use primitives::CommitteeSeats; +use anyhow::anyhow; use crate::{ - accounts::{account_ids_from_keys, get_validators_keys}, - Config, + accounts::{account_ids_from_keys, get_validators_raw_keys}, + config::{setup_test, Config}, }; fn get_initial_reserved_validators(config: &Config) -> Vec { - get_validators_keys(config)[..2].to_vec() + get_validators_raw_keys(config)[..2] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect() } fn get_initial_non_reserved_validators(config: &Config) -> Vec { - get_validators_keys(config)[2..].to_vec() + get_validators_raw_keys(config)[2..] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect() } fn get_new_reserved_validators(config: &Config) -> Vec { - get_validators_keys(config)[3..].to_vec() + get_validators_raw_keys(config)[3..] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect() } fn get_new_non_reserved_validators(config: &Config) -> Vec { - get_validators_keys(config)[..3].to_vec() + get_validators_raw_keys(config)[..3] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect() } -fn get_current_and_next_era_reserved_validators( - connection: &SignedConnection, +async fn get_current_and_next_era_reserved_validators( + connection: &C, ) -> (Vec, Vec) { - let stored_reserved = get_next_era_reserved_validators(connection); - let current_reserved = get_current_era_reserved_validators(connection); + let stored_reserved = connection.get_next_era_reserved_validators(None).await; + let current_reserved = connection.get_current_era_validators(None).await.reserved; (current_reserved, stored_reserved) } -fn get_current_and_next_era_non_reserved_validators( - connection: &SignedConnection, +async fn get_current_and_next_era_non_reserved_validators( + connection: &C, ) -> (Vec, Vec) { - let stored_non_reserved = get_next_era_non_reserved_validators(connection); - let current_non_reserved = get_current_era_non_reserved_validators(connection); + let stored_non_reserved = connection.get_next_era_non_reserved_validators(None).await; + let current_non_reserved = connection + .get_current_era_validators(None) + .await + .non_reserved; (current_non_reserved, stored_non_reserved) } -pub fn era_validators(config: &Config) -> anyhow::Result<()> { - let connection = config.get_first_signed_connection(); - let root_connection = config.create_root_connection(); +#[tokio::test] +pub async fn era_validators() -> anyhow::Result<()> { + let config = setup_test(); + let connection = config.get_first_signed_connection().await; + let root_connection = config.create_root_connection().await; let initial_reserved_validators_keys = get_initial_reserved_validators(config); let initial_reserved_validators = account_ids_from_keys(&initial_reserved_validators_keys); @@ -60,36 +78,40 @@ pub fn era_validators(config: &Config) -> anyhow::Result<()> { let new_non_reserved_validators_keys = get_new_non_reserved_validators(config); let new_non_reserved_validators = account_ids_from_keys(&new_non_reserved_validators_keys); - change_validators( - &root_connection, - Some(initial_reserved_validators.clone()), - Some(initial_non_reserved_validators.clone()), - Some(CommitteeSeats { - reserved_seats: 2, - non_reserved_seats: 2, - }), - XtStatus::InBlock, - ); - wait_for_full_era_completion(&connection)?; - - change_validators( - &root_connection, - Some(new_reserved_validators.clone()), - Some(new_non_reserved_validators.clone()), - Some(CommitteeSeats { - reserved_seats: 2, - non_reserved_seats: 2, - }), - XtStatus::InBlock, - ); - - let current_session = get_current_session(&connection); - wait_for_session(&connection, current_session + 1)?; - + root_connection + .change_validators( + Some(initial_reserved_validators.clone()), + Some(initial_non_reserved_validators.clone()), + Some(CommitteeSeats { + reserved_seats: 2, + non_reserved_seats: 2, + }), + TxStatus::InBlock, + ) + .await?; + root_connection + .wait_for_n_eras(1, BlockStatus::Finalized) + .await; + + root_connection + .change_validators( + Some(new_reserved_validators.clone()), + Some(new_non_reserved_validators.clone()), + Some(CommitteeSeats { + reserved_seats: 2, + non_reserved_seats: 2, + }), + TxStatus::InBlock, + ) + .await?; + + root_connection + .wait_for_session(1, BlockStatus::Finalized) + .await; let (eras_reserved, stored_reserved) = - get_current_and_next_era_reserved_validators(&connection); + get_current_and_next_era_reserved_validators(&connection).await; let (eras_non_reserved, stored_non_reserved) = - get_current_and_next_era_non_reserved_validators(&connection); + get_current_and_next_era_non_reserved_validators(&connection).await; assert_eq!( stored_reserved, new_reserved_validators, @@ -109,12 +131,12 @@ pub fn era_validators(config: &Config) -> anyhow::Result<()> { "Non-reserved validators set has been updated too early." ); - wait_for_next_era(&connection)?; + connection.wait_for_n_eras(1, BlockStatus::Finalized).await; let (eras_reserved, stored_reserved) = - get_current_and_next_era_reserved_validators(&connection); + get_current_and_next_era_reserved_validators(&connection).await; let (eras_non_reserved, stored_non_reserved) = - get_current_and_next_era_non_reserved_validators(&connection); + get_current_and_next_era_non_reserved_validators(&connection).await; assert_eq!( stored_reserved, new_reserved_validators, @@ -134,8 +156,13 @@ pub fn era_validators(config: &Config) -> anyhow::Result<()> { "Non-reserved validators set is not properly updated in the next era." ); - let block_number = get_current_block_number(&connection); - wait_for_finalized_block(&connection, block_number)?; + let block_number = connection + .get_best_block() + .await? + .ok_or(anyhow!("Failed to retrieve best block number!"))?; + connection + .wait_for_block(|n| n >= block_number, BlockStatus::Finalized) + .await; Ok(()) } diff --git a/e2e-tests/src/test/fee.rs b/e2e-tests/src/test/fee.rs deleted file mode 100644 index 2375ef3efa..0000000000 --- a/e2e-tests/src/test/fee.rs +++ /dev/null @@ -1,125 +0,0 @@ -use aleph_client::{ - balances_transfer, get_next_fee_multiplier, AccountId, BalanceTransfer, CallSystem, FeeInfo, - GetTxInfo, ReadStorage, RootConnection, XtStatus, -}; -use sp_runtime::{traits::One, FixedPointNumber, FixedU128}; - -use crate::{config::Config, transfer::setup_for_transfer}; - -pub fn fee_calculation(config: &Config) -> anyhow::Result<()> { - // An initial transfer is needed to establish the fee multiplier. - let (connection, to) = setup_for_transfer(config); - let root_connection = config.create_root_connection(); - let transfer_value = 1000u128; - balances_transfer(&connection, &to, transfer_value, XtStatus::Finalized); - - // An example transaction for which we will query fee details at different traffic level. - let tx = prepare_transaction(&connection); - - let (actual_multiplier, fee_info) = check_current_fees(&connection, &tx); - assert_no_scaling( - actual_multiplier, - fee_info, - "In the beginning the fee multiplier should be equal to the minimum value", - "In the beginning fees should not be scaled", - ); - - // The target saturation level is set to 25%, so unless we cross this limit, - // the fees should not increase. Note that effectively it is 18.75% of the whole block. - fill_blocks(15, 5, &root_connection); - let (actual_multiplier, fee_info) = check_current_fees(&connection, &tx); - assert_no_scaling( - actual_multiplier, - fee_info, - "When the traffic is low the fee multiplier should not increase", - "When the traffic is low fees should not be scaled", - ); - - // At 60% of occupancy the fees should increase by ~2.4% per block. However, the - // intermediate blocks will be empty, so in order to have reliable reads we have to - // simulate high traffic for a longer time. - fill_blocks(60, 4, &root_connection); - let (actual_multiplier, fee_info) = check_current_fees(&connection, &tx); - assert!( - actual_multiplier.gt(&FixedU128::one()), - "When the traffic is high the fee multiplier should increase", - ); - assert!( - fee_info.unadjusted_weight < fee_info.adjusted_weight, - "When the traffic is high fees should be scaled up", - ); - - let (prev_multiplier, prev_fee_info) = (actual_multiplier, fee_info); - fill_blocks(60, 4, &root_connection); - let (actual_multiplier, fee_info) = check_current_fees(&connection, &tx); - assert!( - actual_multiplier.gt(&prev_multiplier), - "When the traffic is still high the fee multiplier should still increase", - ); - assert!( - prev_fee_info.adjusted_weight < fee_info.adjusted_weight, - "When the traffic is still high fees should be scaled up even more", - ); - - let (prev_multiplier, prev_fee_info) = (actual_multiplier, fee_info); - fill_blocks(0, 8, &root_connection); - let (actual_multiplier, fee_info) = check_current_fees(&connection, &tx); - // This is rather an ethical version of sleep. - assert!( - prev_multiplier.gt(&actual_multiplier), - "When the traffic is low again the fee multiplier should decrease", - ); - assert!( - fee_info.adjusted_weight < prev_fee_info.adjusted_weight, - "When the traffic is low again fees should be scaled down", - ); - - Ok(()) -} - -fn check_current_fees>( - connection: &C, - tx: &C::TransferTx, -) -> (FixedU128, FeeInfo) { - // The storage query will return an u128 value which is the 'inner' representation - // i.e. scaled up by 10^18 (see `implement_fixed!` for `FixedU128). - let actual_multiplier = FixedU128::from_inner(get_next_fee_multiplier(connection)); - let fee_info = connection.get_tx_info(tx); - (actual_multiplier, fee_info) -} - -fn assert_no_scaling( - actual_multiplier: FixedU128, - fee_info: FeeInfo, - error_multiplier_msg: &str, - error_fee_msg: &str, -) { - // We should never drop below 1, in particular when there is no traffic. - let minimum_multiplier = FixedU128::saturating_from_integer(1); - - assert_eq!( - minimum_multiplier, actual_multiplier, - "{} (actual multiplier: {})", - error_multiplier_msg, actual_multiplier - ); - assert_eq!( - fee_info.unadjusted_weight, fee_info.adjusted_weight, - "{} ({} was scaled to {})", - error_fee_msg, fee_info.unadjusted_weight, fee_info.adjusted_weight, - ); -} - -fn prepare_transaction(connection: &C) -> C::TransferTx { - let bytes = [0u8; 32]; - let account = AccountId::from(bytes); - - connection.create_transfer_tx(account, 0u128) -} - -fn fill_blocks(target_ratio: u32, blocks: u32, connection: &RootConnection) { - for _ in 0..blocks { - connection - .fill_block(target_ratio, XtStatus::InBlock) - .unwrap_or_else(|err| panic!("Error while sending a fill_block transation: {:?}", err)); - } -} diff --git a/e2e-tests/src/test/finality_version.rs b/e2e-tests/src/test/finality_version.rs new file mode 100644 index 0000000000..06053e4d75 --- /dev/null +++ b/e2e-tests/src/test/finality_version.rs @@ -0,0 +1,223 @@ +use aleph_client::{ + pallets::{aleph::AlephSudoApi, elections::ElectionsApi, session::SessionApi}, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus}, + AsConnection, TxStatus, +}; +use anyhow::anyhow; +use log::info; +use primitives::{BlockNumber, SessionIndex, Version, LEGACY_FINALITY_VERSION}; + +use crate::{ + config::setup_test, + finality_version::{ + check_finality_version_at_block, check_next_session_finality_version_at_block, + }, +}; + +const UPGRADE_TO_VERSION: u32 = 1; +const UPGRADE_SESSION: SessionIndex = 3; +const UPGRADE_FINALIZATION_WAIT_SESSIONS: u32 = 3; + +const SESSION_WITH_FINALITY_VERSION_CHANGE: SessionIndex = 4; +const SCHEDULING_OFFSET_SESSIONS: f64 = -2.5; +const CHECK_START_BLOCK: BlockNumber = 0; + +/// Simple test that schedules a version upgrade, awaits it, and checks if the node is still finalizing after the planned upgrade session. +#[tokio::test] +pub async fn schedule_version_change() -> anyhow::Result<()> { + let config = setup_test(); + let connection = config.create_root_connection().await; + let test_case_params = config.test_case_params.clone(); + + let current_session = connection.get_session(None).await; + let version_for_upgrade = test_case_params + .upgrade_to_version + .unwrap_or(UPGRADE_TO_VERSION); + let session_for_upgrade = + current_session + test_case_params.upgrade_session.unwrap_or(UPGRADE_SESSION); + let wait_sessions_after_upgrade = test_case_params + .upgrade_finalization_wait_sessions + .unwrap_or(UPGRADE_FINALIZATION_WAIT_SESSIONS); + let session_after_upgrade = session_for_upgrade + wait_sessions_after_upgrade; + + connection + .schedule_finality_version_change( + version_for_upgrade, + session_for_upgrade, + TxStatus::Finalized, + ) + .await?; + connection + .wait_for_session(session_after_upgrade + 1, BlockStatus::Finalized) + .await; + + let block_number = connection + .get_best_block() + .await? + .ok_or(anyhow!("Failed to retrieve best block number!"))?; + connection + .wait_for_block(|n| n >= block_number, BlockStatus::Finalized) + .await; + + Ok(()) +} + +/// A test that schedules a version upgrade which is supposed to fail, awaits it, and checks if finalization stopped. +/// It's up to the user of this test to ensure that version upgrade will actually break finalization (a non-compatible change in protocol, # updated nodes k is f < k < 2/3n). +#[tokio::test] +pub async fn schedule_doomed_version_change_and_verify_finalization_stopped() -> anyhow::Result<()> +{ + let config = setup_test(); + let connection = config.create_root_connection().await; + let test_case_params = config.test_case_params.clone(); + + let current_session = connection.get_session(None).await; + let version_for_upgrade = test_case_params + .upgrade_to_version + .unwrap_or(UPGRADE_TO_VERSION); + let session_for_upgrade = + current_session + test_case_params.upgrade_session.unwrap_or(UPGRADE_SESSION); + let wait_sessions_after_upgrade = test_case_params + .upgrade_finalization_wait_sessions + .unwrap_or(UPGRADE_FINALIZATION_WAIT_SESSIONS); + let session_after_upgrade = session_for_upgrade + wait_sessions_after_upgrade; + + connection + .schedule_finality_version_change( + version_for_upgrade, + session_for_upgrade, + TxStatus::Finalized, + ) + .await?; + connection + .wait_for_session(session_after_upgrade + 1, BlockStatus::Best) + .await; + + let last_finalized_block = session_for_upgrade * connection.get_session_period().await? - 1; + + let finalized_block_head = connection.get_finalized_block_hash().await?; + let finalized_block = connection.get_block_number(finalized_block_head).await?; + + let finalized_block = match finalized_block { + Some(block) => block, + _ => { + return Err(anyhow::Error::msg( + "somehow no block was finalized (even though we saw one)", + )) + } + }; + + // check if finalization is still behind the upgrade-session + assert!(finalized_block <= last_finalized_block); + + Ok(()) +} + +/// Sets up the test. Waits for block 2.5 sessions ahead of `SESSION_WITH_FINALITY_VERSION_CHANGE`. +/// Schedules a finality version change. Waits for all blocks of session +/// `SESSION_WITH_FINALITY_VERSION_CHANGE` to be finalized. Checks the finality version and the +/// finality version for the next session for all the blocks from block `CHECK_START_BLOCK` +/// until the end of session `SESSION_WITH_FINALITY_VERSION_CHANGE`. +#[tokio::test] +pub async fn finality_version_change() -> anyhow::Result<()> { + let config = setup_test(); + let root_connection = config.create_root_connection().await; + let session_period = root_connection.get_session_period().await?; + + let start_point_in_sessions = + SESSION_WITH_FINALITY_VERSION_CHANGE as f64 + SCHEDULING_OFFSET_SESSIONS; + let scheduling_block = (start_point_in_sessions * session_period as f64) as u32; + let end_block = (SESSION_WITH_FINALITY_VERSION_CHANGE + 1) * session_period - 1; + + let first_incoming_finality_version = LEGACY_FINALITY_VERSION as Version + 1; + + info!( + "Finality version check | start block: {} | end block: {}", + CHECK_START_BLOCK, end_block, + ); + info!( + "Version change to be scheduled on block {} for block {}", + scheduling_block, + SESSION_WITH_FINALITY_VERSION_CHANGE * session_period + ); + root_connection + .wait_for_block(|n| n >= scheduling_block, BlockStatus::Finalized) + .await; + + root_connection + .schedule_finality_version_change( + first_incoming_finality_version, + SESSION_WITH_FINALITY_VERSION_CHANGE, + TxStatus::Finalized, + ) + .await?; + + root_connection + .wait_for_block(|n| n >= end_block, BlockStatus::Finalized) + .await; + + let finality_change_block = SESSION_WITH_FINALITY_VERSION_CHANGE * session_period; + let last_block_with_default_next_session_finality_version = + finality_change_block - session_period - 1; + + info!( + "Checking default finality versions. Blocks {} to {}", + CHECK_START_BLOCK, last_block_with_default_next_session_finality_version + ); + for block in CHECK_START_BLOCK..(last_block_with_default_next_session_finality_version + 1) { + check_finality_version_at_block( + root_connection.as_connection(), + block, + LEGACY_FINALITY_VERSION as Version, + ) + .await; + check_next_session_finality_version_at_block( + root_connection.as_connection(), + block, + LEGACY_FINALITY_VERSION as Version, + ) + .await; + } + + info!( + "Checking finality versions for session prior to the change. Blocks {} to {}", + last_block_with_default_next_session_finality_version + 1, + finality_change_block - 1 + ); + for block in (last_block_with_default_next_session_finality_version + 1)..finality_change_block + { + check_finality_version_at_block( + root_connection.as_connection(), + block, + LEGACY_FINALITY_VERSION as Version, + ) + .await; + check_next_session_finality_version_at_block( + root_connection.as_connection(), + block, + first_incoming_finality_version, + ) + .await; + } + info!( + "Checking finality versions once the change has come into effect. Blocks {} to {}", + finality_change_block, end_block + ); + for block in finality_change_block..(end_block + 1) { + check_finality_version_at_block( + root_connection.as_connection(), + block, + first_incoming_finality_version, + ) + .await; + check_next_session_finality_version_at_block( + root_connection.as_connection(), + block, + first_incoming_finality_version, + ) + .await; + } + + Ok(()) +} diff --git a/e2e-tests/src/test/finalization.rs b/e2e-tests/src/test/finalization.rs index bbc9882829..ab01b8d032 100644 --- a/e2e-tests/src/test/finalization.rs +++ b/e2e-tests/src/test/finalization.rs @@ -1,9 +1,27 @@ -use aleph_client::{create_connection, wait_for_finalized_block}; +use aleph_client::{ + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus}, +}; +use anyhow::anyhow; -use crate::config::Config; +use crate::config::setup_test; + +#[tokio::test] +pub async fn finalization() -> anyhow::Result<()> { + let config = setup_test(); + let connection = config.create_root_connection().await; + + let finalized = connection.get_finalized_block_hash().await?; + let finalized_number = connection + .get_block_number(finalized) + .await? + .ok_or(anyhow!( + "Failed to retrieve block number for hash {finalized:?}" + ))?; + + connection + .wait_for_block(|n| n > finalized_number, BlockStatus::Finalized) + .await; -pub fn finalization(config: &Config) -> anyhow::Result<()> { - let connection = create_connection(&config.node); - wait_for_finalized_block(&connection, 1)?; Ok(()) } diff --git a/e2e-tests/src/test/helpers.rs b/e2e-tests/src/test/helpers.rs new file mode 100644 index 0000000000..343e0d6b89 --- /dev/null +++ b/e2e-tests/src/test/helpers.rs @@ -0,0 +1,84 @@ +use std::ops::Deref; + +use aleph_client::{ + pallets::balances::BalanceUserApi, AccountId, Connection, KeyPair, Pair, SignedConnection, + SignedConnectionApi, TxStatus, +}; +use anyhow::Result; +use primitives::Balance; +use rand::Rng; + +use crate::config::Config; + +/// A wrapper around a KeyPair for purposes of converting to an account id in tests. +pub struct KeyPairWrapper(KeyPair); + +impl KeyPairWrapper { + /// Creates a copy of the `connection` signed by `signer` + pub fn sign(&self, conn: &Connection) -> SignedConnection { + SignedConnection::from_connection(conn.clone(), self.clone().0) + } +} + +impl Clone for KeyPairWrapper { + fn clone(&self) -> Self { + Self(KeyPair::new(self.0.signer().clone())) + } +} + +impl Deref for KeyPairWrapper { + type Target = KeyPair; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl From<&KeyPairWrapper> for AccountId { + fn from(keypair: &KeyPairWrapper) -> Self { + keypair.signer().public().into() + } +} + +impl From for AccountId { + fn from(keypair: KeyPairWrapper) -> Self { + (&keypair).into() + } +} + +/// Derives a test account based on a randomized string +pub fn random_account() -> KeyPairWrapper { + KeyPairWrapper(aleph_client::keypair_from_string(&format!( + "//TestAccount/{}", + rand::thread_rng().gen::() + ))) +} + +/// Transfer `amount` from `from` to `to` +pub async fn transfer( + conn: &S, + to: &KeyPair, + amount: Balance, +) -> Result<()> { + conn.transfer(to.signer().public().into(), amount, TxStatus::Finalized) + .await + .map(|_| ()) +} + +/// Returns a number representing the given amount of alephs (adding decimals) +pub fn alephs(basic_unit_amount: Balance) -> Balance { + basic_unit_amount * 1_000_000_000_000 +} + +/// Prepares a `(conn, authority, account)` triple with some money in `account` for fees. +pub async fn basic_test_context( + config: &Config, +) -> Result<(Connection, KeyPairWrapper, KeyPairWrapper)> { + let conn = Connection::new(&config.node).await; + let authority = KeyPairWrapper(aleph_client::keypair_from_string(&config.sudo_seed)); + let account = random_account(); + + transfer(&authority.sign(&conn), &account, alephs(1)).await?; + + Ok((conn, authority, account)) +} diff --git a/e2e-tests/src/test/high_latency.rs b/e2e-tests/src/test/high_latency.rs new file mode 100644 index 0000000000..0c60b0bec8 --- /dev/null +++ b/e2e-tests/src/test/high_latency.rs @@ -0,0 +1,96 @@ +use std::cmp::max; + +use aleph_client::{ + pallets::session::SessionApi, + waiting::{AlephWaiting, BlockStatus}, +}; +use log::info; + +use crate::{config::setup_test, synthetic_network::set_out_latency}; + +const OUT_LATENCY: u64 = 500; + +/// Test if nodes are able to proceed despite high latency. More precisely, it first awaits predefined number of sessions, sets +/// egress-latency for each node using same value (default is 500 milliseconds) and verifies if after it was able to proceed two +/// more sessions. +#[tokio::test] +pub async fn high_out_latency_for_all() -> anyhow::Result<()> { + let config = setup_test(); + let out_latency = config.test_case_params.out_latency.unwrap_or(OUT_LATENCY); + + let connections = config.create_signed_connections().await; + info!("waiting for at least session 3"); + for connection in &connections { + if connection.get_session(None).await < 3 { + connection.wait_for_session(3, BlockStatus::Finalized).await; + } + } + + info!("setting out-latency"); + for synthetic_url in config.synthetic_network_urls() { + info!( + "setting out-latency of node {} to {}", + synthetic_url, out_latency + ); + set_out_latency(out_latency, synthetic_url).await; + } + + let mut max_session = 0; + for connection in &connections { + let node_session = connection.get_session(None).await; + max_session = max(max_session, node_session); + } + info!("current session is {}", max_session); + + for connection in connections { + connection + .wait_for_session(max_session + 2, BlockStatus::Finalized) + .await; + } + Ok(()) +} + +/// Test if nodes are able to proceed despite high latency, but set only for a subset of nodes. More precisely, it first awaits +/// predefined number of sessions, sets egress-latency for 1/3n of nodes using same value (default is 500 milliseconds) and +/// verifies if after it was able to proceed two more sessions. +#[tokio::test] +pub async fn high_out_latency_for_each_quorum() -> anyhow::Result<()> { + let config = setup_test(); + let out_latency = config.test_case_params.out_latency.unwrap_or(OUT_LATENCY); + + let connections = config.create_signed_connections().await; + info!("waiting for at least session 3"); + for connection in &connections { + if connection.get_session(None).await < 3 { + connection.wait_for_session(3, BlockStatus::Finalized).await; + } + } + + info!("setting out-latency"); + for synthetic_url in config + .synthetic_network_urls() + .into_iter() + .take(((config.validator_count - 1) / 3 + 1) as usize) + { + info!( + "setting out-latency of node {} to {}", + synthetic_url, out_latency + ); + set_out_latency(out_latency, synthetic_url).await; + } + + let mut max_session = 0; + for connection in &connections { + let node_session = connection.get_session(None).await; + max_session = max(max_session, node_session); + } + info!("current session is {}", max_session); + + info!("waiting for session {}", max_session + 2); + for connection in connections { + connection + .wait_for_session(max_session + 2, BlockStatus::Finalized) + .await; + } + Ok(()) +} diff --git a/e2e-tests/src/test/mod.rs b/e2e-tests/src/test/mod.rs index 90b1261b06..a181eaf31b 100644 --- a/e2e-tests/src/test/mod.rs +++ b/e2e-tests/src/test/mod.rs @@ -1,4 +1,6 @@ -pub use ban::{ban_automatic, ban_manual, clearing_session_count}; +pub use ban::{ + ban_automatic, ban_manual, ban_threshold, clearing_session_count, permissionless_ban, +}; pub use button_game::{ back_to_the_future, button_game_reset, early_bird_special, marketplace, simple_dex, the_pressiah_cometh, wrapped_azero, @@ -6,8 +8,12 @@ pub use button_game::{ pub use electing_validators::authorities_are_staking; pub use era_payout::era_payouts_calculated_correctly; pub use era_validators::era_validators; -pub use fee::fee_calculation; +pub use finality_version::{ + finality_version_change, schedule_doomed_version_change_and_verify_finalization_stopped, + schedule_version_change, +}; pub use finalization::finalization; +pub use high_latency::{high_out_latency_for_all, high_out_latency_for_each_quorum}; pub use rewards::{ change_stake_and_force_new_era, disable_node, force_new_era, points_basic, points_stake_change, }; @@ -15,19 +21,18 @@ pub use staking::{staking_era_payouts, staking_new_validator}; pub use transfer::token_transfer; pub use treasury::{channeling_fee_and_tip, treasury_access}; pub use utility::batch_transactions; -pub use validators_change::change_validators; pub use validators_rotate::validators_rotate; -pub use version_upgrade::{ - schedule_doomed_version_change_and_verify_finalization_stopped, schedule_version_change, -}; +mod adder; mod ban; mod button_game; mod electing_validators; mod era_payout; mod era_validators; -mod fee; +mod finality_version; mod finalization; +mod helpers; +mod high_latency; mod rewards; mod staking; mod transfer; @@ -35,4 +40,3 @@ mod treasury; mod utility; mod validators_change; mod validators_rotate; -mod version_upgrade; diff --git a/e2e-tests/src/test/rewards.rs b/e2e-tests/src/test/rewards.rs index 4e749e8fd6..cd7d225718 100644 --- a/e2e-tests/src/test/rewards.rs +++ b/e2e-tests/src/test/rewards.rs @@ -1,19 +1,24 @@ use aleph_client::{ - get_active_era, get_current_session, staking_force_new_era, wait_for_full_era_completion, - wait_for_next_era, wait_for_session, AccountId, SignedConnection, XtStatus, + pallets::{ + elections::ElectionsApi, + session::SessionApi, + staking::{StakingApi, StakingSudoApi}, + }, + primitives::{CommitteeSeats, EraValidators}, + utility::{BlocksApi, SessionEraApi}, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + AccountId, SignedConnection, SignedConnectionApi, TxStatus, }; use log::info; -use primitives::{ - staking::MIN_VALIDATOR_BOND, CommitteeSeats, EraIndex, EraValidators, SessionIndex, -}; +use primitives::{staking::MIN_VALIDATOR_BOND, EraIndex, SessionIndex}; use crate::{ + config::setup_test, elections::get_and_test_members_for_session, rewards::{ - check_points, get_era_for_session, reset_validator_keys, set_invalid_keys_for_validator, - setup_validators, validators_bond_extra_stakes, + check_points, reset_validator_keys, set_invalid_keys_for_validator, setup_validators, + validators_bond_extra_stakes, }, - Config, }; // Maximum difference between fractions of total reward that a validator gets. @@ -21,13 +26,15 @@ use crate::{ // retrieved from pallet Staking. const MAX_DIFFERENCE: f64 = 0.07; -pub fn points_basic(config: &Config) -> anyhow::Result<()> { - let (era_validators, committee_size, start_session) = setup_validators(config)?; +#[tokio::test] +pub async fn points_basic() -> anyhow::Result<()> { + let config = setup_test(); + let (era_validators, committee_size, start_session) = setup_validators(config).await?; - let connection = config.get_first_signed_connection(); + let connection = config.get_first_signed_connection().await; - wait_for_next_era(&connection)?; - let end_session = get_current_session(&connection); + connection.wait_for_n_eras(1, BlockStatus::Best).await; + let end_session = connection.get_session(None).await; let members_per_session = committee_size.reserved_seats + committee_size.non_reserved_seats; info!( @@ -36,9 +43,14 @@ pub fn points_basic(config: &Config) -> anyhow::Result<()> { ); for session in start_session..end_session { - let era = get_era_for_session(&connection, session); - let (members_active, members_bench) = - get_and_test_members_for_session(&connection, committee_size, &era_validators, session); + let era = connection.get_active_era_for_session(session).await?; + let (members_active, members_bench) = get_and_test_members_for_session( + &connection, + committee_size.clone(), + &era_validators, + session, + ) + .await?; check_points( &connection, @@ -48,7 +60,8 @@ pub fn points_basic(config: &Config) -> anyhow::Result<()> { members_bench, members_per_session, MAX_DIFFERENCE, - )? + ) + .await? } Ok(()) @@ -56,8 +69,10 @@ pub fn points_basic(config: &Config) -> anyhow::Result<()> { /// Runs a chain, bonds extra stakes to validator accounts and checks that reward points /// are calculated correctly afterward. -pub fn points_stake_change(config: &Config) -> anyhow::Result<()> { - let (era_validators, committee_size, _) = setup_validators(config)?; +#[tokio::test] +pub async fn points_stake_change() -> anyhow::Result<()> { + let config = setup_test(); + let (era_validators, committee_size, _) = setup_validators(config).await?; validators_bond_extra_stakes( config, @@ -68,12 +83,13 @@ pub fn points_stake_change(config: &Config) -> anyhow::Result<()> { 2 * MIN_VALIDATOR_BOND, 0, ], - ); + ) + .await; - let connection = config.get_first_signed_connection(); - let start_session = get_current_session(&connection); - wait_for_next_era(&connection)?; - let end_session = get_current_session(&connection); + let connection = config.get_first_signed_connection().await; + let start_session = connection.get_session(None).await; + connection.wait_for_n_eras(1, BlockStatus::Best).await; + let end_session = connection.get_session(None).await; let members_per_session = committee_size.reserved_seats + committee_size.non_reserved_seats; info!( @@ -82,9 +98,14 @@ pub fn points_stake_change(config: &Config) -> anyhow::Result<()> { ); for session in start_session..end_session { - let era = get_era_for_session(&connection, session); - let (members_active, members_bench) = - get_and_test_members_for_session(&connection, committee_size, &era_validators, session); + let era = connection.get_active_era_for_session(session).await?; + let (members_active, members_bench) = get_and_test_members_for_session( + &connection, + committee_size.clone(), + &era_validators, + session, + ) + .await?; check_points( &connection, @@ -94,7 +115,8 @@ pub fn points_stake_change(config: &Config) -> anyhow::Result<()> { members_bench, members_per_session, MAX_DIFFERENCE, - )? + ) + .await? } Ok(()) @@ -102,19 +124,22 @@ pub fn points_stake_change(config: &Config) -> anyhow::Result<()> { /// Runs a chain, sets invalid session keys for one validator, re-sets the keys to valid ones /// and checks that reward points are calculated correctly afterward. -pub fn disable_node(config: &Config) -> anyhow::Result<()> { - let (era_validators, committee_size, start_session) = setup_validators(config)?; +#[tokio::test] +pub async fn disable_node() -> anyhow::Result<()> { + let config = setup_test(); + let (era_validators, committee_size, start_session) = setup_validators(config).await?; - let root_connection = config.create_root_connection(); - let controller_connection = SignedConnection::new(&config.node, config.node_keys().controller); + let root_connection = config.create_root_connection().await; + let controller_connection = + SignedConnection::new(&config.node, config.node_keys().controller).await; // this should `disable` this node by setting invalid session_keys - set_invalid_keys_for_validator(&controller_connection)?; + set_invalid_keys_for_validator(&controller_connection).await?; // this should `re-enable` this node, i.e. by means of the `rotate keys` procedure - reset_validator_keys(&controller_connection)?; + reset_validator_keys(&controller_connection).await?; - wait_for_full_era_completion(&root_connection)?; - let end_session = get_current_session(&root_connection); + root_connection.wait_for_n_eras(1, BlockStatus::Best).await; + let end_session = root_connection.get_session(None).await; let members_per_session = committee_size.reserved_seats + committee_size.non_reserved_seats; info!( @@ -123,13 +148,14 @@ pub fn disable_node(config: &Config) -> anyhow::Result<()> { ); for session in start_session..end_session { - let era = get_era_for_session(&controller_connection, session); + let era = root_connection.get_active_era_for_session(session).await?; let (members_active, members_bench) = get_and_test_members_for_session( &controller_connection, - committee_size, + committee_size.clone(), &era_validators, session, - ); + ) + .await?; check_points( &controller_connection, @@ -139,7 +165,8 @@ pub fn disable_node(config: &Config) -> anyhow::Result<()> { members_bench, members_per_session, MAX_DIFFERENCE, - )?; + ) + .await?; } Ok(()) @@ -149,20 +176,23 @@ pub fn disable_node(config: &Config) -> anyhow::Result<()> { /// for 3 sessions: 1) immediately following the forcing call, 2) in the subsequent, interim /// session, when the new era has not yet started, 3) in the next session, second one after /// the call, when the new era has already begun. -pub fn force_new_era(config: &Config) -> anyhow::Result<()> { - let (era_validators, committee_size, start_session) = setup_validators(config)?; +#[tokio::test] +pub async fn force_new_era() -> anyhow::Result<()> { + let config = setup_test(); + let (era_validators, committee_size, start_session) = setup_validators(config).await?; - let connection = config.get_first_signed_connection(); - let root_connection = config.create_root_connection(); - let start_era = get_era_for_session(&connection, start_session); + let connection = config.get_first_signed_connection().await; + let root_connection = config.create_root_connection().await; + let start_era = connection.get_active_era_for_session(start_session).await?; info!("Start | era: {}, session: {}", start_era, start_session); - staking_force_new_era(&root_connection, XtStatus::Finalized); - - wait_for_session(&connection, start_session + 2)?; - let active_era = get_active_era(&connection); - let current_session = get_current_session(&connection); + root_connection.force_new_era(TxStatus::Finalized).await?; + connection + .wait_for_session(start_session + 2, BlockStatus::Finalized) + .await; + let active_era = connection.get_active_era(None).await; + let current_session = connection.get_session(None).await; info!( "After ForceNewEra | era: {}, session: {}", active_era, current_session @@ -175,7 +205,8 @@ pub fn force_new_era(config: &Config) -> anyhow::Result<()> { &era_validators, committee_size, MAX_DIFFERENCE, - )?; + ) + .await?; Ok(()) } @@ -185,13 +216,15 @@ pub fn force_new_era(config: &Config) -> anyhow::Result<()> { /// Expected behaviour: until the next (forced) era, rewards are calculated using old stakes, /// and after two sessions (required for a new era to be forced) they are adjusted to the new /// stakes. -pub fn change_stake_and_force_new_era(config: &Config) -> anyhow::Result<()> { - let (era_validators, committee_size, start_session) = setup_validators(config)?; +#[tokio::test] +pub async fn change_stake_and_force_new_era() -> anyhow::Result<()> { + let config = setup_test(); + let (era_validators, committee_size, start_session) = setup_validators(config).await?; - let connection = config.get_first_signed_connection(); - let root_connection = config.create_root_connection(); + let connection = config.get_first_signed_connection().await; + let root_connection = config.create_root_connection().await; - let start_era = get_era_for_session(&connection, start_session); + let start_era = connection.get_active_era_for_session(start_session).await?; info!("Start | era: {}, session: {}", start_era, start_session); validators_bond_extra_stakes( @@ -203,13 +236,16 @@ pub fn change_stake_and_force_new_era(config: &Config) -> anyhow::Result<()> { 0, 4 * MIN_VALIDATOR_BOND, ], - ); - - staking_force_new_era(&root_connection, XtStatus::Finalized); - - wait_for_session(&connection, start_session + 2)?; - let active_era = get_active_era(&connection); - let current_session = get_current_session(&connection); + ) + .await; + + root_connection.force_new_era(TxStatus::Finalized).await?; + let start_session = root_connection.get_session(None).await; + connection + .wait_for_session(start_session + 2, BlockStatus::Finalized) + .await; + let active_era = connection.get_active_era(None).await; + let current_session = connection.get_session(None).await; info!( "After ForceNewEra | era: {}, session: {}", active_era, current_session @@ -222,12 +258,15 @@ pub fn change_stake_and_force_new_era(config: &Config) -> anyhow::Result<()> { &era_validators, committee_size, MAX_DIFFERENCE, - )?; + ) + .await?; Ok(()) } -fn check_points_after_force_new_era( - connection: &SignedConnection, +async fn check_points_after_force_new_era< + S: SignedConnectionApi + BlocksApi + ElectionsApi + AlephWaiting + StakingApi, +>( + connection: &S, start_session: SessionIndex, start_era: EraIndex, era_validators: &EraValidators, @@ -248,8 +287,13 @@ fn check_points_after_force_new_era( era_to_check, session_to_check ); - let (members_active, members_bench) = - get_and_test_members_for_session(connection, seats, era_validators, session_to_check); + let (members_active, members_bench) = get_and_test_members_for_session( + connection, + seats.clone(), + era_validators, + session_to_check, + ) + .await?; check_points( connection, @@ -259,7 +303,8 @@ fn check_points_after_force_new_era( members_bench, seats.reserved_seats + seats.non_reserved_seats, max_relative_difference, - )?; + ) + .await?; } Ok(()) } diff --git a/e2e-tests/src/test/staking.rs b/e2e-tests/src/test/staking.rs index 3ed7419fe1..0e9a68ccab 100644 --- a/e2e-tests/src/test/staking.rs +++ b/e2e-tests/src/test/staking.rs @@ -1,24 +1,28 @@ use aleph_client::{ - balances_batch_transfer, change_validators, get_current_session, keypair_from_string, - payout_stakers_and_assert_locked_balance, rotate_keys, set_keys, staking_bond, staking_bonded, - staking_ledger, staking_multi_bond, staking_nominate, staking_validate, - wait_for_full_era_completion, wait_for_session, AccountId, KeyPair, SignedConnection, - StakingLedger, XtStatus, + account_from_keypair, + api::runtime_types::sp_core::bounded::bounded_vec::BoundedVec, + keypair_from_string, + pallet_staking::StakingLedger, + pallets::{ + author::AuthorRpc, + balances::{BalanceApi, BalanceUserApi, BalanceUserBatchExtApi}, + elections::ElectionsSudoApi, + session::SessionUserApi, + staking::{StakingApi, StakingUserApi}, + }, + primitives::CommitteeSeats, + waiting::{BlockStatus, WaitingExt}, + AccountId, KeyPair, Pair, SignedConnection, SignedConnectionApi, TxStatus, }; -use frame_support::BoundedVec; use log::info; use primitives::{ staking::{MIN_NOMINATOR_BOND, MIN_VALIDATOR_BOND}, - CommitteeSeats, TOKEN, + Balance, BlockNumber, TOKEN, }; -use rayon::iter::{ - IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator, -}; -use sp_core::Pair; use crate::{ accounts::{account_ids_from_keys, accounts_seeds_to_keys, get_validators_seeds}, - config::Config, + config::{setup_test, Config}, }; fn get_validator_stashes_key_pairs(config: &Config) -> (Vec, Vec) { @@ -38,44 +42,57 @@ fn get_validator_stashes_key_pairs(config: &Config) -> (Vec, Vec anyhow::Result<()> { +#[tokio::test] +pub async fn staking_era_payouts() -> anyhow::Result<()> { + let config = setup_test(); let (stashes_accounts_key_pairs, validator_accounts) = get_validator_stashes_key_pairs(config); let node = &config.node; - let connection = config.get_first_signed_connection(); + let connection = config.get_first_signed_connection().await; let stashes_accounts = account_ids_from_keys(&stashes_accounts_key_pairs); - balances_batch_transfer(&connection, stashes_accounts, MIN_NOMINATOR_BOND + TOKEN); - staking_multi_bond(node, &stashes_accounts_key_pairs, MIN_NOMINATOR_BOND); + connection + .batch_transfer( + &stashes_accounts, + MIN_NOMINATOR_BOND + TOKEN, + TxStatus::InBlock, + ) + .await?; + multi_bond(node, &stashes_accounts_key_pairs, MIN_NOMINATOR_BOND).await; - stashes_accounts_key_pairs - .par_iter() - .zip(validator_accounts.par_iter()) - .for_each(|(nominator, nominee)| { - let connection = SignedConnection::new(node, nominator.clone()); - let nominee_account_id = AccountId::from(nominee.public()); - staking_nominate(&connection, &nominee_account_id) - }); + for (nominator, nominee) in stashes_accounts_key_pairs + .into_iter() + .zip(validator_accounts) + { + let connection = SignedConnection::new(node, nominator).await; + let nominee_account_id = AccountId::from(nominee.signer().public()); + connection + .nominate(nominee_account_id, TxStatus::InBlock) + .await?; + } // All the above calls influence the next era, so we need to wait that it passes. // this test can be speeded up by forcing new era twice, and waiting 4 sessions in total instead of almost 10 sessions - let current_era = wait_for_full_era_completion(&connection)?; + connection.wait_for_n_eras(2, BlockStatus::Finalized).await; + let current_era = connection.get_current_era(None).await; info!( "Era {} started, claiming rewards for era {}", current_era, current_era - 1 ); - validator_accounts.into_par_iter().for_each(|key_pair| { - let stash_connection = SignedConnection::new(node, key_pair.clone()); - let stash_account = AccountId::from(key_pair.public()); + let (_, validator_accounts) = get_validator_stashes_key_pairs(config); + for key_pair in validator_accounts { + let stash_account = AccountId::from(key_pair.signer().public()); + let stash_connection = SignedConnection::new(node, key_pair).await; payout_stakers_and_assert_locked_balance( &stash_connection, &[stash_account.clone()], &stash_account, current_era, ) - }); + .await; + } Ok(()) } @@ -89,107 +106,113 @@ pub fn staking_era_payouts(config: &Config) -> anyhow::Result<()> { // 7. add 4th validator which is the new stash account // 8. wait for next era // 9. claim rewards for the stash account -pub fn staking_new_validator(config: &Config) -> anyhow::Result<()> { +#[tokio::test] +pub async fn staking_new_validator() -> anyhow::Result<()> { + let config = setup_test(); let controller_seed = "//Controller"; let controller = keypair_from_string(controller_seed); - let controller_account = AccountId::from(controller.public()); + let controller_account = AccountId::from(controller.signer().public()); let stash_seed = "//Stash"; let stash = keypair_from_string(stash_seed); - let stash_account = AccountId::from(stash.public()); + let stash_account = AccountId::from(stash.signer().public()); let (_, mut validator_accounts) = get_validator_stashes_key_pairs(config); let node = &config.node; let _ = validator_accounts.remove(0); // signer of this connection is sudo, the same node which in this test is used as the new one // it's essential since keys from rotate_keys() needs to be run against that node - let root_connection = config.create_root_connection(); - - change_validators( - &root_connection, - Some(account_ids_from_keys(&validator_accounts)), - Some(vec![]), - Some(CommitteeSeats { - reserved_seats: 4, - non_reserved_seats: 0, - }), - XtStatus::InBlock, - ); + let root_connection = config.create_root_connection().await; - let current_session = get_current_session(&root_connection); + root_connection + .change_validators( + Some(account_ids_from_keys(&validator_accounts)), + Some(vec![]), + Some(CommitteeSeats { + reserved_seats: 4, + non_reserved_seats: 0, + }), + TxStatus::InBlock, + ) + .await?; - let _ = wait_for_session(&root_connection, current_session + 2)?; + root_connection + .wait_for_n_sessions(2, BlockStatus::Best) + .await; // to cover tx fees as we need a bit more than VALIDATOR_STAKE - balances_batch_transfer( - &root_connection.as_signed(), - vec![stash_account.clone()], - MIN_VALIDATOR_BOND + TOKEN, - ); + root_connection + .transfer( + stash_account.clone(), + MIN_VALIDATOR_BOND + TOKEN, + TxStatus::InBlock, + ) + .await?; // to cover txs fees - balances_batch_transfer( - &root_connection.as_signed(), - vec![controller_account.clone()], - TOKEN, - ); + root_connection + .transfer(controller_account.clone(), TOKEN, TxStatus::InBlock) + .await?; - let stash_connection = SignedConnection::new(node, stash.clone()); + let stash_connection = SignedConnection::new(node, KeyPair::new(stash.signer().clone())).await; - staking_bond( - &stash_connection, - MIN_VALIDATOR_BOND, - &controller_account, - XtStatus::InBlock, - ); - let bonded_controller_account = staking_bonded(&root_connection, &stash).unwrap_or_else(|| { - panic!( - "Expected that stash account {} is bonded to some controller!", - &stash_account + stash_connection + .bond( + MIN_VALIDATOR_BOND, + controller_account.clone(), + TxStatus::InBlock, ) - }); + .await?; + + let bonded_controller_account = root_connection + .get_bonded(stash_account.clone(), None) + .await + .expect("should be bonded to smth"); assert_eq!( bonded_controller_account, controller_account, "Expected that stash account {} is bonded to the controller account {}, got {} instead!", &stash_account, &controller_account, &bonded_controller_account ); - let validator_keys = rotate_keys(&root_connection).expect("Failed to retrieve keys from chain"); - let controller_connection = SignedConnection::new(node, controller.clone()); - set_keys(&controller_connection, validator_keys, XtStatus::InBlock); - - // to be elected in next era instead of expected validator_account_id - staking_validate(&controller_connection, 10, XtStatus::InBlock); - - let ledger = staking_ledger(&root_connection, &controller); - assert!( - ledger.is_some(), - "Expected controller {} configuration to be non empty", - controller_account - ); - let ledger = ledger.unwrap(); + let validator_keys = root_connection.author_rotate_keys().await?; + let controller_connection = + SignedConnection::new(node, KeyPair::new(controller.signer().clone())).await; + controller_connection + .set_keys(validator_keys, TxStatus::InBlock) + .await?; + controller_connection + .validate(10, TxStatus::InBlock) + .await?; + let ledger = controller_connection + .get_ledger(controller_account, None) + .await; assert_eq!( ledger, StakingLedger { stash: stash_account.clone(), total: MIN_VALIDATOR_BOND, active: MIN_VALIDATOR_BOND, - unlocking: BoundedVec::try_from(vec![]).unwrap(), + unlocking: BoundedVec(vec![]), + // since era is 3 sessions, validate is done in the first block of 2nd session, + // that is already after elections has been done for 1st era + claimed_rewards: BoundedVec(vec![0]), } ); validator_accounts.push(stash); - change_validators( - &root_connection, - Some(account_ids_from_keys(&validator_accounts)), - Some(vec![]), - Some(CommitteeSeats { - reserved_seats: 5, - non_reserved_seats: 0, - }), - XtStatus::InBlock, - ); - let current_session = get_current_session(&root_connection); - let _ = wait_for_session(&root_connection, current_session + 2)?; - - let current_era = wait_for_full_era_completion(&root_connection)?; + root_connection + .change_validators( + Some(account_ids_from_keys(&validator_accounts)), + Some(vec![]), + Some(CommitteeSeats { + reserved_seats: 5, + non_reserved_seats: 0, + }), + TxStatus::InBlock, + ) + .await?; + root_connection + .wait_for_n_sessions(2, BlockStatus::Best) + .await; + root_connection.wait_for_n_eras(2, BlockStatus::Best).await; + let current_era = root_connection.get_current_era(None).await; info!( "Era {} started, claiming rewards for era {}", current_era, @@ -201,7 +224,45 @@ pub fn staking_new_validator(config: &Config) -> anyhow::Result<()> { &[stash_account.clone()], &stash_account, current_era, - ); + ) + .await; Ok(()) } + +pub async fn multi_bond(node: &str, bonders: &[KeyPair], stake: Balance) { + for bonder in bonders { + let controller_account = account_from_keypair(bonder.signer()); + let connection = SignedConnection::new(node, KeyPair::new(bonder.signer().clone())).await; + connection + .bond(stake, controller_account, TxStatus::InBlock) + .await + .unwrap(); + } +} + +async fn payout_stakers_and_assert_locked_balance( + stash_connection: &S, + accounts_to_check_balance: &[AccountId], + stash_account: &AccountId, + era: BlockNumber, +) { + let locked_stash_balances_before_payout = stash_connection + .locks(accounts_to_check_balance, None) + .await; + stash_connection + .payout_stakers(stash_account.clone(), era - 1, TxStatus::Finalized) + .await + .unwrap(); + let locked_stash_balances_after_payout = stash_connection + .locks(accounts_to_check_balance, None) + .await; + locked_stash_balances_before_payout.iter() + .zip(locked_stash_balances_after_payout.iter()) + .zip(accounts_to_check_balance.iter()) + .for_each(|((balances_before, balances_after), account_id)| { + assert!(balances_after[0].amount > balances_before[0].amount, + "Expected payout to be positive in locked balance for account {}. Balance before: {}, balance after: {}", + account_id, balances_before[0].amount, balances_after[0].amount); + }); +} diff --git a/e2e-tests/src/test/transfer.rs b/e2e-tests/src/test/transfer.rs index 9cb53ab0d9..c0c29a04a8 100644 --- a/e2e-tests/src/test/transfer.rs +++ b/e2e-tests/src/test/transfer.rs @@ -1,18 +1,25 @@ -use aleph_client::{balances_transfer, get_free_balance, XtStatus}; +use aleph_client::{ + pallets::{balances::BalanceUserApi, system::SystemApi}, + TxStatus, +}; use log::info; -use crate::{config::Config, transfer::setup_for_transfer}; +use crate::{config::setup_test, transfer::setup_for_transfer}; -pub fn token_transfer(config: &Config) -> anyhow::Result<()> { - let (connection, to) = setup_for_transfer(config); +#[tokio::test] +pub async fn token_transfer() -> anyhow::Result<()> { + let config = setup_test(); + let (connection, to) = setup_for_transfer(config).await; - let balance_before = get_free_balance(&connection, &to); + let balance_before = connection.get_free_balance(to.clone(), None).await; info!("[+] Account {} balance before tx: {}", to, balance_before); - let transfer_value = 1000u128; - balances_transfer(&connection, &to, transfer_value, XtStatus::Finalized); + let transfer_value = 1000; + connection + .transfer(to.clone(), transfer_value, TxStatus::Finalized) + .await?; - let balance_after = get_free_balance(&connection, &to); + let balance_after = connection.get_free_balance(to.clone(), None).await; info!("[+] Account {} balance after tx: {}", to, balance_after); assert_eq!( diff --git a/e2e-tests/src/test/treasury.rs b/e2e-tests/src/test/treasury.rs index b60e2b512f..57f53df9d6 100644 --- a/e2e-tests/src/test/treasury.rs +++ b/e2e-tests/src/test/treasury.rs @@ -1,23 +1,29 @@ use aleph_client::{ - account_from_keypair, approve_treasury_proposal, get_free_balance, make_treasury_proposal, - reject_treasury_proposal, staking_treasury_payout, total_issuance, treasury_account, - treasury_proposals_counter, Balance, BalanceTransfer, GetTxInfo, ReadStorage, RootConnection, - SignedConnection, XtStatus, + account_from_keypair, + api::{transaction_payment::events::TransactionFeePaid, treasury::events::Rejected}, + pallets::{ + balances::{BalanceApi, BalanceUserApi}, + fee::TransactionPaymentApi, + system::SystemApi, + treasury::{TreasureApiExt, TreasuryApi, TreasuryUserApi}, + }, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus}, + AccountId, ConnectionApi, KeyPair, RootConnection, SignedConnection, TxStatus, }; use log::info; +use primitives::Balance; -use crate::{ - accounts::{get_sudo_key, get_validators_keys}, - config::Config, - transfer::setup_for_tipped_transfer, -}; +use crate::{accounts::get_validators_raw_keys, config::setup_test, transfer::setup_for_transfer}; /// Returns current treasury free funds and total issuance. /// /// Takes two storage reads. -fn balance_info(connection: &C) -> (Balance, Balance) { - let treasury_balance = get_free_balance(connection, &treasury_account()); - let issuance = total_issuance(connection); +async fn balance_info(connection: &C) -> (Balance, Balance) { + let treasury_balance = connection + .get_free_balance(connection.treasury_account().await, None) + .await; + let issuance = connection.total_issuance(None).await; info!( "[+] Treasury balance: {}. Total issuance: {}.", treasury_balance, issuance @@ -26,31 +32,28 @@ fn balance_info(connection: &C) -> (Balance, Balance) { (treasury_balance, issuance) } -pub fn channeling_fee_and_tip(config: &Config) -> anyhow::Result<()> { +#[tokio::test] +pub async fn channeling_fee_and_tip() -> anyhow::Result<()> { + let config = setup_test(); let (transfer_amount, tip) = (1_000u128, 10_000u128); - let (connection, to) = setup_for_tipped_transfer(config, tip); + let (connection, to) = setup_for_transfer(config).await; - let (treasury_balance_before, issuance_before) = balance_info(&connection); - let tx = connection.create_transfer_tx(to, transfer_amount); - connection.transfer(tx.clone(), XtStatus::Finalized)?; - let (treasury_balance_after, issuance_after) = balance_info(&connection); + let (treasury_balance_before, issuance_before) = balance_info(&connection).await; + let possible_treasury_gain_from_staking = connection.possible_treasury_payout().await?; - let possible_treasury_gain_from_staking = staking_treasury_payout(&connection); + let (fee, _) = current_fees(&connection, to, Some(tip), transfer_amount).await; + let (treasury_balance_after, issuance_after) = balance_info(&connection).await; check_issuance( possible_treasury_gain_from_staking, issuance_before, issuance_after, ); - - let fee_info = connection.get_tx_info(&tx); - let fee = fee_info.fee_without_weight + fee_info.adjusted_weight; check_treasury_balance( possible_treasury_gain_from_staking, treasury_balance_before, treasury_balance_after, fee, - tip, ); Ok(()) @@ -82,33 +85,37 @@ fn check_treasury_balance( treasury_balance_before: Balance, treasury_balance_after: Balance, fee: Balance, - tip: Balance, ) { - let treasury_balance_diff = treasury_balance_after - (treasury_balance_before + fee + tip); + let treasury_balance_diff = treasury_balance_after - (treasury_balance_before + fee); assert_eq!( treasury_balance_diff % possibly_treasury_gain_from_staking, 0, - "Incorrect amount was channeled to the treasury: before = {}, after = {}, fee = {}, tip = \ - {}. We can be different only as multiples of staking treasury reward {}, but the remainder \ + "Incorrect amount was channeled to the treasury: before = {}, after = {}, fee = {}. \ + We can be different only as multiples of staking treasury reward {}, but the remainder \ is {}", treasury_balance_before, treasury_balance_after, fee, - tip, possibly_treasury_gain_from_staking, treasury_balance_diff % possibly_treasury_gain_from_staking, ); } -pub fn treasury_access(config: &Config) -> anyhow::Result<()> { - let proposer = get_validators_keys(config)[0].clone(); - let beneficiary = account_from_keypair(&proposer); - let connection = SignedConnection::new(&config.node, proposer); - - let proposals_counter_before = treasury_proposals_counter(&connection); - make_treasury_proposal(&connection, 10u128, &beneficiary)?; - make_treasury_proposal(&connection, 100u128, &beneficiary)?; - let proposals_counter_after = treasury_proposals_counter(&connection); +#[tokio::test] +pub async fn treasury_access() -> anyhow::Result<()> { + let config = setup_test(); + let proposer = KeyPair::new(get_validators_raw_keys(config)[0].clone()); + let beneficiary = account_from_keypair(proposer.signer()); + let connection = SignedConnection::new(&config.node, proposer).await; + + let proposals_counter_before = connection.proposals_count(None).await.unwrap_or_default(); + connection + .propose_spend(10, beneficiary.clone(), TxStatus::InBlock) + .await?; + connection + .propose_spend(100, beneficiary.clone(), TxStatus::InBlock) + .await?; + let proposals_counter_after = connection.proposals_count(None).await.unwrap_or_default(); assert_eq!( proposals_counter_before + 2, @@ -116,11 +123,59 @@ pub fn treasury_access(config: &Config) -> anyhow::Result<()> { "Proposal has not been created" ); - let sudo = get_sudo_key(config); - let connection = RootConnection::new(&config.node, sudo); + let root_connection = config.create_root_connection().await; + + approve_treasury_proposal(&root_connection, proposals_counter_after - 2).await?; + reject_treasury_proposal(&root_connection, proposals_counter_after - 1).await?; + + Ok(()) +} + +async fn approve_treasury_proposal(connection: &RootConnection, id: u32) -> anyhow::Result<()> { + connection.approve(id, TxStatus::Finalized).await?; + let approvals = connection.approvals(None).await; + assert!(approvals.contains(&id)); + + Ok(()) +} - approve_treasury_proposal(&connection, proposals_counter_after - 2)?; - reject_treasury_proposal(&connection, proposals_counter_after - 1)?; +async fn reject_treasury_proposal(connection: &RootConnection, id: u32) -> anyhow::Result<()> { + let handle_connection = connection.clone(); + let handle = tokio::spawn(async move { + handle_connection + .wait_for_event( + |e: &Rejected| e.proposal_index == id, + BlockStatus::Finalized, + ) + .await; + }); + connection.reject(id, TxStatus::Finalized).await?; + handle.await?; Ok(()) } + +async fn current_fees( + connection: &SignedConnection, + to: AccountId, + tip: Option, + transfer_value: Balance, +) -> (Balance, u128) { + let actual_multiplier = connection.get_next_fee_multiplier(None).await; + + let tx_info = match tip { + None => connection.transfer(to, transfer_value, TxStatus::Finalized), + Some(tip) => connection.transfer_with_tip(to, transfer_value, tip, TxStatus::Finalized), + } + .await + .unwrap(); + + let events = connection.get_tx_events(tx_info).await.unwrap(); + let event = events.find_first::().unwrap().unwrap(); + + let fee = event.actual_fee; + + info!("fee payed: {}", fee); + + (fee, actual_multiplier) +} diff --git a/e2e-tests/src/test/utility.rs b/e2e-tests/src/test/utility.rs index 0a38c2a710..c675dc32c3 100644 --- a/e2e-tests/src/test/utility.rs +++ b/e2e-tests/src/test/utility.rs @@ -1,26 +1,20 @@ use std::iter::repeat; -use aleph_client::{BalanceTransfer, BatchTransactions, XtStatus}; -use log::info; +use aleph_client::{pallets::balances::BalanceUserBatchExtApi, TxStatus}; -use crate::{config::Config, transfer::setup_for_transfer}; +use crate::{config::setup_test, transfer::setup_for_transfer}; -pub fn batch_transactions(config: &Config) -> anyhow::Result<()> { +#[tokio::test] +pub async fn batch_transactions() -> anyhow::Result<()> { + let config = setup_test(); const NUMBER_OF_TRANSACTIONS: usize = 100; - let (connection, to) = setup_for_transfer(config); + let (connection, to) = setup_for_transfer(config).await; - let call = connection.create_transfer_tx(to, 1000u128); - let transactions = repeat(&call).take(NUMBER_OF_TRANSACTIONS); - - let finalized_block_hash = connection - .batch_and_send_transactions(transactions, XtStatus::Finalized) - .unwrap_or_else(|err| panic!("error while sending a batch of txs: {:?}", err)) - .expect("Could not get tx hash"); - info!( - "[+] A batch of {} transactions was included in finalized {} block.", - NUMBER_OF_TRANSACTIONS, finalized_block_hash - ); + let accounts: Vec<_> = repeat(to.clone()).take(NUMBER_OF_TRANSACTIONS).collect(); + connection + .batch_transfer(&accounts, 1000, TxStatus::Finalized) + .await?; Ok(()) } diff --git a/e2e-tests/src/test/validators_change.rs b/e2e-tests/src/test/validators_change.rs index 824931d4ff..187142c3da 100644 --- a/e2e-tests/src/test/validators_change.rs +++ b/e2e-tests/src/test/validators_change.rs @@ -1,65 +1,63 @@ use aleph_client::{ - get_current_block_number, get_next_era_committee_seats, get_next_era_non_reserved_validators, - get_next_era_reserved_validators, wait_for_event, wait_for_finalized_block, AccountId, - XtStatus, + api::elections::events::ChangeValidators, + pallets::elections::{ElectionsApi, ElectionsSudoApi}, + primitives::CommitteeSeats, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus}, + AccountId, Pair, TxStatus, }; -use codec::Decode; +use anyhow::anyhow; use log::info; -use primitives::CommitteeSeats; -use sp_core::Pair; -use crate::{accounts::get_validators_keys, config::Config}; +use crate::{accounts::get_validators_keys, config::setup_test}; + +#[tokio::test] +pub async fn change_validators() -> anyhow::Result<()> { + let config = setup_test(); -pub fn change_validators(config: &Config) -> anyhow::Result<()> { let accounts = get_validators_keys(config); - let connection = config.create_root_connection(); + let connection = config.create_root_connection().await; - let reserved_before = get_next_era_reserved_validators(&connection); - let non_reserved_before = get_next_era_non_reserved_validators(&connection); - let committee_size_before = get_next_era_committee_seats(&connection); + let reserved_before = connection.get_next_era_reserved_validators(None).await; + let non_reserved_before = connection.get_next_era_non_reserved_validators(None).await; + let committee_size_before = connection.get_next_era_committee_seats(None).await; info!( "[+] state before tx: reserved: {:#?}, non_reserved: {:#?}, committee_size: {:#?}", reserved_before, non_reserved_before, committee_size_before ); - let new_validators: Vec = accounts.iter().map(|pair| pair.public().into()).collect(); - aleph_client::change_validators( - &connection, - Some(new_validators[0..2].to_vec()), - Some(new_validators[2..].to_vec()), - Some(CommitteeSeats { - reserved_seats: 2, - non_reserved_seats: 2, - }), - XtStatus::InBlock, - ); + let new_validators: Vec = accounts + .iter() + .map(|pair| pair.signer().public().into()) + .collect(); + connection + .change_validators( + Some(new_validators[0..2].to_vec()), + Some(new_validators[2..].to_vec()), + Some(CommitteeSeats { + reserved_seats: 2, + non_reserved_seats: 2, + }), + TxStatus::InBlock, + ) + .await?; - #[derive(Debug, Decode, Clone)] - struct NewValidatorsEvent { - reserved: Vec, - non_reserved: Vec, - committee_size: CommitteeSeats, - } - wait_for_event( - &connection, - ("Elections", "ChangeValidators"), - |e: NewValidatorsEvent| { - info!("[+] NewValidatorsEvent: reserved: {:#?}, non_reserved: {:#?}, committee_size: {:#?}", e.reserved, e.non_reserved, e.non_reserved); + connection.wait_for_event(|e: &ChangeValidators| { + info!("[+] NewValidatorsEvent: reserved: {:#?}, non_reserved: {:#?}, committee_size: {:#?}", e.0, e.1, e.2); - e.reserved == new_validators[0..2] - && e.non_reserved == new_validators[2..] - && e.committee_size - == CommitteeSeats { - reserved_seats: 2, - non_reserved_seats: 2, - } - }, - )?; + e.0 == new_validators[0..2] + && e.1 == new_validators[2..] + && e.2 + == CommitteeSeats { + reserved_seats: 2, + non_reserved_seats: 2, + } + }, BlockStatus::Best).await; - let reserved_after = get_next_era_reserved_validators(&connection); - let non_reserved_after = get_next_era_non_reserved_validators(&connection); - let committee_size_after = get_next_era_committee_seats(&connection); + let reserved_after = connection.get_next_era_reserved_validators(None).await; + let non_reserved_after = connection.get_next_era_non_reserved_validators(None).await; + let committee_size_after = connection.get_next_era_committee_seats(None).await; info!( "[+] state before tx: reserved: {:#?}, non_reserved: {:#?}, committee_size: {:#?}", @@ -76,8 +74,13 @@ pub fn change_validators(config: &Config) -> anyhow::Result<()> { committee_size_after ); - let block_number = get_current_block_number(&connection); - wait_for_finalized_block(&connection, block_number)?; + let block_number = connection + .get_best_block() + .await? + .ok_or(anyhow!("Failed to retrieve best block!"))?; + connection + .wait_for_block(|n| n >= block_number, BlockStatus::Finalized) + .await; Ok(()) } diff --git a/e2e-tests/src/test/validators_rotate.rs b/e2e-tests/src/test/validators_rotate.rs index e8d3f5a555..8e55cc67b4 100644 --- a/e2e-tests/src/test/validators_rotate.rs +++ b/e2e-tests/src/test/validators_rotate.rs @@ -1,21 +1,26 @@ use std::collections::HashMap; use aleph_client::{ - change_validators, get_current_block_number, get_current_session, get_validators_for_session, - wait_for_finalized_block, wait_for_full_era_completion, wait_for_session, XtStatus, + pallets::{elections::ElectionsSudoApi, session::SessionApi}, + primitives::CommitteeSeats, + utility::BlocksApi, + waiting::{AlephWaiting, BlockStatus, WaitingExt}, + TxStatus, }; -use primitives::CommitteeSeats; +use anyhow::anyhow; use crate::{ - accounts::account_ids_from_keys, elections::get_members_subset_for_session, - validators::get_test_validators, Config, + accounts::account_ids_from_keys, config::setup_test, elections::get_members_subset_for_session, + validators::get_test_validators, }; const TEST_LENGTH: u32 = 5; -pub fn validators_rotate(config: &Config) -> anyhow::Result<()> { - let connection = config.get_first_signed_connection(); - let root_connection = config.create_root_connection(); +#[tokio::test] +pub async fn validators_rotate() -> anyhow::Result<()> { + let config = setup_test(); + let connection = config.get_first_signed_connection().await; + let root_connection = config.create_root_connection().await; let era_validators = get_test_validators(config); let reserved_validators = account_ids_from_keys(&era_validators.reserved); @@ -27,22 +32,28 @@ pub fn validators_rotate(config: &Config) -> anyhow::Result<()> { non_reserved_seats: 2, }; - change_validators( - &root_connection, - Some(reserved_validators.clone()), - Some(non_reserved_validators.clone()), - Some(seats), - XtStatus::InBlock, - ); - wait_for_full_era_completion(&connection)?; - - let current_session = get_current_session(&connection); - wait_for_session(&connection, current_session + TEST_LENGTH)?; + root_connection + .change_validators( + Some(reserved_validators.clone()), + Some(non_reserved_validators.clone()), + Some(seats.clone()), + TxStatus::InBlock, + ) + .await?; + root_connection + .wait_for_n_eras(2, BlockStatus::Finalized) + .await; + let current_session = root_connection.get_session(None).await; + root_connection + .wait_for_n_sessions(TEST_LENGTH, BlockStatus::Finalized) + .await; let mut non_reserved_count = HashMap::new(); for session in current_session..current_session + TEST_LENGTH { - let elected = get_validators_for_session(&connection, session); + let elected = connection + .get_validators(connection.first_block_of_session(session).await?) + .await; let non_reserved = get_members_subset_for_session( seats.non_reserved_seats, @@ -88,8 +99,13 @@ pub fn validators_rotate(config: &Config) -> anyhow::Result<()> { let min_elected = non_reserved_count.values().min().unwrap(); assert!(max_elected - min_elected <= 1); - let block_number = get_current_block_number(&connection); - wait_for_finalized_block(&connection, block_number)?; + let block_number = connection + .get_best_block() + .await? + .ok_or(anyhow!("Failed to retrieve best block number!"))?; + connection + .wait_for_block(|n| n >= block_number, BlockStatus::Finalized) + .await; Ok(()) } diff --git a/e2e-tests/src/test/version_upgrade.rs b/e2e-tests/src/test/version_upgrade.rs deleted file mode 100644 index 1dbd3a5193..0000000000 --- a/e2e-tests/src/test/version_upgrade.rs +++ /dev/null @@ -1,81 +0,0 @@ -use aleph_client::{ - get_current_session, get_session_period, schedule_upgrade, wait_for_at_least_session, - wait_for_finalized_block, AnyConnection, -}; -use primitives::{Header, SessionIndex}; - -use crate::Config; - -const UPGRADE_TO_VERSION: u32 = 1; - -const UPGRADE_SESSION: SessionIndex = 3; - -const UPGRADE_FINALIZATION_WAIT_SESSIONS: u32 = 3; - -// Simple test that schedules a version upgrade, awaits it, and checks if node is still finalizing after planned upgrade session. -pub fn schedule_version_change(config: &Config) -> anyhow::Result<()> { - let connection = config.create_root_connection(); - let test_case_params = config.test_case_params.clone(); - - let current_session = get_current_session(&connection); - let version_for_upgrade = test_case_params - .upgrade_to_version - .unwrap_or(UPGRADE_TO_VERSION); - let session_for_upgrade = - current_session + test_case_params.upgrade_session.unwrap_or(UPGRADE_SESSION); - let wait_sessions_after_upgrade = test_case_params - .upgrade_finalization_wait_sessions - .unwrap_or(UPGRADE_FINALIZATION_WAIT_SESSIONS); - let session_after_upgrade = session_for_upgrade + wait_sessions_after_upgrade; - - schedule_upgrade(&connection, version_for_upgrade, session_for_upgrade)?; - - wait_for_at_least_session(&connection, session_after_upgrade)?; - let block_number = session_after_upgrade * get_session_period(&connection); - wait_for_finalized_block(&connection, block_number)?; - - Ok(()) -} - -// A test that schedules a version upgrade which is supposed to fail, awaits it, and checks if finalization stopped. -// It's up to the user of this test to ensure that version upgrade will actually break finalization (non-compatible change in protocol, # updated nodes k is f < k < 2/3n). -pub fn schedule_doomed_version_change_and_verify_finalization_stopped( - config: &Config, -) -> anyhow::Result<()> { - let connection = config.create_root_connection(); - let test_case_params = config.test_case_params.clone(); - - let current_session = get_current_session(&connection); - let version_for_upgrade = test_case_params - .upgrade_to_version - .unwrap_or(UPGRADE_TO_VERSION); - let session_for_upgrade = - current_session + test_case_params.upgrade_session.unwrap_or(UPGRADE_SESSION); - let wait_sessions_after_upgrade = test_case_params - .upgrade_finalization_wait_sessions - .unwrap_or(UPGRADE_FINALIZATION_WAIT_SESSIONS); - let session_after_upgrade = session_for_upgrade + wait_sessions_after_upgrade; - - schedule_upgrade(&connection, version_for_upgrade, session_for_upgrade)?; - wait_for_at_least_session(&connection, session_for_upgrade)?; - let last_finalized_block = session_for_upgrade * get_session_period(&connection) - 1; - - wait_for_at_least_session(&connection, session_after_upgrade)?; - let connection = connection.as_connection(); - let finalized_block_head = connection.as_connection().get_finalized_head()?; - let finalized_block = connection.get_header::
(finalized_block_head)?; - - let finalized_block = match finalized_block { - Some(block) => block.number, - None => { - return Err(anyhow::Error::msg( - "somehow no block was finalized (even though we saw one)", - )) - } - }; - - // check if finalization is still behind the upgrade-session - assert!(finalized_block <= last_finalized_block); - - Ok(()) -} diff --git a/e2e-tests/src/transfer.rs b/e2e-tests/src/transfer.rs index 7bb13d37cc..b12364a8e7 100644 --- a/e2e-tests/src/transfer.rs +++ b/e2e-tests/src/transfer.rs @@ -1,24 +1,18 @@ -use aleph_client::{ - create_connection, AccountId, Balance, Connection, KeyPair, ManageParams, SignedConnection, -}; -use sp_core::Pair; +use aleph_client::{AccountId, Connection, KeyPair, Pair, SignedConnection}; -use crate::{accounts::get_validators_keys, config::Config}; +use crate::{accounts::get_validators_raw_keys, config::Config}; -fn setup(config: &Config) -> (Connection, KeyPair, AccountId) { - let accounts = get_validators_keys(config); - let (from, to) = (accounts[0].clone(), accounts[1].clone()); - let to = AccountId::from(to.public()); - (create_connection(&config.node), from, to) +async fn setup(config: &Config) -> (Connection, KeyPair, AccountId) { + let accounts = get_validators_raw_keys(config); + let (from, to) = ( + KeyPair::new(accounts[0].clone()), + KeyPair::new(accounts[1].clone()), + ); + let to = AccountId::from(to.signer().public()); + (Connection::new(&config.node).await, from, to) } -pub fn setup_for_transfer(config: &Config) -> (SignedConnection, AccountId) { - let (connection, from, to) = setup(config); - (SignedConnection::from_any_connection(&connection, from), to) -} - -pub fn setup_for_tipped_transfer(config: &Config, tip: Balance) -> (SignedConnection, AccountId) { - let (connection, from, to) = setup(config); - let connection = SignedConnection::from_any_connection(&connection, from).set_tip(tip); - (connection, to) +pub async fn setup_for_transfer(config: &Config) -> (SignedConnection, AccountId) { + let (connection, from, to) = setup(config).await; + (SignedConnection::from_connection(connection, from), to) } diff --git a/e2e-tests/src/validators.rs b/e2e-tests/src/validators.rs index fe1676033c..3a6c6dab54 100644 --- a/e2e-tests/src/validators.rs +++ b/e2e-tests/src/validators.rs @@ -1,16 +1,29 @@ use aleph_client::{ - account_from_keypair, balances_batch_transfer, keypair_from_string, rotate_keys, set_keys, - staking_bond, staking_validate, AccountId, KeyPair, SignedConnection, XtStatus, + account_from_keypair, keypair_from_string, + pallets::{ + author::AuthorRpc, balances::BalanceUserBatchExtApi, session::SessionUserApi, + staking::StakingUserApi, + }, + primitives::EraValidators, + raw_keypair_from_string, AccountId, KeyPair, RawKeyPair, SignedConnection, SignedConnectionApi, + TxStatus, }; -use primitives::{staking::MIN_VALIDATOR_BOND, EraValidators, TOKEN}; +use futures::future::join_all; +use primitives::{staking::MIN_VALIDATOR_BOND, TOKEN}; -use crate::{accounts::get_validators_keys, Config}; +use crate::{accounts::get_validators_raw_keys, config::Config}; /// Get all validators assumed for test pub fn get_test_validators(config: &Config) -> EraValidators { - let all_validators = get_validators_keys(config); - let reserved = all_validators[0..2].to_vec(); - let non_reserved = all_validators[2..].to_vec(); + let all_validators = get_validators_raw_keys(config); + let reserved = all_validators[0..2] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect(); + let non_reserved = all_validators[2..] + .iter() + .map(|k| KeyPair::new(k.clone())) + .collect(); EraValidators { reserved, @@ -22,21 +35,29 @@ pub fn get_test_validators(config: &Config) -> EraValidators { pub struct Accounts { stash_keys: Vec, stash_accounts: Vec, - + stash_raw_keys: Vec, controller_keys: Vec, controller_accounts: Vec, + controller_raw_keys: Vec, } +#[allow(dead_code)] impl Accounts { pub fn get_stash_keys(&self) -> &Vec { &self.stash_keys } + pub fn get_stash_raw_keys(&self) -> &Vec { + &self.stash_raw_keys + } pub fn get_stash_accounts(&self) -> &Vec { &self.stash_accounts } pub fn get_controller_keys(&self) -> &Vec { &self.controller_keys } + pub fn get_controller_raw_keys(&self) -> &Vec { + &self.controller_raw_keys + } pub fn get_controller_accounts(&self) -> &Vec { &self.controller_accounts } @@ -47,54 +68,113 @@ pub fn setup_accounts(desired_validator_count: u32) -> Accounts { let seeds = (0..desired_validator_count).map(|idx| format!("//Validator//{}", idx)); let stash_seeds = seeds.clone().map(|seed| format!("{}//Stash", seed)); - let stash_keys = stash_seeds.map(|s| keypair_from_string(&s)); - let stash_accounts = stash_keys.clone().map(|k| account_from_keypair(&k)); + let stash_keys: Vec<_> = stash_seeds + .clone() + .map(|s| keypair_from_string(&s)) + .collect(); + let stash_raw_keys = stash_seeds.map(|s| raw_keypair_from_string(&s)).collect(); + let stash_accounts = stash_keys + .iter() + .map(|k| account_from_keypair(k.signer())) + .collect(); let controller_seeds = seeds.map(|seed| format!("{}//Controller", seed)); - let controller_keys = controller_seeds.map(|s| keypair_from_string(&s)); - let controller_accounts = controller_keys.clone().map(|k| account_from_keypair(&k)); + let controller_keys: Vec<_> = controller_seeds + .clone() + .map(|s| keypair_from_string(&s)) + .collect(); + let controller_raw_keys = controller_seeds + .map(|s| raw_keypair_from_string(&s)) + .collect(); + let controller_accounts = controller_keys + .iter() + .map(|k| account_from_keypair(k.signer())) + .collect(); Accounts { - stash_keys: stash_keys.collect(), - stash_accounts: stash_accounts.collect(), - controller_keys: controller_keys.collect(), - controller_accounts: controller_accounts.collect(), + stash_keys, + stash_accounts, + controller_keys, + controller_accounts, + stash_raw_keys, + controller_raw_keys, } } /// Endow validators (stashes and controllers), bond and rotate keys. /// /// Signer of `connection` should have enough balance to endow new accounts. -pub fn prepare_validators(connection: &SignedConnection, node: &str, accounts: &Accounts) { - balances_batch_transfer( - connection, - accounts.stash_accounts.clone(), - MIN_VALIDATOR_BOND + TOKEN, - ); - balances_batch_transfer( - connection, - accounts.get_controller_accounts().to_vec(), - TOKEN, - ); +pub async fn prepare_validators( + connection: &S, + node: &str, + accounts: &Accounts, + controller_connections: Vec, +) -> anyhow::Result<()> { + connection + .batch_transfer( + &accounts.stash_accounts, + MIN_VALIDATOR_BOND + TOKEN, + TxStatus::Finalized, + ) + .await + .unwrap(); + connection + .batch_transfer(&accounts.controller_accounts, TOKEN, TxStatus::Finalized) + .await + .unwrap(); + let mut handles = vec![]; for (stash, controller) in accounts - .stash_keys + .stash_raw_keys .iter() .zip(accounts.get_controller_accounts().iter()) { - let connection = SignedConnection::new(node, stash.clone()); - staking_bond( - &connection, - MIN_VALIDATOR_BOND, - controller, - XtStatus::Finalized, - ); + let connection = SignedConnection::new(node, KeyPair::new(stash.clone())).await; + let contr = controller.clone(); + handles.push(tokio::spawn(async move { + connection + .bond(MIN_VALIDATOR_BOND, contr, TxStatus::Finalized) + .await + .unwrap(); + })); } - for controller in accounts.controller_keys.iter() { - let keys = rotate_keys(connection).expect("Failed to generate new keys"); - let connection = SignedConnection::new(node, controller.clone()); - set_keys(&connection, keys, XtStatus::Finalized); - staking_validate(&connection, 10, XtStatus::Finalized); + for connection in controller_connections { + let keys = connection.author_rotate_keys().await?; + handles.push(tokio::spawn(async move { + connection + .set_keys(keys, TxStatus::Finalized) + .await + .unwrap(); + connection.validate(10, TxStatus::Finalized).await.unwrap(); + })); } + + join_all(handles).await; + Ok(()) +} + +// Assumes the same ip address and consecutive ports for nodes, e.g. ws://127.0.0.1:9943, +// ws://127.0.0.1:9944, etc. +pub async fn get_controller_connections_to_nodes( + first_node_address: &str, + controller_raw_keys: Vec, +) -> anyhow::Result> { + let address_tokens = first_node_address.split(':').collect::>(); + let prefix = format!("{}:{}", address_tokens[0], address_tokens[1]); + let address_prefix = prefix.as_str(); + let first_port = address_tokens[2].parse::()?; + let controller_connections = + controller_raw_keys + .into_iter() + .enumerate() + .map(|(port_idx, controller)| async move { + SignedConnection::new( + format!("{}:{}", address_prefix, first_port + port_idx as u16).as_str(), + KeyPair::new(controller), + ) + .await + }); + let connections = join_all(controller_connections.collect::>()).await; + Ok(connections) } diff --git a/finality-aleph/Cargo.toml b/finality-aleph/Cargo.toml index d7cc652c69..4917cb3e14 100644 --- a/finality-aleph/Cargo.toml +++ b/finality-aleph/Cargo.toml @@ -1,21 +1,21 @@ [package] name = "finality-aleph" -version = "0.5.0" +version = "0.6.1" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" [dependencies] # fixed version to 'freeze' some types used in abft, mainly `SignatureSet` used in justification and signature aggregation -aleph-bft-crypto = "0.4.0" +aleph-bft-crypto = "0.5" -current-aleph-bft = { package = "aleph-bft", version = "0.19.1" } -current-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.5.0" } -legacy-aleph-bft = { package = "aleph-bft", version = "0.18.1" } -legacy-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.4.0" } +current-aleph-bft = { package = "aleph-bft", version = "0.20" } +current-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.6" } +legacy-aleph-bft = { package = "aleph-bft", version = "0.19" } +legacy-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.5" } aleph-primitives = { package = "primitives", path = "../primitives" } -legacy-aleph-aggregator = { package = "aggregator", git = "https://github.com/Cardinal-Cryptography/aleph-node.git", tag = "aggregator-v0.1.0" } +legacy-aleph-aggregator = { package = "aggregator", git = "https://github.com/Cardinal-Cryptography/aleph-node.git", tag = "aggregator-v0.2.1" } current-aleph-aggregator = { path = "../aggregator", package = "aggregator" } async-trait = "0.1" @@ -29,36 +29,35 @@ hash-db = { version = "0.15.2", default-features = false } ip_network = "0.4" log = "0.4" lru = "0.7" -parity-util-mem = "0.11" parking_lot = "0.12" rand = "0.8" serde = "1.0" tiny-bip39 = "1.0" tokio = { version = "1.17", features = [ "sync", "macros", "time", "rt-multi-thread" ] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-network = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-network-common = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-telemetry = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-service = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-application-crypto = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-state-machine = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-trie = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-utils = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-blockchain = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-client-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-io = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-keystore = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-network = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-network-common = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-telemetry = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-service = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-application-crypto = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-state-machine = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-trie = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-utils = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-blockchain = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-client-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-io = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [dev-dependencies] -substrate-test-runtime-client = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -substrate-test-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sc-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +substrate-test-runtime-client = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +substrate-test-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sc-block-builder = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [features] only_legacy = [] diff --git a/finality-aleph/src/abft/common.rs b/finality-aleph/src/abft/common.rs index 6354e36044..5ef41bccf7 100644 --- a/finality-aleph/src/abft/common.rs +++ b/finality-aleph/src/abft/common.rs @@ -25,14 +25,12 @@ fn exponential_slowdown( } pub type DelaySchedule = Arc Duration + Sync + Send + 'static>; +pub type RecipientCountSchedule = Arc usize + Sync + Send + 'static>; pub fn unit_creation_delay_fn(unit_creation_delay: UnitCreationDelay) -> DelaySchedule { - Arc::new(move |t| { - if t == 0 { - Duration::from_millis(2000) - } else { - exponential_slowdown(t, unit_creation_delay.0 as f64, 5000, 1.005) - } + Arc::new(move |t| match t { + 0 => Duration::from_millis(2000), + _ => exponential_slowdown(t, unit_creation_delay.0 as f64, 5000, 1.005), }) } @@ -42,6 +40,11 @@ pub struct DelayConfig { pub unit_rebroadcast_interval_min: Duration, pub unit_rebroadcast_interval_max: Duration, pub unit_creation_delay: DelaySchedule, + pub coord_request_delay: DelaySchedule, + pub coord_request_recipients: RecipientCountSchedule, + pub parent_request_delay: DelaySchedule, + pub parent_request_recipients: RecipientCountSchedule, + pub newest_request_delay: DelaySchedule, } pub struct AlephConfig { @@ -83,10 +86,14 @@ impl From for current_aleph_bft::DelayConfig { fn from(cfg: DelayConfig) -> Self { Self { tick_interval: cfg.tick_interval, - requests_interval: cfg.requests_interval, unit_rebroadcast_interval_max: cfg.unit_rebroadcast_interval_max, unit_rebroadcast_interval_min: cfg.unit_rebroadcast_interval_min, unit_creation_delay: cfg.unit_creation_delay, + coord_request_delay: cfg.coord_request_delay, + coord_request_recipients: cfg.coord_request_recipients, + parent_request_delay: cfg.parent_request_delay, + parent_request_recipients: cfg.parent_request_recipients, + newest_request_delay: cfg.newest_request_delay, } } } diff --git a/finality-aleph/src/abft/current.rs b/finality-aleph/src/abft/current.rs index 15744d7f63..8a2fb2d474 100644 --- a/finality-aleph/src/abft/current.rs +++ b/finality-aleph/src/abft/current.rs @@ -1,18 +1,14 @@ -use std::time::Duration; - -use current_aleph_bft::{Config, LocalIO, Terminator}; +pub use aleph_primitives::CURRENT_FINALITY_VERSION as VERSION; +use current_aleph_bft::{default_config, Config, LocalIO, Terminator}; use log::debug; use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block; use crate::{ - abft::{ - common::{unit_creation_delay_fn, AlephConfig, DelayConfig}, - NetworkWrapper, SpawnHandleT, - }, + abft::{common::unit_creation_delay_fn, NetworkWrapper, SpawnHandleT}, crypto::Signature, data_io::{AlephData, OrderedDataInterpreter}, - network::DataNetwork, + network::data::Network, oneshot, party::{ backup::ABFTBackup, @@ -21,13 +17,10 @@ use crate::{ CurrentNetworkData, Hasher, Keychain, NodeIndex, SessionId, SignatureSet, UnitCreationDelay, }; -/// Version of the current abft -pub const VERSION: u32 = 1; - pub fn run_member< B: Block, C: HeaderBackend + Send + 'static, - ADN: DataNetwork> + 'static, + ADN: Network> + 'static, >( subtask_common: SubtaskCommon, multikeychain: Keychain, @@ -75,13 +68,8 @@ pub fn create_aleph_config( session_id: SessionId, unit_creation_delay: UnitCreationDelay, ) -> Config { - let delay_config = DelayConfig { - tick_interval: Duration::from_millis(100), - requests_interval: Duration::from_millis(3000), - unit_rebroadcast_interval_min: Duration::from_millis(15000), - unit_rebroadcast_interval_max: Duration::from_millis(20000), - unit_creation_delay: unit_creation_delay_fn(unit_creation_delay), - }; + let mut config = default_config(n_members.into(), node_id.into(), session_id.0 as u64); + config.delay_config.unit_creation_delay = unit_creation_delay_fn(unit_creation_delay); - AlephConfig::new(delay_config, n_members, node_id, session_id).into() + config } diff --git a/finality-aleph/src/abft/legacy.rs b/finality-aleph/src/abft/legacy.rs index b8613c2710..ba3ed40a99 100644 --- a/finality-aleph/src/abft/legacy.rs +++ b/finality-aleph/src/abft/legacy.rs @@ -1,17 +1,14 @@ -use std::time::Duration; - -use legacy_aleph_bft::{Config, LocalIO}; +pub use aleph_primitives::LEGACY_FINALITY_VERSION as VERSION; +use legacy_aleph_bft::{default_config, Config, LocalIO, Terminator}; use log::debug; use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block; +use super::common::unit_creation_delay_fn; use crate::{ - abft::{ - common::{unit_creation_delay_fn, AlephConfig, DelayConfig}, - NetworkWrapper, SpawnHandleT, - }, + abft::{NetworkWrapper, SpawnHandleT}, data_io::{AlephData, OrderedDataInterpreter}, - network::DataNetwork, + network::data::Network, oneshot, party::{ backup::ABFTBackup, @@ -20,13 +17,10 @@ use crate::{ Keychain, LegacyNetworkData, NodeIndex, SessionId, UnitCreationDelay, }; -/// Version of the legacy abft -pub const VERSION: u32 = 0; - pub fn run_member< B: Block, C: HeaderBackend + Send + 'static, - ADN: DataNetwork> + 'static, + ADN: Network> + 'static, >( subtask_common: SubtaskCommon, multikeychain: Keychain, @@ -41,6 +35,7 @@ pub fn run_member< session_id, } = subtask_common; let (stop, exit) = oneshot::channel(); + let member_terminator = Terminator::create_root(exit, "member"); let local_io = LocalIO::new(data_provider, ordered_data_interpreter, backup.0, backup.1); let task = { @@ -53,7 +48,7 @@ pub fn run_member< network, multikeychain, spawn_handle, - exit, + member_terminator, ) .await; debug!(target: "aleph-party", "Member task stopped for {:?}", session_id); @@ -70,13 +65,8 @@ pub fn create_aleph_config( session_id: SessionId, unit_creation_delay: UnitCreationDelay, ) -> Config { - let delay_config = DelayConfig { - tick_interval: Duration::from_millis(100), - requests_interval: Duration::from_millis(3000), - unit_rebroadcast_interval_min: Duration::from_millis(15000), - unit_rebroadcast_interval_max: Duration::from_millis(20000), - unit_creation_delay: unit_creation_delay_fn(unit_creation_delay), - }; + let mut config = default_config(n_members.into(), node_id.into(), session_id.0 as u64); + config.delay_config.unit_creation_delay = unit_creation_delay_fn(unit_creation_delay); - AlephConfig::new(delay_config, n_members, node_id, session_id).into() + config } diff --git a/finality-aleph/src/abft/network.rs b/finality-aleph/src/abft/network.rs index 6cb22b57ab..ee1cac44c6 100644 --- a/finality-aleph/src/abft/network.rs +++ b/finality-aleph/src/abft/network.rs @@ -7,7 +7,7 @@ use crate::{ abft::SignatureSet, crypto::Signature, data_io::{AlephData, AlephNetworkMessage}, - network::{Data, DataNetwork}, + network::{data::Network, Data}, Hasher, Recipient, }; @@ -34,12 +34,12 @@ impl AlephNetworkMessage } /// A wrapper needed only because of type system theoretical constraints. Sadness. -pub struct NetworkWrapper> { +pub struct NetworkWrapper> { inner: DN, _phantom: PhantomData, } -impl> From for NetworkWrapper { +impl> From for NetworkWrapper { fn from(inner: DN) -> Self { NetworkWrapper { inner, @@ -48,7 +48,7 @@ impl> From for NetworkWrapper { } } -impl> NetworkWrapper { +impl> NetworkWrapper { fn send(&self, data: D, recipient: R) where R: Into, @@ -64,7 +64,7 @@ impl> NetworkWrapper { } #[async_trait::async_trait] -impl> current_aleph_bft::Network for NetworkWrapper { +impl> current_aleph_bft::Network for NetworkWrapper { fn send(&self, data: D, recipient: current_aleph_bft::Recipient) { NetworkWrapper::send(self, data, recipient) } @@ -75,7 +75,7 @@ impl> current_aleph_bft::Network for NetworkWrapp } #[async_trait::async_trait] -impl> legacy_aleph_bft::Network for NetworkWrapper { +impl> legacy_aleph_bft::Network for NetworkWrapper { fn send(&self, data: D, recipient: legacy_aleph_bft::Recipient) { NetworkWrapper::send(self, data, recipient) } diff --git a/finality-aleph/src/aggregation/mod.rs b/finality-aleph/src/aggregation/mod.rs index 728da661c9..3861230ad2 100644 --- a/finality-aleph/src/aggregation/mod.rs +++ b/finality-aleph/src/aggregation/mod.rs @@ -11,7 +11,10 @@ use crate::{ crypto::Signature, metrics::Checkpoint, mpsc, - network::{Data, DataNetwork, SendError}, + network::{ + data::{Network, SendError}, + Data, + }, Keychain, Metrics, }; @@ -50,8 +53,8 @@ pub type CurrentAggregator<'a, B, N> = current_aleph_aggregator::IO< enum EitherAggregator<'a, B, CN, LN> where B: Block, - LN: DataNetwork>, - CN: DataNetwork>, + LN: Network>, + CN: Network>, ::Hash: AsRef<[u8]>, { Current(CurrentAggregator<'a, B, CN>), @@ -63,8 +66,8 @@ where pub struct Aggregator<'a, B, CN, LN> where B: Block, - LN: DataNetwork>, - CN: DataNetwork>, + LN: Network>, + CN: Network>, ::Hash: AsRef<[u8]>, { agg: EitherAggregator<'a, B, CN, LN>, @@ -73,8 +76,8 @@ where impl<'a, B, CN, LN> Aggregator<'a, B, CN, LN> where B: Block, - LN: DataNetwork>, - CN: DataNetwork>, + LN: Network>, + CN: Network>, ::Hash: AsRef<[u8]>, { pub fn new_legacy( @@ -163,9 +166,9 @@ where } } -pub struct NetworkWrapper>(N, PhantomData); +pub struct NetworkWrapper>(N, PhantomData); -impl> NetworkWrapper { +impl> NetworkWrapper { pub fn new(network: N) -> Self { Self(network, PhantomData) } @@ -186,7 +189,7 @@ impl current_aleph_aggregator::Metrics f #[async_trait::async_trait] impl legacy_aleph_aggregator::ProtocolSink for NetworkWrapper where - T: DataNetwork, + T: Network, D: Data, { async fn next(&mut self) -> Option { @@ -207,7 +210,7 @@ where #[async_trait::async_trait] impl current_aleph_aggregator::ProtocolSink for NetworkWrapper where - T: DataNetwork, + T: Network, D: Data, { async fn next(&mut self) -> Option { @@ -217,7 +220,7 @@ where fn send( &self, data: D, - recipient: legacy_aleph_bft::Recipient, + recipient: current_aleph_bft::Recipient, ) -> Result<(), CurrentNetworkError> { self.0.send(data, recipient.into()).map_err(|e| match e { SendError::SendFailed => CurrentNetworkError::SendFail, diff --git a/finality-aleph/src/crypto.rs b/finality-aleph/src/crypto.rs index f1b0cd8b36..17070a6e82 100644 --- a/finality-aleph/src/crypto.rs +++ b/finality-aleph/src/crypto.rs @@ -95,7 +95,7 @@ pub fn verify(authority: &AuthorityId, message: &[u8], signature: &Signature) -> /// Holds the public authority keys for a session allowing for verification of messages from that /// session. -#[derive(Clone)] +#[derive(PartialEq, Clone, Debug)] pub struct AuthorityVerifier { authorities: Vec, } diff --git a/finality-aleph/src/data_io/chain_info.rs b/finality-aleph/src/data_io/chain_info.rs index 2acfe63cfc..9bf7a87e90 100644 --- a/finality-aleph/src/data_io/chain_info.rs +++ b/finality-aleph/src/data_io/chain_info.rs @@ -1,11 +1,9 @@ use std::sync::Arc; +use log::error; use lru::LruCache; use sc_client_api::HeaderBackend; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, Header as HeaderT, NumberFor, One}, -}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor, One}; use crate::{data_io::ChainInfoCacheConfig, BlockHashNum}; @@ -25,9 +23,7 @@ where C: HeaderBackend, { fn is_block_imported(&mut self, block: &BlockHashNum) -> bool { - let maybe_header = self - .header(BlockId::Hash(block.hash)) - .expect("client must answer a query"); + let maybe_header = self.header(block.hash).expect("client must answer a query"); if let Some(header) = maybe_header { // If the block number is incorrect, we treat as not imported. return *header.number() == block.num; @@ -40,10 +36,15 @@ where return Err(()); } - if let Some(header) = self - .header(BlockId::Number(num)) - .expect("client must respond") - { + let block_hash = match self.hash(num).ok().flatten() { + None => { + error!(target: "chain-info", "Could not get hash for block #{:?}", num); + return Err(()); + } + Some(h) => h, + }; + + if let Some(header) = self.header(block_hash).expect("client must respond") { Ok((header.hash(), num).into()) } else { Err(()) @@ -51,10 +52,7 @@ where } fn get_parent_hash(&mut self, block: &BlockHashNum) -> Result { - if let Some(header) = self - .header(BlockId::Hash(block.hash)) - .expect("client must respond") - { + if let Some(header) = self.header(block.hash).expect("client must respond") { Ok(*header.parent_hash()) } else { Err(()) diff --git a/finality-aleph/src/data_io/data_provider.rs b/finality-aleph/src/data_io/data_provider.rs index 2d7dcdbea0..e77d9f6891 100644 --- a/finality-aleph/src/data_io/data_provider.rs +++ b/finality-aleph/src/data_io/data_provider.rs @@ -6,7 +6,6 @@ use parking_lot::Mutex; use sc_client_api::HeaderBackend; use sp_consensus::SelectChain; use sp_runtime::{ - generic::BlockId, traits::{Block as BlockT, Header as HeaderT, NumberFor, One, Zero}, SaturatedConversion, }; @@ -32,7 +31,7 @@ where let mut curr_header = header; while curr_header.number() > &num { curr_header = client - .header(BlockId::Hash(*curr_header.parent_hash())) + .header(*curr_header.parent_hash()) .expect("client must respond") .expect("parent hash is known by the client"); } @@ -47,10 +46,7 @@ where if block.num.is_zero() { return None; } - if let Some(header) = client - .header(BlockId::Hash(block.hash)) - .expect("client must respond") - { + if let Some(header) = client.header(block.hash).expect("client must respond") { Some((*header.parent_hash(), block.num - >::one()).into()) } else { warn!(target: "aleph-data-store", "Trying to fetch the parent of an unknown block {:?}.", block); diff --git a/finality-aleph/src/data_io/data_store.rs b/finality-aleph/src/data_io/data_store.rs index bd9311a51c..55610ddfd9 100644 --- a/finality-aleph/src/data_io/data_store.rs +++ b/finality-aleph/src/data_io/data_store.rs @@ -26,7 +26,13 @@ use crate::{ status_provider::get_proposal_status, AlephNetworkMessage, }, - network::{ComponentNetwork, DataNetwork, ReceiverComponent, RequestBlocks, SimpleNetwork}, + network::{ + data::{ + component::{Network as ComponentNetwork, Receiver, SimpleNetwork}, + Network as DataNetwork, + }, + RequestBlocks, + }, BlockHashNum, SessionBoundaries, }; @@ -174,7 +180,7 @@ where RB: RequestBlocks + 'static, Message: AlephNetworkMessage + std::fmt::Debug + Send + Sync + Clone + codec::Codec + 'static, - R: ReceiverComponent, + R: Receiver, { next_free_id: MessageId, pending_proposals: HashMap, PendingProposalInfo>, @@ -201,7 +207,7 @@ where RB: RequestBlocks + 'static, Message: AlephNetworkMessage + std::fmt::Debug + Send + Sync + Clone + codec::Codec + 'static, - R: ReceiverComponent, + R: Receiver, { /// Returns a struct to be run and a network that outputs messages filtered as appropriate pub fn new>( diff --git a/finality-aleph/src/data_io/proposal.rs b/finality-aleph/src/data_io/proposal.rs index 3e089b7a15..4173081f10 100644 --- a/finality-aleph/src/data_io/proposal.rs +++ b/finality-aleph/src/data_io/proposal.rs @@ -82,7 +82,7 @@ impl UnvalidatedAlephProposal { ) -> Result, ValidationError> { use ValidationError::*; - if self.branch.len() > MAX_DATA_BRANCH_LEN as usize { + if self.branch.len() > MAX_DATA_BRANCH_LEN { return Err(BranchTooLong { branch_size: self.branch.len(), }); diff --git a/finality-aleph/src/finalization.rs b/finality-aleph/src/finalization.rs index 7e06a938a2..aa3eee75cc 100644 --- a/finality-aleph/src/finalization.rs +++ b/finality-aleph/src/finalization.rs @@ -3,7 +3,7 @@ use std::{marker::PhantomData, sync::Arc}; use log::{debug, warn}; use sc_client_api::{Backend, Finalizer, HeaderBackend, LockImportRun}; -use sp_api::{BlockId, NumberFor}; +use sp_api::NumberFor; use sp_blockchain::Error; use sp_runtime::{traits::Block, Justification}; @@ -63,7 +63,7 @@ where let update_res = self.client.lock_import_and_run(|import_op| { // NOTE: all other finalization logic should come here, inside the lock self.client - .apply_finality(import_op, BlockId::Hash(hash), justification, true) + .apply_finality(import_op, hash, justification, true) }); let status = self.client.info(); debug!(target: "aleph-finality", "Attempted to finalize block with hash {:?}. Current best: #{:?}.", hash, status.finalized_number); diff --git a/finality-aleph/src/justification/handler.rs b/finality-aleph/src/justification/handler.rs index cf2b752549..2c038fa0e2 100644 --- a/finality-aleph/src/justification/handler.rs +++ b/finality-aleph/src/justification/handler.rs @@ -1,12 +1,8 @@ -use std::{ - sync::Arc, - time::{Duration, Instant}, -}; +use std::time::{Duration, Instant}; use futures::{channel::mpsc, Stream, StreamExt}; use futures_timer::Delay; use log::{debug, error}; -use sc_client_api::HeaderBackend; use sp_api::BlockT; use sp_runtime::traits::Header; use tokio::time::timeout; @@ -17,53 +13,52 @@ use crate::{ requester::BlockRequester, JustificationHandlerConfig, JustificationNotification, JustificationRequestScheduler, SessionInfo, SessionInfoProvider, Verifier, }, - network, Metrics, STATUS_REPORT_INTERVAL, + network, BlockchainBackend, Metrics, STATUS_REPORT_INTERVAL, }; -pub struct JustificationHandler +pub struct JustificationHandler where B: BlockT, V: Verifier, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, SI: SessionInfoProvider, F: BlockFinalizer, + BB: BlockchainBackend + 'static, { session_info_provider: SI, - block_requester: BlockRequester, + block_requester: BlockRequester, verifier_timeout: Duration, notification_timeout: Duration, } -impl JustificationHandler +impl JustificationHandler where B: BlockT, V: Verifier, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, SI: SessionInfoProvider, F: BlockFinalizer, + BB: BlockchainBackend + 'static, { pub fn new( session_info_provider: SI, block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - justification_handler_config: JustificationHandlerConfig, + justification_handler_config: JustificationHandlerConfig, ) -> Self { Self { session_info_provider, block_requester: BlockRequester::new( block_requester, - client, + blockchain_backend, finalizer, justification_request_scheduler, metrics, - justification_handler_config.min_allowed_delay, ), verifier_timeout: justification_handler_config.verifier_timeout, notification_timeout: justification_handler_config.notification_timeout, diff --git a/finality-aleph/src/justification/mod.rs b/finality-aleph/src/justification/mod.rs index fcc16bf9b5..f5cde9d497 100644 --- a/finality-aleph/src/justification/mod.rs +++ b/finality-aleph/src/justification/mod.rs @@ -55,36 +55,29 @@ pub struct JustificationNotification { } #[derive(Clone)] -pub struct JustificationHandlerConfig { +pub struct JustificationHandlerConfig { /// How long should we wait when the session verifier is not yet available. verifier_timeout: Duration, /// How long should we wait for any notification. notification_timeout: Duration, - ///Distance (in amount of blocks) between the best and the block we want to request justification - min_allowed_delay: NumberFor, } -impl Default for JustificationHandlerConfig { +impl Default for JustificationHandlerConfig { fn default() -> Self { Self { verifier_timeout: Duration::from_millis(500), - notification_timeout: Duration::from_millis(1000), - min_allowed_delay: 3u32.into(), + // request justifications slightly more frequently than they're created + notification_timeout: Duration::from_millis(800), } } } #[cfg(test)] -impl JustificationHandlerConfig { - pub fn new( - verifier_timeout: Duration, - notification_timeout: Duration, - min_allowed_delay: NumberFor, - ) -> Self { +impl JustificationHandlerConfig { + pub fn new(verifier_timeout: Duration, notification_timeout: Duration) -> Self { Self { verifier_timeout, notification_timeout, - min_allowed_delay, } } } diff --git a/finality-aleph/src/justification/requester.rs b/finality-aleph/src/justification/requester.rs index 1e140f8c8d..f9eb221a79 100644 --- a/finality-aleph/src/justification/requester.rs +++ b/finality-aleph/src/justification/requester.rs @@ -1,10 +1,10 @@ -use std::{fmt, marker::PhantomData, sync::Arc, time::Instant}; +use std::{fmt, marker::PhantomData, time::Instant}; use aleph_primitives::ALEPH_ENGINE_ID; use log::{debug, error, info, warn}; -use sc_client_api::HeaderBackend; +use sc_client_api::blockchain::Info; use sp_api::{BlockId, BlockT, NumberFor}; -use sp_runtime::traits::Header; +use sp_runtime::traits::{Header, One, Saturating}; use crate::{ finalization::BlockFinalizer, @@ -13,7 +13,7 @@ use crate::{ JustificationRequestScheduler, Verifier, }, metrics::Checkpoint, - network, Metrics, + network, BlockHashNum, BlockchainBackend, Metrics, }; /// Threshold for how many tries are needed so that JustificationRequestStatus is logged @@ -21,100 +21,122 @@ const REPORT_THRESHOLD: u32 = 2; /// This structure is created for keeping and reporting status of BlockRequester pub struct JustificationRequestStatus { - block_number: Option>, - block_hash: Option, - tries: u32, + block_hash_number: Option>, + block_tries: u32, + parent: Option, + n_children: usize, + children_tries: u32, report_threshold: u32, } impl JustificationRequestStatus { fn new() -> Self { Self { - block_number: None, - block_hash: None, - tries: 0, + block_hash_number: None, + block_tries: 0, + parent: None, + n_children: 0, + children_tries: 0, report_threshold: REPORT_THRESHOLD, } } - fn save_block_number(&mut self, num: NumberFor) { - if Some(num) == self.block_number { - self.tries += 1; + fn save_children(&mut self, hash: B::Hash, n_children: usize) { + if self.parent == Some(hash) { + self.children_tries += 1; } else { - self.block_number = Some(num); - self.block_hash = None; - self.tries = 1; + self.parent = Some(hash); + self.children_tries = 1; } + self.n_children = n_children; } - fn insert_hash(&mut self, hash: B::Hash) { - self.block_hash = Some(hash); + fn save_block(&mut self, hn: BlockHashNum) { + if self.block_hash_number == Some(hn.clone()) { + self.block_tries += 1; + } else { + self.block_hash_number = Some(hn); + self.block_tries = 1; + } + } + + fn reset(&mut self) { + self.block_hash_number = None; + self.block_tries = 0; + self.parent = None; + self.n_children = 0; + self.children_tries = 0; } fn should_report(&self) -> bool { - self.tries >= self.report_threshold + self.block_tries >= self.report_threshold || self.children_tries >= self.report_threshold } } impl fmt::Display for JustificationRequestStatus { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(n) = self.block_number { - let mut status = format!("tries - {}; requested block number - {}; ", self.tries, n); - if let Some(header) = self.block_hash { - status.push_str(&format!("hash - {}; ", header)); - } else { - status.push_str("hash - unknown; "); + if self.block_tries >= self.report_threshold { + if let Some(hn) = &self.block_hash_number { + write!( + f, + "tries - {}; requested block number - {}; hash - {};", + self.block_tries, hn.num, hn.hash, + )?; + } + } + if self.children_tries >= self.report_threshold { + if let Some(parent) = self.parent { + write!( + f, + "tries - {}; requested {} children of finalized block {}; ", + self.children_tries, self.n_children, parent + )?; } - - write!(f, "{}", status)?; } Ok(()) } } -pub struct BlockRequester +pub struct BlockRequester where B: BlockT, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, F: BlockFinalizer, V: Verifier, + BB: BlockchainBackend + 'static, { block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - min_allowed_delay: NumberFor, request_status: JustificationRequestStatus, _phantom: PhantomData, } -impl BlockRequester +impl BlockRequester where B: BlockT, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, F: BlockFinalizer, V: Verifier, + BB: BlockchainBackend + 'static, { pub fn new( block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - min_allowed_delay: NumberFor, ) -> Self { BlockRequester { block_requester, - client, + blockchain_backend, finalizer, justification_request_scheduler, metrics, - min_allowed_delay, request_status: JustificationRequestStatus::new(), _phantom: PhantomData, } @@ -152,6 +174,7 @@ where match finalization_res { Ok(()) => { self.justification_request_scheduler.on_block_finalized(); + self.request_status.reset(); debug!(target: "aleph-justification", "Successfully finalized {:?}", number); if let Some(metrics) = &self.metrics { metrics.report_block(hash, Instant::now(), Checkpoint::Finalized); @@ -169,29 +192,12 @@ where } } - pub fn request_justification(&mut self, num: NumberFor) { + pub fn request_justification(&mut self, wanted: NumberFor) { match self.justification_request_scheduler.schedule_action() { SchedulerActions::Request => { - let num = if num > self.client.info().best_number - && self.client.info().best_number > self.min_allowed_delay - { - self.client.info().best_number - self.min_allowed_delay - } else { - num - }; - - debug!(target: "aleph-justification", "Trying to request block {:?}", num); - self.request_status.save_block_number(num); - - if let Ok(Some(header)) = self.client.header(BlockId::Number(num)) { - self.request_status.insert_hash(header.hash()); - debug!(target: "aleph-justification", "We have block {:?} with hash {:?}. Requesting justification.", num, header.hash()); - self.justification_request_scheduler.on_request_sent(); - self.block_requester - .request_justification(&header.hash(), *header.number()); - } else { - debug!(target: "aleph-justification", "Cancelling request, because we don't have block {:?}.", num); - } + let info = self.blockchain_backend.info(); + self.request_children(&info); + self.request_wanted(wanted, &info); } SchedulerActions::ClearQueue => { debug!(target: "aleph-justification", "Clearing justification request queue"); @@ -202,6 +208,64 @@ where } pub fn finalized_number(&self) -> NumberFor { - self.client.info().finalized_number + self.blockchain_backend.info().finalized_number + } + + fn do_request(&mut self, hash: &::Hash, num: NumberFor) { + debug!(target: "aleph-justification", + "We have block {:?} with hash {:?}. Requesting justification.", num, hash); + self.justification_request_scheduler.on_request_sent(); + self.block_requester.request_justification(hash, num); + } + + // We request justifications for all the children of last finalized block. + // Assuming that we request at the same pace that finalization is progressing, it ensures + // that we are up to date with finalization. + // We also request the child that it's on the same branch as top_wanted since a fork may happen + // somewhere in between them. + fn request_children(&mut self, info: &Info) { + let finalized_hash = info.finalized_hash; + let finalized_number = info.finalized_number; + + let children = self.blockchain_backend.children(finalized_hash); + + if !children.is_empty() { + self.request_status + .save_children(finalized_hash, children.len()); + } + + for child in &children { + self.do_request(child, finalized_number + NumberFor::::one()); + } + } + + // This request is important in the case when we are far behind and want to catch up. + fn request_wanted(&mut self, mut top_wanted: NumberFor, info: &Info) { + let best_number = info.best_number; + if best_number <= top_wanted { + // most probably block best_number is not yet finalized + top_wanted = best_number.saturating_sub(NumberFor::::one()); + } + let finalized_number = info.finalized_number; + // We know that top_wanted >= finalized_number, so + // - if top_wanted == finalized_number, then we don't want to request it + // - if top_wanted == finalized_number + 1, then we already requested it + if top_wanted <= finalized_number + NumberFor::::one() { + return; + } + match self.blockchain_backend.header(BlockId::Number(top_wanted)) { + Ok(Some(header)) => { + let hash = header.hash(); + let num = *header.number(); + self.do_request(&hash, num); + self.request_status.save_block((hash, num).into()); + } + Ok(None) => { + warn!(target: "aleph-justification", "Cancelling request, because we don't have block {:?}.", top_wanted); + } + Err(err) => { + warn!(target: "aleph-justification", "Cancelling request, because fetching block {:?} failed {:?}.", top_wanted, err); + } + } } } diff --git a/finality-aleph/src/lib.rs b/finality-aleph/src/lib.rs index 8326fa7bc6..b2a6f7aae0 100644 --- a/finality-aleph/src/lib.rs +++ b/finality-aleph/src/lib.rs @@ -8,9 +8,10 @@ use futures::{ channel::{mpsc, oneshot}, Future, }; -use sc_client_api::{backend::Backend, BlockchainEvents, Finalizer, LockImportRun, TransactionFor}; +use sc_client_api::{Backend, BlockchainEvents, Finalizer, LockImportRun, TransactionFor}; use sc_consensus::BlockImport; -use sc_network::{ExHashT, NetworkService}; +use sc_network::NetworkService; +use sc_network_common::ExHashT; use sc_service::SpawnTaskHandle; use sp_api::{NumberFor, ProvideRuntimeApi}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; @@ -19,14 +20,13 @@ use sp_runtime::traits::{BlakeTwo256, Block, Header}; use tokio::time::Duration; use crate::{ - abft::{CurrentNetworkData, LegacyNetworkData}, + abft::{CurrentNetworkData, LegacyNetworkData, CURRENT_VERSION, LEGACY_VERSION}, aggregation::{CurrentRmcNetworkData, LegacyRmcNetworkData}, - network::Split, + network::data::split::Split, session::{ first_block_of_session, last_block_of_session, session_id_from_block_num, SessionBoundaries, SessionId, }, - substrate_network::protocol_name, VersionedTryFromError::{ExpectedNewGotOld, ExpectedOldGotNew}, }; @@ -44,17 +44,17 @@ mod nodes; mod party; mod session; mod session_map; -mod substrate_network; -mod tcp_network; +// TODO: remove when module is used +#[allow(dead_code)] +mod sync; #[cfg(test)] pub mod testing; -mod validator_network; pub use abft::{Keychain, NodeCount, NodeIndex, Recipient, SignatureSet, SpawnHandle}; pub use aleph_primitives::{AuthorityId, AuthorityPair, AuthoritySignature}; pub use import::AlephBlockImport; pub use justification::{AlephJustification, JustificationNotification}; -pub use network::Protocol; +pub use network::{Protocol, ProtocolNaming}; pub use nodes::{run_nonvalidator_node, run_validator_node}; pub use session::SessionPeriod; @@ -70,11 +70,12 @@ enum Error { } /// Returns a NonDefaultSetConfig for the specified protocol. -pub fn peers_set_config(protocol: Protocol) -> sc_network::config::NonDefaultSetConfig { - let name = protocol_name(&protocol); - - let mut config = sc_network::config::NonDefaultSetConfig::new( - name, +pub fn peers_set_config( + naming: ProtocolNaming, + protocol: Protocol, +) -> sc_network_common::config::NonDefaultSetConfig { + let mut config = sc_network_common::config::NonDefaultSetConfig::new( + naming.protocol_name(&protocol), // max_notification_size should be larger than the maximum possible honest message size (in bytes). // Max size of alert is UNIT_SIZE * MAX_UNITS_IN_ALERT ~ 100 * 5000 = 50000 bytes // Max size of parents response UNIT_SIZE * N_MEMBERS ~ 100 * N_MEMBERS @@ -82,17 +83,8 @@ pub fn peers_set_config(protocol: Protocol) -> sc_network::config::NonDefaultSet 1024 * 1024, ); - config.set_config = match protocol { - // No spontaneous connections, only reserved nodes added by the network logic. - Protocol::Validator => sc_network::config::SetConfig { - in_peers: 0, - out_peers: 0, - reserved_nodes: Vec::new(), - non_reserved_mode: sc_network::config::NonReservedPeerMode::Deny, - }, - Protocol::Generic => sc_network::config::SetConfig::default(), - Protocol::Authentication => sc_network::config::SetConfig::default(), - }; + config.set_config = sc_network_common::config::SetConfig::default(); + config.add_fallback_names(naming.fallback_protocol_names(&protocol)); config } @@ -106,11 +98,11 @@ pub type LegacySplitData = Split, LegacyRmcNetworkData = Split, CurrentRmcNetworkData>; impl Versioned for LegacyNetworkData { - const VERSION: Version = Version(0); + const VERSION: Version = Version(LEGACY_VERSION); } impl Versioned for CurrentNetworkData { - const VERSION: Version = Version(1); + const VERSION: Version = Version(CURRENT_VERSION); } /// The main purpose of this data type is to enable a seamless transition between protocol versions at the Network level. It @@ -250,9 +242,10 @@ impl From<(H, N)> for HashNum { pub type BlockHashNum = HashNum<::Hash, NumberFor>; -pub struct AlephConfig { +pub struct AlephConfig { pub network: Arc>, pub client: Arc, + pub blockchain_backend: BB, pub select_chain: SC, pub spawn_handle: SpawnTaskHandle, pub keystore: Arc, @@ -264,4 +257,14 @@ pub struct AlephConfig { pub backup_saving_path: Option, pub external_addresses: Vec, pub validator_port: u16, + pub protocol_naming: ProtocolNaming, +} + +pub trait BlockchainBackend { + fn children(&self, parent_hash: ::Hash) -> Vec<::Hash>; + fn info(&self) -> sp_blockchain::Info; + fn header( + &self, + block_id: sp_api::BlockId, + ) -> sp_blockchain::Result::Header>>; } diff --git a/finality-aleph/src/network/clique/crypto.rs b/finality-aleph/src/network/clique/crypto.rs new file mode 100644 index 0000000000..74891a6317 --- /dev/null +++ b/finality-aleph/src/network/clique/crypto.rs @@ -0,0 +1,26 @@ +use std::{fmt::Display, hash::Hash}; + +use codec::Codec; + +/// A public key for signature verification. +pub trait PublicKey: + Send + Sync + Eq + Clone + AsRef<[u8]> + Display + Hash + Codec + 'static +{ + type Signature: Send + Sync + Clone + Codec; + + /// Verify whether the message has been signed with the associated private key. + fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool; +} + +/// Secret key for signing messages, with an associated public key. +#[async_trait::async_trait] +pub trait SecretKey: Clone + Send + Sync + 'static { + type Signature: Send + Sync + Clone + Codec; + type PublicKey: PublicKey; + + /// Produce a signature for the provided message. + async fn sign(&self, message: &[u8]) -> Self::Signature; + + /// Return the associated public key. + fn public_key(&self) -> Self::PublicKey; +} diff --git a/finality-aleph/src/network/clique/incoming.rs b/finality-aleph/src/network/clique/incoming.rs new file mode 100644 index 0000000000..b7fcaa0c0a --- /dev/null +++ b/finality-aleph/src/network/clique/incoming.rs @@ -0,0 +1,89 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use futures::channel::{mpsc, oneshot}; +use log::{debug, info}; + +use crate::network::clique::{ + protocols::{protocol, ProtocolError, ProtocolNegotiationError, ResultForService}, + Data, PublicKey, SecretKey, Splittable, LOG_TARGET, +}; + +enum IncomingError { + ProtocolNegotiationError(ProtocolNegotiationError), + ProtocolError(ProtocolError), +} + +impl Display for IncomingError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use IncomingError::*; + match self { + ProtocolNegotiationError(e) => write!(f, "protocol negotiation error: {}", e), + ProtocolError(e) => write!(f, "protocol error: {}", e), + } + } +} + +impl From for IncomingError { + fn from(e: ProtocolNegotiationError) -> Self { + IncomingError::ProtocolNegotiationError(e) + } +} + +impl From> for IncomingError { + fn from(e: ProtocolError) -> Self { + IncomingError::ProtocolError(e) + } +} + +async fn manage_incoming( + secret_key: SK, + stream: S, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, + authorization_requests_sender: mpsc::UnboundedSender<(SK::PublicKey, oneshot::Sender)>, +) -> Result<(), IncomingError> { + debug!( + target: LOG_TARGET, + "Performing incoming protocol negotiation." + ); + let (stream, protocol) = protocol(stream).await?; + debug!(target: LOG_TARGET, "Negotiated protocol, running."); + Ok(protocol + .manage_incoming( + stream, + secret_key, + result_for_parent, + data_for_user, + authorization_requests_sender, + ) + .await?) +} + +/// Manage an incoming connection. After the handshake it will send the recognized PublicKey to +/// the parent, together with an exit channel for this process. When this channel is dropped the +/// process ends. Whenever data arrives on this connection it will be passed to the user. Any +/// failures in receiving data result in the process stopping, we assume the other side will +/// reestablish it if necessary. +pub async fn incoming( + secret_key: SK, + stream: S, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, + authorization_requests_sender: mpsc::UnboundedSender<(SK::PublicKey, oneshot::Sender)>, +) { + let addr = stream.peer_address_info(); + if let Err(e) = manage_incoming( + secret_key, + stream, + result_for_parent, + data_for_user, + authorization_requests_sender, + ) + .await + { + info!( + target: LOG_TARGET, + "Incoming connection from {} failed: {}.", addr, e + ); + } +} diff --git a/finality-aleph/src/validator_network/io.rs b/finality-aleph/src/network/clique/io.rs similarity index 99% rename from finality-aleph/src/validator_network/io.rs rename to finality-aleph/src/network/clique/io.rs index c8c676055f..fee7f09187 100644 --- a/finality-aleph/src/validator_network/io.rs +++ b/finality-aleph/src/network/clique/io.rs @@ -6,7 +6,7 @@ use std::{ use codec::DecodeAll; use tokio::io::{AsyncReadExt, AsyncWriteExt}; -use crate::validator_network::Data; +use crate::network::Data; // We allow sending up to 16MiB, that should be enough forever. pub const MAX_DATA_SIZE: u32 = 16 * 1024 * 1024; diff --git a/finality-aleph/src/network/clique/manager/direction.rs b/finality-aleph/src/network/clique/manager/direction.rs new file mode 100644 index 0000000000..7ef675a7f6 --- /dev/null +++ b/finality-aleph/src/network/clique/manager/direction.rs @@ -0,0 +1,197 @@ +use std::{ + collections::{HashMap, HashSet}, + ops::BitXor, +}; + +use crate::network::{clique::PublicKey, Data}; + +/// Data about peers we know and whether we should connect to them or they to us. For the former +/// case also keeps the peers' addresses. +pub struct DirectedPeers { + own_id: PK, + outgoing: HashMap, + incoming: HashSet, +} + +/// Whether we should call the remote or the other way around. We xor the peer ids and based on the +/// parity of the sum of bits of the result decide whether the caller should be the smaller or +/// greated lexicographically. They are never equal, because cryptography. +fn should_we_call(own_id: &[u8], remote_id: &[u8]) -> bool { + let xor_sum_parity = (own_id.iter().fold(0u8, BitXor::bitxor) + ^ remote_id.iter().fold(0u8, BitXor::bitxor)) + .count_ones() + % 2; + match xor_sum_parity == 0 { + true => own_id < remote_id, + false => own_id > remote_id, + } +} + +impl DirectedPeers { + /// Create a new set of peers directed using our own peer id. + pub fn new(own_id: PK) -> Self { + DirectedPeers { + own_id, + outgoing: HashMap::new(), + incoming: HashSet::new(), + } + } + + /// Add a peer to the list of peers we want to stay connected to, or + /// update the address if the peer was already added. + /// Returns whether we should start attempts at connecting with the peer, which is the case + /// exactly when the peer is one with which we should attempt connections AND it was added for + /// the first time. + pub fn add_peer(&mut self, peer_id: PK, address: A) -> bool { + match should_we_call(self.own_id.as_ref(), peer_id.as_ref()) { + true => self.outgoing.insert(peer_id, address).is_none(), + false => { + // We discard the address here, as we will never want to call this peer anyway, + // so we don't need it. + self.incoming.insert(peer_id); + false + } + } + } + + /// Return the address of the given peer, or None if we shouldn't attempt connecting with the peer. + pub fn peer_address(&self, peer_id: &PK) -> Option { + self.outgoing.get(peer_id).cloned() + } + + /// Whether we should be maintaining a connection with this peer. + pub fn interested(&self, peer_id: &PK) -> bool { + self.incoming.contains(peer_id) || self.outgoing.contains_key(peer_id) + } + + /// Iterator over the peers we want connections from. + pub fn incoming_peers(&self) -> impl Iterator { + self.incoming.iter() + } + + /// Iterator over the peers we want to connect to. + pub fn outgoing_peers(&self) -> impl Iterator { + self.outgoing.keys() + } + + /// Remove a peer from the list of peers that we want to stay connected with, whether the + /// connection was supposed to be incoming or outgoing. + pub fn remove_peer(&mut self, peer_id: &PK) { + self.incoming.remove(peer_id); + self.outgoing.remove(peer_id); + } +} + +#[cfg(test)] +mod tests { + use super::DirectedPeers; + use crate::network::clique::mock::{key, MockPublicKey}; + + type Address = String; + + fn container_with_id() -> (DirectedPeers, MockPublicKey) { + let (id, _) = key(); + let container = DirectedPeers::new(id.clone()); + (container, id) + } + + fn some_address() -> Address { + String::from("43.43.43.43:43000") + } + + #[test] + fn exactly_one_direction_attempts_connections() { + let (mut container0, id0) = container_with_id(); + let (mut container1, id1) = container_with_id(); + let address = some_address(); + assert!(container0.add_peer(id1, address.clone()) != container1.add_peer(id0, address)); + } + + fn container_with_added_connecting_peer( + ) -> (DirectedPeers, MockPublicKey) { + let (mut container0, id0) = container_with_id(); + let (mut container1, id1) = container_with_id(); + let address = some_address(); + match container0.add_peer(id1.clone(), address.clone()) { + true => (container0, id1), + false => { + container1.add_peer(id0.clone(), address); + (container1, id0) + } + } + } + + fn container_with_added_nonconnecting_peer( + ) -> (DirectedPeers, MockPublicKey) { + let (mut container0, id0) = container_with_id(); + let (mut container1, id1) = container_with_id(); + let address = some_address(); + match container0.add_peer(id1.clone(), address.clone()) { + false => (container0, id1), + true => { + container1.add_peer(id0.clone(), address); + (container1, id0) + } + } + } + + #[test] + fn no_connecting_on_subsequent_add() { + let (mut container0, id1) = container_with_added_connecting_peer(); + let address = some_address(); + assert!(!container0.add_peer(id1, address)); + } + + #[test] + fn peer_address_when_connecting() { + let (container0, id1) = container_with_added_connecting_peer(); + assert!(container0.peer_address(&id1).is_some()); + } + + #[test] + fn no_peer_address_when_nonconnecting() { + let (container0, id1) = container_with_added_nonconnecting_peer(); + assert!(container0.peer_address(&id1).is_none()); + } + + #[test] + fn interested_in_connecting() { + let (container0, id1) = container_with_added_connecting_peer(); + assert!(container0.interested(&id1)); + } + + #[test] + fn interested_in_nonconnecting() { + let (container0, id1) = container_with_added_nonconnecting_peer(); + assert!(container0.interested(&id1)); + } + + #[test] + fn uninterested_in_unknown() { + let (container0, _) = container_with_id(); + let (_, id1) = container_with_id(); + assert!(!container0.interested(&id1)); + } + + #[test] + fn connecting_are_outgoing() { + let (container0, id1) = container_with_added_connecting_peer(); + assert_eq!(container0.outgoing_peers().collect::>(), vec![&id1]); + assert_eq!(container0.incoming_peers().next(), None); + } + + #[test] + fn nonconnecting_are_incoming() { + let (container0, id1) = container_with_added_nonconnecting_peer(); + assert_eq!(container0.incoming_peers().collect::>(), vec![&id1]); + assert_eq!(container0.outgoing_peers().next(), None); + } + + #[test] + fn uninterested_in_removed() { + let (mut container0, id1) = container_with_added_connecting_peer(); + assert!(container0.interested(&id1)); + container0.remove_peer(&id1); + assert!(!container0.interested(&id1)); + } +} diff --git a/finality-aleph/src/network/clique/manager/mod.rs b/finality-aleph/src/network/clique/manager/mod.rs new file mode 100644 index 0000000000..2b661280b3 --- /dev/null +++ b/finality-aleph/src/network/clique/manager/mod.rs @@ -0,0 +1,334 @@ +use std::{ + collections::{HashMap, HashSet}, + fmt::{Display, Error as FmtError, Formatter}, +}; + +use futures::channel::mpsc; + +use crate::network::{clique::PublicKey, Data, PeerId}; + +mod direction; +use direction::DirectedPeers; + +/// Error during sending data through the Manager +#[derive(Debug, PartialEq, Eq)] +pub enum SendError { + /// Outgoing network connection closed + ConnectionClosed, + /// Peer not added to the manager + PeerNotFound, +} + +impl Display for SendError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use SendError::*; + match self { + ConnectionClosed => write!(f, "worker dead"), + PeerNotFound => write!(f, "peer not found"), + } + } +} + +/// Possible results of adding connections. +#[derive(Debug, PartialEq, Eq)] +pub enum AddResult { + /// We do not want to maintain a connection with this peer. + Uninterested, + /// Connection added. + Added, + /// Old connection replaced with new one. + Replaced, +} + +struct ManagerStatus { + outgoing_peers: HashSet, + missing_outgoing: HashSet, + incoming_peers: HashSet, + missing_incoming: HashSet, +} + +impl ManagerStatus { + fn new(manager: &Manager) -> Self { + let mut incoming_peers = HashSet::new(); + let mut missing_incoming = HashSet::new(); + let mut outgoing_peers = HashSet::new(); + let mut missing_outgoing = HashSet::new(); + + for peer in manager.wanted.incoming_peers() { + match manager.active_connection(peer) { + true => incoming_peers.insert(peer.clone()), + false => missing_incoming.insert(peer.clone()), + }; + } + for peer in manager.wanted.outgoing_peers() { + match manager.active_connection(peer) { + true => outgoing_peers.insert(peer.clone()), + false => missing_outgoing.insert(peer.clone()), + }; + } + ManagerStatus { + incoming_peers, + missing_incoming, + outgoing_peers, + missing_outgoing, + } + } + + fn wanted_incoming(&self) -> usize { + self.incoming_peers.len() + self.missing_incoming.len() + } + + fn wanted_outgoing(&self) -> usize { + self.outgoing_peers.len() + self.missing_outgoing.len() + } +} + +fn pretty_peer_id_set(set: &HashSet) -> String { + set.iter() + .map(|peer_id| peer_id.to_short_string()) + .collect::>() + .join(", ") +} + +impl Display for ManagerStatus { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + let wanted_incoming = self.wanted_incoming(); + let wanted_outgoing = self.wanted_outgoing(); + if wanted_incoming + wanted_outgoing == 0 { + return write!(f, "not maintaining any connections; "); + } + + match wanted_incoming { + 0 => write!(f, "not expecting any incoming connections; ")?, + _ => { + write!(f, "expecting {:?} incoming connections; ", wanted_incoming)?; + match self.incoming_peers.is_empty() { + // We warn about the lack of incoming connections, because this is relatively + // likely to be a common misconfiguration; much less the case for outgoing. + true => write!(f, "WARNING! No incoming peers even though we expected them, maybe connecting to us is impossible; ")?, + false => write!( + f, + "have - {:?} [{}]; ", + self.incoming_peers.len(), + pretty_peer_id_set(&self.incoming_peers), + )?, + } + if !self.missing_incoming.is_empty() { + write!( + f, + "missing - {:?} [{}]; ", + self.missing_incoming.len(), + pretty_peer_id_set(&self.missing_incoming), + )?; + } + } + } + + match wanted_outgoing { + 0 => write!(f, "not attempting any outgoing connections; ")?, + _ => { + write!(f, "attempting {:?} outgoing connections; ", wanted_outgoing)?; + if !self.outgoing_peers.is_empty() { + write!( + f, + "have - {:?} [{}]; ", + self.outgoing_peers.len(), + pretty_peer_id_set(&self.outgoing_peers), + )?; + } + if !self.missing_outgoing.is_empty() { + write!( + f, + "missing - {:?} [{}]; ", + self.missing_outgoing.len(), + pretty_peer_id_set(&self.missing_outgoing), + )?; + } + } + } + + Ok(()) + } +} + +/// Network component responsible for holding the list of peers that we +/// want to connect to or let them connect to us, and managing the established +/// connections. +pub struct Manager { + // Which peers we want to be connected with, and which way. + wanted: DirectedPeers, + // This peers we are connected with. We ensure that this is always a subset of what we want. + have: HashMap>, +} + +impl Manager { + /// Create a new Manager with empty list of peers. + pub fn new(own_id: PK) -> Self { + Manager { + wanted: DirectedPeers::new(own_id), + have: HashMap::new(), + } + } + + fn active_connection(&self, peer_id: &PK) -> bool { + self.have + .get(peer_id) + .map(|sender| !sender.is_closed()) + .unwrap_or(false) + } + + /// Add a peer to the list of peers we want to stay connected to, or + /// update the address if the peer was already added. + /// Returns whether we should start attempts at connecting with the peer, which depends on the + /// coorddinated pseudorandom decision on the direction of the connection and whether this was + /// added for the first time. + pub fn add_peer(&mut self, peer_id: PK, address: A) -> bool { + self.wanted.add_peer(peer_id, address) + } + + /// Return the address of the given peer, or None if we shouldn't attempt connecting with the peer. + pub fn peer_address(&self, peer_id: &PK) -> Option { + self.wanted.peer_address(peer_id) + } + + /// Add an established connection with a known peer, but only if the peer is among the peers we want to be connected to. + pub fn add_connection( + &mut self, + peer_id: PK, + data_for_network: mpsc::UnboundedSender, + ) -> AddResult { + use AddResult::*; + if !self.wanted.interested(&peer_id) { + return Uninterested; + } + match self.have.insert(peer_id, data_for_network) { + Some(_) => Replaced, + None => Added, + } + } + + /// Remove a peer from the list of peers that we want to stay connected with. + /// Close any incoming and outgoing connections that were established. + pub fn remove_peer(&mut self, peer_id: &PK) { + self.wanted.remove_peer(peer_id); + self.have.remove(peer_id); + } + + /// Send data to a peer. + /// Returns error if there is no outgoing connection to the peer, + /// or if the connection is dead. + pub fn send_to(&mut self, peer_id: &PK, data: D) -> Result<(), SendError> { + self.have + .get(peer_id) + .ok_or(SendError::PeerNotFound)? + .unbounded_send(data) + .map_err(|_| SendError::ConnectionClosed) + } + + /// A status of the manager, to be displayed somewhere. + pub fn status_report(&self) -> impl Display { + ManagerStatus::new(self) + } + + pub fn is_authorized(&self, public_key: &PK) -> bool { + self.wanted.interested(public_key) + } +} + +#[cfg(test)] +mod tests { + use futures::{channel::mpsc, StreamExt}; + + use super::{AddResult::*, Manager, SendError}; + use crate::network::clique::mock::{key, MockPublicKey}; + + type Data = String; + type Address = String; + + #[test] + fn add_remove() { + let (own_id, _) = key(); + let mut manager = Manager::::new(own_id); + let (peer_id, _) = key(); + let (peer_id_b, _) = key(); + let address = String::from("43.43.43.43:43000"); + // add new peer - might return either true or false, depending on the ids + let attempting_connections = manager.add_peer(peer_id.clone(), address.clone()); + // add known peer - always returns false + assert!(!manager.add_peer(peer_id.clone(), address.clone())); + // get address + match attempting_connections { + true => assert_eq!(manager.peer_address(&peer_id), Some(address)), + false => assert_eq!(manager.peer_address(&peer_id), None), + } + // try to get address of an unknown peer + assert_eq!(manager.peer_address(&peer_id_b), None); + // remove peer + manager.remove_peer(&peer_id); + // try to get address of removed peer + assert_eq!(manager.peer_address(&peer_id), None); + // remove again + manager.remove_peer(&peer_id); + // remove unknown peer + manager.remove_peer(&peer_id_b); + } + + #[tokio::test] + async fn send_receive() { + let (mut connecting_id, _) = key(); + let mut connecting_manager = + Manager::::new(connecting_id.clone()); + let (mut listening_id, _) = key(); + let mut listening_manager = + Manager::::new(listening_id.clone()); + let data = String::from("DATA"); + let address = String::from("43.43.43.43:43000"); + let (tx, _rx) = mpsc::unbounded(); + // try add unknown peer + assert_eq!( + connecting_manager.add_connection(listening_id.clone(), tx), + Uninterested + ); + // sending should fail + assert_eq!( + connecting_manager.send_to(&listening_id, data.clone()), + Err(SendError::PeerNotFound) + ); + // add peer, this time for real + if connecting_manager.add_peer(listening_id.clone(), address.clone()) { + assert!(!listening_manager.add_peer(connecting_id.clone(), address.clone())) + } else { + // We need to switch the names around, because the connection was randomly the + // other way around. + std::mem::swap(&mut connecting_id, &mut listening_id); + std::mem::swap(&mut connecting_manager, &mut listening_manager); + assert!(connecting_manager.add_peer(listening_id.clone(), address.clone())); + } + // add outgoing to connecting + let (tx, mut rx) = mpsc::unbounded(); + assert_eq!( + connecting_manager.add_connection(listening_id.clone(), tx), + Added + ); + // send and receive connecting + assert!(connecting_manager + .send_to(&listening_id, data.clone()) + .is_ok()); + assert_eq!(data, rx.next().await.expect("should receive")); + // add incoming to listening + let (tx, mut rx) = mpsc::unbounded(); + assert_eq!( + listening_manager.add_connection(connecting_id.clone(), tx), + Added + ); + // send and receive listening + assert!(listening_manager + .send_to(&connecting_id, data.clone()) + .is_ok()); + assert_eq!(data, rx.next().await.expect("should receive")); + // remove peer + listening_manager.remove_peer(&connecting_id); + // receiving should fail + assert!(rx.next().await.is_none()); + } +} diff --git a/finality-aleph/src/network/clique/mock.rs b/finality-aleph/src/network/clique/mock.rs new file mode 100644 index 0000000000..1c95d37439 --- /dev/null +++ b/finality-aleph/src/network/clique/mock.rs @@ -0,0 +1,558 @@ +use std::{ + collections::HashMap, + fmt::{Display, Error as FmtError, Formatter}, + io::Result as IoResult, + pin::Pin, + task::{Context, Poll}, +}; + +use codec::{Decode, Encode}; +use futures::{ + channel::{mpsc, mpsc::UnboundedReceiver, oneshot}, + Future, StreamExt, +}; +use log::info; +use rand::Rng; +use tokio::io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf}; + +use crate::network::{ + clique::{ + protocols::{ProtocolError, ResultForService}, + ConnectionInfo, Dialer, Listener, Network, PeerAddressInfo, PublicKey, SecretKey, + Splittable, LOG_TARGET, + }, + mock::Channel, + AddressingInformation, Data, NetworkIdentity, PeerId, +}; + +/// A mock secret key that is able to sign messages. +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct MockSecretKey([u8; 4]); + +/// A mock public key for verifying signatures. +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Encode, Decode)] +pub struct MockPublicKey([u8; 4]); + +impl Display for MockPublicKey { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "PublicKey({:?})", self.0) + } +} + +impl AsRef<[u8]> for MockPublicKey { + fn as_ref(&self) -> &[u8] { + self.0.as_ref() + } +} + +/// A mock signature, able to discern whether the correct key has been used to sign a specific +/// message. +#[derive(Debug, PartialEq, Eq, Clone, Hash, Encode, Decode)] +pub struct MockSignature { + message: Vec, + key_id: [u8; 4], +} + +impl PublicKey for MockPublicKey { + type Signature = MockSignature; + + fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool { + (message == signature.message.as_slice()) && (self.0 == signature.key_id) + } +} + +impl PeerId for MockPublicKey {} + +#[async_trait::async_trait] +impl SecretKey for MockSecretKey { + type Signature = MockSignature; + type PublicKey = MockPublicKey; + + async fn sign(&self, message: &[u8]) -> Self::Signature { + MockSignature { + message: message.to_vec(), + key_id: self.0, + } + } + + fn public_key(&self) -> Self::PublicKey { + MockPublicKey(self.0) + } +} + +/// Create a random key pair. +pub fn key() -> (MockPublicKey, MockSecretKey) { + let secret_key = MockSecretKey(rand::random()); + (secret_key.public_key(), secret_key) +} + +/// Create a HashMap with public keys as keys and secret keys as values. +pub fn random_keys(n_peers: usize) -> HashMap { + let mut result = HashMap::with_capacity(n_peers); + while result.len() < n_peers { + let (pk, sk) = key(); + result.insert(pk, sk); + } + result +} + +/// A mock that can be split into two streams. +pub struct MockSplittable { + incoming_data: DuplexStream, + outgoing_data: DuplexStream, +} + +impl MockSplittable { + /// Create a pair of mock splittables connected to each other. + pub fn new(max_buf_size: usize) -> (Self, Self) { + let (in_a, out_b) = duplex(max_buf_size); + let (in_b, out_a) = duplex(max_buf_size); + ( + MockSplittable { + incoming_data: in_a, + outgoing_data: out_a, + }, + MockSplittable { + incoming_data: in_b, + outgoing_data: out_b, + }, + ) + } +} + +impl AsyncRead for MockSplittable { + fn poll_read( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut ReadBuf<'_>, + ) -> Poll> { + Pin::new(&mut self.get_mut().incoming_data).poll_read(cx, buf) + } +} + +impl AsyncWrite for MockSplittable { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_write(cx, buf) + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_flush(cx) + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_shutdown(cx) + } +} + +impl ConnectionInfo for MockSplittable { + fn peer_address_info(&self) -> PeerAddressInfo { + String::from("MOCK_ADDRESS") + } +} + +impl ConnectionInfo for DuplexStream { + fn peer_address_info(&self) -> PeerAddressInfo { + String::from("MOCK_ADDRESS") + } +} + +impl Splittable for MockSplittable { + type Sender = DuplexStream; + type Receiver = DuplexStream; + + fn split(self) -> (Self::Sender, Self::Receiver) { + (self.outgoing_data, self.incoming_data) + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, Encode, Decode)] +pub struct MockAddressingInformation { + peer_id: MockPublicKey, + address: String, + valid: bool, +} + +impl AddressingInformation for MockAddressingInformation { + type PeerId = MockPublicKey; + + fn peer_id(&self) -> Self::PeerId { + self.peer_id.clone() + } + + fn verify(&self) -> bool { + self.valid + } +} + +impl NetworkIdentity for MockAddressingInformation { + type PeerId = MockPublicKey; + type AddressingInformation = MockAddressingInformation; + + fn identity(&self) -> Self::AddressingInformation { + self.clone() + } +} + +impl From for Vec { + fn from(address: MockAddressingInformation) -> Self { + vec![address] + } +} + +impl TryFrom> for MockAddressingInformation { + type Error = (); + + fn try_from(mut addresses: Vec) -> Result { + match addresses.pop() { + Some(address) => Ok(address), + None => Err(()), + } + } +} + +pub fn random_peer_id() -> MockPublicKey { + key().0 +} + +pub fn random_address_from(address: String, valid: bool) -> MockAddressingInformation { + let peer_id = random_peer_id(); + MockAddressingInformation { + peer_id, + address, + valid, + } +} + +pub fn random_address() -> MockAddressingInformation { + random_address_from( + rand::thread_rng() + .sample_iter(&rand::distributions::Alphanumeric) + .map(char::from) + .take(43) + .collect(), + true, + ) +} + +pub fn random_invalid_address() -> MockAddressingInformation { + random_address_from( + rand::thread_rng() + .sample_iter(&rand::distributions::Alphanumeric) + .map(char::from) + .take(43) + .collect(), + false, + ) +} + +#[derive(Clone)] +pub struct MockNetwork { + pub add_connection: Channel<(MockPublicKey, MockAddressingInformation)>, + pub remove_connection: Channel, + pub send: Channel<(D, MockPublicKey)>, + pub next: Channel, +} + +#[async_trait::async_trait] +impl Network for MockNetwork { + fn add_connection(&mut self, peer: MockPublicKey, address: MockAddressingInformation) { + self.add_connection.send((peer, address)); + } + + fn remove_connection(&mut self, peer: MockPublicKey) { + self.remove_connection.send(peer); + } + + fn send(&self, data: D, recipient: MockPublicKey) { + self.send.send((data, recipient)); + } + + async fn next(&mut self) -> Option { + self.next.next().await + } +} + +impl MockNetwork { + pub fn new() -> Self { + MockNetwork { + add_connection: Channel::new(), + remove_connection: Channel::new(), + send: Channel::new(), + next: Channel::new(), + } + } + + // Consumes the network asserting there are no unreceived messages in the channels. + pub async fn close_channels(self) { + assert!(self.add_connection.close().await.is_none()); + assert!(self.remove_connection.close().await.is_none()); + assert!(self.send.close().await.is_none()); + assert!(self.next.close().await.is_none()); + } +} + +impl Default for MockNetwork { + fn default() -> Self { + Self::new() + } +} + +/// Bidirectional in-memory stream that closes abruptly after a specified +/// number of poll_write calls. +#[derive(Debug)] +pub struct UnreliableDuplexStream { + stream: DuplexStream, + counter: Option, + peer_address: Address, +} + +impl AsyncWrite for UnreliableDuplexStream { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + let this = self.get_mut(); + if let Some(ref mut c) = this.counter { + if c == &0 { + if Pin::new(&mut this.stream).poll_shutdown(cx).is_pending() { + return Poll::Pending; + } + } else { + *c -= 1; + } + } + Pin::new(&mut this.stream).poll_write(cx, buf) + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().stream).poll_flush(cx) + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().stream).poll_shutdown(cx) + } +} + +impl AsyncRead for UnreliableDuplexStream { + fn poll_read( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut ReadBuf<'_>, + ) -> Poll> { + Pin::new(&mut self.get_mut().stream).poll_read(cx, buf) + } +} + +/// A stream that can be split into two instances of UnreliableDuplexStream. +#[derive(Debug)] +pub struct UnreliableSplittable { + incoming_data: UnreliableDuplexStream, + outgoing_data: UnreliableDuplexStream, + peer_address: Address, +} + +impl UnreliableSplittable { + /// Create a pair of mock splittables connected to each other. + pub fn new( + max_buf_size: usize, + ends_after: Option, + l_address: Address, + r_address: Address, + ) -> (Self, Self) { + let (l_in, r_out) = duplex(max_buf_size); + let (r_in, l_out) = duplex(max_buf_size); + ( + UnreliableSplittable { + incoming_data: UnreliableDuplexStream { + stream: l_in, + counter: ends_after, + peer_address: r_address, + }, + outgoing_data: UnreliableDuplexStream { + stream: l_out, + counter: ends_after, + peer_address: r_address, + }, + peer_address: r_address, + }, + UnreliableSplittable { + incoming_data: UnreliableDuplexStream { + stream: r_in, + counter: ends_after, + peer_address: l_address, + }, + outgoing_data: UnreliableDuplexStream { + stream: r_out, + counter: ends_after, + peer_address: l_address, + }, + peer_address: l_address, + }, + ) + } +} + +impl AsyncRead for UnreliableSplittable { + fn poll_read( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut ReadBuf<'_>, + ) -> Poll> { + Pin::new(&mut self.get_mut().incoming_data).poll_read(cx, buf) + } +} + +impl AsyncWrite for UnreliableSplittable { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_write(cx, buf) + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_flush(cx) + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.get_mut().outgoing_data).poll_shutdown(cx) + } +} + +impl ConnectionInfo for UnreliableSplittable { + fn peer_address_info(&self) -> PeerAddressInfo { + self.peer_address.to_string() + } +} + +impl ConnectionInfo for UnreliableDuplexStream { + fn peer_address_info(&self) -> PeerAddressInfo { + self.peer_address.to_string() + } +} + +impl Splittable for UnreliableSplittable { + type Sender = UnreliableDuplexStream; + type Receiver = UnreliableDuplexStream; + + fn split(self) -> (Self::Sender, Self::Receiver) { + (self.outgoing_data, self.incoming_data) + } +} + +type Address = u32; +pub type Addresses = HashMap; +type Callers = HashMap; +type Connection = UnreliableSplittable; + +#[derive(Clone)] +pub struct MockDialer { + // used for logging + own_address: Address, + channel_connect: mpsc::UnboundedSender<(Address, Address, oneshot::Sender)>, +} + +#[async_trait::async_trait] +impl Dialer
for MockDialer { + type Connection = Connection; + type Error = std::io::Error; + + async fn connect(&mut self, address: Address) -> Result { + let (tx, rx) = oneshot::channel(); + self.channel_connect + .unbounded_send((self.own_address, address, tx)) + .expect("should send"); + Ok(rx.await.expect("should receive")) + } +} + +pub struct MockListener { + channel_accept: mpsc::UnboundedReceiver, +} + +#[async_trait::async_trait] +impl Listener for MockListener { + type Connection = Connection; + type Error = std::io::Error; + + async fn accept(&mut self) -> Result { + Ok(self.channel_accept.next().await.expect("should receive")) + } +} + +pub struct UnreliableConnectionMaker { + dialers: mpsc::UnboundedReceiver<(Address, Address, oneshot::Sender)>, + listeners: Vec>, +} + +impl UnreliableConnectionMaker { + pub fn new(ids: Vec) -> (Self, Callers, Addresses) { + let mut listeners = Vec::with_capacity(ids.len()); + let mut callers = HashMap::with_capacity(ids.len()); + let (tx_dialer, dialers) = mpsc::unbounded(); + // create peer addresses that will be understood by the main loop in method run + // each peer gets a one-element vector containing its index, so we'll be able + // to retrieve proper communication channels + let addr: Addresses = ids + .clone() + .into_iter() + .zip(0..ids.len()) + .map(|(id, u)| (id, u as u32)) + .collect(); + // create callers for every peer, keep channels for communicating with them + for id in ids.into_iter() { + let (tx_listener, rx_listener) = mpsc::unbounded(); + let dialer = MockDialer { + own_address: *addr.get(&id).expect("should be there"), + channel_connect: tx_dialer.clone(), + }; + let listener = MockListener { + channel_accept: rx_listener, + }; + listeners.push(tx_listener); + callers.insert(id, (dialer, listener)); + } + ( + UnreliableConnectionMaker { dialers, listeners }, + callers, + addr, + ) + } + + pub async fn run(&mut self, connections_end_after: Option) { + loop { + info!( + target: LOG_TARGET, + "UnreliableConnectionMaker: waiting for new request..." + ); + let (dialer_address, listener_address, c) = + self.dialers.next().await.expect("should receive"); + info!( + target: LOG_TARGET, + "UnreliableConnectionMaker: received request" + ); + let (dialer_stream, listener_stream) = Connection::new( + 4096, + connections_end_after, + dialer_address, + listener_address, + ); + info!( + target: LOG_TARGET, + "UnreliableConnectionMaker: sending stream" + ); + c.send(dialer_stream).expect("should send"); + self.listeners[listener_address as usize] + .unbounded_send(listener_stream) + .expect("should send"); + } + } +} + +pub struct MockPrelims { + pub id_incoming: MockPublicKey, + pub pen_incoming: MockSecretKey, + pub id_outgoing: MockPublicKey, + pub pen_outgoing: MockSecretKey, + pub incoming_handle: Pin>>>>, + pub outgoing_handle: Pin>>>>, + pub data_from_incoming: UnboundedReceiver, + pub data_from_outgoing: Option>, + pub result_from_incoming: UnboundedReceiver>, + pub result_from_outgoing: UnboundedReceiver>, + pub authorization_requests: mpsc::UnboundedReceiver<(MockPublicKey, oneshot::Sender)>, +} diff --git a/finality-aleph/src/validator_network/mod.rs b/finality-aleph/src/network/clique/mod.rs similarity index 62% rename from finality-aleph/src/validator_network/mod.rs rename to finality-aleph/src/network/clique/mod.rs index a797b7e44a..02e30db490 100644 --- a/finality-aleph/src/validator_network/mod.rs +++ b/finality-aleph/src/network/clique/mod.rs @@ -1,32 +1,26 @@ +//! A network for maintaining direct connections between all nodes. use std::fmt::Display; -use aleph_primitives::AuthorityId; -use codec::Codec; -use sp_core::crypto::KeyTypeId; use tokio::io::{AsyncRead, AsyncWrite}; -mod handshake; -mod heartbeat; +use crate::network::Data; + +mod crypto; mod incoming; mod io; mod manager; #[cfg(test)] pub mod mock; mod outgoing; -mod protocol_negotiation; mod protocols; mod service; +pub use crypto::{PublicKey, SecretKey}; pub use service::Service; -pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"a0vn"); - -/// What the data sent using the network has to satisfy. -pub trait Data: Clone + Codec + Send + Sync + 'static {} - -impl Data for D {} +const LOG_TARGET: &str = "clique-network"; -/// Network represents an interface for opening and closing connections with other Validators, +/// Network represents an interface for opening and closing connections with other nodes, /// and sending direct messages between them. /// /// Note on Network reliability and security: it is neither assumed that the sent messages must be @@ -34,25 +28,33 @@ impl Data for D {} /// implementation might fail to deliver any specific message, so messages have to be resent while /// they still should be delivered. #[async_trait::async_trait] -pub trait Network: Send + 'static { +pub trait Network: Send + 'static { /// Add the peer to the set of connected peers. - fn add_connection(&mut self, peer: AuthorityId, addresses: Vec); + fn add_connection(&mut self, peer: PK, address: A); /// Remove the peer from the set of connected peers and close the connection. - fn remove_connection(&mut self, peer: AuthorityId); + fn remove_connection(&mut self, peer: PK); /// Send a message to a single peer. /// This function should be implemented in a non-blocking manner. - fn send(&self, data: D, recipient: AuthorityId); + fn send(&self, data: D, recipient: PK); /// Receive a message from the network. async fn next(&mut self) -> Option; } +pub type PeerAddressInfo = String; + +/// Reports address of the peer that we are connected to. +pub trait ConnectionInfo { + /// Return the address of the peer that we are connected to. + fn peer_address_info(&self) -> PeerAddressInfo; +} + /// A stream that can be split into a sending and receiving part. -pub trait Splittable: AsyncWrite + AsyncRead + Unpin + Send { - type Sender: AsyncWrite + Unpin + Send; - type Receiver: AsyncRead + Unpin + Send; +pub trait Splittable: AsyncWrite + AsyncRead + ConnectionInfo + Unpin + Send { + type Sender: AsyncWrite + ConnectionInfo + Unpin + Send; + type Receiver: AsyncRead + ConnectionInfo + Unpin + Send; /// Split into the sending and receiving part. fn split(self) -> (Self::Sender, Self::Receiver); @@ -64,9 +66,8 @@ pub trait Dialer: Clone + Send + 'static { type Connection: Splittable; type Error: Display + Send; - /// Attempt to connect to a peer using the provided addresses. Should work if at least one of - /// the addresses is correct. - async fn connect(&mut self, addresses: Vec) -> Result; + /// Attempt to connect to a peer using the provided addressing information. + async fn connect(&mut self, address: A) -> Result; } /// Accepts new connections. Usually will be created listening on a specific interface and this is diff --git a/finality-aleph/src/network/clique/outgoing.rs b/finality-aleph/src/network/clique/outgoing.rs new file mode 100644 index 0000000000..a78910c76c --- /dev/null +++ b/finality-aleph/src/network/clique/outgoing.rs @@ -0,0 +1,117 @@ +use std::fmt::{Debug, Display, Error as FmtError, Formatter}; + +use futures::channel::mpsc; +use log::{debug, info}; +use tokio::time::{sleep, timeout, Duration}; + +use crate::network::clique::{ + protocols::{protocol, ProtocolError, ProtocolNegotiationError, ResultForService}, + ConnectionInfo, Data, Dialer, PeerAddressInfo, PublicKey, SecretKey, LOG_TARGET, +}; + +enum OutgoingError> { + Dial(ND::Error), + ProtocolNegotiation(PeerAddressInfo, ProtocolNegotiationError), + Protocol(PeerAddressInfo, ProtocolError), + TimedOut, +} + +impl> Display for OutgoingError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use OutgoingError::*; + match self { + Dial(e) => write!(f, "dial error: {}", e), + ProtocolNegotiation(addr, e) => write!( + f, + "communication with {} failed, protocol negotiation error: {}", + addr, e + ), + Protocol(addr, e) => write!( + f, + "communication with {} failed, protocol error: {}", + addr, e + ), + TimedOut => write!(f, "dial timeout",), + } + } +} + +/// Arbitrarily chosen timeout, should be more than enough. +const DIAL_TIMEOUT: Duration = Duration::from_secs(60); + +async fn manage_outgoing>( + secret_key: SK, + public_key: SK::PublicKey, + mut dialer: ND, + address: A, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, +) -> Result<(), OutgoingError> { + debug!(target: LOG_TARGET, "Trying to connect to {}.", public_key); + let stream = timeout(DIAL_TIMEOUT, dialer.connect(address)) + .await + .map_err(|_| OutgoingError::TimedOut)? + .map_err(OutgoingError::Dial)?; + let peer_address_info = stream.peer_address_info(); + debug!( + target: LOG_TARGET, + "Performing outgoing protocol negotiation." + ); + let (stream, protocol) = protocol(stream) + .await + .map_err(|e| OutgoingError::ProtocolNegotiation(peer_address_info.clone(), e))?; + debug!(target: LOG_TARGET, "Negotiated protocol, running."); + protocol + .manage_outgoing( + stream, + secret_key, + public_key, + result_for_parent, + data_for_user, + ) + .await + .map_err(|e| OutgoingError::Protocol(peer_address_info.clone(), e)) +} + +const RETRY_DELAY: Duration = Duration::from_secs(10); + +/// Establish an outgoing connection to the provided peer using the dialer and then manage it. +/// While this works it will send any data from the user to the peer. Any failures will be reported +/// to the parent, so that connections can be reestablished if necessary. +pub async fn outgoing>( + secret_key: SK, + public_key: SK::PublicKey, + dialer: ND, + address: A, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, +) { + if let Err(e) = manage_outgoing( + secret_key, + public_key.clone(), + dialer, + address.clone(), + result_for_parent.clone(), + data_for_user, + ) + .await + { + info!( + target: LOG_TARGET, + "Outgoing connection to {} {:?} failed: {}, will retry after {}s.", + public_key, + address, + e, + RETRY_DELAY.as_secs() + ); + sleep(RETRY_DELAY).await; + // we send the "new" connection type, because we always assume it's new until proven + // otherwise, and here we did not even get the chance to attempt negotiating a protocol + if result_for_parent + .unbounded_send((public_key, None)) + .is_err() + { + debug!(target: LOG_TARGET, "Could not send the closing message, we've probably been terminated by the parent service."); + } + } +} diff --git a/finality-aleph/src/validator_network/handshake.rs b/finality-aleph/src/network/clique/protocols/handshake.rs similarity index 69% rename from finality-aleph/src/validator_network/handshake.rs rename to finality-aleph/src/network/clique/protocols/handshake.rs index 54f0bf8820..e7720a8880 100644 --- a/finality-aleph/src/validator_network/handshake.rs +++ b/finality-aleph/src/network/clique/protocols/handshake.rs @@ -1,23 +1,19 @@ use std::fmt::{Display, Error as FmtError, Formatter}; -use aleph_primitives::AuthorityId; use codec::{Decode, Encode}; use rand::Rng; use tokio::time::{timeout, Duration}; -use crate::{ - crypto::{verify, AuthorityPen, Signature}, - validator_network::{ - io::{receive_data, send_data, ReceiveError, SendError}, - Splittable, - }, +use crate::network::clique::{ + io::{receive_data, send_data, ReceiveError, SendError}, + PublicKey, SecretKey, Splittable, }; pub const HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(10); /// Handshake error. #[derive(Debug)] -pub enum HandshakeError { +pub enum HandshakeError { /// Send error. SendError(SendError), /// Receive error. @@ -25,12 +21,12 @@ pub enum HandshakeError { /// Signature error. SignatureError, /// Challenge contains invalid peer id. - ChallengeError(AuthorityId, AuthorityId), + ChallengeError(PK, PK), /// Timeout. TimedOut, } -impl Display for HandshakeError { +impl Display for HandshakeError { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { use HandshakeError::*; match self { @@ -47,13 +43,13 @@ impl Display for HandshakeError { } } -impl From for HandshakeError { +impl From for HandshakeError { fn from(e: SendError) -> Self { HandshakeError::SendError(e) } } -impl From for HandshakeError { +impl From for HandshakeError { fn from(e: ReceiveError) -> Self { HandshakeError::ReceiveError(e) } @@ -61,39 +57,44 @@ impl From for HandshakeError { /// Handshake challenge. Contains public key of the creator, and a random nonce. #[derive(Debug, Clone, Encode, Decode)] -struct Challenge { - id: AuthorityId, +struct Challenge { + public_key: PK, nonce: [u8; 32], } -impl Challenge { +impl Challenge { /// Prepare new challenge that contains ID of the creator. - fn new(id: AuthorityId) -> Self { + fn new(public_key: PK) -> Self { let nonce = rand::thread_rng().gen::<[u8; 32]>(); - Self { id, nonce } + Self { public_key, nonce } } } /// Handshake response. Contains public key of the creator, and signature /// related to the received challenge. #[derive(Debug, Clone, Encode, Decode)] -struct Response { - id: AuthorityId, - signature: Signature, +struct Response { + public_key: PK, + signature: PK::Signature, } -impl Response { +impl Response { + // Amusingly the `Signature = PK::Signature` is necessary, the compiler cannot even do this + // simple reasoning. :/ /// Create a new response by signing the challenge. - async fn new(pen: &AuthorityPen, challenge: &Challenge) -> Self { + async fn new>( + secret_key: &SK, + challenge: &Challenge, + ) -> Self { Self { - id: pen.authority_id(), - signature: pen.sign(&challenge.encode()).await, + public_key: secret_key.public_key(), + signature: secret_key.sign(&challenge.encode()).await, } } /// Verify the Response sent by the peer. - fn verify(&self, challenge: &Challenge) -> bool { - verify(&self.id, &challenge.encode(), &self.signature) + fn verify(&self, challenge: &Challenge) -> bool { + self.public_key.verify(&challenge.encode(), &self.signature) } } @@ -105,22 +106,22 @@ impl Response { /// will NOT be secured in any way. We assume that if the channel is /// compromised after the handshake, the peer will establish another connection, /// which will replace the current one. -pub async fn execute_v0_handshake_incoming( +pub async fn execute_v0_handshake_incoming( stream: S, - authority_pen: AuthorityPen, -) -> Result<(S::Sender, S::Receiver, AuthorityId), HandshakeError> { + secret_key: SK, +) -> Result<(S::Sender, S::Receiver, SK::PublicKey), HandshakeError> { // send challenge - let our_challenge = Challenge::new(authority_pen.authority_id()); + let our_challenge = Challenge::new(secret_key.public_key()); let stream = send_data(stream, our_challenge.clone()).await?; // receive response - let (stream, peer_response) = receive_data::<_, Response>(stream).await?; + let (stream, peer_response) = receive_data::<_, Response>(stream).await?; // validate response if !peer_response.verify(&our_challenge) { return Err(HandshakeError::SignatureError); } let (sender, receiver) = stream.split(); - let peer_id = peer_response.id; - Ok((sender, receiver, peer_id)) + let public_key = peer_response.public_key; + Ok((sender, receiver, public_key)) } /// Performs the handshake with a peer that we called. We assume that their @@ -132,45 +133,48 @@ pub async fn execute_v0_handshake_incoming( /// will NOT be secured in any way. We assume that if the channel is /// compromised after the handshake, we will establish another connection, /// which will replace the current one. -pub async fn execute_v0_handshake_outgoing( +pub async fn execute_v0_handshake_outgoing( stream: S, - authority_pen: AuthorityPen, - peer_id: AuthorityId, -) -> Result<(S::Sender, S::Receiver), HandshakeError> { + secret_key: SK, + public_key: SK::PublicKey, +) -> Result<(S::Sender, S::Receiver), HandshakeError> { // receive challenge - let (stream, peer_challenge) = receive_data::<_, Challenge>(stream).await?; - if peer_id != peer_challenge.id { - return Err(HandshakeError::ChallengeError(peer_id, peer_challenge.id)); + let (stream, peer_challenge) = receive_data::<_, Challenge>(stream).await?; + if public_key != peer_challenge.public_key { + return Err(HandshakeError::ChallengeError( + public_key, + peer_challenge.public_key, + )); } // send response - let our_response = Response::new(&authority_pen, &peer_challenge).await; + let our_response = Response::new(&secret_key, &peer_challenge).await; let stream = send_data(stream, our_response).await?; let (sender, receiver) = stream.split(); Ok((sender, receiver)) } /// Wrapper that adds timeout to the function performing handshake. -pub async fn v0_handshake_incoming( +pub async fn v0_handshake_incoming( stream: S, - authority_pen: AuthorityPen, -) -> Result<(S::Sender, S::Receiver, AuthorityId), HandshakeError> { + secret_key: SK, +) -> Result<(S::Sender, S::Receiver, SK::PublicKey), HandshakeError> { timeout( HANDSHAKE_TIMEOUT, - execute_v0_handshake_incoming(stream, authority_pen), + execute_v0_handshake_incoming(stream, secret_key), ) .await .map_err(|_| HandshakeError::TimedOut)? } /// Wrapper that adds timeout to the function performing handshake. -pub async fn v0_handshake_outgoing( +pub async fn v0_handshake_outgoing( stream: S, - authority_pen: AuthorityPen, - peer_id: AuthorityId, -) -> Result<(S::Sender, S::Receiver), HandshakeError> { + secret_key: SK, + public_key: SK::PublicKey, +) -> Result<(S::Sender, S::Receiver), HandshakeError> { timeout( HANDSHAKE_TIMEOUT, - execute_v0_handshake_outgoing(stream, authority_pen, peer_id), + execute_v0_handshake_outgoing(stream, secret_key, public_key), ) .await .map_err(|_| HandshakeError::TimedOut)? @@ -184,16 +188,13 @@ mod tests { execute_v0_handshake_incoming, execute_v0_handshake_outgoing, Challenge, HandshakeError, Response, }; - use crate::{ - crypto::AuthorityPen, - validator_network::{ - io::{receive_data, send_data}, - mock::{key, MockSplittable}, - Splittable, - }, + use crate::network::clique::{ + io::{receive_data, send_data}, + mock::{key, MockPublicKey, MockSecretKey, MockSplittable}, + SecretKey, Splittable, }; - fn assert_send_error(result: Result) { + fn assert_send_error(result: Result>) { match result { Err(HandshakeError::SendError(_)) => (), x => panic!( @@ -203,7 +204,7 @@ mod tests { }; } - fn assert_receive_error(result: Result) { + fn assert_receive_error(result: Result>) { match result { Err(HandshakeError::ReceiveError(_)) => (), x => panic!( @@ -213,7 +214,9 @@ mod tests { }; } - fn assert_signature_error(result: Result) { + fn assert_signature_error( + result: Result>, + ) { match result { Err(HandshakeError::SignatureError) => (), x => panic!( @@ -223,7 +226,9 @@ mod tests { }; } - fn assert_challenge_error(result: Result) { + fn assert_challenge_error( + result: Result>, + ) { match result { Err(HandshakeError::ChallengeError(_, _)) => (), x => panic!( @@ -236,8 +241,8 @@ mod tests { #[tokio::test] async fn handshake() { let (stream_a, stream_b) = MockSplittable::new(4096); - let (id_a, pen_a) = key().await; - let (id_b, pen_b) = key().await; + let (id_a, pen_a) = key(); + let (id_b, pen_b) = key(); assert_ne!(id_a, id_b); let ((_, _, received_id_b), (_, _)) = try_join!( execute_v0_handshake_incoming(stream_a, pen_a), @@ -250,7 +255,7 @@ mod tests { #[tokio::test] async fn handshake_with_malicious_server_peer() { async fn execute_malicious_v0_handshake_incoming(stream: S) { - let (fake_id, _) = key().await; + let (fake_id, _) = key(); // send challenge with incorrect id let our_challenge = Challenge::new(fake_id); send_data(stream, our_challenge.clone()) @@ -261,8 +266,8 @@ mod tests { } let (stream_a, stream_b) = MockSplittable::new(4096); - let (id_a, _) = key().await; - let (_, pen_b) = key().await; + let (id_a, _) = key(); + let (_, pen_b) = key(); tokio::select! { _ = execute_malicious_v0_handshake_incoming(stream_a) => panic!("should wait"), result = execute_v0_handshake_outgoing(stream_b, pen_b, id_a) => assert_challenge_error(result), @@ -273,24 +278,24 @@ mod tests { async fn handshake_with_malicious_client_peer_fake_challenge() { pub async fn execute_malicious_v0_handshake_outgoing_fake_challenge( stream: S, - authority_pen: AuthorityPen, + secret_key: MockSecretKey, ) { // receive challenge - let (stream, _) = receive_data::<_, Challenge>(stream) + let (stream, _) = receive_data::<_, Challenge>(stream) .await .expect("should receive"); // prepare fake challenge - let (fake_id, _) = key().await; + let (fake_id, _) = key(); let fake_challenge = Challenge::new(fake_id); // send response with substituted challenge - let our_response = Response::new(&authority_pen, &fake_challenge).await; + let our_response = Response::new(&secret_key, &fake_challenge).await; send_data(stream, our_response).await.expect("should send"); futures::future::pending::<()>().await; } let (stream_a, stream_b) = MockSplittable::new(4096); - let (_, pen_a) = key().await; - let (_, pen_b) = key().await; + let (_, pen_a) = key(); + let (_, pen_b) = key(); tokio::select! { result = execute_v0_handshake_incoming(stream_a, pen_a) => assert_signature_error(result), _ = execute_malicious_v0_handshake_outgoing_fake_challenge(stream_b, pen_b) => panic!("should wait"), @@ -301,24 +306,24 @@ mod tests { async fn handshake_with_malicious_client_peer_fake_signature() { pub async fn execute_malicious_v0_handshake_outgoing_fake_signature( stream: S, - authority_pen: AuthorityPen, + secret_key: MockSecretKey, ) { // receive challenge - let (stream, challenge) = receive_data::<_, Challenge>(stream) + let (stream, challenge) = receive_data::<_, Challenge>(stream) .await .expect("should receive"); // prepare fake id - let (fake_id, _) = key().await; + let (fake_id, _) = key(); // send response with substituted id - let mut our_response = Response::new(&authority_pen, &challenge).await; - our_response.id = fake_id; + let mut our_response = Response::new(&secret_key, &challenge).await; + our_response.public_key = fake_id; send_data(stream, our_response).await.expect("should send"); futures::future::pending::<()>().await; } let (stream_a, stream_b) = MockSplittable::new(4096); - let (_, pen_a) = key().await; - let (_, pen_b) = key().await; + let (_, pen_a) = key(); + let (_, pen_b) = key(); tokio::select! { result = execute_v0_handshake_incoming(stream_a, pen_a) => assert_signature_error(result), _ = execute_malicious_v0_handshake_outgoing_fake_signature(stream_b, pen_b) => panic!("should wait"), @@ -329,19 +334,19 @@ mod tests { async fn broken_incoming_connection_step_one() { // break the connection even before the handshake starts by dropping the stream let (stream_a, _) = MockSplittable::new(4096); - let (_, pen_a) = key().await; + let (_, pen_a) = key(); assert_send_error(execute_v0_handshake_incoming(stream_a, pen_a).await); } #[tokio::test] async fn broken_incoming_connection_step_two() { let (stream_a, stream_b) = MockSplittable::new(4096); - let (_, pen_a) = key().await; + let (_, pen_a) = key(); let (result, _) = join!( execute_v0_handshake_incoming(stream_a, pen_a), // mock outgoing handshake: receive the first message and terminate async { - receive_data::<_, Challenge>(stream_b) + receive_data::<_, Challenge>(stream_b) .await .expect("should receive"); }, @@ -353,18 +358,18 @@ mod tests { async fn broken_outgoing_connection_step_one() { // break the connection even before the handshake starts by dropping the stream let (stream_a, _) = MockSplittable::new(4096); - let (_, pen_a) = key().await; - let (id_b, _) = key().await; + let (_, pen_a) = key(); + let (id_b, _) = key(); assert_receive_error(execute_v0_handshake_outgoing(stream_a, pen_a, id_b).await); } #[tokio::test] async fn broken_outgoing_connection_step_two() { let (stream_a, stream_b) = MockSplittable::new(4096); - let (id_a, pen_a) = key().await; - let (_, pen_b) = key().await; + let (id_a, pen_a) = key(); + let (_, pen_b) = key(); // mock incoming handshake: send the first message and terminate - send_data(stream_a, Challenge::new(pen_a.authority_id())) + send_data(stream_a, Challenge::new(pen_a.public_key())) .await .expect("should send"); assert_send_error(execute_v0_handshake_outgoing(stream_b, pen_b, id_a).await); diff --git a/finality-aleph/src/network/clique/protocols/mod.rs b/finality-aleph/src/network/clique/protocols/mod.rs new file mode 100644 index 0000000000..c1f30c40fe --- /dev/null +++ b/finality-aleph/src/network/clique/protocols/mod.rs @@ -0,0 +1,152 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use futures::channel::{mpsc, oneshot}; + +use crate::network::clique::{ + io::{ReceiveError, SendError}, + Data, PublicKey, SecretKey, Splittable, +}; + +mod handshake; +mod negotiation; +mod v1; + +use handshake::HandshakeError; +pub use negotiation::{protocol, ProtocolNegotiationError}; + +pub type Version = u32; + +/// What connections send back to the service after they become established. Starts with a public +/// key of the remote node, followed by a channel for sending data to that node, with None if the +/// connection was unsuccessful and should be reestablished. +pub type ResultForService = (PK, Option>); + +/// Defines the protocol for communication. Currently single variant, but left in case of protocol change. +#[derive(Debug, PartialEq, Eq)] +pub enum Protocol { + /// The current version of the protocol, with pseudorandom connection direction and + /// multiplexing. + V1, +} + +/// Protocol error. +#[derive(Debug)] +pub enum ProtocolError { + /// Error during performing a handshake. + HandshakeError(HandshakeError), + /// Sending failed. + SendError(SendError), + /// Receiving failed. + ReceiveError(ReceiveError), + /// Heartbeat stopped. + CardiacArrest, + /// Channel to the parent service closed. + NoParentConnection, + /// Data channel closed. + NoUserConnection, + /// Authorization error. + NotAuthorized, +} + +impl Display for ProtocolError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use ProtocolError::*; + match self { + HandshakeError(e) => write!(f, "handshake error: {}", e), + SendError(e) => write!(f, "send error: {}", e), + ReceiveError(e) => write!(f, "receive error: {}", e), + CardiacArrest => write!(f, "heartbeat stopped"), + NoParentConnection => write!(f, "cannot send result to service"), + NoUserConnection => write!(f, "cannot send data to user"), + NotAuthorized => write!(f, "peer not authorized"), + } + } +} + +impl From> for ProtocolError { + fn from(e: HandshakeError) -> Self { + ProtocolError::HandshakeError(e) + } +} + +impl From for ProtocolError { + fn from(e: SendError) -> Self { + ProtocolError::SendError(e) + } +} + +impl From for ProtocolError { + fn from(e: ReceiveError) -> Self { + ProtocolError::ReceiveError(e) + } +} + +impl Protocol { + /// Minimal supported protocol version. + const MIN_VERSION: Version = 1; + + /// Maximal supported protocol version. + const MAX_VERSION: Version = 1; + + /// Launches the proper variant of the protocol (receiver half). + pub async fn manage_incoming( + &self, + stream: S, + secret_key: SK, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, + authorization_requests_sender: mpsc::UnboundedSender<( + SK::PublicKey, + oneshot::Sender, + )>, + ) -> Result<(), ProtocolError> { + use Protocol::*; + match self { + V1 => { + v1::incoming( + stream, + secret_key, + authorization_requests_sender, + result_for_parent, + data_for_user, + ) + .await + } + } + } + + /// Launches the proper variant of the protocol (sender half). + pub async fn manage_outgoing( + &self, + stream: S, + secret_key: SK, + public_key: SK::PublicKey, + result_for_service: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, + ) -> Result<(), ProtocolError> { + use Protocol::*; + match self { + V1 => { + v1::outgoing( + stream, + secret_key, + public_key, + result_for_service, + data_for_user, + ) + .await + } + } + } +} + +impl TryFrom for Protocol { + type Error = Version; + + fn try_from(version: Version) -> Result { + match version { + 1 => Ok(Protocol::V1), + unknown_version => Err(unknown_version), + } + } +} diff --git a/finality-aleph/src/validator_network/protocol_negotiation.rs b/finality-aleph/src/network/clique/protocols/negotiation.rs similarity index 90% rename from finality-aleph/src/validator_network/protocol_negotiation.rs rename to finality-aleph/src/network/clique/protocols/negotiation.rs index 6413dfc63b..5519a94c7a 100644 --- a/finality-aleph/src/validator_network/protocol_negotiation.rs +++ b/finality-aleph/src/network/clique/protocols/negotiation.rs @@ -8,17 +8,13 @@ use tokio::{ time::{timeout, Duration}, }; -use crate::validator_network::protocols::Protocol; +use crate::network::clique::protocols::{Protocol, Version}; -pub type ProtocolVersion = u32; - -const MIN_SUPPORTED_PROTOCOL: ProtocolVersion = 0; -const MAX_SUPPORTED_PROTOCOL: ProtocolVersion = 0; const PROTOCOL_NEGOTIATION_TIMEOUT: Duration = Duration::from_secs(5); /// A range of supported protocols, will fail to decode if the range is empty. #[derive(Clone, Debug, PartialEq, Eq)] -pub struct ProtocolsRange(ProtocolVersion, ProtocolVersion); +pub struct ProtocolsRange(Version, Version); impl Display for ProtocolsRange { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { @@ -27,7 +23,7 @@ impl Display for ProtocolsRange { } const fn supported_protocol_range() -> ProtocolsRange { - ProtocolsRange(MIN_SUPPORTED_PROTOCOL, MAX_SUPPORTED_PROTOCOL) + ProtocolsRange(Protocol::MIN_VERSION, Protocol::MAX_VERSION) } /// What went wrong when negotiating a protocol. @@ -36,7 +32,7 @@ pub enum ProtocolNegotiationError { ConnectionClosed, InvalidRange(ProtocolsRange), ProtocolMismatch(ProtocolsRange, ProtocolsRange), - BadChoice(ProtocolVersion), + BadChoice(Version), TimedOut, } @@ -74,12 +70,8 @@ impl ProtocolsRange { fn decode(encoded: &[u8; 8]) -> Result { let result = ProtocolsRange( - ProtocolVersion::from_le_bytes( - encoded[0..4].try_into().expect("this is literally 4 bytes"), - ), - ProtocolVersion::from_le_bytes( - encoded[4..8].try_into().expect("this is literally 4 bytes"), - ), + Version::from_le_bytes(encoded[0..4].try_into().expect("this is literally 4 bytes")), + Version::from_le_bytes(encoded[4..8].try_into().expect("this is literally 4 bytes")), ); match result.valid() { true => Ok(result), @@ -103,9 +95,11 @@ fn maximum_of_intersection( range1: ProtocolsRange, range2: ProtocolsRange, ) -> Result { - intersection(range1, range2).map(|intersection| match intersection.1 { - 0 => Ok(Protocol::V0), - unknown_version => Err(ProtocolNegotiationError::BadChoice(unknown_version)), + intersection(range1, range2).map(|intersection| { + intersection + .1 + .try_into() + .map_err(ProtocolNegotiationError::BadChoice) })? } @@ -147,11 +141,11 @@ mod tests { use tokio::io::duplex; use super::{negotiate_protocol_version, supported_protocol_range, ProtocolNegotiationError}; - use crate::validator_network::protocols::Protocol; + use crate::network::clique::protocols::Protocol; fn correct_negotiation(result: Result<(S, Protocol), ProtocolNegotiationError>) { match result { - Ok((_stream, protocol)) => assert_eq!(Protocol::V0, protocol), + Ok((_stream, protocol)) => assert_eq!(Protocol::V1, protocol), Err(e) => panic!("Unexpected error: {:?}", e), } } diff --git a/finality-aleph/src/network/clique/protocols/v1/mod.rs b/finality-aleph/src/network/clique/protocols/v1/mod.rs new file mode 100644 index 0000000000..8e0d1c41a3 --- /dev/null +++ b/finality-aleph/src/network/clique/protocols/v1/mod.rs @@ -0,0 +1,525 @@ +use codec::{Decode, Encode}; +use futures::{ + channel::{mpsc, oneshot}, + StreamExt, +}; +use log::{debug, info, trace}; +use tokio::{ + io::{AsyncRead, AsyncWrite}, + time::{timeout, Duration}, +}; + +use crate::network::clique::{ + io::{receive_data, send_data}, + protocols::{ + handshake::{v0_handshake_incoming, v0_handshake_outgoing}, + ProtocolError, ResultForService, + }, + Data, PublicKey, SecretKey, Splittable, LOG_TARGET, +}; + +const HEARTBEAT_TIMEOUT: Duration = Duration::from_secs(5); +const MAX_MISSED_HEARTBEATS: u32 = 4; + +#[derive(Debug, Clone, Encode, Decode)] +enum Message { + Data(D), + Heartbeat, +} + +async fn check_authorization( + authorization_requests_sender: mpsc::UnboundedSender<(SK::PublicKey, oneshot::Sender)>, + public_key: SK::PublicKey, +) -> Result> { + let (sender, receiver) = oneshot::channel(); + authorization_requests_sender + .unbounded_send((public_key.clone(), sender)) + .map_err(|_| ProtocolError::NoParentConnection)?; + receiver + .await + .map_err(|_| ProtocolError::NoParentConnection) +} + +async fn sending( + mut sender: S, + mut data_from_user: mpsc::UnboundedReceiver, +) -> Result<(), ProtocolError> { + use Message::*; + loop { + let to_send = match timeout(HEARTBEAT_TIMEOUT, data_from_user.next()).await { + Ok(maybe_data) => match maybe_data { + Some(data) => Data(data), + // We have been closed by the parent service, all good. + None => return Ok(()), + }, + _ => Heartbeat, + }; + sender = send_data(sender, to_send).await?; + } +} + +async fn receiving( + mut stream: S, + data_for_user: mpsc::UnboundedSender, +) -> Result<(), ProtocolError> { + use Message::*; + loop { + let (old_stream, message) = timeout( + MAX_MISSED_HEARTBEATS * HEARTBEAT_TIMEOUT, + receive_data(stream), + ) + .await + .map_err(|_| ProtocolError::CardiacArrest)??; + stream = old_stream; + match message { + Data(data) => data_for_user + .unbounded_send(data) + .map_err(|_| ProtocolError::NoUserConnection)?, + Heartbeat => (), + } + } +} + +async fn manage_connection< + PK: PublicKey, + D: Data, + S: AsyncWrite + Unpin + Send, + R: AsyncRead + Unpin + Send, +>( + sender: S, + receiver: R, + data_from_user: mpsc::UnboundedReceiver, + data_for_user: mpsc::UnboundedSender, +) -> Result<(), ProtocolError> { + let sending = sending(sender, data_from_user); + let receiving = receiving(receiver, data_for_user); + tokio::select! { + result = receiving => result, + result = sending => result, + } +} + +/// Performs the outgoing handshake, and then manages a connection sending and receiving data. +/// Exits on parent request, or in case of broken or dead network connection. +pub async fn outgoing( + stream: S, + secret_key: SK, + public_key: SK::PublicKey, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, +) -> Result<(), ProtocolError> { + trace!(target: LOG_TARGET, "Extending hand to {}.", public_key); + let (sender, receiver) = v0_handshake_outgoing(stream, secret_key, public_key.clone()).await?; + info!( + target: LOG_TARGET, + "Outgoing handshake with {} finished successfully.", public_key + ); + let (data_for_network, data_from_user) = mpsc::unbounded(); + result_for_parent + .unbounded_send((public_key.clone(), Some(data_for_network))) + .map_err(|_| ProtocolError::NoParentConnection)?; + + debug!( + target: LOG_TARGET, + "Starting worker for communicating with {}.", public_key + ); + manage_connection(sender, receiver, data_from_user, data_for_user).await +} + +/// Performs the incoming handshake, and then manages a connection sending and receiving data. +/// Exits on parent request (when the data source is dropped), or in case of broken or dead +/// network connection. +pub async fn incoming( + stream: S, + secret_key: SK, + authorization_requests_sender: mpsc::UnboundedSender<(SK::PublicKey, oneshot::Sender)>, + result_for_parent: mpsc::UnboundedSender>, + data_for_user: mpsc::UnboundedSender, +) -> Result<(), ProtocolError> { + trace!(target: LOG_TARGET, "Waiting for extended hand..."); + let (sender, receiver, public_key) = v0_handshake_incoming(stream, secret_key).await?; + info!( + target: LOG_TARGET, + "Incoming handshake with {} finished successfully.", public_key + ); + + if !check_authorization::(authorization_requests_sender, public_key.clone()).await? { + return Err(ProtocolError::NotAuthorized); + } + + let (data_for_network, data_from_user) = mpsc::unbounded(); + result_for_parent + .unbounded_send((public_key.clone(), Some(data_for_network))) + .map_err(|_| ProtocolError::NoParentConnection)?; + debug!( + target: LOG_TARGET, + "Starting worker for communicating with {}.", public_key + ); + manage_connection(sender, receiver, data_from_user, data_for_user).await +} + +#[cfg(test)] +mod tests { + use futures::{ + channel::{mpsc, oneshot}, + pin_mut, Future, FutureExt, StreamExt, + }; + + use crate::network::clique::{ + mock::{key, MockPrelims, MockSplittable}, + protocols::{ + v1::{incoming, outgoing}, + ProtocolError, + }, + Data, + }; + + fn prepare() -> MockPrelims { + let (stream_incoming, stream_outgoing) = MockSplittable::new(4096); + let (id_incoming, pen_incoming) = key(); + let (id_outgoing, pen_outgoing) = key(); + assert_ne!(id_incoming, id_outgoing); + let (incoming_result_for_service, result_from_incoming) = mpsc::unbounded(); + let (outgoing_result_for_service, result_from_outgoing) = mpsc::unbounded(); + let (incoming_data_for_user, data_from_incoming) = mpsc::unbounded::(); + let (outgoing_data_for_user, data_from_outgoing) = mpsc::unbounded::(); + let (authorization_requests_sender, authorization_requests) = mpsc::unbounded(); + let incoming_handle = Box::pin(incoming( + stream_incoming, + pen_incoming.clone(), + authorization_requests_sender, + incoming_result_for_service, + incoming_data_for_user, + )); + let outgoing_handle = Box::pin(outgoing( + stream_outgoing, + pen_outgoing.clone(), + id_incoming.clone(), + outgoing_result_for_service, + outgoing_data_for_user, + )); + MockPrelims { + id_incoming, + pen_incoming, + id_outgoing, + pen_outgoing, + incoming_handle, + outgoing_handle, + data_from_incoming, + data_from_outgoing: Some(data_from_outgoing), + result_from_incoming, + result_from_outgoing, + authorization_requests, + } + } + + fn handle_authorization( + mut authorization_requests: mpsc::UnboundedReceiver<(PK, oneshot::Sender)>, + handler: impl FnOnce(PK) -> bool + Send + 'static, + ) -> impl Future> { + tokio::spawn(async move { + let (public_key, response_sender) = authorization_requests + .next() + .await + .expect("We should recieve at least one authorization request."); + let authorization_result = handler(public_key); + response_sender + .send(authorization_result) + .expect("We should be able to send back an authorization response."); + Result::<(), ()>::Ok(()) + }) + .map(|result| match result { + Ok(ok) => ok, + Err(_) => Err(()), + }) + } + + fn all_pass_authorization_handler( + authorization_requests: mpsc::UnboundedReceiver<(PK, oneshot::Sender)>, + ) -> impl Future> { + handle_authorization(authorization_requests, |_| true) + } + + fn no_go_authorization_handler( + authorization_requests: mpsc::UnboundedReceiver<(PK, oneshot::Sender)>, + ) -> impl Future> { + handle_authorization(authorization_requests, |_| false) + } + + #[tokio::test] + async fn send_data() { + let MockPrelims { + incoming_handle, + outgoing_handle, + mut data_from_incoming, + data_from_outgoing, + mut result_from_incoming, + mut result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + let mut data_from_outgoing = data_from_outgoing.expect("No data from outgoing!"); + let incoming_handle = incoming_handle.fuse(); + let outgoing_handle = outgoing_handle.fuse(); + pin_mut!(incoming_handle); + pin_mut!(outgoing_handle); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + let _data_for_outgoing = tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + result = result_from_outgoing.next() => { + let (_, maybe_data_for_outgoing) = result.expect("the channel shouldn't be dropped"); + let data_for_outgoing = maybe_data_for_outgoing.expect("successfully connected"); + data_for_outgoing + .unbounded_send(vec![4, 3, 43]) + .expect("should send"); + data_for_outgoing + .unbounded_send(vec![2, 1, 3, 7]) + .expect("should send"); + data_for_outgoing + }, + }; + let _data_for_incoming = tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + result = result_from_incoming.next() => { + let (_, maybe_data_for_incoming) = result.expect("the channel shouldn't be dropped"); + let data_for_incoming = maybe_data_for_incoming.expect("successfully connected"); + data_for_incoming + .unbounded_send(vec![5, 4, 44]) + .expect("should send"); + data_for_incoming + .unbounded_send(vec![3, 2, 4, 8]) + .expect("should send"); + data_for_incoming + }, + }; + tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + v = data_from_incoming.next() => { + assert_eq!(v, Some(vec![4, 3, 43])); + }, + }; + tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + v = data_from_incoming.next() => { + assert_eq!(v, Some(vec![2, 1, 3, 7])); + }, + }; + tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + v = data_from_outgoing.next() => { + assert_eq!(v, Some(vec![5, 4, 44])); + }, + }; + tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + v = data_from_outgoing.next() => { + assert_eq!(v, Some(vec![3, 2, 4, 8])); + }, + }; + } + + #[tokio::test] + async fn closed_by_parent_service() { + let MockPrelims { + id_outgoing, + incoming_handle, + outgoing_handle, + data_from_incoming: _data_from_incoming, + data_from_outgoing: _data_from_outgoing, + mut result_from_incoming, + result_from_outgoing: _result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + let incoming_handle = incoming_handle.fuse(); + let outgoing_handle = outgoing_handle.fuse(); + pin_mut!(incoming_handle); + pin_mut!(outgoing_handle); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + received = result_from_incoming.next() => { + // we drop the data sending channel, thus finishing incoming_handle + let (received_id, _) = received.expect("the channel shouldn't be dropped"); + assert_eq!(received_id, id_outgoing); + }, + }; + incoming_handle + .await + .expect("closed manually, should finish with no error"); + } + + #[tokio::test] + async fn parent_service_dead() { + let MockPrelims { + incoming_handle, + outgoing_handle, + data_from_incoming: _data_from_incoming, + data_from_outgoing: _data_from_outgoing, + result_from_incoming, + result_from_outgoing: _result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + std::mem::drop(result_from_incoming); + let incoming_handle = incoming_handle.fuse(); + let outgoing_handle = outgoing_handle.fuse(); + pin_mut!(incoming_handle); + pin_mut!(outgoing_handle); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + tokio::select! { + e = &mut incoming_handle => match e { + Err(ProtocolError::NoParentConnection) => (), + Err(e) => panic!("unexpected error: {}", e), + Ok(_) => panic!("successfully finished when parent dead"), + }, + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + }; + } + + #[tokio::test] + async fn parent_user_dead() { + let MockPrelims { + incoming_handle, + outgoing_handle, + data_from_incoming, + data_from_outgoing: _data_from_outgoing, + result_from_incoming: _result_from_incoming, + mut result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + std::mem::drop(data_from_incoming); + let incoming_handle = incoming_handle.fuse(); + let outgoing_handle = outgoing_handle.fuse(); + pin_mut!(incoming_handle); + pin_mut!(outgoing_handle); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + let _data_for_outgoing = tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + result = result_from_outgoing.next() => { + let (_, maybe_data_for_outgoing) = result.expect("the channel shouldn't be dropped"); + let data_for_outgoing = maybe_data_for_outgoing.expect("successfully connected"); + data_for_outgoing + .unbounded_send(vec![2, 1, 3, 7]) + .expect("should send"); + data_for_outgoing + }, + }; + tokio::select! { + e = &mut incoming_handle => match e { + Err(ProtocolError::NoUserConnection) => (), + Err(e) => panic!("unexpected error: {}", e), + Ok(_) => panic!("successfully finished when user dead"), + }, + _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), + }; + } + + #[tokio::test] + async fn sender_dead_before_handshake() { + let MockPrelims { + incoming_handle, + outgoing_handle, + data_from_incoming: _data_from_incoming, + data_from_outgoing: _data_from_outgoing, + result_from_incoming: _result_from_incoming, + result_from_outgoing: _result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + std::mem::drop(outgoing_handle); + match incoming_handle.await { + Err(ProtocolError::HandshakeError(_)) => (), + Err(e) => panic!("unexpected error: {}", e), + Ok(_) => panic!("successfully finished when connection dead"), + }; + } + + #[tokio::test] + async fn sender_dead_after_handshake() { + let MockPrelims { + incoming_handle, + outgoing_handle, + data_from_incoming: _data_from_incoming, + data_from_outgoing: _data_from_outgoing, + mut result_from_incoming, + result_from_outgoing: _result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + let incoming_handle = incoming_handle.fuse(); + pin_mut!(incoming_handle); + let (_, _exit) = tokio::select! { + _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), + _ = outgoing_handle => panic!("outgoing process unexpectedly finished"), + out = result_from_incoming.next() => out.expect("should receive"), + }; + // outgoing_handle got consumed by tokio::select!, the sender is dead + match incoming_handle.await { + Err(ProtocolError::ReceiveError(_)) => (), + Err(e) => panic!("unexpected error: {}", e), + Ok(_) => panic!("successfully finished when connection dead"), + }; + } + + #[tokio::test] + async fn receiver_dead_before_handshake() { + let MockPrelims { + incoming_handle, + outgoing_handle, + data_from_incoming: _data_from_incoming, + data_from_outgoing: _data_from_outgoing, + result_from_incoming: _result_from_incoming, + result_from_outgoing: _result_from_outgoing, + authorization_requests, + .. + } = prepare::>(); + let _authorization_handle = all_pass_authorization_handler(authorization_requests); + std::mem::drop(incoming_handle); + match outgoing_handle.await { + Err(ProtocolError::HandshakeError(_)) => (), + Err(e) => panic!("unexpected error: {}", e), + Ok(_) => panic!("successfully finished when connection dead"), + }; + } + + #[tokio::test] + async fn do_not_call_sender_and_receiver_until_authorized() { + let MockPrelims { + incoming_handle, + outgoing_handle, + mut data_from_incoming, + mut result_from_incoming, + authorization_requests, + .. + } = prepare::>(); + + let authorization_handle = no_go_authorization_handler(authorization_requests); + + // since we are returning `NotAuthorized` all except `outgoing_handle` should finish hapilly + let (incoming_result, outgoing_result, authorization_result) = + tokio::join!(incoming_handle, outgoing_handle, authorization_handle); + + assert!(incoming_result.is_err()); + assert!(outgoing_result.is_err()); + // this also verifies if it was called at all + assert!(authorization_result.is_ok()); + + let data_from_incoming = data_from_incoming.try_next(); + assert!(data_from_incoming.ok().flatten().is_none()); + + let result_from_incoming = result_from_incoming.try_next(); + assert!(result_from_incoming.ok().flatten().is_none()); + } +} diff --git a/finality-aleph/src/network/clique/service.rs b/finality-aleph/src/network/clique/service.rs new file mode 100644 index 0000000000..4c78907559 --- /dev/null +++ b/finality-aleph/src/network/clique/service.rs @@ -0,0 +1,247 @@ +use std::fmt::Debug; + +use futures::{ + channel::{mpsc, oneshot}, + StreamExt, +}; +use log::{info, trace, warn}; +use tokio::time; + +use crate::{ + network::{ + clique::{ + incoming::incoming, + manager::{AddResult, Manager}, + outgoing::outgoing, + protocols::ResultForService, + Dialer, Listener, Network, PublicKey, SecretKey, LOG_TARGET, + }, + Data, PeerId, + }, + SpawnTaskHandle, STATUS_REPORT_INTERVAL, +}; + +enum ServiceCommand { + AddConnection(PK, A), + DelConnection(PK), + SendData(D, PK), +} + +struct ServiceInterface { + commands_for_service: mpsc::UnboundedSender>, + next_from_service: mpsc::UnboundedReceiver, +} + +#[async_trait::async_trait] +impl Network for ServiceInterface { + /// Add the peer to the set of connected peers. + fn add_connection(&mut self, peer: PK, address: A) { + if self + .commands_for_service + .unbounded_send(ServiceCommand::AddConnection(peer, address)) + .is_err() + { + info!(target: LOG_TARGET, "Service is dead."); + }; + } + + /// Remove the peer from the set of connected peers and close the connection. + fn remove_connection(&mut self, peer: PK) { + if self + .commands_for_service + .unbounded_send(ServiceCommand::DelConnection(peer)) + .is_err() + { + info!(target: LOG_TARGET, "Service is dead."); + }; + } + + /// Send a message to a single peer. + /// This function should be implemented in a non-blocking manner. + fn send(&self, data: D, recipient: PK) { + if self + .commands_for_service + .unbounded_send(ServiceCommand::SendData(data, recipient)) + .is_err() + { + info!(target: LOG_TARGET, "Service is dead."); + }; + } + + /// Receive a message from the network. + async fn next(&mut self) -> Option { + self.next_from_service.next().await + } +} + +/// A service that has to be run for the clique network to work. +pub struct Service, NL: Listener> +where + SK::PublicKey: PeerId, +{ + commands_from_interface: mpsc::UnboundedReceiver>, + next_to_interface: mpsc::UnboundedSender, + manager: Manager, + dialer: ND, + listener: NL, + spawn_handle: SpawnTaskHandle, + secret_key: SK, +} + +impl, NL: Listener> Service +where + SK::PublicKey: PeerId, +{ + /// Create a new clique network service plus an interface for interacting with it. + pub fn new( + dialer: ND, + listener: NL, + secret_key: SK, + spawn_handle: SpawnTaskHandle, + ) -> (Self, impl Network) { + // Channel for sending commands between the service and interface + let (commands_for_service, commands_from_interface) = mpsc::unbounded(); + // Channel for receiving data from the network + let (next_to_interface, next_from_service) = mpsc::unbounded(); + ( + Self { + commands_from_interface, + next_to_interface, + manager: Manager::new(secret_key.public_key()), + dialer, + listener, + spawn_handle, + secret_key, + }, + ServiceInterface { + commands_for_service, + next_from_service, + }, + ) + } + + fn spawn_new_outgoing( + &mut self, + public_key: SK::PublicKey, + address: A, + result_for_parent: mpsc::UnboundedSender>, + ) { + let secret_key = self.secret_key.clone(); + let dialer = self.dialer.clone(); + let next_to_interface = self.next_to_interface.clone(); + self.spawn_handle + .spawn("aleph/clique_network_outgoing", None, async move { + outgoing( + secret_key, + public_key, + dialer, + address, + result_for_parent, + next_to_interface, + ) + .await; + }); + } + + fn spawn_new_incoming( + &self, + stream: NL::Connection, + result_for_parent: mpsc::UnboundedSender>, + authorization_requests_sender: mpsc::UnboundedSender<( + SK::PublicKey, + oneshot::Sender, + )>, + ) { + let secret_key = self.secret_key.clone(); + let next_to_interface = self.next_to_interface.clone(); + self.spawn_handle + .spawn("aleph/clique_network_incoming", None, async move { + incoming( + secret_key, + stream, + result_for_parent, + next_to_interface, + authorization_requests_sender, + ) + .await; + }); + } + + fn peer_address(&self, public_key: &SK::PublicKey) -> Option { + self.manager.peer_address(public_key) + } + + fn add_connection( + &mut self, + public_key: SK::PublicKey, + data_for_network: mpsc::UnboundedSender, + ) -> AddResult { + self.manager.add_connection(public_key, data_for_network) + } + + /// Run the service until a signal from exit. + pub async fn run(mut self, mut exit: oneshot::Receiver<()>) { + let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); + let (result_for_parent, mut worker_results) = mpsc::unbounded(); + let (authorization_requests_sender, mut authorization_requests) = mpsc::unbounded(); + use ServiceCommand::*; + loop { + tokio::select! { + // got new incoming connection from the listener - spawn an incoming worker + maybe_stream = self.listener.accept() => match maybe_stream { + Ok(stream) => self.spawn_new_incoming(stream, result_for_parent.clone(), authorization_requests_sender.clone()), + Err(e) => warn!(target: LOG_TARGET, "Listener failed to accept connection: {}", e), + }, + // got a new command from the interface + Some(command) = self.commands_from_interface.next() => match command { + // register new peer in manager or update its address if already there + // spawn a worker managing outgoing connection if the peer was not known + AddConnection(public_key, address) => { + if self.manager.add_peer(public_key.clone(), address.clone()) { + self.spawn_new_outgoing(public_key, address, result_for_parent.clone()); + }; + }, + // remove the peer from the manager all workers will be killed automatically, due to closed channels + DelConnection(public_key) => { + self.manager.remove_peer(&public_key); + }, + // pass the data to the manager + SendData(data, public_key) => { + match self.manager.send_to(&public_key, data) { + Ok(_) => trace!(target: LOG_TARGET, "Sending data to {}.", public_key), + Err(e) => trace!(target: LOG_TARGET, "Failed sending to {}: {}", public_key, e), + } + } + }, + Some((public_key, response_channel)) = authorization_requests.next() => { + let authorization_result = self.manager.is_authorized(&public_key); + if response_channel.send(authorization_result).is_err() { + warn!(target: LOG_TARGET, "Other side of the Authorization Service is already closed."); + } + }, + // received information from a spawned worker managing a connection + // check if we still want to be connected to the peer, and if so, spawn a new worker or actually add proper connection + Some((public_key, maybe_data_for_network)) = worker_results.next() => { + use AddResult::*; + match maybe_data_for_network { + Some(data_for_network) => match self.add_connection(public_key.clone(), data_for_network) { + Uninterested => warn!(target: LOG_TARGET, "Established connection with peer {} for unknown reasons.", public_key), + Added => info!(target: LOG_TARGET, "New connection with peer {}.", public_key), + Replaced => info!(target: LOG_TARGET, "Replaced connection with peer {}.", public_key), + }, + None => if let Some(address) = self.peer_address(&public_key) { + self.spawn_new_outgoing(public_key, address, result_for_parent.clone()); + } + } + }, + // periodically reporting what we are trying to do + _ = status_ticker.tick() => { + info!(target: LOG_TARGET, "Clique Network status: {}", self.manager.status_report()); + } + // received exit signal, stop the network + // all workers will be killed automatically after the manager gets dropped + _ = &mut exit => break, + }; + } + } +} diff --git a/finality-aleph/src/network/component.rs b/finality-aleph/src/network/data/component.rs similarity index 96% rename from finality-aleph/src/network/component.rs rename to finality-aleph/src/network/data/component.rs index fb69ede92c..c154ff1664 100644 --- a/finality-aleph/src/network/component.rs +++ b/finality-aleph/src/network/data/component.rs @@ -4,7 +4,10 @@ use futures::{channel::mpsc, StreamExt}; use log::warn; use crate::{ - network::{Data, DataNetwork, SendError}, + network::{ + data::{Network as DataNetwork, SendError}, + Data, + }, Recipient, }; @@ -185,8 +188,11 @@ mod tests { use super::{DataNetwork, NetworkMap, Receiver, Sender}; use crate::{ network::{ - component::{Network, ReceiverMap, SenderMap}, - Data, SendError, + data::{ + component::{Network, ReceiverMap, SenderMap}, + SendError, + }, + Data, }, Recipient, }; @@ -221,8 +227,8 @@ mod tests { } } - impl Into for IntoType { - fn into(self) -> FromType { + impl From for FromType { + fn from(_value: IntoType) -> Self { FromType::A } } diff --git a/finality-aleph/src/network/data/mod.rs b/finality-aleph/src/network/data/mod.rs new file mode 100644 index 0000000000..2ee22d75d7 --- /dev/null +++ b/finality-aleph/src/network/data/mod.rs @@ -0,0 +1,18 @@ +//! Abstraction over an abstract network sending data to a set of nodes. +use crate::{abft::Recipient, network::Data}; + +pub mod component; +pub mod split; + +/// Returned when something went wrong when sending data using a Network. +#[derive(Debug)] +pub enum SendError { + SendFailed, +} + +/// A generic interface for sending and receiving data. +#[async_trait::async_trait] +pub trait Network: Send + Sync { + fn send(&self, data: D, recipient: Recipient) -> Result<(), SendError>; + async fn next(&mut self) -> Option; +} diff --git a/finality-aleph/src/network/split.rs b/finality-aleph/src/network/data/split.rs similarity index 87% rename from finality-aleph/src/network/split.rs rename to finality-aleph/src/network/data/split.rs index 73268ec6d2..c674902d1b 100644 --- a/finality-aleph/src/network/split.rs +++ b/finality-aleph/src/network/data/split.rs @@ -9,8 +9,11 @@ use tokio::sync::Mutex; use crate::{ network::{ - ComponentNetwork, ComponentNetworkExt, Data, ReceiverComponent, SendError, SenderComponent, - SimpleNetwork, + data::{ + component::{Network, NetworkExt, Receiver, Sender, SimpleNetwork}, + SendError, + }, + Data, }, Recipient, Version, Versioned, }; @@ -65,7 +68,7 @@ impl Convert for ToRightSplitConvert { struct SplitSender< LeftData: Data, RightData: Data, - S: SenderComponent>, + S: Sender>, Conv: Convert, > { sender: S, @@ -75,9 +78,9 @@ struct SplitSender< impl< LeftData: Data, RightData: Data, - S: SenderComponent>, + S: Sender>, Conv: Convert> + Clone + Send + Sync, - > SenderComponent for SplitSender + > Sender for SplitSender where ::From: Data, ::To: Data, @@ -96,7 +99,7 @@ type RightSender = struct SplitReceiver< LeftData: Data, RightData: Data, - R: ReceiverComponent>, + R: Receiver>, TranslatedData: Data, > { receiver: Arc>, @@ -110,9 +113,9 @@ struct SplitReceiver< impl< LeftData: Data, RightData: Data, - R: ReceiverComponent>, + R: Receiver>, TranslatedData: Data, - > ReceiverComponent for SplitReceiver + > Receiver for SplitReceiver { async fn next(&mut self) -> Option { loop { @@ -137,7 +140,7 @@ type RightReceiver = SplitReceiver>, + R: Receiver>, >( receiver: &Arc>, left_sender: &mpsc::UnboundedSender, @@ -169,7 +172,7 @@ async fn forward_or_wait< } } -fn split_sender>>( +fn split_sender>>( sender: S, ) -> ( LeftSender, @@ -187,11 +190,7 @@ fn split_sender>, ->( +fn split_receiver>>( receiver: R, left_name: &'static str, right_name: &'static str, @@ -229,14 +228,11 @@ fn split_receiver< /// /// The main example for now is creating an `aleph_bft::Network` and a separate one for accumulating /// signatures for justifications. -pub fn split>>( +pub fn split>>( network: CN, left_name: &'static str, right_name: &'static str, -) -> ( - impl ComponentNetworkExt, - impl ComponentNetworkExt, -) { +) -> (impl NetworkExt, impl NetworkExt) { let (sender, receiver) = network.into(); let (left_sender, right_sender) = split_sender(sender); let (left_receiver, right_receiver) = split_receiver(receiver, left_name, right_name); diff --git a/finality-aleph/src/network/gossip/mock.rs b/finality-aleph/src/network/gossip/mock.rs new file mode 100644 index 0000000000..9bac21124d --- /dev/null +++ b/finality-aleph/src/network/gossip/mock.rs @@ -0,0 +1,130 @@ +use std::{collections::VecDeque, fmt, sync::Arc}; + +use async_trait::async_trait; +use futures::{ + channel::{mpsc, oneshot}, + StreamExt, +}; +use parking_lot::Mutex; + +use crate::network::{ + clique::mock::MockPublicKey, + gossip::{Event, EventStream, NetworkSender, Protocol, RawNetwork}, + mock::Channel, +}; + +pub type MockEvent = Event; + +pub struct MockEventStream(mpsc::UnboundedReceiver); + +#[async_trait] +impl EventStream for MockEventStream { + async fn next_event(&mut self) -> Option { + self.0.next().await + } +} + +pub struct MockNetworkSender { + sender: mpsc::UnboundedSender<(Vec, MockPublicKey, Protocol)>, + peer_id: MockPublicKey, + protocol: Protocol, + error: Result<(), MockSenderError>, +} + +#[async_trait] +impl NetworkSender for MockNetworkSender { + type SenderError = MockSenderError; + + async fn send<'a>( + &'a self, + data: impl Into> + Send + Sync + 'static, + ) -> Result<(), MockSenderError> { + self.error?; + self.sender + .unbounded_send((data.into(), self.peer_id.clone(), self.protocol)) + .unwrap(); + Ok(()) + } +} + +#[derive(Clone)] +pub struct MockRawNetwork { + pub send_message: Channel<(Vec, MockPublicKey, Protocol)>, + pub event_sinks: Arc>>>, + event_stream_taken_oneshot: Arc>>>, + pub create_sender_errors: Arc>>, + pub send_errors: Arc>>, +} + +#[derive(Debug, Copy, Clone)] +pub struct MockSenderError; + +impl fmt::Display for MockSenderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Some error message") + } +} + +impl std::error::Error for MockSenderError {} + +impl RawNetwork for MockRawNetwork { + type SenderError = MockSenderError; + type NetworkSender = MockNetworkSender; + type PeerId = MockPublicKey; + type EventStream = MockEventStream; + + fn event_stream(&self) -> Self::EventStream { + let (tx, rx) = mpsc::unbounded(); + self.event_sinks.lock().push(tx); + // Necessary for tests to detect when service takes event_stream + if let Some(tx) = self.event_stream_taken_oneshot.lock().take() { + tx.send(()).unwrap(); + } + MockEventStream(rx) + } + + fn sender( + &self, + peer_id: Self::PeerId, + protocol: Protocol, + ) -> Result { + self.create_sender_errors + .lock() + .pop_front() + .map_or(Ok(()), Err)?; + let error = self.send_errors.lock().pop_front().map_or(Ok(()), Err); + Ok(MockNetworkSender { + sender: self.send_message.0.clone(), + peer_id, + protocol, + error, + }) + } +} + +impl MockRawNetwork { + pub fn new(oneshot_sender: oneshot::Sender<()>) -> Self { + MockRawNetwork { + send_message: Channel::new(), + event_sinks: Arc::new(Mutex::new(vec![])), + event_stream_taken_oneshot: Arc::new(Mutex::new(Some(oneshot_sender))), + create_sender_errors: Arc::new(Mutex::new(VecDeque::new())), + send_errors: Arc::new(Mutex::new(VecDeque::new())), + } + } + + pub fn emit_event(&mut self, event: MockEvent) { + for sink in &*self.event_sinks.lock() { + sink.unbounded_send(event.clone()).unwrap(); + } + } + + // Consumes the network asserting there are no unreceived messages in the channels. + pub async fn close_channels(self) { + self.event_sinks.lock().clear(); + // We disable it until tests regarding new substrate network protocol are created. + // assert!(self.add_reserved.close().await.is_none()); + // assert!(self.remove_reserved.close().await.is_none()); + assert!(self.send_message.close().await.is_none()); + } +} diff --git a/finality-aleph/src/network/gossip/mod.rs b/finality-aleph/src/network/gossip/mod.rs new file mode 100644 index 0000000000..9edd411206 --- /dev/null +++ b/finality-aleph/src/network/gossip/mod.rs @@ -0,0 +1,98 @@ +//! A P2P-based gossip network, for now only for sending broadcasts. +use std::{ + collections::HashSet, + fmt::{Debug, Display}, + hash::Hash, +}; + +use bytes::Bytes; + +use crate::network::Data; + +#[cfg(test)] +pub mod mock; +mod service; + +pub use service::Service; + +#[async_trait::async_trait] +/// Interface for the gossip network. This represents a P2P network and a lot of the properties of +/// this interface result from that. In particular we might know the ID of a given peer, but not be +/// connected to them directly. +pub trait Network: Send + 'static { + type Error: Display + Send; + type PeerId: Clone + Debug + Eq + Hash + Send + 'static; + + /// Attempt to send data to a peer. Might silently fail if we are not connected to them. + fn send_to(&mut self, data: D, peer_id: Self::PeerId) -> Result<(), Self::Error>; + + /// Send data to a random peer, preferably from a list. It should send the data to a randomly + /// chosen peer from the provided list, but if it cannot (e.g. because it's not connected) it + /// will send to a random available peer. No guarantees any peer gets it even if no errors are + /// returned, retry appropriately. + fn send_to_random( + &mut self, + data: D, + peer_ids: HashSet, + ) -> Result<(), Self::Error>; + + /// Broadcast data to all directly connected peers. Network-wide broadcasts have to be + /// implemented on top of this abstraction. Note that there might be no currently connected + /// peers, so there are no guarantees any single call sends anything even if no errors are + /// returned, retry appropriately. + fn broadcast(&mut self, data: D) -> Result<(), Self::Error>; + + /// Receive some data from the network, including information about who sent it. + async fn next(&mut self) -> Result<(D, Self::PeerId), Self::Error>; +} + +/// Protocols used by the network. +#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] +pub enum Protocol { + /// The authentication protocol is used for validator discovery. + Authentication, + /// The block synchronization protocol. + BlockSync, +} + +/// Abstraction over a sender to the raw network. +#[async_trait::async_trait] +pub trait NetworkSender: Send + Sync + 'static { + type SenderError: std::error::Error; + + /// A method for sending data. Returns Error if not connected to the peer. + async fn send<'a>( + &'a self, + data: impl Into> + Send + Sync + 'static, + ) -> Result<(), Self::SenderError>; +} + +#[derive(Clone)] +pub enum Event

{ + StreamOpened(P, Protocol), + StreamClosed(P, Protocol), + Messages(P, Vec<(Protocol, Bytes)>), +} + +#[async_trait::async_trait] +pub trait EventStream

{ + async fn next_event(&mut self) -> Option>; +} + +/// Abstraction over a raw p2p network. +pub trait RawNetwork: Clone + Send + Sync + 'static { + type SenderError: std::error::Error; + type NetworkSender: NetworkSender; + type PeerId: Clone + Debug + Eq + Hash + Send + 'static; + type EventStream: EventStream; + + /// Returns a stream of events representing what happens on the network. + fn event_stream(&self) -> Self::EventStream; + + /// Returns a sender to the given peer using a given protocol. Returns Error if not connected to the peer. + fn sender( + &self, + peer_id: Self::PeerId, + protocol: Protocol, + ) -> Result; +} diff --git a/finality-aleph/src/network/gossip/service.rs b/finality-aleph/src/network/gossip/service.rs new file mode 100644 index 0000000000..5f9640802d --- /dev/null +++ b/finality-aleph/src/network/gossip/service.rs @@ -0,0 +1,775 @@ +use std::{ + collections::{HashMap, HashSet}, + fmt::{Debug, Display, Error as FmtError, Formatter}, + future::Future, + hash::Hash, +}; + +use futures::{channel::mpsc, StreamExt}; +use log::{debug, error, info, trace, warn}; +use rand::{seq::IteratorRandom, thread_rng}; +use sc_service::SpawnTaskHandle; +use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; +use tokio::time; + +const QUEUE_SIZE_WARNING: i64 = 1_000; + +use crate::{ + network::{ + gossip::{Event, EventStream, Network, NetworkSender, Protocol, RawNetwork}, + Data, + }, + STATUS_REPORT_INTERVAL, +}; + +enum Command { + Send(D, P, Protocol), + SendToRandom(D, HashSet

, Protocol), + Broadcast(D, Protocol), +} + +/// A service managing all the direct interaction with the underlying network implementation. It +/// handles: +/// 1. Incoming network events +/// 1. Messages are forwarded to the user. +/// 2. Various forms of (dis)connecting, keeping track of all currently connected nodes. +/// 3. Outgoing messages, sending them out, using 1.2. to broadcast. +pub struct Service { + network: N, + messages_from_user: mpsc::UnboundedReceiver>, + messages_for_authentication_user: mpsc::UnboundedSender<(D, N::PeerId)>, + messages_for_block_sync_user: mpsc::UnboundedSender<(D, N::PeerId)>, + authentication_connected_peers: HashSet, + authentication_peer_senders: HashMap>, + block_sync_connected_peers: HashSet, + block_sync_peer_senders: HashMap>, + spawn_handle: SpawnTaskHandle, +} + +struct ServiceInterface { + protocol: Protocol, + messages_from_service: mpsc::UnboundedReceiver<(D, P)>, + messages_for_service: mpsc::UnboundedSender>, +} + +/// What can go wrong when receiving or sending data. +#[derive(Debug)] +pub enum Error { + ServiceStopped, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use Error::*; + match self { + ServiceStopped => { + write!(f, "gossip network service stopped") + } + } + } +} + +#[async_trait::async_trait] +impl Network for ServiceInterface { + type Error = Error; + type PeerId = P; + + fn send_to(&mut self, data: D, peer_id: Self::PeerId) -> Result<(), Self::Error> { + self.messages_for_service + .unbounded_send(Command::Send(data, peer_id, self.protocol)) + .map_err(|_| Error::ServiceStopped) + } + + fn send_to_random( + &mut self, + data: D, + peer_ids: HashSet, + ) -> Result<(), Self::Error> { + self.messages_for_service + .unbounded_send(Command::SendToRandom(data, peer_ids, self.protocol)) + .map_err(|_| Error::ServiceStopped) + } + + fn broadcast(&mut self, data: D) -> Result<(), Self::Error> { + self.messages_for_service + .unbounded_send(Command::Broadcast(data, self.protocol)) + .map_err(|_| Error::ServiceStopped) + } + + async fn next(&mut self) -> Result<(D, Self::PeerId), Self::Error> { + self.messages_from_service + .next() + .await + .ok_or(Error::ServiceStopped) + } +} + +#[derive(Debug)] +enum SendError { + MissingSender, + SendingFailed, +} + +impl Service { + pub fn new( + network: N, + spawn_handle: SpawnTaskHandle, + ) -> ( + Service, + impl Network, + impl Network, + ) { + let (messages_for_authentication_user, messages_from_authentication_service) = + mpsc::unbounded(); + let (messages_for_block_sync_user, messages_from_block_sync_service) = mpsc::unbounded(); + let (messages_for_service, messages_from_user) = mpsc::unbounded(); + ( + Service { + network, + messages_from_user, + messages_for_authentication_user, + messages_for_block_sync_user, + spawn_handle, + authentication_connected_peers: HashSet::new(), + authentication_peer_senders: HashMap::new(), + block_sync_connected_peers: HashSet::new(), + block_sync_peer_senders: HashMap::new(), + }, + ServiceInterface { + protocol: Protocol::Authentication, + messages_from_service: messages_from_authentication_service, + messages_for_service: messages_for_service.clone(), + }, + ServiceInterface { + protocol: Protocol::BlockSync, + messages_from_service: messages_from_block_sync_service, + messages_for_service, + }, + ) + } + + fn get_sender( + &mut self, + peer: &N::PeerId, + protocol: Protocol, + ) -> Option<&mut TracingUnboundedSender> { + match protocol { + Protocol::Authentication => self.authentication_peer_senders.get_mut(peer), + Protocol::BlockSync => self.block_sync_peer_senders.get_mut(peer), + } + } + + fn peer_sender( + &self, + peer_id: N::PeerId, + mut receiver: TracingUnboundedReceiver, + protocol: Protocol, + ) -> impl Future + Send + 'static { + let network = self.network.clone(); + async move { + let mut sender = None; + loop { + if let Some(data) = receiver.next().await { + let s = if let Some(s) = sender.as_mut() { + s + } else { + match network.sender(peer_id.clone(), protocol) { + Ok(s) => sender.insert(s), + Err(e) => { + debug!(target: "aleph-network", "Failed creating sender. Dropping message: {}", e); + continue; + } + } + }; + if let Err(e) = s.send(data.encode()).await { + debug!(target: "aleph-network", "Failed sending data to peer. Dropping sender and message: {}", e); + sender = None; + } + } else { + debug!(target: "aleph-network", "Sender was dropped for peer {:?}. Peer sender exiting.", peer_id); + return; + } + } + } + } + + fn send_to_peer( + &mut self, + data: D, + peer: N::PeerId, + protocol: Protocol, + ) -> Result<(), SendError> { + match self.get_sender(&peer, protocol) { + Some(sender) => { + match sender.unbounded_send(data) { + Err(e) => { + // Receiver can also be dropped when thread cannot send to peer. In case receiver is dropped this entry will be removed by Event::NotificationStreamClosed + // No need to remove the entry here + if e.is_disconnected() { + trace!(target: "aleph-network", "Failed sending data to peer because peer_sender receiver is dropped: {:?}", peer); + } + Err(SendError::SendingFailed) + } + Ok(_) => Ok(()), + } + } + None => Err(SendError::MissingSender), + } + } + + fn send(&mut self, data: D, peer_id: N::PeerId, protocol: Protocol) { + if let Err(e) = self.send_to_peer(data, peer_id.clone(), protocol) { + trace!(target: "aleph-network", "Failed to send to peer{:?}, {:?}", peer_id, e); + } + } + + fn protocol_peers(&self, protocol: Protocol) -> &HashSet { + match protocol { + Protocol::Authentication => &self.authentication_connected_peers, + Protocol::BlockSync => &self.block_sync_connected_peers, + } + } + + fn random_peer<'a>( + &'a self, + peer_ids: &'a HashSet, + protocol: Protocol, + ) -> Option<&'a N::PeerId> { + peer_ids + .intersection(self.protocol_peers(protocol)) + .into_iter() + .choose(&mut thread_rng()) + .or_else(|| { + self.protocol_peers(protocol) + .iter() + .choose(&mut thread_rng()) + }) + } + + fn send_to_random(&mut self, data: D, peer_ids: HashSet, protocol: Protocol) { + let peer_id = match self.random_peer(&peer_ids, protocol) { + Some(peer_id) => peer_id.clone(), + None => { + trace!(target: "aleph-network", "Failed to send to random peer, no peers are available."); + return; + } + }; + self.send(data, peer_id, protocol); + } + + fn broadcast(&mut self, data: D, protocol: Protocol) { + let peers = self.protocol_peers(protocol).clone(); + for peer in peers { + self.send(data.clone(), peer, protocol); + } + } + + fn handle_network_event( + &mut self, + event: Event, + ) -> Result<(), mpsc::TrySendError<(D, N::PeerId)>> { + use Event::*; + match event { + StreamOpened(peer, protocol) => { + trace!(target: "aleph-network", "StreamOpened event for peer {:?} and the protocol {:?}.", peer, protocol); + let rx = match &protocol { + Protocol::Authentication => { + let (tx, rx) = tracing_unbounded( + "mpsc_notification_stream_authentication", + QUEUE_SIZE_WARNING, + ); + self.authentication_connected_peers.insert(peer.clone()); + self.authentication_peer_senders.insert(peer.clone(), tx); + rx + } + Protocol::BlockSync => { + let (tx, rx) = tracing_unbounded( + "mpsc_notification_stream_block_sync", + QUEUE_SIZE_WARNING, + ); + self.block_sync_connected_peers.insert(peer.clone()); + self.block_sync_peer_senders.insert(peer.clone(), tx); + rx + } + }; + self.spawn_handle.spawn( + "aleph/network/peer_sender", + None, + self.peer_sender(peer, rx, protocol), + ); + } + StreamClosed(peer, protocol) => { + trace!(target: "aleph-network", "StreamClosed event for peer {:?} and protocol {:?}", peer, protocol); + match protocol { + Protocol::Authentication => { + self.authentication_connected_peers.remove(&peer); + self.authentication_peer_senders.remove(&peer); + } + Protocol::BlockSync => { + self.block_sync_connected_peers.remove(&peer); + self.block_sync_peer_senders.remove(&peer); + } + } + } + Messages(peer_id, messages) => { + for (protocol, data) in messages.into_iter() { + match protocol { + Protocol::Authentication => match D::decode(&mut &data[..]) { + Ok(data) => self + .messages_for_authentication_user + .unbounded_send((data, peer_id.clone()))?, + Err(e) => { + warn!(target: "aleph-network", "Error decoding authentication protocol message: {}", e) + } + }, + // This is a bit of a placeholder for now, as we are not yet using this + // protocol. In the future we will not be using the same D as above. + Protocol::BlockSync => match D::decode(&mut &data[..]) { + Ok(data) => self + .messages_for_block_sync_user + .unbounded_send((data, peer_id.clone()))?, + Err(e) => { + warn!(target: "aleph-network", "Error decoding block sync protocol message: {}", e) + } + }, + }; + } + } + } + Ok(()) + } + + fn status_report(&self) { + let mut status = String::from("Network status report: "); + + status.push_str(&format!( + "authentication connected peers - {:?}; ", + self.authentication_connected_peers.len() + )); + status.push_str(&format!( + "block sync connected peers - {:?}; ", + self.block_sync_connected_peers.len() + )); + + info!(target: "aleph-network", "{}", status); + } + + pub async fn run(mut self) { + let mut events_from_network = self.network.event_stream(); + + let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); + loop { + tokio::select! { + maybe_event = events_from_network.next_event() => match maybe_event { + Some(event) => if let Err(e) = self.handle_network_event(event) { + error!(target: "aleph-network", "Cannot forward messages to user: {:?}", e); + return; + }, + None => { + error!(target: "aleph-network", "Network event stream ended."); + return; + } + }, + maybe_message = self.messages_from_user.next() => match maybe_message { + Some(Command::Broadcast(message, protocol)) => self.broadcast(message, protocol), + Some(Command::SendToRandom(message, peer_ids, protocol)) => self.send_to_random(message, peer_ids, protocol), + Some(Command::Send(message, peer_id, protocol)) => self.send(message, peer_id, protocol), + None => { + error!(target: "aleph-network", "User message stream ended."); + return; + } + }, + _ = status_ticker.tick() => { + self.status_report(); + }, + } + } + } +} + +#[cfg(test)] +mod tests { + use std::{collections::HashSet, iter}; + + use codec::Encode; + use futures::channel::oneshot; + use sc_service::TaskManager; + use tokio::runtime::Handle; + + use super::{Error, Service}; + use crate::network::{ + clique::mock::{random_peer_id, MockPublicKey}, + gossip::{ + mock::{MockEvent, MockRawNetwork, MockSenderError}, + Network, + }, + mock::MockData, + Protocol, + }; + + const PROTOCOL: Protocol = Protocol::Authentication; + + pub struct TestData { + pub network: MockRawNetwork, + gossip_network: Box>, + pub service: Service, + // `TaskManager` can't be dropped for `SpawnTaskHandle` to work + _task_manager: TaskManager, + } + + impl TestData { + async fn prepare() -> Self { + let task_manager = TaskManager::new(Handle::current(), None).unwrap(); + + // Event stream will never be taken, so we can drop the receiver + let (event_stream_oneshot_tx, _) = oneshot::channel(); + + // Prepare service + let network = MockRawNetwork::new(event_stream_oneshot_tx); + let (service, gossip_network, _) = + Service::new(network.clone(), task_manager.spawn_handle()); + let gossip_network = Box::new(gossip_network); + + // `TaskManager` needs to be passed, so sender threads are running in background. + Self { + network, + service, + gossip_network, + _task_manager: task_manager, + } + } + + async fn cleanup(self) { + self.network.close_channels().await; + } + } + + #[async_trait::async_trait] + impl Network for TestData { + type Error = Error; + type PeerId = MockPublicKey; + + fn send_to(&mut self, data: MockData, peer_id: Self::PeerId) -> Result<(), Self::Error> { + self.gossip_network.send_to(data, peer_id) + } + + fn send_to_random( + &mut self, + data: MockData, + peer_ids: HashSet, + ) -> Result<(), Self::Error> { + self.gossip_network.send_to_random(data, peer_ids) + } + + fn broadcast(&mut self, data: MockData) -> Result<(), Self::Error> { + self.gossip_network.broadcast(data) + } + + async fn next(&mut self) -> Result<(MockData, Self::PeerId), Self::Error> { + self.gossip_network.next().await + } + } + + fn message(i: u8) -> MockData { + MockData::new(i.into(), 3) + } + + #[tokio::test] + async fn test_notification_stream_opened() { + let mut test_data = TestData::prepare().await; + + let peer_ids: Vec<_> = (0..3).map(|_| random_peer_id()).collect(); + + peer_ids.iter().for_each(|peer_id| { + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + }); + + let message = message(1); + test_data.service.broadcast(message.clone(), PROTOCOL); + + let broadcasted_messages = HashSet::<_>::from_iter( + test_data + .network + .send_message + .take(peer_ids.len()) + .await + .into_iter(), + ); + + let expected_messages = HashSet::from_iter( + peer_ids + .into_iter() + .map(|peer_id| (message.clone().encode(), peer_id, PROTOCOL)), + ); + + assert_eq!(broadcasted_messages, expected_messages); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_notification_stream_closed() { + let mut test_data = TestData::prepare().await; + + let peer_ids: Vec<_> = (0..3).map(|_| random_peer_id()).collect(); + let opened_authorities_n = 2; + + peer_ids.iter().for_each(|peer_id| { + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + }); + + peer_ids + .iter() + .skip(opened_authorities_n) + .for_each(|peer_id| { + test_data + .service + .handle_network_event(MockEvent::StreamClosed(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + }); + + let message = message(1); + test_data.service.broadcast(message.clone(), PROTOCOL); + + let broadcasted_messages = HashSet::<_>::from_iter( + test_data + .network + .send_message + .take(opened_authorities_n) + .await + .into_iter(), + ); + + let expected_messages = HashSet::from_iter( + peer_ids + .into_iter() + .take(opened_authorities_n) + .map(|peer_id| (message.clone().encode(), peer_id, PROTOCOL)), + ); + + assert_eq!(broadcasted_messages, expected_messages); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_create_sender_error() { + let mut test_data = TestData::prepare().await; + + test_data + .network + .create_sender_errors + .lock() + .push_back(MockSenderError); + + let peer_id = random_peer_id(); + + let message_1 = message(1); + let message_2 = message(4); + + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + + test_data.service.broadcast(message_1, PROTOCOL); + + test_data.service.broadcast(message_2.clone(), PROTOCOL); + + let expected = (message_2.encode(), peer_id, PROTOCOL); + + assert_eq!( + test_data + .network + .send_message + .next() + .await + .expect("Should receive message"), + expected, + ); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_send_error() { + let mut test_data = TestData::prepare().await; + + test_data + .network + .send_errors + .lock() + .push_back(MockSenderError); + + let peer_id = random_peer_id(); + + let message_1 = message(1); + let message_2 = message(4); + + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + + test_data.service.broadcast(message_1, PROTOCOL); + + test_data.service.broadcast(message_2.clone(), PROTOCOL); + + let expected = (message_2.encode(), peer_id, PROTOCOL); + + assert_eq!( + test_data + .network + .send_message + .next() + .await + .expect("Should receive message"), + expected, + ); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_notification_received() { + let mut test_data = TestData::prepare().await; + + let message = message(1); + + let peer_id = random_peer_id(); + test_data + .service + .handle_network_event(MockEvent::Messages( + peer_id.clone(), + vec![(PROTOCOL, message.clone().encode().into())], + )) + .expect("Should handle"); + + let (received_message, received_peer_id) = + test_data.next().await.expect("Should receive message"); + assert_eq!(received_message, message); + assert_eq!(received_peer_id, peer_id); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_send_to_connected() { + let mut test_data = TestData::prepare().await; + + let peer_id = random_peer_id(); + + let message = message(1); + + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + + test_data + .service + .send(message.clone(), peer_id.clone(), PROTOCOL); + + let expected = (message.encode(), peer_id, PROTOCOL); + + assert_eq!( + test_data + .network + .send_message + .next() + .await + .expect("Should receive message"), + expected, + ); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_no_send_to_disconnected() { + let mut test_data = TestData::prepare().await; + + let peer_id = random_peer_id(); + + let message = message(1); + + test_data.service.send(message, peer_id, PROTOCOL); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_send_to_random_connected() { + let mut test_data = TestData::prepare().await; + + let peer_id = random_peer_id(); + + let message = message(1); + + test_data + .service + .handle_network_event(MockEvent::StreamOpened(peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + + test_data.service.send_to_random( + message.clone(), + iter::once(peer_id.clone()).collect(), + PROTOCOL, + ); + + let expected = (message.encode(), peer_id, PROTOCOL); + + assert_eq!( + test_data + .network + .send_message + .next() + .await + .expect("Should receive message"), + expected, + ); + + test_data.cleanup().await + } + + #[tokio::test] + async fn test_send_to_random_disconnected() { + let mut test_data = TestData::prepare().await; + + let peer_id = random_peer_id(); + let other_peer_id = random_peer_id(); + + let message = message(1); + + test_data + .service + .handle_network_event(MockEvent::StreamOpened(other_peer_id.clone(), PROTOCOL)) + .expect("Should handle"); + + test_data.service.send_to_random( + message.clone(), + iter::once(peer_id.clone()).collect(), + PROTOCOL, + ); + + let expected = (message.encode(), other_peer_id, PROTOCOL); + + assert_eq!( + test_data + .network + .send_message + .next() + .await + .expect("Should receive message"), + expected, + ); + + test_data.cleanup().await + } +} diff --git a/finality-aleph/src/network/io.rs b/finality-aleph/src/network/io.rs deleted file mode 100644 index 815285f800..0000000000 --- a/finality-aleph/src/network/io.rs +++ /dev/null @@ -1,39 +0,0 @@ -use futures::channel::mpsc; - -use crate::network::{ - manager::NetworkData, ConnectionManagerIO, Data, Multiaddress, NetworkServiceIO as NetworkIo, - SessionManagerIO, -}; - -type NetworkServiceIO = NetworkIo, M>; - -pub fn setup() -> ( - ConnectionManagerIO, - NetworkServiceIO, - SessionManagerIO, -) { - // Prepare and start the network - let (commands_for_network, commands_from_io) = mpsc::unbounded(); - let (messages_for_network, messages_from_user) = mpsc::unbounded(); - let (commands_for_service, commands_from_user) = mpsc::unbounded(); - let (messages_for_service, commands_from_manager) = mpsc::unbounded(); - let (messages_for_user, messages_from_network) = mpsc::unbounded(); - - let connection_io = ConnectionManagerIO::new( - commands_for_network, - messages_for_network, - commands_from_user, - commands_from_manager, - messages_from_network, - ); - let channels_for_network = - NetworkServiceIO::new(messages_from_user, messages_for_user, commands_from_io); - let channels_for_session_manager = - SessionManagerIO::new(commands_for_service, messages_for_service); - - ( - connection_io, - channels_for_network, - channels_for_session_manager, - ) -} diff --git a/finality-aleph/src/network/manager/compatibility.rs b/finality-aleph/src/network/manager/compatibility.rs deleted file mode 100644 index 5afa8bd306..0000000000 --- a/finality-aleph/src/network/manager/compatibility.rs +++ /dev/null @@ -1,212 +0,0 @@ -use std::{ - fmt::{Display, Error as FmtError, Formatter}, - mem::size_of, -}; - -use codec::{Decode, Encode, Error as CodecError, Input as CodecInput}; -use log::warn; - -use crate::{ - network::{ - manager::{DiscoveryMessage, NetworkData}, - Data, Multiaddress, - }, - Version, -}; - -type ByteCount = u16; - -// We allow sending authentications of size up to 16KiB, that should be enough. -const MAX_AUTHENTICATION_SIZE: u16 = 16 * 1024; - -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum VersionedAuthentication { - // Most likely from the future. - Other(Version, Vec), - V1(DiscoveryMessage), -} - -impl TryInto> for VersionedAuthentication { - type Error = Error; - - fn try_into(self) -> Result, Self::Error> { - use VersionedAuthentication::*; - match self { - V1(message) => Ok(NetworkData::Meta(message)), - Other(v, _) => Err(Error::UnknownVersion(v)), - } - } -} - -impl From> for VersionedAuthentication { - fn from(message: DiscoveryMessage) -> VersionedAuthentication { - VersionedAuthentication::V1(message) - } -} - -fn encode_with_version(version: Version, payload: &[u8]) -> Vec { - // If size is bigger then u16 we set it to MAX_AUTHENTICATION_SIZE. - // This should never happen but in case it does we will not panic. - // Also for other users if they have this version of protocol, authentication - // will be decoded. If they do not know the protocol, authentication will result - // in decoding error. - // We do not have a guarantee that size_hint is implemented for DiscoveryMessage, so we need - // to compute actual size to place it in the encoded data. - let size = payload - .len() - .try_into() - .unwrap_or(MAX_AUTHENTICATION_SIZE + 1); - if size > MAX_AUTHENTICATION_SIZE { - warn!( - "Versioned Authentication v{:?} too big during Encode. Size is {:?}. Should be {:?} at max.", - version, - payload.len(), - MAX_AUTHENTICATION_SIZE - ); - } - - let mut result = Vec::with_capacity(version.size_hint() + size.size_hint() + payload.len()); - - version.encode_to(&mut result); - size.encode_to(&mut result); - result.extend_from_slice(payload); - - result -} - -impl Encode for VersionedAuthentication { - fn size_hint(&self) -> usize { - use VersionedAuthentication::*; - let version_size = size_of::(); - let byte_count_size = size_of::(); - version_size - + byte_count_size - + match self { - Other(_, payload) => payload.len(), - V1(data) => data.size_hint(), - } - } - - fn encode(&self) -> Vec { - use VersionedAuthentication::*; - match self { - Other(version, payload) => encode_with_version(*version, payload), - V1(data) => encode_with_version(Version(1), &data.encode()), - } - } -} - -impl Decode for VersionedAuthentication { - fn decode(input: &mut I) -> Result { - use VersionedAuthentication::*; - let version = Version::decode(input)?; - let num_bytes = ByteCount::decode(input)?; - match version { - Version(1) => Ok(V1(DiscoveryMessage::decode(input)?)), - _ => { - if num_bytes > MAX_AUTHENTICATION_SIZE { - Err("Authentication has unknown version and is encoded as more than 16KiB.")?; - }; - let mut payload = vec![0; num_bytes.into()]; - input.read(payload.as_mut_slice())?; - Ok(Other(version, payload)) - } - } - } -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum Error { - UnknownVersion(Version), -} - -impl Display for Error { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - use Error::*; - match self { - UnknownVersion(version) => { - write!(f, "Authentication has unknown version {}", version.0) - } - } - } -} - -#[cfg(test)] -mod test { - use codec::{Decode, Encode}; - - use super::{DiscoveryMessage, VersionedAuthentication}; - use crate::{ - network::{ - manager::{compatibility::MAX_AUTHENTICATION_SIZE, SessionHandler}, - mock::{crypto_basics, MockMultiaddress, MockNetworkIdentity}, - NetworkIdentity, - }, - SessionId, Version, - }; - - #[tokio::test] - async fn correctly_decodes_v1() { - let crypto_basics = crypto_basics(1).await; - let handler = SessionHandler::new( - Some(crypto_basics.0[0].clone()), - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let authentication_v1 = VersionedAuthentication::V1(DiscoveryMessage::Authentication( - handler.authentication().unwrap(), - )); - let encoded = authentication_v1.encode(); - let decoded = VersionedAuthentication::decode(&mut encoded.as_slice()); - assert_eq!(decoded, Ok(authentication_v1)) - } - - #[tokio::test] - async fn correctly_decodes_other() { - let other = VersionedAuthentication::::Other(Version(42), vec![21, 37]); - let encoded = other.encode(); - let decoded = VersionedAuthentication::decode(&mut encoded.as_slice()); - assert_eq!(decoded, Ok(other)); - - let mut other_big = 42u16.encode(); - other_big.append(&mut (MAX_AUTHENTICATION_SIZE).encode()); - other_big.append(&mut vec![0u8; (MAX_AUTHENTICATION_SIZE).into()]); - let decoded = - VersionedAuthentication::::decode(&mut other_big.as_slice()); - assert_eq!( - decoded, - Ok(VersionedAuthentication::::Other( - Version(42), - other_big[4..].to_vec() - )) - ); - } - - #[tokio::test] - async fn returns_error_other_too_big() { - let mut other = 42u16.encode(); - let size = MAX_AUTHENTICATION_SIZE + 1; - other.append(&mut size.encode()); - other.append(&mut vec![0u8; size.into()]); - let decoded = VersionedAuthentication::::decode(&mut other.as_slice()); - assert!(decoded.is_err()); - - let other = - VersionedAuthentication::::Other(Version(42), vec![0u8; size.into()]); - let encoded = other.encode(); - let decoded = VersionedAuthentication::::decode(&mut encoded.as_slice()); - assert!(decoded.is_err()); - } - - #[tokio::test] - async fn returns_error_other_wrong_size() { - let mut other = 42u16.encode(); - other.append(&mut MAX_AUTHENTICATION_SIZE.encode()); - other.append(&mut vec![21, 37]); - let decoded = VersionedAuthentication::::decode(&mut other.as_slice()); - assert!(decoded.is_err()); - } -} diff --git a/finality-aleph/src/network/manager/discovery.rs b/finality-aleph/src/network/manager/discovery.rs deleted file mode 100644 index 93bab16160..0000000000 --- a/finality-aleph/src/network/manager/discovery.rs +++ /dev/null @@ -1,384 +0,0 @@ -use std::{ - collections::HashMap, - marker::PhantomData, - time::{Duration, Instant}, -}; - -use codec::{Decode, Encode}; -use log::{debug, info, trace, warn}; - -use crate::{ - network::{ - manager::{Authentication, SessionHandler}, - DataCommand, Multiaddress, Protocol, - }, - NodeIndex, SessionId, -}; - -/// Messages used for discovery and authentication. -#[derive(Clone, Debug, PartialEq, Eq, Hash, Encode, Decode)] -pub enum DiscoveryMessage { - AuthenticationBroadcast(Authentication), - Authentication(Authentication), -} - -impl DiscoveryMessage { - pub fn session_id(&self) -> SessionId { - use DiscoveryMessage::*; - match self { - AuthenticationBroadcast((auth_data, _)) | Authentication((auth_data, _)) => { - auth_data.session() - } - } - } -} - -/// Handles creating and responding to discovery messages. -pub struct Discovery { - cooldown: Duration, - last_broadcast: HashMap, - _phantom: PhantomData, -} - -type DiscoveryCommand = ( - DiscoveryMessage, - DataCommand<::PeerId>, -); - -fn authentication_broadcast( - authentication: Authentication, -) -> DiscoveryCommand { - ( - DiscoveryMessage::AuthenticationBroadcast(authentication), - DataCommand::Broadcast, - ) -} - -fn response( - authentication: Authentication, - peer_id: M::PeerId, -) -> DiscoveryCommand { - ( - DiscoveryMessage::Authentication(authentication), - DataCommand::SendTo(peer_id, Protocol::Generic), - ) -} - -impl Discovery { - /// Create a new discovery handler with the given response/broadcast cooldown. - pub fn new(cooldown: Duration) -> Self { - Discovery { - cooldown, - last_broadcast: HashMap::new(), - _phantom: PhantomData, - } - } - - /// Returns messages that should be sent as part of authority discovery at this moment. - pub fn discover_authorities( - &mut self, - handler: &SessionHandler, - ) -> Vec> { - let authentication = match handler.authentication() { - Some(authentication) => authentication, - None => return Vec::new(), - }; - - let missing_authorities = handler.missing_nodes(); - let node_count = handler.node_count(); - info!(target: "aleph-network", "{}/{} authorities known for session {}.", node_count.0-missing_authorities.len(), node_count.0, handler.session_id().0); - vec![authentication_broadcast(authentication)] - } - - /// Checks the authentication using the handler and returns the addresses we should be - /// connected to if the authentication is correct. - fn handle_authentication( - &mut self, - authentication: Authentication, - handler: &mut SessionHandler, - ) -> Vec { - if !handler.handle_authentication(authentication.clone()) { - return Vec::new(); - } - authentication.0.addresses() - } - - fn should_rebroadcast(&self, node_id: &NodeIndex) -> bool { - match self.last_broadcast.get(node_id) { - Some(instant) => Instant::now() > *instant + self.cooldown, - None => true, - } - } - - fn handle_broadcast( - &mut self, - authentication: Authentication, - handler: &mut SessionHandler, - ) -> (Vec, Vec>) { - debug!(target: "aleph-network", "Handling broadcast with authentication {:?}.", authentication); - let addresses = self.handle_authentication(authentication.clone(), handler); - if addresses.is_empty() { - return (Vec::new(), Vec::new()); - } - let node_id = authentication.0.creator(); - let mut messages = Vec::new(); - match handler.peer_id(&node_id) { - Some(peer_id) => { - if let Some(handler_authentication) = handler.authentication() { - messages.push(response(handler_authentication, peer_id)); - } - } - None => { - warn!(target: "aleph-network", "Id of correctly authenticated peer not present.") - } - } - if self.should_rebroadcast(&node_id) { - trace!(target: "aleph-network", "Rebroadcasting {:?}.", authentication); - self.last_broadcast.insert(node_id, Instant::now()); - messages.push(authentication_broadcast(authentication)); - } - (addresses, messages) - } - - /// Analyzes the provided message and returns all the new multiaddresses we should - /// be connected to if we want to stay connected to the committee and any messages - /// that we should send as a result of it. - pub fn handle_message( - &mut self, - message: DiscoveryMessage, - handler: &mut SessionHandler, - ) -> (Vec, Vec>) { - use DiscoveryMessage::*; - match message { - AuthenticationBroadcast(authentication) => { - self.handle_broadcast(authentication, handler) - } - Authentication(authentication) => ( - self.handle_authentication(authentication, handler), - Vec::new(), - ), - } - } -} - -#[cfg(test)] -mod tests { - use std::{thread::sleep, time::Duration}; - - use codec::Encode; - - use super::{Discovery, DiscoveryMessage}; - use crate::{ - network::{ - manager::SessionHandler, - mock::{crypto_basics, MockMultiaddress, MockPeerId}, - DataCommand, - }, - SessionId, - }; - - const NUM_NODES: u8 = 7; - const MS_COOLDOWN: u64 = 200; - - fn addresses() -> Vec { - (0..NUM_NODES) - .map(|_| MockMultiaddress::random_with_id(MockPeerId::random())) - .collect() - } - - async fn build_number( - num_nodes: u8, - ) -> ( - Discovery, - Vec>, - SessionHandler, - ) { - let crypto_basics = crypto_basics(num_nodes.into()).await; - let mut handlers = Vec::new(); - for (authority_index_and_pen, address) in crypto_basics.0.into_iter().zip(addresses()) { - handlers.push( - SessionHandler::new( - Some(authority_index_and_pen), - crypto_basics.1.clone(), - SessionId(43), - vec![address], - ) - .await - .unwrap(), - ); - } - let non_validator = SessionHandler::new( - None, - crypto_basics.1.clone(), - SessionId(43), - vec![MockMultiaddress::random_with_id(MockPeerId::random())], - ) - .await - .unwrap(); - ( - Discovery::new(Duration::from_millis(MS_COOLDOWN)), - handlers, - non_validator, - ) - } - - async fn build() -> ( - Discovery, - Vec>, - SessionHandler, - ) { - build_number(NUM_NODES).await - } - - #[tokio::test] - async fn broadcasts_when_clueless() { - for num_nodes in 2..NUM_NODES { - let (mut discovery, mut handlers, _) = build_number(num_nodes).await; - let handler = &mut handlers[0]; - let mut messages = discovery.discover_authorities(handler); - assert_eq!(messages.len(), 1); - let message = messages.pop().unwrap(); - assert_eq!( - message, - ( - DiscoveryMessage::AuthenticationBroadcast(handler.authentication().unwrap()), - DataCommand::Broadcast - ) - ); - } - } - - #[tokio::test] - async fn non_validator_discover_authorities_returns_empty_vector() { - let (mut discovery, _, non_validator) = build().await; - let messages = discovery.discover_authorities(&non_validator); - assert!(messages.is_empty()); - } - - #[tokio::test] - async fn rebroadcasts_responds_and_accepts_addresses() { - let (mut discovery, mut handlers, _) = build().await; - let authentication = handlers[1].authentication().unwrap(); - let handler = &mut handlers[0]; - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - handler, - ); - assert_eq!(addresses, authentication.0.addresses()); - assert_eq!(commands.len(), 2); - assert!(commands.iter().any(|command| matches!(command, ( - DiscoveryMessage::AuthenticationBroadcast(rebroadcast_authentication), - DataCommand::Broadcast, - ) if rebroadcast_authentication == &authentication))); - assert!(commands.iter().any(|command| matches!(command, ( - DiscoveryMessage::Authentication(authentication), - DataCommand::SendTo(_, _), - ) if *authentication == handler.authentication().unwrap()))); - } - - #[tokio::test] - async fn non_validators_rebroadcasts_responds() { - let (mut discovery, handlers, mut non_validator) = build().await; - let authentication = handlers[1].authentication().unwrap(); - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - &mut non_validator, - ); - assert_eq!(addresses, authentication.0.addresses()); - assert_eq!(commands.len(), 1); - assert!(commands.iter().any(|command| matches!(command, ( - DiscoveryMessage::AuthenticationBroadcast(rebroadcast_authentication), - DataCommand::Broadcast, - ) if rebroadcast_authentication == &authentication))); - } - - #[tokio::test] - async fn does_not_rebroadcast_nor_respond_to_wrong_authentications() { - let (mut discovery, mut handlers, _) = build().await; - let (auth_data, _) = handlers[1].authentication().unwrap(); - let (_, signature) = handlers[2].authentication().unwrap(); - let authentication = (auth_data, signature); - let handler = &mut handlers[0]; - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication), - handler, - ); - assert!(addresses.is_empty()); - assert!(commands.is_empty()); - } - - #[tokio::test] - async fn does_not_rebroadcast_quickly_but_still_responds() { - let (mut discovery, mut handlers, _) = build().await; - let authentication = handlers[1].authentication().unwrap(); - let handler = &mut handlers[0]; - discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - handler, - ); - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - handler, - ); - assert_eq!(addresses.len(), authentication.0.addresses().len()); - assert_eq!( - addresses[0].encode(), - authentication.0.addresses()[0].encode() - ); - assert_eq!(commands.len(), 1); - assert!(matches!(&commands[0], ( - DiscoveryMessage::Authentication(authentication), - DataCommand::SendTo(_, _), - ) if *authentication == handler.authentication().unwrap())); - } - - #[tokio::test] - async fn rebroadcasts_after_cooldown() { - let (mut discovery, mut handlers, _) = build().await; - let authentication = handlers[1].authentication().unwrap(); - let handler = &mut handlers[0]; - discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - handler, - ); - sleep(Duration::from_millis(MS_COOLDOWN + 5)); - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::AuthenticationBroadcast(authentication.clone()), - handler, - ); - assert_eq!(addresses, authentication.0.addresses()); - assert!(commands.iter().any(|command| matches!(command, ( - DiscoveryMessage::AuthenticationBroadcast(rebroadcast_authentication), - DataCommand::Broadcast, - ) if rebroadcast_authentication == &authentication))); - } - - #[tokio::test] - async fn accepts_correct_authentications() { - let (mut discovery, mut handlers, _) = build().await; - let expected_address = handlers[1].authentication().unwrap().0.addresses()[0].encode(); - let authentication = handlers[1].authentication().unwrap(); - let handler = &mut handlers[0]; - let (addresses, commands) = - discovery.handle_message(DiscoveryMessage::Authentication(authentication), handler); - assert_eq!(addresses.len(), 1); - let address = addresses[0].encode(); - assert_eq!(address, expected_address); - assert!(commands.is_empty()); - } - - #[tokio::test] - async fn does_not_accept_incorrect_authentications() { - let (mut discovery, mut handlers, _) = build().await; - let (auth_data, _) = handlers[1].authentication().unwrap(); - let (_, signature) = handlers[2].authentication().unwrap(); - let incorrect_authentication = (auth_data, signature); - let handler = &mut handlers[0]; - let (addresses, commands) = discovery.handle_message( - DiscoveryMessage::Authentication(incorrect_authentication), - handler, - ); - assert!(addresses.is_empty()); - assert!(commands.is_empty()); - } -} diff --git a/finality-aleph/src/network/manager/mod.rs b/finality-aleph/src/network/manager/mod.rs deleted file mode 100644 index e2c7b3a83c..0000000000 --- a/finality-aleph/src/network/manager/mod.rs +++ /dev/null @@ -1,92 +0,0 @@ -use codec::{Decode, Encode, Error, Input, Output}; - -use crate::{ - crypto::Signature, - network::{Data, Multiaddress}, - NodeIndex, SessionId, -}; - -mod compatibility; -mod connections; -mod discovery; -mod service; -mod session; - -pub use compatibility::VersionedAuthentication; -use connections::Connections; -pub use discovery::{Discovery, DiscoveryMessage}; -pub use service::{ - Config as ConnectionManagerConfig, Service as ConnectionManager, SessionCommand, - IO as ConnectionIO, -}; -pub use session::{Handler as SessionHandler, HandlerError as SessionHandlerError}; - -/// Data validators use to authenticate themselves for a single session -/// and disseminate their addresses. -#[derive(Clone, Debug, PartialEq, Eq, Hash, Encode, Decode)] -pub struct AuthData { - addresses: Vec, - node_id: NodeIndex, - session_id: SessionId, -} - -impl AuthData { - pub fn session(&self) -> SessionId { - self.session_id - } - - pub fn creator(&self) -> NodeIndex { - self.node_id - } - - pub fn addresses(&self) -> Vec { - self.addresses.clone() - } -} - -/// A full authentication, consisting of a signed AuthData. -pub type Authentication = (AuthData, Signature); - -/// Data inside session, sent to validator network. -/// Wrapper for data send over network. We need it to ensure compatibility. -/// The order of the data and session_id is fixed in encode and the decode expects it to be data, session_id. -/// Since data is versioned, i.e. it's encoding starts with a version number in the standardized way, -/// this will allow us to retrofit versioning here if we ever need to change this structure. -#[derive(Clone)] -pub struct DataInSession { - pub data: D, - pub session_id: SessionId, -} - -impl Decode for DataInSession { - fn decode(input: &mut I) -> Result { - let data = D::decode(input)?; - let session_id = SessionId::decode(input)?; - - Ok(Self { data, session_id }) - } -} - -impl Encode for DataInSession { - fn size_hint(&self) -> usize { - self.data.size_hint() + self.session_id.size_hint() - } - - fn encode_to(&self, dest: &mut T) { - self.data.encode_to(dest); - self.session_id.encode_to(dest); - } -} - -impl From> for NetworkData { - fn from(data: DataInSession) -> Self { - NetworkData::Data(data.data, data.session_id) - } -} - -/// The data that should be sent to the network service. -#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode)] -pub enum NetworkData { - Meta(DiscoveryMessage), - Data(D, SessionId), -} diff --git a/finality-aleph/src/network/manager/service.rs b/finality-aleph/src/network/manager/service.rs deleted file mode 100644 index da1bdb597b..0000000000 --- a/finality-aleph/src/network/manager/service.rs +++ /dev/null @@ -1,984 +0,0 @@ -use std::{ - cmp, - collections::{HashMap, HashSet}, - time::Duration, -}; - -use futures::{ - channel::{mpsc, oneshot}, - StreamExt, -}; -use log::{debug, info, trace, warn}; -use tokio::time::{self, Instant}; - -use crate::{ - abft::Recipient, - crypto::{AuthorityPen, AuthorityVerifier}, - network::{ - manager::{ - Connections, Discovery, DiscoveryMessage, NetworkData, SessionHandler, - SessionHandlerError, - }, - ConnectionCommand, Data, DataCommand, Multiaddress, NetworkIdentity, PeerId, Protocol, - }, - MillisecsPerBlock, NodeIndex, SessionId, SessionPeriod, STATUS_REPORT_INTERVAL, -}; - -/// Commands for manipulating sessions, stopping them and starting both validator and non-validator -/// sessions. -pub enum SessionCommand { - StartValidator( - SessionId, - AuthorityVerifier, - NodeIndex, - AuthorityPen, - Option>>, - ), - StartNonvalidator(SessionId, AuthorityVerifier), - Stop(SessionId), -} - -struct Session { - handler: SessionHandler, - discovery: Discovery, - data_for_user: Option>, -} - -#[derive(Clone)] -struct PreValidatorSession { - session_id: SessionId, - verifier: AuthorityVerifier, - node_id: NodeIndex, - pen: AuthorityPen, -} - -#[derive(Clone)] -struct PreNonvalidatorSession { - session_id: SessionId, - verifier: AuthorityVerifier, -} - -#[derive(Clone)] -enum PreSession { - Validator(PreValidatorSession), - Nonvalidator(PreNonvalidatorSession), -} - -impl PreSession { - fn session_id(&self) -> SessionId { - match self { - Self::Validator(pre_session) => pre_session.session_id, - Self::Nonvalidator(pre_session) => pre_session.session_id, - } - } -} - -/// Configuration for the session manager service. Controls how often the maintenance and -/// rebroadcasts are triggerred. Also controls when maintenance starts. -pub struct Config { - discovery_cooldown: Duration, - maintenance_period: Duration, - initial_delay: Duration, -} - -impl Config { - fn new( - discovery_cooldown: Duration, - maintenance_period: Duration, - initial_delay: Duration, - ) -> Self { - Config { - discovery_cooldown, - maintenance_period, - initial_delay, - } - } - - /// Returns a configuration that triggers maintenance about 5 times per session. - pub fn with_session_period( - session_period: &SessionPeriod, - millisecs_per_block: &MillisecsPerBlock, - ) -> Self { - let discovery_cooldown = - Duration::from_millis(millisecs_per_block.0 * session_period.0 as u64 / 5); - let maintenance_period = discovery_cooldown / 2; - let initial_delay = cmp::min( - Duration::from_millis(millisecs_per_block.0 * 10), - maintenance_period, - ); - Config::new(discovery_cooldown, maintenance_period, initial_delay) - } -} - -type MessageForNetwork = (NetworkData, DataCommand<::PeerId>); - -pub struct ServiceActions { - maybe_command: Option>, - data: Vec>, -} - -impl ServiceActions { - fn noop() -> Self { - ServiceActions { - maybe_command: None, - data: Vec::new(), - } - } -} - -/// The connection manager service. It handles the abstraction over the network we build to support -/// separate sessions. This includes: -/// 1. Starting and ending specific sessions on user demand. -/// 2. Forwarding in-session user messages to the network using session handlers for address -/// translation. -/// 3. Handling network messages: -/// 1. In-session messages are forwarded to the user. -/// 2. Authentication messages forwarded to session handlers. -/// 4. Running periodic maintenance, mostly related to node discovery. -pub struct Service { - network_identity: NI, - connections: Connections<::PeerId>, - sessions: HashMap>, - to_retry: Vec<( - PreSession, - Option>>, - )>, - discovery_cooldown: Duration, - maintenance_period: Duration, - initial_delay: Duration, -} - -impl Service { - /// Create a new connection manager service. - pub fn new(network_identity: NI, config: Config) -> Self { - let Config { - discovery_cooldown, - maintenance_period, - initial_delay, - } = config; - Service { - network_identity, - connections: Connections::new(), - sessions: HashMap::new(), - to_retry: Vec::new(), - discovery_cooldown, - maintenance_period, - initial_delay, - } - } - - fn delete_reserved( - to_remove: HashSet, - ) -> Option> { - match to_remove.is_empty() { - true => None, - false => Some(ConnectionCommand::DelReserved(to_remove)), - } - } - - fn finish_session( - &mut self, - session_id: SessionId, - ) -> Option> { - self.sessions.remove(&session_id); - self.to_retry - .retain(|(pre_session, _)| pre_session.session_id() != session_id); - Self::delete_reserved(self.connections.remove_session(session_id)) - } - - fn network_message( - (message, command): (DiscoveryMessage, DataCommand), - ) -> MessageForNetwork { - (NetworkData::Meta(message), command) - } - - fn discover_authorities( - &mut self, - session_id: &SessionId, - ) -> Vec> { - if let Some(Session { - handler, discovery, .. - }) = self.sessions.get_mut(session_id) - { - discovery - .discover_authorities(handler) - .into_iter() - .map(Self::network_message) - .collect() - } else { - Vec::new() - } - } - - /// Returns all the network messages that should be sent as part of discovery at this moment. - pub fn discovery(&mut self) -> Vec> { - let mut result = Vec::new(); - let sessions: Vec<_> = self.sessions.keys().cloned().collect(); - for session_id in sessions { - result.append(&mut self.discover_authorities(&session_id)); - } - result - } - - fn addresses(&self) -> Vec { - let (addresses, peer_id) = self.network_identity.identity(); - debug!(target: "aleph-network", "Got addresses:\n{:?}\n and peer_id:{:?}", addresses, peer_id); - addresses - .into_iter() - .filter_map(|address| address.add_matching_peer_id(peer_id.clone())) - .collect() - } - - async fn start_validator_session( - &mut self, - pre_session: PreValidatorSession, - addresses: Vec, - ) -> Result< - ( - Vec>, - mpsc::UnboundedReceiver, - ), - SessionHandlerError, - > { - let PreValidatorSession { - session_id, - verifier, - node_id, - pen, - } = pre_session; - let handler = - SessionHandler::new(Some((node_id, pen)), verifier, session_id, addresses).await?; - let discovery = Discovery::new(self.discovery_cooldown); - let (data_for_user, data_from_network) = mpsc::unbounded(); - let data_for_user = Some(data_for_user); - self.sessions.insert( - session_id, - Session { - handler, - discovery, - data_for_user, - }, - ); - Ok((self.discover_authorities(&session_id), data_from_network)) - } - - async fn update_validator_session( - &mut self, - pre_session: PreValidatorSession, - ) -> Result< - ( - ServiceActions, - mpsc::UnboundedReceiver, - ), - SessionHandlerError, - > { - let addresses = self.addresses(); - let session = match self.sessions.get_mut(&pre_session.session_id) { - Some(session) => session, - None => { - let (data, data_from_network) = - self.start_validator_session(pre_session, addresses).await?; - return Ok(( - ServiceActions { - maybe_command: None, - data, - }, - data_from_network, - )); - } - }; - let PreValidatorSession { - session_id, - verifier, - node_id, - pen, - } = pre_session; - let peers_to_stay = session - .handler - .update(Some((node_id, pen)), verifier, addresses) - .await? - .iter() - .flat_map(|address| address.get_peer_id()) - .collect(); - let maybe_command = Self::delete_reserved( - self.connections - .remove_session(session_id) - .difference(&peers_to_stay) - .cloned() - .collect(), - ); - let (data_for_user, data_from_network) = mpsc::unbounded(); - session.data_for_user = Some(data_for_user); - self.connections.add_peers(session_id, peers_to_stay); - Ok(( - ServiceActions { - maybe_command, - data: self.discover_authorities(&session_id), - }, - data_from_network, - )) - } - - async fn handle_validator_presession( - &mut self, - pre_session: PreValidatorSession, - result_for_user: Option>>, - ) -> Result, SessionHandlerError> { - match self.update_validator_session(pre_session.clone()).await { - Ok((actions, data_from_network)) => { - if let Some(result_for_user) = result_for_user { - if result_for_user.send(data_from_network).is_err() { - warn!(target: "aleph-network", "Failed to send started session.") - } - } - Ok(actions) - } - Err(e) => { - self.to_retry - .push((PreSession::Validator(pre_session), result_for_user)); - Err(e) - } - } - } - - async fn start_nonvalidator_session( - &mut self, - pre_session: PreNonvalidatorSession, - addresses: Vec, - ) -> Result<(), SessionHandlerError> { - let PreNonvalidatorSession { - session_id, - verifier, - } = pre_session; - let handler = SessionHandler::new(None, verifier, session_id, addresses).await?; - let discovery = Discovery::new(self.discovery_cooldown); - self.sessions.insert( - session_id, - Session { - handler, - discovery, - data_for_user: None, - }, - ); - Ok(()) - } - - async fn update_nonvalidator_session( - &mut self, - pre_session: PreNonvalidatorSession, - ) -> Result<(), SessionHandlerError> { - let addresses = self.addresses(); - let session = match self.sessions.get_mut(&pre_session.session_id) { - Some(session) => session, - None => { - return self - .start_nonvalidator_session(pre_session, addresses) - .await; - } - }; - session - .handler - .update(None, pre_session.verifier, addresses) - .await?; - Ok(()) - } - - async fn handle_nonvalidator_presession( - &mut self, - pre_session: PreNonvalidatorSession, - ) -> Result<(), SessionHandlerError> { - self.update_nonvalidator_session(pre_session.clone()) - .await - .map_err(|e| { - self.to_retry - .push((PreSession::Nonvalidator(pre_session), None)); - e - }) - } - - /// Handle a session command. - /// Returns a command possibly changing what we should stay connected to and a list of data to - /// be sent over the network. - pub async fn on_command( - &mut self, - command: SessionCommand, - ) -> Result, SessionHandlerError> { - use SessionCommand::*; - match command { - StartValidator(session_id, verifier, node_id, pen, result_for_user) => { - let pre_session = PreValidatorSession { - session_id, - verifier, - node_id, - pen, - }; - self.handle_validator_presession(pre_session, result_for_user) - .await - } - StartNonvalidator(session_id, verifier) => { - let pre_session = PreNonvalidatorSession { - session_id, - verifier, - }; - self.handle_nonvalidator_presession(pre_session).await?; - Ok(ServiceActions::noop()) - } - Stop(session_id) => Ok(ServiceActions { - maybe_command: self.finish_session(session_id), - data: Vec::new(), - }), - } - } - - /// Handle a user request for sending data. - /// Returns a list of data to be sent over the network. - pub fn on_user_message( - &self, - message: D, - session_id: SessionId, - recipient: Recipient, - ) -> Vec> { - if let Some(handler) = self - .sessions - .get(&session_id) - .map(|session| &session.handler) - { - let to_send = NetworkData::Data(message, session_id); - match recipient { - Recipient::Everyone => (0..handler.node_count().0) - .map(NodeIndex) - .flat_map(|node_id| handler.peer_id(&node_id)) - .map(|peer_id| { - ( - to_send.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - ) - }) - .collect(), - Recipient::Node(node_id) => handler - .peer_id(&node_id) - .into_iter() - .map(|peer_id| { - ( - to_send.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - ) - }) - .collect(), - } - } else { - Vec::new() - } - } - - /// Handle a discovery message. - /// Returns a command possibly changing what we should stay connected to and a list of data to - /// be sent over the network. - pub fn on_discovery_message( - &mut self, - message: DiscoveryMessage, - ) -> ServiceActions { - let session_id = message.session_id(); - match self.sessions.get_mut(&session_id) { - Some(Session { - handler, discovery, .. - }) => { - let (addresses, responses) = discovery.handle_message(message, handler); - let maybe_command = match !addresses.is_empty() && handler.is_validator() { - true => { - debug!(target: "aleph-network", "Adding addresses for session {:?} to reserved: {:?}", session_id, addresses); - self.connections.add_peers( - session_id, - addresses.iter().flat_map(|address| address.get_peer_id()), - ); - Some(ConnectionCommand::AddReserved( - addresses.into_iter().collect(), - )) - } - false => None, - }; - ServiceActions { - maybe_command, - data: responses.into_iter().map(Self::network_message).collect(), - } - } - None => { - debug!(target: "aleph-network", "Received message from unknown session: {:?}", message); - ServiceActions::noop() - } - } - } - - /// Sends the data to the identified session. - pub fn send_session_data(&self, session_id: &SessionId, data: D) -> Result<(), Error> { - match self - .sessions - .get(session_id) - .and_then(|session| session.data_for_user.as_ref()) - { - Some(data_for_user) => data_for_user - .unbounded_send(data) - .map_err(|_| Error::UserSend), - None => Err(Error::NoSession), - } - } - - /// Retries starting a validator session the user requested, but which failed to start - /// initially. Mostly useful when the network was not yet aware of its own address at time of - /// the request. - pub async fn retry_session_start( - &mut self, - ) -> Result, SessionHandlerError> { - let (pre_session, result_for_user) = match self.to_retry.pop() { - Some(to_retry) => to_retry, - None => return Ok(ServiceActions::noop()), - }; - match pre_session { - PreSession::Validator(pre_session) => { - self.handle_validator_presession(pre_session, result_for_user) - .await - } - PreSession::Nonvalidator(pre_session) => { - self.handle_nonvalidator_presession(pre_session).await?; - Ok(ServiceActions::noop()) - } - } - } - - pub fn status_report(&self) { - let mut status = String::from("Connection Manager status report: "); - - let mut authenticated: Vec<_> = self - .sessions - .iter() - .filter(|(_, session)| session.handler.authentication().is_some()) - .map(|(session_id, session)| { - let mut peers = session - .handler - .peers() - .into_iter() - .map(|(node_id, peer_id)| (node_id.0, peer_id)) - .collect::>(); - peers.sort_by(|x, y| x.0.cmp(&y.0)); - (session_id.0, session.handler.node_count().0, peers) - }) - .collect(); - authenticated.sort_by(|x, y| x.0.cmp(&y.0)); - if !authenticated.is_empty() { - let authenticated_status = authenticated - .iter() - .map(|(session_id, node_count, peers)| { - let peer_ids = peers - .iter() - .map(|(node_id, peer_id)| { - format!("{:?}: {}", node_id, peer_id.to_short_string()) - }) - .collect::>() - .join(", "); - - format!( - "{:?}: {}/{} {{{}}}", - session_id, - peers.len() + 1, - node_count, - peer_ids - ) - }) - .collect::>() - .join(", "); - status.push_str(&format!( - "authenticated authorities: {}; ", - authenticated_status - )); - } - - let mut missing: Vec<_> = self - .sessions - .iter() - .filter(|(_, session)| session.handler.authentication().is_some()) - .map(|(session_id, session)| { - ( - session_id.0, - session - .handler - .missing_nodes() - .iter() - .map(|id| id.0) - .collect::>(), - ) - }) - .filter(|(_, missing)| !missing.is_empty()) - .collect(); - missing.sort_by(|x, y| x.0.cmp(&y.0)); - if !missing.is_empty() { - let missing_status = missing - .iter() - .map(|(session_id, missing)| format!("{:?}: {:?}", session_id, missing)) - .collect::>() - .join(", "); - status.push_str(&format!("missing authorities: {}; ", missing_status)); - } - - if !authenticated.is_empty() || !missing.is_empty() { - info!(target: "aleph-network", "{}", status); - } - } -} - -/// Input/output interface for the connectiona manager service. -pub struct IO { - commands_for_network: mpsc::UnboundedSender>, - messages_for_network: mpsc::UnboundedSender>, - commands_from_user: mpsc::UnboundedReceiver>, - messages_from_user: mpsc::UnboundedReceiver<(D, SessionId, Recipient)>, - messages_from_network: mpsc::UnboundedReceiver>, -} - -/// Errors that can happen during the network service operations. -#[derive(Debug, PartialEq, Eq)] -pub enum Error { - NetworkSend, - CommandSend, - /// Should never be fatal. - UserSend, - /// Should never be fatal. - NoSession, - CommandsChannel, - MessageChannel, - NetworkChannel, -} - -impl IO { - pub fn new( - commands_for_network: mpsc::UnboundedSender>, - messages_for_network: mpsc::UnboundedSender>, - commands_from_user: mpsc::UnboundedReceiver>, - messages_from_user: mpsc::UnboundedReceiver<(D, SessionId, Recipient)>, - messages_from_network: mpsc::UnboundedReceiver>, - ) -> IO { - IO { - commands_for_network, - messages_for_network, - commands_from_user, - messages_from_user, - messages_from_network, - } - } - - fn send_data(&self, to_send: MessageForNetwork) -> Result<(), Error> { - self.messages_for_network - .unbounded_send(to_send) - .map_err(|_| Error::NetworkSend) - } - - fn send_command(&self, to_send: ConnectionCommand) -> Result<(), Error> { - self.commands_for_network - .unbounded_send(to_send) - .map_err(|_| Error::CommandSend) - } - - fn send( - &self, - ServiceActions { - maybe_command, - data, - }: ServiceActions, - ) -> Result<(), Error> { - if let Some(command) = maybe_command { - self.send_command(command)?; - } - for data_to_send in data { - self.send_data(data_to_send)?; - } - Ok(()) - } - - fn on_network_message>( - &self, - service: &mut Service, - message: NetworkData, - ) -> Result<(), Error> { - use NetworkData::*; - match message { - Meta(message) => self.send(service.on_discovery_message(message)), - Data(data, session_id) => service.send_session_data(&session_id, data), - } - } - - /// Run the connection manager service with this IO. - pub async fn run>( - mut self, - mut service: Service, - ) -> Result<(), Error> { - // Initial delay is needed so that Network is fully set up and we received some first discovery broadcasts from other nodes. - // Otherwise this might cause first maintenance never working, as it happens before first broadcasts. - let mut maintenance = time::interval_at( - Instant::now() + service.initial_delay, - service.maintenance_period, - ); - - let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); - loop { - trace!(target: "aleph-network", "Manager Loop started a next iteration"); - tokio::select! { - maybe_command = self.commands_from_user.next() => { - trace!(target: "aleph-network", "Manager received a command from user"); - match maybe_command { - Some(command) => match service.on_command(command).await { - Ok(to_send) => self.send(to_send)?, - Err(e) => warn!(target: "aleph-network", "Failed to update handler: {:?}", e), - }, - None => return Err(Error::CommandsChannel), - } - }, - maybe_message = self.messages_from_user.next() => { - trace!(target: "aleph-network", "Manager received a message from user"); - match maybe_message { - Some((message, session_id, recipient)) => for message in service.on_user_message(message, session_id, recipient) { - self.send_data(message)?; - }, - None => return Err(Error::MessageChannel), - } - }, - maybe_message = self.messages_from_network.next() => { - trace!(target: "aleph-network", "Manager received a message from network"); - match maybe_message { - Some(message) => if let Err(e) = self.on_network_message(&mut service, message) { - match e { - Error::UserSend => trace!(target: "aleph-network", "Failed to send to user in session."), - Error::NoSession => trace!(target: "aleph-network", "Received message for unknown session."), - _ => return Err(e), - } - }, - None => return Err(Error::NetworkChannel), - } - }, - _ = maintenance.tick() => { - debug!(target: "aleph-network", "Manager starts maintenence"); - match service.retry_session_start().await { - Ok(to_send) => self.send(to_send)?, - Err(e) => warn!(target: "aleph-network", "Retry failed to update handler: {:?}", e), - } - for to_send in service.discovery() { - self.send_data(to_send)?; - } - }, - _ = status_ticker.tick() => { - service.status_report(); - } - } - } - } -} - -#[cfg(test)] -mod tests { - use std::time::Duration; - - use futures::{channel::oneshot, StreamExt}; - - use super::{Config, Error, Service, ServiceActions, SessionCommand}; - use crate::{ - network::{ - manager::{DiscoveryMessage, NetworkData}, - mock::{crypto_basics, MockNetworkIdentity}, - ConnectionCommand, DataCommand, Protocol, - }, - Recipient, SessionId, - }; - - const NUM_NODES: usize = 7; - const MAINTENANCE_PERIOD: Duration = Duration::from_secs(120); - const DISCOVERY_PERIOD: Duration = Duration::from_secs(60); - const INITIAL_DELAY: Duration = Duration::from_secs(5); - - fn build() -> Service { - Service::new( - MockNetworkIdentity::new(), - Config::new(MAINTENANCE_PERIOD, DISCOVERY_PERIOD, INITIAL_DELAY), - ) - } - - #[tokio::test] - async fn starts_nonvalidator_session() { - let mut service = build(); - let (_, verifier) = crypto_basics(NUM_NODES).await; - let session_id = SessionId(43); - let ServiceActions { - maybe_command, - data, - } = service - .on_command(SessionCommand::StartNonvalidator(session_id, verifier)) - .await - .unwrap(); - assert!(maybe_command.is_none()); - assert!(data.is_empty()); - assert_eq!( - service.send_session_data(&session_id, -43), - Err(Error::NoSession) - ); - } - - #[tokio::test] - async fn starts_validator_session() { - let mut service = build(); - let (validator_data, verifier) = crypto_basics(NUM_NODES).await; - let (node_id, pen) = validator_data[0].clone(); - let session_id = SessionId(43); - let (result_for_user, result_from_service) = oneshot::channel(); - let ServiceActions { - maybe_command, - data, - } = service - .on_command(SessionCommand::StartValidator( - session_id, - verifier, - node_id, - pen, - Some(result_for_user), - )) - .await - .unwrap(); - assert!(maybe_command.is_none()); - assert_eq!(data.len(), 1); - assert!(data - .iter() - .all(|(_, command)| command == &DataCommand::Broadcast)); - let _data_from_network = result_from_service.await.unwrap(); - assert_eq!(service.send_session_data(&session_id, -43), Ok(())); - } - - #[tokio::test] - async fn stops_session() { - let mut service = build(); - let (validator_data, verifier) = crypto_basics(NUM_NODES).await; - let (node_id, pen) = validator_data[0].clone(); - let session_id = SessionId(43); - let (result_for_user, result_from_service) = oneshot::channel(); - let ServiceActions { - maybe_command, - data, - } = service - .on_command(SessionCommand::StartValidator( - session_id, - verifier, - node_id, - pen, - Some(result_for_user), - )) - .await - .unwrap(); - assert!(maybe_command.is_none()); - assert_eq!(data.len(), 1); - assert!(data - .iter() - .all(|(_, command)| command == &DataCommand::Broadcast)); - assert_eq!(service.send_session_data(&session_id, -43), Ok(())); - let mut data_from_network = result_from_service.await.unwrap(); - assert_eq!(data_from_network.next().await, Some(-43)); - let ServiceActions { - maybe_command, - data, - } = service - .on_command(SessionCommand::Stop(session_id)) - .await - .unwrap(); - assert!(maybe_command.is_none()); - assert!(data.is_empty()); - assert_eq!( - service.send_session_data(&session_id, -43), - Err(Error::NoSession) - ); - assert!(data_from_network.next().await.is_none()); - } - - #[tokio::test] - async fn handles_broadcast() { - let mut service = build(); - let (validator_data, verifier) = crypto_basics(NUM_NODES).await; - let (node_id, pen) = validator_data[0].clone(); - let session_id = SessionId(43); - service - .on_command(SessionCommand::StartValidator( - session_id, - verifier.clone(), - node_id, - pen, - None, - )) - .await - .unwrap(); - let mut other_service = build(); - let (node_id, pen) = validator_data[1].clone(); - let ServiceActions { data, .. } = other_service - .on_command(SessionCommand::StartValidator( - session_id, verifier, node_id, pen, None, - )) - .await - .unwrap(); - let broadcast = match data[0].clone() { - (NetworkData::Meta(broadcast), DataCommand::Broadcast) => broadcast, - _ => panic!("Expected discovery massage broadcast, got: {:?}", data[0]), - }; - let addresses = match &broadcast { - DiscoveryMessage::AuthenticationBroadcast((auth_data, _)) => auth_data.addresses(), - _ => panic!("Expected an authentication broadcast, got {:?}", broadcast), - }; - let ServiceActions { - maybe_command, - data, - } = service.on_discovery_message(broadcast); - assert_eq!( - maybe_command, - Some(ConnectionCommand::AddReserved( - addresses.into_iter().collect() - )) - ); - assert_eq!(data.len(), 2); - assert!(data - .iter() - .any(|(_, command)| command == &DataCommand::Broadcast)); - assert!(data - .iter() - .any(|(_, command)| matches!(command, &DataCommand::SendTo(_, _)))); - } - - #[tokio::test] - async fn sends_user_data() { - let mut service = build(); - let (validator_data, verifier) = crypto_basics(NUM_NODES).await; - let (node_id, pen) = validator_data[0].clone(); - let session_id = SessionId(43); - service - .on_command(SessionCommand::StartValidator( - session_id, - verifier.clone(), - node_id, - pen, - None, - )) - .await - .unwrap(); - let mut other_service = build(); - let (node_id, pen) = validator_data[1].clone(); - let ServiceActions { data, .. } = other_service - .on_command(SessionCommand::StartValidator( - session_id, verifier, node_id, pen, None, - )) - .await - .unwrap(); - let broadcast = match data[0].clone() { - (NetworkData::Meta(broadcast), DataCommand::Broadcast) => broadcast, - _ => panic!("Expected discovery massage broadcast, got: {:?}", data[0]), - }; - service.on_discovery_message(broadcast); - let messages = service.on_user_message(2137, session_id, Recipient::Everyone); - assert_eq!(messages.len(), 1); - let (network_data, data_command) = &messages[0]; - assert!(matches!( - data_command, - DataCommand::SendTo(_, Protocol::Validator) - )); - assert_eq!(network_data, &NetworkData::Data(2137, session_id)); - } -} diff --git a/finality-aleph/src/network/manager/session.rs b/finality-aleph/src/network/manager/session.rs deleted file mode 100644 index 209ecc1658..0000000000 --- a/finality-aleph/src/network/manager/session.rs +++ /dev/null @@ -1,682 +0,0 @@ -use std::collections::HashMap; - -use codec::Encode; - -use crate::{ - abft::NodeCount, - crypto::{AuthorityPen, AuthorityVerifier}, - network::{ - manager::{AuthData, Authentication}, - Multiaddress, PeerId, - }, - NodeIndex, SessionId, -}; - -#[derive(Debug)] -pub enum SessionInfo { - SessionId(SessionId), - OwnAuthentication(Authentication), -} - -impl SessionInfo { - fn session_id(&self) -> SessionId { - match self { - SessionInfo::SessionId(session_id) => *session_id, - SessionInfo::OwnAuthentication((auth_data, _)) => auth_data.session_id, - } - } -} - -type PeerAuthentications = (Authentication, Option>); - -/// A struct for handling authentications for a given session and maintaining -/// mappings between PeerIds and NodeIndexes within that session. -pub struct Handler { - peers_by_node: HashMap, - authentications: HashMap>, - session_info: SessionInfo, - own_peer_id: M::PeerId, - authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, - authority_verifier: AuthorityVerifier, -} - -#[derive(Debug)] -pub enum HandlerError { - /// Returned when handler is change from validator to nonvalidator - /// or vice versa - TypeChange, - /// Returned when a set of addresses is not usable for creating authentications. - /// Either because none of the addresses are externally reachable libp2p addresses, - /// or the addresses contain multiple libp2p PeerIds. - NoP2pAddresses, - MultiplePeerIds, -} - -enum CommonPeerId { - Unknown, - Unique(PID), - NotUnique, -} - -impl From> for Option { - fn from(cpi: CommonPeerId) -> Self { - use CommonPeerId::*; - match cpi { - Unique(peer_id) => Some(peer_id), - Unknown | NotUnique => None, - } - } -} - -impl CommonPeerId { - fn aggregate(self, peer_id: PID) -> Self { - use CommonPeerId::*; - match self { - Unknown => Unique(peer_id), - Unique(current_peer_id) => match peer_id == current_peer_id { - true => Unique(current_peer_id), - false => NotUnique, - }, - NotUnique => NotUnique, - } - } -} - -fn get_common_peer_id(addresses: &[M]) -> Option { - addresses - .iter() - .fold( - CommonPeerId::Unknown, - |common_peer_id, address| match address.get_peer_id() { - Some(peer_id) => common_peer_id.aggregate(peer_id), - None => CommonPeerId::NotUnique, - }, - ) - .into() -} - -fn retrieve_peer_id(addresses: &[M]) -> Result { - if addresses.is_empty() { - return Err(HandlerError::NoP2pAddresses); - } - get_common_peer_id(addresses).ok_or(HandlerError::MultiplePeerIds) -} - -async fn construct_session_info( - authority_index_and_pen: &Option<(NodeIndex, AuthorityPen)>, - session_id: SessionId, - addresses: Vec, -) -> Result<(SessionInfo, M::PeerId), HandlerError> { - let addresses: Vec<_> = addresses - .into_iter() - .filter(|address| address.get_peer_id().is_some()) - .collect(); - let peer = retrieve_peer_id(&addresses)?; - - if let Some((node_index, authority_pen)) = authority_index_and_pen { - let auth_data = AuthData { - addresses, - node_id: *node_index, - session_id, - }; - let signature = authority_pen.sign(&auth_data.encode()).await; - return Ok((SessionInfo::OwnAuthentication((auth_data, signature)), peer)); - } - Ok((SessionInfo::SessionId(session_id), peer)) -} - -impl Handler { - /// Returns an error if the set of addresses contains no external libp2p addresses, or contains - /// at least two such addresses with differing PeerIds. - pub async fn new( - authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, - authority_verifier: AuthorityVerifier, - session_id: SessionId, - addresses: Vec, - ) -> Result, HandlerError> { - let (session_info, own_peer_id) = - construct_session_info(&authority_index_and_pen, session_id, addresses).await?; - Ok(Handler { - peers_by_node: HashMap::new(), - authentications: HashMap::new(), - session_info, - authority_index_and_pen, - authority_verifier, - own_peer_id, - }) - } - - fn index(&self) -> Option { - match self.authority_index_and_pen { - Some((index, _)) => Some(index), - _ => None, - } - } - - pub fn is_validator(&self) -> bool { - self.authority_index_and_pen.is_some() - } - - pub fn node_count(&self) -> NodeCount { - self.authority_verifier.node_count() - } - - pub fn session_id(&self) -> SessionId { - self.session_info.session_id() - } - - /// Returns the authentication for the node and session this handler is responsible for. - pub fn authentication(&self) -> Option> { - match &self.session_info { - SessionInfo::SessionId(_) => None, - SessionInfo::OwnAuthentication(own_authentication) => Some(own_authentication.clone()), - } - } - - /// Returns a vector of indices of nodes for which the handler has no authentication. - pub fn missing_nodes(&self) -> Vec { - let node_count = self.node_count().0; - if self.peers_by_node.len() + 1 == node_count { - return Vec::new(); - } - (0..node_count) - .map(NodeIndex) - .filter(|node_id| { - Some(*node_id) != self.index() && !self.peers_by_node.contains_key(node_id) - }) - .collect() - } - - /// Verifies the authentication, uses it to update mappings, and returns whether we should - /// remain connected to the multiaddresses. - pub fn handle_authentication(&mut self, authentication: Authentication) -> bool { - if authentication.0.session_id != self.session_id() { - return false; - } - let (auth_data, signature) = &authentication; - - // The auth is completely useless if it doesn't have a consistent PeerId. - let peer_id = match get_common_peer_id(&auth_data.addresses) { - Some(peer_id) => peer_id, - None => return false, - }; - if peer_id == self.own_peer_id { - return false; - } - if !self - .authority_verifier - .verify(&auth_data.encode(), signature, auth_data.node_id) - { - // This might be an authentication for a key that has been changed, but we are not yet - // aware of the change. - if let Some(auth_pair) = self.authentications.get_mut(&peer_id) { - auth_pair.1 = Some(authentication.clone()); - } - return false; - } - self.peers_by_node - .insert(auth_data.node_id, peer_id.clone()); - self.authentications.insert(peer_id, (authentication, None)); - true - } - - /// Returns the PeerId of the node with the given NodeIndex, if known. - pub fn peer_id(&self, node_id: &NodeIndex) -> Option { - self.peers_by_node.get(node_id).cloned() - } - - /// Returns maping from NodeIndex to PeerId - pub fn peers(&self) -> HashMap { - self.peers_by_node.clone() - } - - /// Updates the handler with the given keychain and set of own addresses. - /// Returns an error if the set of addresses is not valid. - /// All authentications will be rechecked, invalid ones purged and cached ones that turn out to - /// now be valid canonalized. - /// Own authentication will be regenerated. - /// If successful returns a set of addresses that we should be connected to. - pub async fn update( - &mut self, - authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, - authority_verifier: AuthorityVerifier, - addresses: Vec, - ) -> Result, HandlerError> { - if authority_index_and_pen.is_none() != self.authority_index_and_pen.is_none() { - return Err(HandlerError::TypeChange); - } - - let authentications = self.authentications.clone(); - - *self = Handler::new( - authority_index_and_pen, - authority_verifier, - self.session_id(), - addresses, - ) - .await?; - - for (_, (auth, maybe_auth)) in authentications { - self.handle_authentication(auth); - if let Some(auth) = maybe_auth { - self.handle_authentication(auth); - } - } - Ok(self - .authentications - .values() - .flat_map(|((auth_data, _), _)| auth_data.addresses.iter().cloned()) - .collect()) - } -} - -#[cfg(test)] -mod tests { - use super::{get_common_peer_id, Handler, HandlerError}; - use crate::{ - network::{ - mock::{crypto_basics, MockMultiaddress, MockNetworkIdentity, MockPeerId}, - NetworkIdentity, - }, - NodeIndex, SessionId, - }; - - const NUM_NODES: usize = 7; - - #[tokio::test] - async fn creates_with_correct_data() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - assert!(Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .is_ok()); - } - - #[tokio::test] - async fn creates_with_local_address() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - assert!(Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .is_ok()); - } - - #[tokio::test] - async fn creates_without_node_index_nor_authority_pen() { - let crypto_basics = crypto_basics(NUM_NODES).await; - assert!(Handler::new( - None, - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .is_ok()); - } - - #[tokio::test] - async fn identifies_whether_node_is_authority_in_current_session() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let no_authority_handler = Handler::new( - None, - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let authority_handler = Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - assert!(!no_authority_handler.is_validator()); - assert!(authority_handler.is_validator()); - } - - #[tokio::test] - async fn non_validator_handler_returns_none_for_authentication() { - let crypto_basics = crypto_basics(NUM_NODES).await; - assert!(Handler::new( - None, - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0 - ) - .await - .unwrap() - .authentication() - .is_none()); - } - - #[tokio::test] - async fn fails_to_create_with_no_addresses() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - assert!(matches!( - Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - Vec::::new() - ) - .await, - Err(HandlerError::NoP2pAddresses) - )); - } - - #[tokio::test] - async fn fails_to_create_with_non_unique_peer_id() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let addresses = vec![ - MockMultiaddress::random_with_id(MockPeerId::random()), - MockMultiaddress::random_with_id(MockPeerId::random()), - ]; - assert!(matches!( - Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - addresses - ) - .await, - Err(HandlerError::MultiplePeerIds) - )); - } - - #[tokio::test] - async fn fails_to_update_from_validator_to_non_validator() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let addresses = MockNetworkIdentity::new().identity().0; - let mut handler0 = Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1.clone(), - SessionId(43), - addresses.clone(), - ) - .await - .unwrap(); - assert!(matches!( - handler0 - .update(None, crypto_basics.1.clone(), addresses) - .await, - Err(HandlerError::TypeChange) - )); - } - - #[tokio::test] - async fn fails_to_update_from_non_validator_to_validator() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let addresses = MockNetworkIdentity::new().identity().0; - let mut handler0 = Handler::new( - None, - crypto_basics.1.clone(), - SessionId(43), - addresses.clone(), - ) - .await - .unwrap(); - assert!(matches!( - handler0 - .update( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1.clone(), - addresses, - ) - .await, - Err(HandlerError::TypeChange) - )); - } - - #[tokio::test] - async fn does_not_keep_own_peer_id_or_authentication() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let handler0 = Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - assert!(handler0.peer_id(&NodeIndex(0)).is_none()); - } - - #[tokio::test] - async fn misses_all_other_nodes_initially() { - let mut crypto_basics = crypto_basics(NUM_NODES).await; - let handler0 = Handler::new( - Some(crypto_basics.0.pop().unwrap()), - crypto_basics.1, - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (0..NUM_NODES - 1).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - assert!(handler0.peer_id(&NodeIndex(1)).is_none()); - } - - #[tokio::test] - async fn accepts_correct_authentication() { - let crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - Some(crypto_basics.0[0].clone()), - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let addresses = MockNetworkIdentity::new().identity().0; - let handler1 = Handler::new( - Some(crypto_basics.0[1].clone()), - crypto_basics.1.clone(), - SessionId(43), - addresses.clone(), - ) - .await - .unwrap(); - assert!(handler0.handle_authentication(handler1.authentication().unwrap())); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (2..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - let peer_id1 = get_common_peer_id(&addresses); - assert_eq!(handler0.peer_id(&NodeIndex(1)), peer_id1); - } - - #[tokio::test] - async fn non_validator_accepts_correct_authentication() { - let crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - None, - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let addresses = MockNetworkIdentity::new().identity().0; - let handler1 = Handler::new( - Some(crypto_basics.0[1].clone()), - crypto_basics.1.clone(), - SessionId(43), - addresses.clone(), - ) - .await - .unwrap(); - assert!(handler0.handle_authentication(handler1.authentication().unwrap())); - let missing_nodes = handler0.missing_nodes(); - let mut expected_missing: Vec<_> = (0..NUM_NODES).map(NodeIndex).collect(); - expected_missing.remove(1); - assert_eq!(missing_nodes, expected_missing); - let peer_id1 = get_common_peer_id(&addresses); - assert_eq!(handler0.peer_id(&NodeIndex(1)), peer_id1); - } - - #[tokio::test] - async fn ignores_badly_signed_authentication() { - let crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - Some(crypto_basics.0[0].clone()), - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let handler1 = Handler::new( - Some(crypto_basics.0[1].clone()), - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let mut authentication = handler1.authentication().unwrap(); - authentication.1 = handler0.authentication().unwrap().1; - assert!(!handler0.handle_authentication(authentication)); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - } - - #[tokio::test] - async fn ignores_wrong_session_authentication() { - let crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - Some(crypto_basics.0[0].clone()), - crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let handler1 = Handler::new( - Some(crypto_basics.0[1].clone()), - crypto_basics.1.clone(), - SessionId(44), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - assert!(!handler0.handle_authentication(handler1.authentication().unwrap())); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - } - - #[tokio::test] - async fn ignores_own_authentication() { - let awaited_crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - Some(awaited_crypto_basics.0[0].clone()), - awaited_crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - assert!(!handler0.handle_authentication(handler0.authentication().unwrap())); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - } - - #[tokio::test] - async fn invalidates_obsolete_authentication() { - let awaited_crypto_basics = crypto_basics(NUM_NODES).await; - let mut handler0 = Handler::new( - Some(awaited_crypto_basics.0[0].clone()), - awaited_crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let handler1 = Handler::new( - Some(awaited_crypto_basics.0[1].clone()), - awaited_crypto_basics.1.clone(), - SessionId(43), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - assert!(handler0.handle_authentication(handler1.authentication().unwrap())); - let new_crypto_basics = crypto_basics(NUM_NODES).await; - handler0 - .update( - Some(new_crypto_basics.0[0].clone()), - new_crypto_basics.1.clone(), - MockNetworkIdentity::new().identity().0, - ) - .await - .unwrap(); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - assert!(handler0.peer_id(&NodeIndex(1)).is_none()); - } - - #[tokio::test] - async fn uses_cached_authentication() { - let awaited_crypto_basics = crypto_basics(NUM_NODES).await; - let addresses0 = MockNetworkIdentity::new().identity().0; - let mut handler0 = Handler::new( - Some(awaited_crypto_basics.0[0].clone()), - awaited_crypto_basics.1.clone(), - SessionId(43), - addresses0.clone(), - ) - .await - .unwrap(); - let addresses1 = MockNetworkIdentity::new().identity().0; - let mut handler1 = Handler::new( - Some(awaited_crypto_basics.0[1].clone()), - awaited_crypto_basics.1.clone(), - SessionId(43), - addresses1.clone(), - ) - .await - .unwrap(); - assert!(handler0.handle_authentication(handler1.authentication().unwrap())); - let new_crypto_basics = crypto_basics(NUM_NODES).await; - assert!(handler1 - .update( - Some(new_crypto_basics.0[1].clone()), - new_crypto_basics.1.clone(), - addresses1.clone(), - ) - .await - .unwrap() - .is_empty()); - assert!(!handler0.handle_authentication(handler1.authentication().unwrap())); - handler0 - .update( - Some(new_crypto_basics.0[0].clone()), - new_crypto_basics.1.clone(), - addresses0, - ) - .await - .unwrap(); - let missing_nodes = handler0.missing_nodes(); - let expected_missing: Vec<_> = (2..NUM_NODES).map(NodeIndex).collect(); - assert_eq!(missing_nodes, expected_missing); - assert_eq!( - handler0.peer_id(&NodeIndex(1)), - get_common_peer_id(&addresses1) - ); - } -} diff --git a/finality-aleph/src/network/mock.rs b/finality-aleph/src/network/mock.rs index 6817de8251..dff81e2e46 100644 --- a/finality-aleph/src/network/mock.rs +++ b/finality-aleph/src/network/mock.rs @@ -1,102 +1,72 @@ -use std::{ - collections::{HashSet, VecDeque}, - fmt, - sync::Arc, -}; +use std::{sync::Arc, time::Duration}; use aleph_primitives::KEY_TYPE; -use async_trait::async_trait; -use codec::{Decode, Encode}; -use futures::{ - channel::{mpsc, oneshot}, - StreamExt, -}; -use parking_lot::Mutex; -use rand::random; +use codec::{Decode, Encode, Output}; +use futures::{channel::mpsc, StreamExt}; use sp_keystore::{testing::KeyStore, CryptoStore}; +use tokio::time::timeout; use crate::{ crypto::{AuthorityPen, AuthorityVerifier}, - network::{ - manager::NetworkData, ConnectionCommand, DataCommand, Event, EventStream, Multiaddress, - Network, NetworkIdentity, NetworkSender, NetworkServiceIO as NetworkIO, PeerId, Protocol, - }, AuthorityId, NodeIndex, }; -#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash, Encode, Decode)] -pub struct MockPeerId(u32); - -impl MockPeerId { - pub fn random() -> Self { - MockPeerId(random()) - } -} -impl fmt::Display for MockPeerId { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl PeerId for MockPeerId {} - -#[derive(PartialEq, Eq, Clone, Debug, Hash, Encode, Decode)] -pub struct MockMultiaddress { - peer_id: Option, - address: u32, +#[derive(Hash, Debug, Clone, PartialEq, Eq)] +pub struct MockData { + data: u32, + filler: Vec, + decodes: bool, } -impl MockMultiaddress { - pub fn random_with_id(peer_id: MockPeerId) -> Self { - MockMultiaddress { - peer_id: Some(peer_id), - address: random(), +impl MockData { + pub fn new(data: u32, filler_size: usize) -> MockData { + MockData { + data, + filler: vec![0; filler_size], + decodes: true, } } -} -impl Multiaddress for MockMultiaddress { - type PeerId = MockPeerId; - - fn get_peer_id(&self) -> Option { - self.peer_id + pub fn new_undecodable(data: u32, filler_size: usize) -> MockData { + MockData { + data, + filler: vec![0; filler_size], + decodes: false, + } } - fn add_matching_peer_id(mut self, peer_id: Self::PeerId) -> Option { - match self.peer_id { - Some(old_peer_id) => match old_peer_id == peer_id { - true => Some(self), - false => None, - }, - None => { - self.peer_id = Some(peer_id); - Some(self) - } - } + pub fn data(&self) -> u32 { + self.data } } -pub struct MockNetworkIdentity { - addresses: Vec, - peer_id: MockPeerId, -} +impl Encode for MockData { + fn size_hint(&self) -> usize { + self.data.size_hint() + self.filler.size_hint() + self.decodes.size_hint() + } -impl MockNetworkIdentity { - pub fn new() -> Self { - let peer_id = MockPeerId::random(); - let addresses = (0..3) - .map(|_| MockMultiaddress::random_with_id(peer_id)) - .collect(); - MockNetworkIdentity { addresses, peer_id } + fn encode_to(&self, dest: &mut T) { + // currently this is exactly the default behaviour, but we still + // need it here to make sure that decode works in the future + self.data.encode_to(dest); + self.filler.encode_to(dest); + self.decodes.encode_to(dest); } } -impl NetworkIdentity for MockNetworkIdentity { - type PeerId = MockPeerId; - type Multiaddress = MockMultiaddress; - - fn identity(&self) -> (Vec, Self::PeerId) { - (self.addresses.clone(), self.peer_id) +impl Decode for MockData { + fn decode(value: &mut I) -> Result { + let data = u32::decode(value)?; + let filler = Vec::::decode(value)?; + let decodes = bool::decode(value)?; + if !decodes { + return Err("Simulated decode failure.".into()); + } + Ok(Self { + data, + filler, + decodes, + }) } } @@ -106,6 +76,8 @@ pub struct Channel( pub Arc>>, ); +const TIMEOUT_FAIL: Duration = Duration::from_secs(10); + impl Channel { pub fn new() -> Self { let (tx, rx) = mpsc::unbounded(); @@ -117,7 +89,19 @@ impl Channel { } pub async fn next(&mut self) -> Option { - self.1.lock().await.next().await + timeout(TIMEOUT_FAIL, self.1.lock().await.next()) + .await + .ok() + .flatten() + } + + pub async fn take(&mut self, n: usize) -> Vec { + timeout( + TIMEOUT_FAIL, + self.1.lock().await.by_ref().take(n).collect::>(), + ) + .await + .unwrap_or_default() } pub async fn try_next(&self) -> Option { @@ -136,181 +120,6 @@ impl Default for Channel { } } -pub type MockEvent = Event; - -pub type MockData = Vec; -type MessageForUser = (NetworkData, DataCommand<::PeerId>); -type NetworkServiceIO = NetworkIO, M>; - -pub struct MockIO { - pub messages_for_user: mpsc::UnboundedSender>, - pub messages_from_user: mpsc::UnboundedReceiver>, - pub commands_for_manager: mpsc::UnboundedSender>, - pub legacy_messages_for_user: mpsc::UnboundedSender>, - pub legacy_messages_from_user: mpsc::UnboundedReceiver>, - pub legacy_commands_for_manager: mpsc::UnboundedSender>, -} - -impl MockIO { - pub fn new() -> (MockIO, NetworkServiceIO, NetworkServiceIO) { - let (mock_messages_for_user, messages_from_user) = mpsc::unbounded(); - let (messages_for_user, mock_messages_from_user) = mpsc::unbounded(); - let (mock_commands_for_manager, commands_from_manager) = mpsc::unbounded(); - let (legacy_mock_messages_for_user, legacy_messages_from_user) = mpsc::unbounded(); - let (legacy_messages_for_user, legacy_mock_messages_from_user) = mpsc::unbounded(); - let (legacy_mock_commands_for_manager, legacy_commands_from_manager) = mpsc::unbounded(); - ( - MockIO { - messages_for_user: mock_messages_for_user, - messages_from_user: mock_messages_from_user, - commands_for_manager: mock_commands_for_manager, - legacy_messages_for_user: legacy_mock_messages_for_user, - legacy_messages_from_user: legacy_mock_messages_from_user, - legacy_commands_for_manager: legacy_mock_commands_for_manager, - }, - NetworkServiceIO::new(messages_from_user, messages_for_user, commands_from_manager), - NetworkServiceIO::new( - legacy_messages_from_user, - legacy_messages_for_user, - legacy_commands_from_manager, - ), - ) - } -} - -pub struct MockEventStream(mpsc::UnboundedReceiver); - -#[async_trait] -impl EventStream for MockEventStream { - async fn next_event(&mut self) -> Option { - self.0.next().await - } -} - -pub struct MockNetworkSender { - sender: mpsc::UnboundedSender<(Vec, MockPeerId, Protocol)>, - peer_id: MockPeerId, - protocol: Protocol, - error: Result<(), MockSenderError>, -} - -#[async_trait] -impl NetworkSender for MockNetworkSender { - type SenderError = MockSenderError; - - async fn send<'a>( - &'a self, - data: impl Into> + Send + Sync + 'static, - ) -> Result<(), MockSenderError> { - self.error?; - self.sender - .unbounded_send((data.into(), self.peer_id, self.protocol)) - .unwrap(); - Ok(()) - } -} - -#[derive(Clone)] -pub struct MockNetwork { - pub add_reserved: Channel<(HashSet, Protocol)>, - pub remove_reserved: Channel<(HashSet, Protocol)>, - pub send_message: Channel<(Vec, MockPeerId, Protocol)>, - pub event_sinks: Arc>>>, - event_stream_taken_oneshot: Arc>>>, - pub create_sender_errors: Arc>>, - pub send_errors: Arc>>, -} - -#[derive(Debug, Copy, Clone)] -pub enum MockSenderError { - SomeError, -} - -impl fmt::Display for MockSenderError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - MockSenderError::SomeError => { - write!(f, "Some error message") - } - } - } -} - -impl std::error::Error for MockSenderError {} - -impl Network for MockNetwork { - type SenderError = MockSenderError; - type NetworkSender = MockNetworkSender; - type PeerId = MockPeerId; - type Multiaddress = MockMultiaddress; - type EventStream = MockEventStream; - - fn event_stream(&self) -> Self::EventStream { - let (tx, rx) = mpsc::unbounded(); - self.event_sinks.lock().push(tx); - // Necessary for tests to detect when service takes event_stream - if let Some(tx) = self.event_stream_taken_oneshot.lock().take() { - tx.send(()).unwrap(); - } - MockEventStream(rx) - } - - fn sender( - &self, - peer_id: Self::PeerId, - protocol: Protocol, - ) -> Result { - self.create_sender_errors - .lock() - .pop_front() - .map_or(Ok(()), Err)?; - let error = self.send_errors.lock().pop_front().map_or(Ok(()), Err); - Ok(MockNetworkSender { - sender: self.send_message.0.clone(), - peer_id, - protocol, - error, - }) - } - - fn add_reserved(&self, addresses: HashSet, protocol: Protocol) { - self.add_reserved.send((addresses, protocol)); - } - - fn remove_reserved(&self, peers: HashSet, protocol: Protocol) { - self.remove_reserved.send((peers, protocol)); - } -} - -impl MockNetwork { - pub fn new(oneshot_sender: oneshot::Sender<()>) -> Self { - MockNetwork { - add_reserved: Channel::new(), - remove_reserved: Channel::new(), - send_message: Channel::new(), - event_sinks: Arc::new(Mutex::new(vec![])), - event_stream_taken_oneshot: Arc::new(Mutex::new(Some(oneshot_sender))), - create_sender_errors: Arc::new(Mutex::new(VecDeque::new())), - send_errors: Arc::new(Mutex::new(VecDeque::new())), - } - } - - pub fn emit_event(&mut self, event: MockEvent) { - for sink in &*self.event_sinks.lock() { - sink.unbounded_send(event.clone()).unwrap(); - } - } - - // Consumes the network asserting there are no unreceived messages in the channels. - pub async fn close_channels(self) { - self.event_sinks.lock().clear(); - // We disable it until tests regarding new substrate network protocol are created. - // assert!(self.add_reserved.close().await.is_none()); - // assert!(self.remove_reserved.close().await.is_none()); - assert!(self.send_message.close().await.is_none()); - } -} - pub async fn crypto_basics( num_crypto_basics: usize, ) -> (Vec<(NodeIndex, AuthorityPen)>, AuthorityVerifier) { diff --git a/finality-aleph/src/network/mod.rs b/finality-aleph/src/network/mod.rs index 91dc680378..7ae7b269e6 100644 --- a/finality-aleph/src/network/mod.rs +++ b/finality-aleph/src/network/mod.rs @@ -1,46 +1,25 @@ use std::{ - collections::HashSet, fmt::{Debug, Display}, hash::Hash, }; -use async_trait::async_trait; -use bytes::Bytes; use codec::Codec; use sp_api::NumberFor; use sp_runtime::traits::Block; -use crate::abft::Recipient; - -mod component; -mod io; -mod manager; +pub mod clique; +pub mod data; +mod gossip; #[cfg(test)] pub mod mock; -mod service; -mod session; -mod split; - -pub use component::{ - Network as ComponentNetwork, NetworkExt as ComponentNetworkExt, - NetworkMap as ComponentNetworkMap, Receiver as ReceiverComponent, Sender as SenderComponent, - SimpleNetwork, -}; -pub use io::setup as setup_io; -use manager::SessionCommand; -pub use manager::{ - ConnectionIO as ConnectionManagerIO, ConnectionManager, ConnectionManagerConfig, -}; -pub use service::{Service, IO as NetworkServiceIO}; -pub use session::{Manager as SessionManager, ManagerError, Sender, IO as SessionManagerIO}; -pub use split::{split, Split}; +pub mod session; +mod substrate; +pub mod tcp; + #[cfg(test)] -pub mod testing { - pub use super::manager::{ - Authentication, DataInSession, DiscoveryMessage, NetworkData, SessionHandler, - VersionedAuthentication, - }; -} +pub use gossip::mock::{MockEvent, MockRawNetwork}; +pub use gossip::{Network as GossipNetwork, Protocol, Service as GossipService}; +pub use substrate::{ProtocolNaming, SubstrateNetwork}; /// Represents the id of an arbitrary node. pub trait PeerId: PartialEq + Eq + Clone + Debug + Display + Hash + Codec + Send { @@ -60,84 +39,23 @@ pub trait PeerId: PartialEq + Eq + Clone + Debug + Display + Hash + Codec + Send } /// Represents the address of an arbitrary node. -pub trait Multiaddress: Debug + Hash + Codec + Clone + Eq + Send + Sync { +pub trait AddressingInformation: Debug + Hash + Codec + Clone + Eq + Send + Sync + 'static { type PeerId: PeerId; - /// Returns the peer id associated with this multiaddress if it exists and is unique. - fn get_peer_id(&self) -> Option; - - /// Returns the address extended by the peer id, unless it already contained another peer id. - fn add_matching_peer_id(self, peer_id: Self::PeerId) -> Option; -} + /// Returns the peer id associated with this address. + fn peer_id(&self) -> Self::PeerId; -/// The Generic protocol is used for validator discovery. -/// The Validator protocol is used for validator-specific messages, i.e. ones needed for -/// finalization. -#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] -pub enum Protocol { - Generic, - Validator, - Authentication, + /// Verify the information. + fn verify(&self) -> bool; } -/// Abstraction over a sender to network. -#[async_trait] -pub trait NetworkSender: Send + Sync + 'static { - type SenderError: std::error::Error; - - /// A method for sending data. Returns Error if not connected to the peer. - async fn send<'a>( - &'a self, - data: impl Into> + Send + Sync + 'static, - ) -> Result<(), Self::SenderError>; -} - -#[derive(Clone)] -pub enum Event { - Connected(M), - Disconnected(M::PeerId), - StreamOpened(M::PeerId, Protocol), - StreamClosed(M::PeerId, Protocol), - Messages(Vec<(Protocol, Bytes)>), -} - -#[async_trait] -pub trait EventStream { - async fn next_event(&mut self) -> Option>; -} - -/// Abstraction over a network. -pub trait Network: Clone + Send + Sync + 'static { - type SenderError: std::error::Error; - type NetworkSender: NetworkSender; - type PeerId: PeerId; - type Multiaddress: Multiaddress; - type EventStream: EventStream; - - /// Returns a stream of events representing what happens on the network. - fn event_stream(&self) -> Self::EventStream; - - /// Returns a sender to the given peer using a given protocol. Returns Error if not connected to the peer. - fn sender( - &self, - peer_id: Self::PeerId, - protocol: Protocol, - ) -> Result; - - /// Add peers to one of the reserved sets. - fn add_reserved(&self, addresses: HashSet, protocol: Protocol); - - /// Remove peers from one of the reserved sets. - fn remove_reserved(&self, peers: HashSet, protocol: Protocol); -} - -/// Abstraction for requesting own network addresses and PeerId. +/// Abstraction for requesting own network addressing information. pub trait NetworkIdentity { type PeerId: PeerId; - type Multiaddress: Multiaddress; + type AddressingInformation: AddressingInformation; - /// The external identity of this node, consisting of addresses and the PeerId. - fn identity(&self) -> (Vec, Self::PeerId); + /// The external identity of this node. + fn identity(&self) -> Self::AddressingInformation; } /// Abstraction for requesting justifications for finalized blocks and stale blocks. @@ -160,35 +78,7 @@ pub trait RequestBlocks: Clone + Send + Sync + 'static { fn is_major_syncing(&self) -> bool; } -/// What do do with a specific piece of data. -/// Note that broadcast does not specify the protocol, as we only broadcast Generic messages in this sense. -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum DataCommand { - Broadcast, - SendTo(PID, Protocol), -} - -/// Commands for manipulating the reserved peers set. -#[derive(Debug, PartialEq, Eq)] -pub enum ConnectionCommand { - AddReserved(HashSet), - DelReserved(HashSet), -} - -/// Returned when something went wrong when sending data using a DataNetwork. -#[derive(Debug)] -pub enum SendError { - SendFailed, -} - -/// What the data sent using the network has to satisfy. +/// A basic alias for properties we expect basic data to satisfy. pub trait Data: Clone + Codec + Send + Sync + 'static {} impl Data for D {} - -/// A generic interface for sending and receiving data. -#[async_trait::async_trait] -pub trait DataNetwork: Send + Sync { - fn send(&self, data: D, recipient: Recipient) -> Result<(), SendError>; - async fn next(&mut self) -> Option; -} diff --git a/finality-aleph/src/network/service.rs b/finality-aleph/src/network/service.rs deleted file mode 100644 index ca7bf71e10..0000000000 --- a/finality-aleph/src/network/service.rs +++ /dev/null @@ -1,1388 +0,0 @@ -use std::{ - collections::{HashMap, HashSet}, - future::Future, - iter, -}; - -use aleph_primitives::AuthorityId; -use codec::{Decode, Encode}; -use futures::{channel::mpsc, StreamExt}; -use log::{debug, error, info, trace, warn}; -use sc_service::SpawnTaskHandle; -use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; -use tokio::time; - -use super::manager::DataInSession; -use crate::{ - network::{ - manager::{NetworkData, VersionedAuthentication}, - ConnectionCommand, Data, DataCommand, Event, EventStream, Multiaddress, Network, - NetworkSender, PeerId, Protocol, - }, - validator_network::Network as ValidatorNetwork, - STATUS_REPORT_INTERVAL, -}; - -type MessageFromUser = (NetworkData, DataCommand<::PeerId>); -/// A service managing all the direct interaction with the underlying network implementation. It -/// handles: -/// 1. Incoming network events -/// 1. Messages are forwarded to the user. -/// 2. Various forms of (dis)connecting, keeping track of all currently connected nodes. -/// 2. Commands from the network manager, modifying the reserved peer set. -/// 3. Outgoing messages, sending them out, using 1.2. to broadcast. -/// For the time of transition from old validator network (called legacy here) to new tcp validator network -/// we need to support both networks here. To do that we rename legacy network methods to have prefix `legacy_`. -/// We also support two connection managers one for each network. -pub struct Service< - N: Network, - D: Data, - LD: Data, - A: Data + Multiaddress, - VN: ValidatorNetwork>, -> { - network: N, - validator_network: VN, - messages_from_user: mpsc::UnboundedReceiver>, - messages_for_user: mpsc::UnboundedSender>, - commands_from_manager: mpsc::UnboundedReceiver>, - // In future these legacy senders and receiver will be removed - legacy_messages_from_user: mpsc::UnboundedReceiver<(LD, DataCommand)>, - legacy_messages_for_user: mpsc::UnboundedSender, - legacy_commands_from_manager: mpsc::UnboundedReceiver>, - legacy_generic_connected_peers: HashSet, - legacy_validator_connected_peers: HashSet, - authentication_connected_peers: HashSet, - // For now we need to use `Vec` here. - // This is needed for backward compatibility with old network. - // This can be changed back to `Data` once Legacy Network is removed. - // In future this will be changed to somethig like `AuthenticationData`. - legacy_generic_peer_senders: HashMap>>, - legacy_validator_peer_senders: HashMap>>, - authentication_peer_senders: HashMap>>, - spawn_handle: SpawnTaskHandle, -} - -/// Input/output channels for the network service. -pub struct IO { - pub messages_from_user: mpsc::UnboundedReceiver<(D, DataCommand)>, - pub messages_for_user: mpsc::UnboundedSender, - pub commands_from_manager: mpsc::UnboundedReceiver>, -} - -impl IO { - pub fn new( - messages_from_user: mpsc::UnboundedReceiver<(D, DataCommand)>, - messages_for_user: mpsc::UnboundedSender, - commands_from_manager: mpsc::UnboundedReceiver>, - ) -> IO { - IO { - messages_from_user, - messages_for_user, - commands_from_manager, - } - } -} - -#[derive(Debug)] -enum SendError { - MissingSender, - SendingFailed, -} - -#[derive(Debug)] -enum SendToUserError { - LegacySender, - LatestSender, -} - -impl< - N: Network, - D: Data, - LD: Data, - A: Data + Multiaddress, - VN: ValidatorNetwork>, - > Service -{ - pub fn new( - network: N, - validator_network: VN, - spawn_handle: SpawnTaskHandle, - io: IO, A>, - legacy_io: IO, - ) -> Service { - Service { - network, - validator_network, - messages_from_user: io.messages_from_user, - messages_for_user: io.messages_for_user, - commands_from_manager: io.commands_from_manager, - legacy_messages_from_user: legacy_io.messages_from_user, - legacy_messages_for_user: legacy_io.messages_for_user, - legacy_commands_from_manager: legacy_io.commands_from_manager, - spawn_handle, - legacy_generic_connected_peers: HashSet::new(), - legacy_validator_connected_peers: HashSet::new(), - authentication_connected_peers: HashSet::new(), - legacy_generic_peer_senders: HashMap::new(), - legacy_validator_peer_senders: HashMap::new(), - authentication_peer_senders: HashMap::new(), - } - } - - fn get_sender( - &mut self, - peer: &N::PeerId, - protocol: Protocol, - ) -> Option<&mut TracingUnboundedSender>> { - match protocol { - Protocol::Generic => self.legacy_generic_peer_senders.get_mut(peer), - Protocol::Validator => self.legacy_validator_peer_senders.get_mut(peer), - Protocol::Authentication => self.authentication_peer_senders.get_mut(peer), - } - } - - fn peer_sender( - &self, - peer_id: N::PeerId, - mut receiver: TracingUnboundedReceiver>, - protocol: Protocol, - ) -> impl Future + Send + 'static { - let network = self.network.clone(); - async move { - let mut sender = None; - loop { - if let Some(data) = receiver.next().await { - let s = if let Some(s) = sender.as_mut() { - s - } else { - match network.sender(peer_id.clone(), protocol) { - Ok(s) => sender.insert(s), - Err(e) => { - debug!(target: "aleph-network", "Failed creating sender. Dropping message: {}", e); - continue; - } - } - }; - if let Err(e) = s.send(data).await { - debug!(target: "aleph-network", "Failed sending data to peer. Dropping sender and message: {}", e); - sender = None; - } - } else { - debug!(target: "aleph-network", "Sender was dropped for peer {:?}. Peer sender exiting.", peer_id); - return; - } - } - } - } - - fn send_to_peer( - &mut self, - data: Vec, - peer: N::PeerId, - protocol: Protocol, - ) -> Result<(), SendError> { - match self.get_sender(&peer, protocol) { - Some(sender) => { - match sender.unbounded_send(data) { - Err(e) => { - // Receiver can also be dropped when thread cannot send to peer. In case receiver is dropped this entry will be removed by Event::NotificationStreamClosed - // No need to remove the entry here - if e.is_disconnected() { - trace!(target: "aleph-network", "Failed sending data to peer because peer_sender receiver is dropped: {:?}", peer); - } - Err(SendError::SendingFailed) - } - Ok(_) => Ok(()), - } - } - None => Err(SendError::MissingSender), - } - } - - fn broadcast(&mut self, data: Vec, protocol: Protocol) { - let peers = match protocol { - // Validator protocol will never broadcast. - Protocol::Validator => HashSet::new(), - Protocol::Generic => self.legacy_generic_connected_peers.clone(), - Protocol::Authentication => self.authentication_connected_peers.clone(), - }; - for peer in peers { - // We only broadcast authentication information in this sense, so we use the generic - // Protocol. - if let Err(e) = self.send_to_peer(data.clone(), peer.clone(), protocol) { - trace!(target: "aleph-network", "Failed to send broadcast to peer{:?}, {:?}", peer, e); - } - } - } - - fn handle_network_event( - &mut self, - event: Event, - ) -> Result<(), SendToUserError> { - use Event::*; - match event { - Connected(multiaddress) => { - trace!(target: "aleph-network", "Connected event from address {:?}", multiaddress); - self.network.add_reserved( - iter::once(multiaddress.clone()).collect(), - Protocol::Generic, - ); - self.network - .add_reserved(iter::once(multiaddress).collect(), Protocol::Authentication); - } - Disconnected(peer) => { - trace!(target: "aleph-network", "Disconnected event for peer {:?}", peer); - self.network - .remove_reserved(iter::once(peer.clone()).collect(), Protocol::Generic); - self.network - .remove_reserved(iter::once(peer).collect(), Protocol::Authentication); - } - StreamOpened(peer, protocol) => { - trace!(target: "aleph-network", "StreamOpened event for peer {:?} and the protocol {:?}.", peer, protocol); - let rx = match &protocol { - Protocol::Generic => { - let (tx, rx) = tracing_unbounded("mpsc_notification_stream_legacy_generic"); - self.legacy_generic_connected_peers.insert(peer.clone()); - self.legacy_generic_peer_senders.insert(peer.clone(), tx); - rx - } - Protocol::Validator => { - let (tx, rx) = - tracing_unbounded("mpsc_notification_stream_legacy_validator"); - self.legacy_validator_connected_peers.insert(peer.clone()); - self.legacy_validator_peer_senders.insert(peer.clone(), tx); - rx - } - Protocol::Authentication => { - let (tx, rx) = tracing_unbounded("mpsc_notification_stream_authentication"); - self.authentication_connected_peers.insert(peer.clone()); - self.authentication_peer_senders.insert(peer.clone(), tx); - rx - } - }; - self.spawn_handle.spawn( - "aleph/network/peer_sender", - None, - self.peer_sender(peer, rx, protocol), - ); - } - StreamClosed(peer, protocol) => { - trace!(target: "aleph-network", "StreamClosed event for peer {:?} and protocol {:?}", peer, protocol); - match protocol { - Protocol::Generic => { - self.legacy_generic_connected_peers.remove(&peer); - self.legacy_generic_peer_senders.remove(&peer); - } - Protocol::Validator => { - self.legacy_validator_connected_peers.remove(&peer); - self.legacy_validator_peer_senders.remove(&peer); - } - Protocol::Authentication => { - self.authentication_connected_peers.remove(&peer); - self.authentication_peer_senders.remove(&peer); - } - } - } - Messages(messages) => { - for (protocol, data) in messages.into_iter() { - match protocol { - Protocol::Generic => match LD::decode(&mut &data[..]) { - Ok(data) => self - .legacy_messages_for_user - .unbounded_send(data) - .map_err(|_| SendToUserError::LegacySender)?, - Err(e) => { - warn!(target: "aleph-network", "Error decoding legacy generic protocol message: {}", e) - } - }, - Protocol::Validator => match LD::decode(&mut &data[..]) { - Ok(data) => self - .legacy_messages_for_user - .unbounded_send(data) - .map_err(|_| SendToUserError::LegacySender)?, - Err(e) => { - warn!(target: "aleph-network", "Error decoding legacy validator protocol message: {}", e) - } - }, - Protocol::Authentication => { - match VersionedAuthentication::::decode(&mut &data[..]) - .map(|a| a.try_into()) - { - Ok(Ok(data)) => self - .messages_for_user - .unbounded_send(data) - .map_err(|_| SendToUserError::LatestSender)?, - Ok(Err(e)) => { - warn!(target: "aleph-network", "Error decoding authentication protocol message: {}", e) - } - Err(e) => { - warn!(target: "aleph-network", "Error decoding authentication protocol message: {}", e) - } - } - } - }; - } - } - } - Ok(()) - } - - fn handle_validator_network_data( - &mut self, - data: DataInSession, - ) -> Result<(), mpsc::TrySendError>> { - self.messages_for_user.unbounded_send(data.into()) - } - - fn on_manager_command(&mut self, command: ConnectionCommand) { - use ConnectionCommand::*; - match command { - AddReserved(addresses) => { - for multi in addresses { - if let Some(peer_id) = multi.get_peer_id() { - self.validator_network.add_connection(peer_id, vec![multi]); - } - } - } - DelReserved(peers) => { - for peer in peers { - self.validator_network.remove_connection(peer); - } - } - } - } - - /// This will be removed in the future - fn legacy_on_manager_command(&mut self, command: ConnectionCommand) { - use ConnectionCommand::*; - match command { - AddReserved(addresses) => { - self.network.add_reserved(addresses, Protocol::Validator); - } - DelReserved(peers) => self.network.remove_reserved(peers, Protocol::Validator), - } - } - - fn on_user_message(&mut self, data: NetworkData, command: DataCommand) { - use DataCommand::*; - - match data { - NetworkData::Meta(discovery_message) => { - let data: VersionedAuthentication = discovery_message.into(); - match command { - Broadcast => self.broadcast(data.encode(), Protocol::Authentication), - SendTo(_, _) => { - // We ignore this for now. Sending Meta messages to peer is an optimization done for the sake of tests. - } - } - } - NetworkData::Data(data, session_id) => { - match command { - Broadcast => { - // We ignore this for now. AlephBFT does not broadcast data. - } - SendTo(peer, _) => self - .validator_network - .send(DataInSession { data, session_id }, peer), - } - } - } - } - - /// This will be removed in the future - fn legacy_on_user_message(&mut self, data: LD, command: DataCommand) { - use DataCommand::*; - match command { - Broadcast => self.broadcast(data.encode(), Protocol::Generic), - SendTo(peer, protocol) => { - if let Err(e) = self.send_to_peer(data.encode(), peer.clone(), protocol) { - trace!(target: "aleph-network", "Failed to send data to peer{:?} via protocol {:?}, {:?}", peer, protocol, e); - } - } - } - } - - fn status_report(&self) { - let mut status = String::from("Network status report: "); - - status.push_str(&format!( - "authentication connected peers - {:?}; ", - self.authentication_connected_peers.len() - )); - - status.push_str(&format!( - "generic connected peers - {:?}; ", - self.legacy_generic_connected_peers.len() - )); - - let peer_ids = self - .legacy_validator_connected_peers - .iter() - .map(|peer_id| peer_id.to_short_string()) - .collect::>() - .join(", "); - status.push_str(&format!( - "validator connected peers - {:?} [{}]; ", - self.legacy_validator_connected_peers.len(), - peer_ids, - )); - - info!(target: "aleph-network", "{}", status); - } - - pub async fn run(mut self) { - let mut events_from_network = self.network.event_stream(); - - let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); - loop { - tokio::select! { - maybe_event = events_from_network.next_event() => match maybe_event { - Some(event) => if let Err(e) = self.handle_network_event(event) { - match e { - SendToUserError::LegacySender => error!(target: "aleph-network", "Cannot forward messages to user through legacy sender: {:?}", e), - SendToUserError::LatestSender => error!(target: "aleph-network", "Cannot forward messages to user: {:?}", e), - }; - return; - }, - None => { - error!(target: "aleph-network", "Network event stream ended."); - return; - } - }, - maybe_data = self.validator_network.next() => match maybe_data { - Some(data) => if let Err(e) = self.handle_validator_network_data(data) { - error!(target: "aleph-network", "Cannot forward messages to user: {:?}", e); - return; - }, - None => { - error!(target: "aleph-network", "Validator network event stream ended."); - } - }, - maybe_message = self.messages_from_user.next() => match maybe_message { - Some((data, command)) => self.on_user_message(data, command), - None => { - error!(target: "aleph-network", "User message stream ended."); - return; - } - }, - maybe_command = self.commands_from_manager.next() => match maybe_command { - Some(command) => self.on_manager_command(command), - None => { - error!(target: "aleph-network", "Manager command stream ended."); - return; - } - }, - maybe_message = self.legacy_messages_from_user.next() => match maybe_message { - Some((data, command)) => self.legacy_on_user_message(data, command), - None => { - error!(target: "aleph-network", "Legacy user message stream ended."); - return; - } - }, - maybe_command = self.legacy_commands_from_manager.next() => match maybe_command { - Some(command) => self.legacy_on_manager_command(command), - None => { - error!(target: "aleph-network", "Legacy manager command stream ended."); - return; - } - }, - _ = status_ticker.tick() => { - self.status_report(); - }, - } - } - } -} - -#[cfg(test)] -mod tests { - use std::{collections::HashSet, iter, iter::FromIterator}; - - use codec::Encode; - use futures::{channel::oneshot, StreamExt}; - use sc_service::TaskManager; - use tokio::{runtime::Handle, task::JoinHandle}; - - use super::{ConnectionCommand, DataCommand, Service}; - use crate::{ - network::{ - manager::DataInSession, - mock::{ - MockData, MockEvent, MockIO, MockMultiaddress as LegacyMockMultiaddress, - MockNetwork, MockNetworkIdentity, MockPeerId, MockSenderError, - }, - testing::NetworkData, - NetworkIdentity, Protocol, - }, - session::SessionId, - testing::mocks::validator_network::{ - MockMultiaddress, MockNetwork as MockValidatorNetwork, - }, - }; - - pub struct TestData { - pub service_handle: JoinHandle<()>, - pub exit_tx: oneshot::Sender<()>, - pub network: MockNetwork, - pub validator_network: MockValidatorNetwork>, - pub mock_io: MockIO, - // `TaskManager` can't be dropped for `SpawnTaskHandle` to work - _task_manager: TaskManager, - } - - impl TestData { - async fn prepare() -> Self { - let task_manager = TaskManager::new(Handle::current(), None).unwrap(); - - // Prepare communication with service - let (mock_io, io, legacy_io) = MockIO::new(); - // Prepare service - let (event_stream_oneshot_tx, event_stream_oneshot_rx) = oneshot::channel(); - let network = MockNetwork::new(event_stream_oneshot_tx); - let validator_network = MockValidatorNetwork::new("addr").await; - let service = Service::new( - network.clone(), - validator_network.clone(), - task_manager.spawn_handle(), - io, - legacy_io, - ); - let (exit_tx, exit_rx) = oneshot::channel(); - let task_handle = async move { - tokio::select! { - _ = service.run() => { }, - _ = exit_rx => { }, - }; - }; - let service_handle = tokio::spawn(task_handle); - // wait till service takes the event_stream - event_stream_oneshot_rx.await.unwrap(); - - // `TaskManager` needs to be passed. - Self { - service_handle, - exit_tx, - network, - validator_network, - mock_io, - _task_manager: task_manager, - } - } - - async fn cleanup(self) { - self.exit_tx.send(()).unwrap(); - self.service_handle.await.unwrap(); - self.network.close_channels().await; - } - - // We do this only to make sure that NotificationStreamOpened/NotificationStreamClosed events are handled - async fn wait_for_events_handled(&mut self) { - let address = LegacyMockMultiaddress::random_with_id(MockPeerId::random()); - self.network - .emit_event(MockEvent::Connected(address.clone())); - assert_eq!( - self.network - .add_reserved - .next() - .await - .expect("Should receive message"), - (iter::once(address).collect(), Protocol::Generic,) - ); - } - } - - fn message(i: u8) -> NetworkData { - NetworkData::Data(vec![i, i + 1, i + 2], SessionId(1)) - } - - #[tokio::test] - async fn test_sync_connected() { - let mut test_data = TestData::prepare().await; - - let address = LegacyMockMultiaddress::random_with_id(MockPeerId::random()); - test_data - .network - .emit_event(MockEvent::Connected(address.clone())); - - let expected = (iter::once(address).collect(), Protocol::Generic); - - assert_eq!( - test_data - .network - .add_reserved - .next() - .await - .expect("Should receive message"), - expected - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_sync_disconnected() { - let mut test_data = TestData::prepare().await; - - let peer_id = MockPeerId::random(); - - test_data - .network - .emit_event(MockEvent::Disconnected(peer_id)); - - let expected = (iter::once(peer_id).collect(), Protocol::Generic); - - assert_eq!( - test_data - .network - .remove_reserved - .next() - .await - .expect("Should receive message"), - expected - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_notification_stream_opened() { - let mut test_data = TestData::prepare().await; - - let peer_ids: Vec<_> = (0..3).map(|_| MockPeerId::random()).collect(); - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Generic)); - }); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - let message = message(1); - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send((message.clone(), DataCommand::Broadcast)) - .unwrap(); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(peer_ids.len()) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = HashSet::from_iter( - peer_ids - .into_iter() - .map(|peer_id| (message.encode(), peer_id, Protocol::Generic)), - ); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_notification_stream_closed() { - let mut test_data = TestData::prepare().await; - - let peer_ids: Vec<_> = (0..4).map(|_| MockPeerId::random()).collect(); - let opened_authorities_n = 2; - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Generic)); - }); - - peer_ids - .iter() - .skip(opened_authorities_n) - .for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamClosed(*peer_id, Protocol::Generic)); - }); - - // We do this only to make sure that NotificationStreamClosed events are handled - test_data.wait_for_events_handled().await; - - let messages: Vec<_> = vec![message(1), message(2)]; - messages.iter().for_each(|m| { - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send((m.clone(), DataCommand::Broadcast)) - .unwrap(); - }); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(opened_authorities_n * messages.len()) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = - HashSet::from_iter(peer_ids.into_iter().take(opened_authorities_n).flat_map( - |peer_id| { - messages - .iter() - .map(move |m| (m.encode(), peer_id, Protocol::Generic)) - }, - )); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_validator_data_command_send_to() { - let mut test_data = TestData::prepare().await; - - let peer_id = MockPeerId::random(); - - let message = message(1); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Validator)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - )) - .unwrap(); - - let expected = (message.encode(), peer_id, Protocol::Validator); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_validator_create_sender_error_one_peer() { - let mut test_data = TestData::prepare().await; - - test_data - .network - .create_sender_errors - .lock() - .push_back(MockSenderError::SomeError); - - let peer_id = MockPeerId::random(); - - let message_1 = message(1); - let message_2 = message(2); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Validator)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_1.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - )) - .unwrap(); - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_2.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - )) - .unwrap(); - - let expected = (message_2.encode(), peer_id, Protocol::Validator); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_validator_create_sender_error_many_peers() { - let mut test_data = TestData::prepare().await; - - let all_authorities_n = 4; - let closed_authorities_n = 2; - for _ in 0..closed_authorities_n { - test_data - .network - .create_sender_errors - .lock() - .push_back(MockSenderError::SomeError); - } - - let peer_ids: Vec<_> = (0..4).map(|_| MockPeerId::random()).collect(); - let message = message(1); - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Validator)); - }); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - peer_ids.iter().for_each(|peer_id| { - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(*peer_id, Protocol::Validator), - )) - .unwrap(); - }); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(all_authorities_n - closed_authorities_n) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = HashSet::from_iter( - peer_ids - .into_iter() - .skip(closed_authorities_n) - .map(|peer_id| (message.encode(), peer_id, Protocol::Validator)), - ); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_validator_data_command_send_to_error_one_peer() { - let mut test_data = TestData::prepare().await; - - test_data - .network - .send_errors - .lock() - .push_back(MockSenderError::SomeError); - - let peer_id = MockPeerId::random(); - - let message_1 = message(1); - let message_2 = message(2); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Validator)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_1.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - )) - .unwrap(); - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_2.clone(), - DataCommand::SendTo(peer_id, Protocol::Validator), - )) - .unwrap(); - - let expected = (message_2.encode(), peer_id, Protocol::Validator); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_validator_data_command_send_to_error_many_peers() { - let mut test_data = TestData::prepare().await; - - let all_authorities_n = 4; - let closed_authorities_n = 2; - for _ in 0..closed_authorities_n { - test_data - .network - .send_errors - .lock() - .push_back(MockSenderError::SomeError); - } - - let peer_ids: Vec<_> = (0..4).map(|_| MockPeerId::random()).collect(); - let message = message(1); - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Validator)); - }); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - peer_ids.iter().for_each(|peer_id| { - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(*peer_id, Protocol::Validator), - )) - .unwrap(); - }); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(all_authorities_n - closed_authorities_n) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = HashSet::from_iter( - peer_ids - .into_iter() - .skip(closed_authorities_n) - .map(|peer_id| (message.encode(), peer_id, Protocol::Validator)), - ); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_generic_data_command_send_to() { - let mut test_data = TestData::prepare().await; - - let peer_id = MockPeerId::random(); - - let message = message(1); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Generic)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(peer_id, Protocol::Generic), - )) - .unwrap(); - - let expected = (message.encode(), peer_id, Protocol::Generic); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_generic_create_sender_error_one_peer() { - let mut test_data = TestData::prepare().await; - - test_data - .network - .create_sender_errors - .lock() - .push_back(MockSenderError::SomeError); - - let peer_id = MockPeerId::random(); - - let message_1 = message(1); - let message_2 = message(2); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Generic)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_1.clone(), - DataCommand::SendTo(peer_id, Protocol::Generic), - )) - .unwrap(); - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_2.clone(), - DataCommand::SendTo(peer_id, Protocol::Generic), - )) - .unwrap(); - - let expected = (message_2.encode(), peer_id, Protocol::Generic); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_generic_create_sender_error_many_peers() { - let mut test_data = TestData::prepare().await; - - let all_authorities_n = 4; - let closed_authorities_n = 2; - for _ in 0..closed_authorities_n { - test_data - .network - .create_sender_errors - .lock() - .push_back(MockSenderError::SomeError); - } - - let peer_ids: Vec<_> = (0..4).map(|_| MockPeerId::random()).collect(); - let message = message(1); - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Generic)); - }); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - peer_ids.iter().for_each(|peer_id| { - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(*peer_id, Protocol::Generic), - )) - .unwrap(); - }); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(all_authorities_n - closed_authorities_n) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = HashSet::from_iter( - peer_ids - .into_iter() - .skip(closed_authorities_n) - .map(|peer_id| (message.encode(), peer_id, Protocol::Generic)), - ); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_generic_data_command_send_to_error_one_peer() { - let mut test_data = TestData::prepare().await; - - test_data - .network - .send_errors - .lock() - .push_back(MockSenderError::SomeError); - - let peer_id = MockPeerId::random(); - - let message_1 = message(1); - let message_2 = message(2); - - test_data - .network - .emit_event(MockEvent::StreamOpened(peer_id, Protocol::Generic)); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_1.clone(), - DataCommand::SendTo(peer_id, Protocol::Generic), - )) - .unwrap(); - - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message_2.clone(), - DataCommand::SendTo(peer_id, Protocol::Generic), - )) - .unwrap(); - - let expected = (message_2.encode(), peer_id, Protocol::Generic); - - assert_eq!( - test_data - .network - .send_message - .next() - .await - .expect("Should receive message"), - expected, - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_generic_data_command_send_to_error_many_peers() { - let mut test_data = TestData::prepare().await; - - let all_authorities_n = 4; - let closed_authorities_n = 2; - for _ in 0..closed_authorities_n { - test_data - .network - .send_errors - .lock() - .push_back(MockSenderError::SomeError); - } - - let peer_ids: Vec<_> = (0..4).map(|_| MockPeerId::random()).collect(); - let message = message(1); - - peer_ids.iter().for_each(|peer_id| { - test_data - .network - .emit_event(MockEvent::StreamOpened(*peer_id, Protocol::Generic)); - }); - - // We do this only to make sure that NotificationStreamOpened events are handled - test_data.wait_for_events_handled().await; - - peer_ids.iter().for_each(|peer_id| { - test_data - .mock_io - .legacy_messages_for_user - .unbounded_send(( - message.clone(), - DataCommand::SendTo(*peer_id, Protocol::Generic), - )) - .unwrap(); - }); - - let broadcasted_messages = HashSet::<_>::from_iter( - test_data - .network - .send_message - .1 - .lock() - .await - .by_ref() - .take(all_authorities_n - closed_authorities_n) - .collect::>() - .await - .into_iter(), - ); - - let expected_messages = HashSet::from_iter( - peer_ids - .into_iter() - .skip(closed_authorities_n) - .map(|peer_id| (message.encode(), peer_id, Protocol::Generic)), - ); - - assert_eq!(broadcasted_messages, expected_messages); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_notification_received() { - let mut test_data = TestData::prepare().await; - - let message = message(1); - - test_data.network.emit_event(MockEvent::Messages(vec![( - Protocol::Validator, - NetworkData::encode(&message).into(), - )])); - - assert_eq!( - test_data - .mock_io - .legacy_messages_from_user - .next() - .await - .expect("Should receive message"), - message - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_command_add_reserved() { - let mut test_data = TestData::prepare().await; - - let (addresses, _) = MockNetworkIdentity::new().identity(); - - test_data - .mock_io - .legacy_commands_for_manager - .unbounded_send(ConnectionCommand::AddReserved( - addresses.clone().into_iter().collect(), - )) - .unwrap(); - - let expected = (addresses.into_iter().collect(), Protocol::Validator); - - assert_eq!( - test_data - .network - .add_reserved - .next() - .await - .expect("Should receive message"), - expected - ); - - test_data.cleanup().await - } - - #[tokio::test] - async fn test_command_remove_reserved() { - let mut test_data = TestData::prepare().await; - - let peer_id = MockPeerId::random(); - - test_data - .mock_io - .legacy_commands_for_manager - .unbounded_send(ConnectionCommand::DelReserved( - iter::once(peer_id).collect(), - )) - .unwrap(); - - let expected = (iter::once(peer_id).collect(), Protocol::Validator); - - assert_eq!( - test_data - .network - .remove_reserved - .next() - .await - .expect("Should receive message"), - expected - ); - - test_data.cleanup().await - } -} diff --git a/finality-aleph/src/network/session.rs b/finality-aleph/src/network/session.rs deleted file mode 100644 index 5d7fedb648..0000000000 --- a/finality-aleph/src/network/session.rs +++ /dev/null @@ -1,199 +0,0 @@ -use futures::channel::{mpsc, oneshot}; - -use super::SimpleNetwork; -use crate::{ - abft::Recipient, - crypto::{AuthorityPen, AuthorityVerifier}, - network::{Data, ReceiverComponent, SendError, SenderComponent, SessionCommand}, - NodeIndex, SessionId, -}; - -/// Sends data within a single session. -#[derive(Clone)] -pub struct Sender { - session_id: SessionId, - messages_for_network: mpsc::UnboundedSender<(D, SessionId, Recipient)>, - legacy_messages_for_network: mpsc::UnboundedSender<(D, SessionId, Recipient)>, -} - -impl SenderComponent for Sender { - fn send(&self, data: D, recipient: Recipient) -> Result<(), SendError> { - self.messages_for_network - .unbounded_send((data.clone(), self.session_id, recipient.clone())) - .map_err(|_| SendError::SendFailed)?; - self.legacy_messages_for_network - .unbounded_send((data, self.session_id, recipient)) - .map_err(|_| SendError::SendFailed) - } -} - -pub struct Receiver { - data_from_network: mpsc::UnboundedReceiver, - legacy_data_from_network: mpsc::UnboundedReceiver, -} - -#[async_trait::async_trait] -impl ReceiverComponent for Receiver { - async fn next(&mut self) -> Option { - tokio::select! { - maybe_next = self.data_from_network.next() => maybe_next, - maybe_next = self.legacy_data_from_network.next() => maybe_next, - } - } -} - -/// Sends and receives data within a single session. -type Network = SimpleNetwork, Sender>; - -/// Manages sessions for which the network should be active. -pub struct Manager { - commands_for_service: mpsc::UnboundedSender>, - messages_for_service: mpsc::UnboundedSender<(D, SessionId, Recipient)>, - legacy_commands_for_service: mpsc::UnboundedSender>, - legacy_messages_for_service: mpsc::UnboundedSender<(D, SessionId, Recipient)>, -} - -/// What went wrong during a session management operation. -#[derive(Debug)] -pub enum ManagerError { - CommandSendFailed, - NetworkReceiveFailed, -} - -pub struct IO { - pub commands_for_service: mpsc::UnboundedSender>, - pub messages_for_service: mpsc::UnboundedSender<(D, SessionId, Recipient)>, -} - -impl IO { - pub fn new( - commands_for_service: mpsc::UnboundedSender>, - messages_for_service: mpsc::UnboundedSender<(D, SessionId, Recipient)>, - ) -> Self { - IO { - commands_for_service, - messages_for_service, - } - } -} - -impl Manager { - /// Create a new manager with the given channels to the service. - pub fn new(io: IO, legacy_io: IO) -> Self { - Manager { - commands_for_service: io.commands_for_service, - messages_for_service: io.messages_for_service, - legacy_commands_for_service: legacy_io.commands_for_service, - legacy_messages_for_service: legacy_io.messages_for_service, - } - } - - /// Start participating or update the verifier in the given session where you are not a - /// validator. - pub fn start_nonvalidator_session( - &self, - session_id: SessionId, - verifier: AuthorityVerifier, - ) -> Result<(), ManagerError> { - self.commands_for_service - .unbounded_send(SessionCommand::StartNonvalidator( - session_id, - verifier.clone(), - )) - .map_err(|_| ManagerError::CommandSendFailed)?; - self.legacy_commands_for_service - .unbounded_send(SessionCommand::StartNonvalidator(session_id, verifier)) - .map_err(|_| ManagerError::CommandSendFailed) - } - - /// Start participating or update the information about the given session where you are a - /// validator. Returns a session network to be used for sending and receiving data within the - /// session. - pub async fn start_validator_session( - &self, - session_id: SessionId, - verifier: AuthorityVerifier, - node_id: NodeIndex, - pen: AuthorityPen, - ) -> Result, ManagerError> { - let (result_for_us, result_from_service) = oneshot::channel(); - self.commands_for_service - .unbounded_send(SessionCommand::StartValidator( - session_id, - verifier.clone(), - node_id, - pen.clone(), - Some(result_for_us), - )) - .map_err(|_| ManagerError::CommandSendFailed)?; - - let (legacy_result_for_us, legacy_result_from_service) = oneshot::channel(); - self.legacy_commands_for_service - .unbounded_send(SessionCommand::StartValidator( - session_id, - verifier, - node_id, - pen, - Some(legacy_result_for_us), - )) - .map_err(|_| ManagerError::CommandSendFailed)?; - - let data_from_network = result_from_service - .await - .map_err(|_| ManagerError::NetworkReceiveFailed)?; - let messages_for_network = self.messages_for_service.clone(); - - let legacy_data_from_network = legacy_result_from_service - .await - .map_err(|_| ManagerError::NetworkReceiveFailed)?; - let legacy_messages_for_network = self.legacy_messages_for_service.clone(); - - Ok(Network::new( - Receiver { - data_from_network, - legacy_data_from_network, - }, - Sender { - session_id, - messages_for_network, - legacy_messages_for_network, - }, - )) - } - - /// Start participating or update the information about the given session where you are a - /// validator. Used for early starts when you don't yet need the returned network, but would - /// like to start discovery. - pub fn early_start_validator_session( - &self, - session_id: SessionId, - verifier: AuthorityVerifier, - node_id: NodeIndex, - pen: AuthorityPen, - ) -> Result<(), ManagerError> { - self.commands_for_service - .unbounded_send(SessionCommand::StartValidator( - session_id, - verifier.clone(), - node_id, - pen.clone(), - None, - )) - .map_err(|_| ManagerError::CommandSendFailed)?; - self.legacy_commands_for_service - .unbounded_send(SessionCommand::StartValidator( - session_id, verifier, node_id, pen, None, - )) - .map_err(|_| ManagerError::CommandSendFailed) - } - - /// Stop participating in the given session. - pub fn stop_session(&self, session_id: SessionId) -> Result<(), ManagerError> { - self.commands_for_service - .unbounded_send(SessionCommand::Stop(session_id)) - .map_err(|_| ManagerError::CommandSendFailed)?; - self.legacy_commands_for_service - .unbounded_send(SessionCommand::Stop(session_id)) - .map_err(|_| ManagerError::CommandSendFailed) - } -} diff --git a/finality-aleph/src/network/session/compatibility.rs b/finality-aleph/src/network/session/compatibility.rs new file mode 100644 index 0000000000..ec301a191a --- /dev/null +++ b/finality-aleph/src/network/session/compatibility.rs @@ -0,0 +1,295 @@ +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + mem::size_of, +}; + +use codec::{Decode, Encode, Error as CodecError, Input as CodecInput}; +use log::warn; + +use crate::{ + network::{session::Authentication, AddressingInformation}, + SessionId, Version, +}; + +type ByteCount = u16; + +// We allow sending authentications of size up to 16KiB, that should be enough. +const MAX_AUTHENTICATION_SIZE: u16 = 16 * 1024; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum VersionedAuthentication { + // Most likely from the future. + Other(Version, Vec), + V2(Authentication), +} + +impl From> for Vec> { + fn from(authentication: Authentication) -> Self { + vec![VersionedAuthentication::V2(authentication)] + } +} + +pub type DiscoveryMessage = Authentication; + +impl DiscoveryMessage { + /// Session ID associated with this message. + pub fn session_id(&self) -> SessionId { + self.0.session() + } +} + +impl TryInto> for VersionedAuthentication { + type Error = Error; + + fn try_into(self) -> Result, Self::Error> { + use VersionedAuthentication::*; + match self { + V2(authentication) => Ok(authentication), + Other(v, _) => Err(Error::UnknownVersion(v)), + } + } +} + +fn encode_with_version(version: Version, payload: &[u8]) -> Vec { + // If size is bigger then u16 we set it to MAX_AUTHENTICATION_SIZE. + // This should never happen but in case it does we will not panic. + // Also for other users if they have this version of protocol, authentication + // will be decoded. If they do not know the protocol, authentication will result + // in decoding error. + // We do not have a guarantee that size_hint is implemented for DiscoveryMessage, so we need + // to compute actual size to place it in the encoded data. + let size = payload + .len() + .try_into() + .unwrap_or(MAX_AUTHENTICATION_SIZE + 1); + if size > MAX_AUTHENTICATION_SIZE { + warn!( + "Versioned Authentication v{:?} too big during Encode. Size is {:?}. Should be {:?} at max.", + version, + payload.len(), + MAX_AUTHENTICATION_SIZE + ); + } + + let mut result = Vec::with_capacity(version.size_hint() + size.size_hint() + payload.len()); + + version.encode_to(&mut result); + size.encode_to(&mut result); + result.extend_from_slice(payload); + + result +} + +impl Encode for VersionedAuthentication { + fn size_hint(&self) -> usize { + use VersionedAuthentication::*; + let version_size = size_of::(); + let byte_count_size = size_of::(); + version_size + + byte_count_size + + match self { + Other(_, payload) => payload.len(), + V2(data) => data.size_hint(), + } + } + + fn encode(&self) -> Vec { + use VersionedAuthentication::*; + match self { + Other(version, payload) => encode_with_version(*version, payload), + V2(data) => encode_with_version(Version(2), &data.encode()), + } + } +} + +impl Decode for VersionedAuthentication { + fn decode(input: &mut I) -> Result { + use VersionedAuthentication::*; + let version = Version::decode(input)?; + let num_bytes = ByteCount::decode(input)?; + match version { + Version(2) => Ok(V2(Authentication::decode(input)?)), + _ => { + if num_bytes > MAX_AUTHENTICATION_SIZE { + Err("Authentication has unknown version and is encoded as more than 16KiB.")?; + }; + let mut payload = vec![0; num_bytes.into()]; + input.read(payload.as_mut_slice())?; + Ok(Other(version, payload)) + } + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Error { + UnknownVersion(Version), +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use Error::*; + match self { + UnknownVersion(version) => { + write!(f, "Authentication has unknown version {}", version.0) + } + } + } +} + +#[cfg(test)] +mod test { + use std::sync::Arc; + + use codec::{Decode, Encode}; + use sp_keystore::testing::KeyStore; + + use super::VersionedAuthentication; + use crate::{ + crypto::AuthorityVerifier, + network::{ + clique::mock::MockAddressingInformation, + session::{compatibility::MAX_AUTHENTICATION_SIZE, SessionHandler}, + tcp::{testing::new_identity, SignedTcpAddressingInformation}, + NetworkIdentity, + }, + nodes::testing::new_pen, + NodeIndex, SessionId, Version, + }; + + /// Session Handler used for generating versioned authentication in `raw_authentication_v1` + async fn handler() -> SessionHandler { + let mnemonic = "ring cool spatial rookie need wing opinion pond fork garbage more april"; + let external_addresses = vec![ + String::from("addr1"), + String::from("addr2"), + String::from("addr3"), + ]; + + let keystore = Arc::new(KeyStore::new()); + let pen = new_pen(mnemonic, keystore).await; + let identity = new_identity(external_addresses, &pen).await; + + SessionHandler::new( + Some((NodeIndex(21), pen)), + AuthorityVerifier::new(vec![]), + SessionId(37), + identity.identity(), + ) + .await + } + + fn authentication_v2( + handler: SessionHandler, + ) -> VersionedAuthentication { + VersionedAuthentication::V2( + handler + .authentication() + .expect("should have authentication"), + ) + } + + /// Versioned authentication for authority with: + /// external_addresses: [String::from("addr1"), String::from("addr2"), String::from("addr3")] + /// derived from mnemonic "ring cool spatial rookie need wing opinion pond fork garbage more april" + /// for node index 21 and session id 37 + /// encoded at version of Aleph Node after 8.0 + fn raw_authentication_v2() -> Vec { + //TODO: this will fail, check what it should be + vec![ + 2, 0, 191, 0, 50, 40, 192, 239, 72, 72, 119, 156, 76, 37, 212, 220, 76, 165, 39, 73, + 20, 89, 77, 66, 171, 174, 61, 31, 254, 137, 186, 1, 7, 141, 187, 219, 20, 97, 100, 100, + 114, 49, 8, 20, 97, 100, 100, 114, 50, 20, 97, 100, 100, 114, 51, 193, 134, 174, 215, + 223, 67, 113, 105, 253, 217, 120, 59, 47, 176, 146, 72, 205, 114, 242, 242, 115, 214, + 97, 112, 69, 56, 119, 168, 164, 170, 74, 7, 97, 149, 53, 122, 42, 209, 198, 146, 6, + 169, 37, 242, 131, 152, 209, 10, 52, 78, 218, 52, 69, 81, 235, 254, 58, 44, 134, 201, + 119, 132, 5, 8, 21, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 230, 134, 124, 175, 213, 131, 76, + 99, 89, 247, 169, 129, 87, 134, 249, 172, 99, 77, 203, 254, 12, 171, 178, 163, 47, 145, + 104, 166, 75, 174, 164, 119, 197, 78, 101, 221, 52, 51, 116, 221, 67, 45, 196, 65, 61, + 5, 246, 111, 56, 215, 145, 48, 170, 241, 60, 68, 231, 187, 72, 201, 18, 82, 249, 11, + ] + } + + #[tokio::test] + async fn correcly_encodes_v2_to_bytes() { + let handler = handler().await; + let raw = raw_authentication_v2(); + let authentication_v2 = authentication_v2(handler); + + assert_eq!(authentication_v2.encode(), raw); + } + + #[tokio::test] + async fn correcly_decodes_v2_from_bytes() { + let handler = handler().await; + let raw = raw_authentication_v2(); + let authentication_v2 = authentication_v2(handler); + + let decoded = VersionedAuthentication::decode(&mut raw.as_slice()); + + assert_eq!(decoded, Ok(authentication_v2)); + } + + #[tokio::test] + async fn correctly_decodes_v2_roundtrip() { + let handler = handler().await; + let authentication_v2 = authentication_v2(handler); + + let encoded = authentication_v2.encode(); + let decoded = VersionedAuthentication::decode(&mut encoded.as_slice()); + + assert_eq!(decoded, Ok(authentication_v2)) + } + + #[tokio::test] + async fn correctly_decodes_other() { + let other = + VersionedAuthentication::::Other(Version(42), vec![21, 37]); + let encoded = other.encode(); + let decoded = VersionedAuthentication::decode(&mut encoded.as_slice()); + assert_eq!(decoded, Ok(other)); + + let mut other_big = 42u16.encode(); + other_big.append(&mut (MAX_AUTHENTICATION_SIZE).encode()); + other_big.append(&mut vec![0u8; (MAX_AUTHENTICATION_SIZE).into()]); + let decoded = + VersionedAuthentication::::decode(&mut other_big.as_slice()); + assert_eq!( + decoded, + Ok(VersionedAuthentication::::Other( + Version(42), + other_big[4..].to_vec() + )) + ); + } + + #[tokio::test] + async fn returns_error_other_too_big() { + let mut other = 42u16.encode(); + let size = MAX_AUTHENTICATION_SIZE + 1; + other.append(&mut size.encode()); + other.append(&mut vec![0u8; size.into()]); + let decoded = + VersionedAuthentication::::decode(&mut other.as_slice()); + assert!(decoded.is_err()); + + let other = VersionedAuthentication::::Other( + Version(42), + vec![0u8; size.into()], + ); + let encoded = other.encode(); + let decoded = + VersionedAuthentication::::decode(&mut encoded.as_slice()); + assert!(decoded.is_err()); + } + + #[tokio::test] + async fn returns_error_other_wrong_size() { + let mut other = 42u16.encode(); + other.append(&mut MAX_AUTHENTICATION_SIZE.encode()); + other.append(&mut vec![21, 37]); + let decoded = + VersionedAuthentication::::decode(&mut other.as_slice()); + assert!(decoded.is_err()); + } +} diff --git a/finality-aleph/src/network/manager/connections.rs b/finality-aleph/src/network/session/connections.rs similarity index 94% rename from finality-aleph/src/network/manager/connections.rs rename to finality-aleph/src/network/session/connections.rs index 0982acede3..4db59a51b7 100644 --- a/finality-aleph/src/network/manager/connections.rs +++ b/finality-aleph/src/network/session/connections.rs @@ -56,10 +56,13 @@ mod tests { use std::collections::HashSet; use super::Connections; - use crate::{network::mock::MockPeerId, SessionId}; + use crate::{ + network::clique::mock::{random_keys, MockPublicKey}, + SessionId, + }; - fn random_peer_ids(num: usize) -> HashSet { - (0..num).map(|_| MockPeerId::random()).collect() + fn random_peer_ids(num: usize) -> HashSet { + random_keys(num).into_keys().collect() } #[test] diff --git a/finality-aleph/src/network/session/data.rs b/finality-aleph/src/network/session/data.rs new file mode 100644 index 0000000000..db7cf5f672 --- /dev/null +++ b/finality-aleph/src/network/session/data.rs @@ -0,0 +1,34 @@ +use codec::{Decode, Encode, Error, Input, Output}; + +use crate::{network::Data, SessionId}; + +/// Data inside session, sent to validator network. +/// Wrapper for data send over network. We need it to ensure compatibility. +/// The order of the data and session_id is fixed in encode and the decode expects it to be data, session_id. +/// Since data is versioned, i.e. it's encoding starts with a version number in the standardized way, +/// this will allow us to retrofit versioning here if we ever need to change this structure. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct DataInSession { + pub data: D, + pub session_id: SessionId, +} + +impl Decode for DataInSession { + fn decode(input: &mut I) -> Result { + let data = D::decode(input)?; + let session_id = SessionId::decode(input)?; + + Ok(Self { data, session_id }) + } +} + +impl Encode for DataInSession { + fn size_hint(&self) -> usize { + self.data.size_hint() + self.session_id.size_hint() + } + + fn encode_to(&self, dest: &mut T) { + self.data.encode_to(dest); + self.session_id.encode_to(dest); + } +} diff --git a/finality-aleph/src/network/session/discovery.rs b/finality-aleph/src/network/session/discovery.rs new file mode 100644 index 0000000000..752279e88b --- /dev/null +++ b/finality-aleph/src/network/session/discovery.rs @@ -0,0 +1,214 @@ +use std::{ + collections::HashMap, + marker::PhantomData, + time::{Duration, Instant}, +}; + +use log::{debug, info, trace}; + +use crate::{ + network::{ + session::{Authentication, SessionHandler}, + AddressingInformation, + }, + NodeIndex, +}; + +/// Handles creating and rebroadcasting discovery messages. +pub struct Discovery { + cooldown: Duration, + last_broadcast: HashMap, + _phantom: PhantomData, +} + +impl Discovery { + /// Create a new discovery handler with the given response/broadcast cooldown. + pub fn new(cooldown: Duration) -> Self { + Discovery { + cooldown, + last_broadcast: HashMap::new(), + _phantom: PhantomData, + } + } + + /// Returns a message that should be sent as part of authority discovery at this moment. + pub fn discover_authorities( + &mut self, + handler: &SessionHandler, + ) -> Option> { + let authentication = match handler.authentication() { + Some(authentication) => authentication, + None => return None, + }; + + let missing_authorities = handler.missing_nodes(); + let node_count = handler.node_count(); + info!(target: "aleph-network", "{}/{} authorities known for session {}.", node_count.0-missing_authorities.len(), node_count.0, handler.session_id().0); + Some(authentication) + } + + fn should_rebroadcast(&self, node_id: &NodeIndex) -> bool { + match self.last_broadcast.get(node_id) { + Some(instant) => Instant::now() > *instant + self.cooldown, + None => true, + } + } + + /// Processes the provided authentication and returns any new address we should + /// be connected to if we want to stay connected to the committee and an optional + /// message that we should send as a result of it. + pub fn handle_authentication( + &mut self, + authentication: Authentication, + handler: &mut SessionHandler, + ) -> (Option, Option>) { + debug!(target: "aleph-network", "Handling broadcast with authentication {:?}.", authentication); + let address = match handler.handle_authentication(authentication.clone()) { + Some(address) => Some(address), + None => return (None, None), + }; + let node_id = authentication.0.creator(); + if !self.should_rebroadcast(&node_id) { + return (address, None); + } + trace!(target: "aleph-network", "Rebroadcasting {:?}.", authentication); + self.last_broadcast.insert(node_id, Instant::now()); + (address, Some(authentication)) + } +} + +#[cfg(test)] +mod tests { + use std::{thread::sleep, time::Duration}; + + use super::Discovery; + use crate::{ + network::{ + clique::mock::{random_address, MockAddressingInformation}, + mock::crypto_basics, + session::{authentication, Authentication, SessionHandler}, + }, + SessionId, + }; + + const NUM_NODES: u8 = 7; + const MS_COOLDOWN: u64 = 200; + + fn addresses() -> Vec { + (0..NUM_NODES).map(|_| random_address()).collect() + } + + async fn build_number( + num_nodes: u8, + ) -> ( + Discovery, + Vec>, + SessionHandler, + ) { + let crypto_basics = crypto_basics(num_nodes.into()).await; + let mut handlers = Vec::new(); + for (authority_index_and_pen, address) in crypto_basics.0.into_iter().zip(addresses()) { + handlers.push( + SessionHandler::new( + Some(authority_index_and_pen), + crypto_basics.1.clone(), + SessionId(43), + address, + ) + .await, + ); + } + let non_validator = SessionHandler::new( + None, + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + ( + Discovery::new(Duration::from_millis(MS_COOLDOWN)), + handlers, + non_validator, + ) + } + + async fn build() -> ( + Discovery, + Vec>, + SessionHandler, + ) { + build_number(NUM_NODES).await + } + + #[tokio::test] + async fn broadcasts_when_clueless() { + for num_nodes in 2..NUM_NODES { + let (mut discovery, mut handlers, _) = build_number(num_nodes).await; + let handler = &mut handlers[0]; + let maybe_authentication = discovery.discover_authorities(handler); + assert_eq!( + maybe_authentication.expect("there is an authentication"), + handler + .authentication() + .expect("the handler has an authentication"), + ); + } + } + + #[tokio::test] + async fn non_validator_discover_authorities_returns_empty_vector() { + let (mut discovery, _, non_validator) = build().await; + let maybe_authentication = discovery.discover_authorities(&non_validator); + assert!(maybe_authentication.is_none()); + } + + #[tokio::test] + async fn rebroadcasts_and_accepts_addresses() { + let (mut discovery, mut handlers, _) = build().await; + let authentication = authentication(&handlers[1]); + let handler = &mut handlers[0]; + let (address, command) = discovery.handle_authentication(authentication.clone(), handler); + assert_eq!(address, Some(authentication.0.address())); + assert!(matches!(command, Some( + rebroadcast_authentication, + ) if rebroadcast_authentication == authentication)); + } + + #[tokio::test] + async fn non_validator_rebroadcasts() { + let (mut discovery, handlers, mut non_validator) = build().await; + let authentication = authentication(&handlers[1]); + let (address, command) = + discovery.handle_authentication(authentication.clone(), &mut non_validator); + assert_eq!(address, Some(authentication.0.address())); + assert!(matches!(command, Some( + rebroadcast_authentication, + ) if rebroadcast_authentication == authentication)); + } + + #[tokio::test] + async fn does_not_rebroadcast_wrong_authentications() { + let (mut discovery, mut handlers, _) = build().await; + let Authentication(auth_data, _) = authentication(&handlers[1]); + let Authentication(_, signature) = authentication(&handlers[2]); + let authentication = Authentication(auth_data, signature); + let handler = &mut handlers[0]; + let (address, command) = discovery.handle_authentication(authentication, handler); + assert!(address.is_none()); + assert!(command.is_none()); + } + + #[tokio::test] + async fn rebroadcasts_after_cooldown() { + let (mut discovery, mut handlers, _) = build().await; + let authentication = authentication(&handlers[1]); + let handler = &mut handlers[0]; + discovery.handle_authentication(authentication.clone(), handler); + sleep(Duration::from_millis(MS_COOLDOWN + 5)); + let (address, command) = discovery.handle_authentication(authentication.clone(), handler); + assert_eq!(address, Some(authentication.0.address())); + assert!(matches!(command, Some( + rebroadcast_authentication, + ) if rebroadcast_authentication == authentication)); + } +} diff --git a/finality-aleph/src/network/session/handler.rs b/finality-aleph/src/network/session/handler.rs new file mode 100644 index 0000000000..0ce4d8828e --- /dev/null +++ b/finality-aleph/src/network/session/handler.rs @@ -0,0 +1,519 @@ +use std::collections::HashMap; + +use codec::Encode; + +use crate::{ + abft::NodeCount, + crypto::{AuthorityPen, AuthorityVerifier}, + network::{ + session::{AuthData, Authentication}, + AddressingInformation, + }, + NodeIndex, SessionId, +}; + +#[derive(Debug)] +pub enum SessionInfo { + SessionId(SessionId), + OwnAuthentication(Authentication), +} + +impl SessionInfo { + fn session_id(&self) -> SessionId { + match self { + SessionInfo::SessionId(session_id) => *session_id, + SessionInfo::OwnAuthentication(peer_authentications) => { + peer_authentications.session_id() + } + } + } +} + +/// A struct for handling authentications for a given session and maintaining +/// mappings between PeerIds and NodeIndexes within that session. +pub struct Handler { + peers_by_node: HashMap, + authentications: HashMap>, + session_info: SessionInfo, + own_peer_id: A::PeerId, + authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, + authority_verifier: AuthorityVerifier, +} + +#[derive(Debug)] +pub enum HandlerError { + /// Returned when handler is change from validator to nonvalidator + /// or vice versa + TypeChange, +} + +async fn construct_session_info( + authority_index_and_pen: &Option<(NodeIndex, AuthorityPen)>, + session_id: SessionId, + address: A, +) -> (SessionInfo, A::PeerId) { + let peer_id = address.peer_id(); + match authority_index_and_pen { + Some((node_index, authority_pen)) => { + let auth_data = AuthData { + address, + node_id: *node_index, + session_id, + }; + let signature = authority_pen.sign(&auth_data.encode()).await; + let authentications = Authentication(auth_data, signature); + (SessionInfo::OwnAuthentication(authentications), peer_id) + } + None => (SessionInfo::SessionId(session_id), peer_id), + } +} + +impl Handler { + /// Creates a new session handler. It will be a validator session handler if the authority + /// index and pen are provided. + pub async fn new( + authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, + authority_verifier: AuthorityVerifier, + session_id: SessionId, + address: A, + ) -> Handler { + let (session_info, own_peer_id) = + construct_session_info(&authority_index_and_pen, session_id, address).await; + Handler { + peers_by_node: HashMap::new(), + authentications: HashMap::new(), + session_info, + authority_index_and_pen, + authority_verifier, + own_peer_id, + } + } + + fn index(&self) -> Option { + match self.authority_index_and_pen { + Some((index, _)) => Some(index), + _ => None, + } + } + + pub fn is_validator(&self) -> bool { + self.authority_index_and_pen.is_some() + } + + pub fn node_count(&self) -> NodeCount { + self.authority_verifier.node_count() + } + + pub fn session_id(&self) -> SessionId { + self.session_info.session_id() + } + + /// Returns the authentication for the node and session this handler is responsible for. + pub fn authentication(&self) -> Option> { + match &self.session_info { + SessionInfo::SessionId(_) => None, + SessionInfo::OwnAuthentication(own_authentications) => { + Some(own_authentications.clone()) + } + } + } + + /// Returns a vector of indices of nodes for which the handler has no authentication. + pub fn missing_nodes(&self) -> Vec { + let node_count = self.node_count().0; + if self.peers_by_node.len() + 1 == node_count { + return Vec::new(); + } + (0..node_count) + .map(NodeIndex) + .filter(|node_id| { + Some(*node_id) != self.index() && !self.peers_by_node.contains_key(node_id) + }) + .collect() + } + + /// Verifies the authentication, uses it to update mappings, and returns the address we + /// should stay connected to if any. + pub fn handle_authentication(&mut self, authentication: Authentication) -> Option { + if authentication.0.session() != self.session_id() { + return None; + } + let Authentication(auth_data, signature) = &authentication; + + let address = auth_data.address(); + if !address.verify() { + return None; + } + let peer_id = address.peer_id(); + if peer_id == self.own_peer_id { + return None; + } + if !self + .authority_verifier + .verify(&auth_data.encode(), signature, auth_data.creator()) + { + return None; + } + self.peers_by_node + .insert(auth_data.creator(), peer_id.clone()); + self.authentications.insert(peer_id, authentication); + Some(address) + } + + /// Returns the PeerId of the node with the given NodeIndex, if known. + pub fn peer_id(&self, node_id: &NodeIndex) -> Option { + self.peers_by_node.get(node_id).cloned() + } + + /// Returns maping from NodeIndex to PeerId + pub fn peers(&self) -> HashMap { + self.peers_by_node.clone() + } + + /// Updates the handler with the given keychain and set of own addresses. + /// Returns an error if the set of addresses is not valid. + /// All authentications will be rechecked, invalid ones purged. + /// Own authentication will be regenerated. + /// If successful returns a set of addresses that we should be connected to. + pub async fn update( + &mut self, + authority_index_and_pen: Option<(NodeIndex, AuthorityPen)>, + authority_verifier: AuthorityVerifier, + address: A, + ) -> Result, HandlerError> { + if authority_index_and_pen.is_none() != self.authority_index_and_pen.is_none() { + return Err(HandlerError::TypeChange); + } + + let authentications = self.authentications.clone(); + + *self = Handler::new( + authority_index_and_pen, + authority_verifier, + self.session_id(), + address, + ) + .await; + + for (_, authentication) in authentications { + self.handle_authentication(authentication); + } + Ok(self + .authentications + .values() + .map(|authentication| authentication.0.address()) + .collect()) + } +} + +#[cfg(test)] +pub mod tests { + use super::{Handler, HandlerError}; + use crate::{ + network::{ + clique::mock::{random_address, random_invalid_address, MockAddressingInformation}, + mock::crypto_basics, + session::Authentication, + AddressingInformation, + }, + NodeIndex, SessionId, + }; + + pub fn authentication( + handler: &Handler, + ) -> Authentication { + handler + .authentication() + .expect("this is a validator handler") + } + + const NUM_NODES: usize = 7; + + #[tokio::test] + async fn identifies_whether_node_is_authority_in_current_session() { + let mut crypto_basics = crypto_basics(NUM_NODES).await; + let no_authority_handler = Handler::new( + None, + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let authority_handler = Handler::new( + Some(crypto_basics.0.pop().unwrap()), + crypto_basics.1, + SessionId(43), + random_address(), + ) + .await; + assert!(!no_authority_handler.is_validator()); + assert!(authority_handler.is_validator()); + } + + #[tokio::test] + async fn non_validator_handler_returns_none_for_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + assert!( + Handler::new(None, crypto_basics.1, SessionId(43), random_address(),) + .await + .authentication() + .is_none() + ); + } + + #[tokio::test] + async fn fails_to_update_from_validator_to_non_validator() { + let mut crypto_basics = crypto_basics(NUM_NODES).await; + let address = random_address(); + let mut handler0 = Handler::new( + Some(crypto_basics.0.pop().unwrap()), + crypto_basics.1.clone(), + SessionId(43), + address.clone(), + ) + .await; + assert!(matches!( + handler0 + .update(None, crypto_basics.1.clone(), address) + .await, + Err(HandlerError::TypeChange) + )); + } + + #[tokio::test] + async fn fails_to_update_from_non_validator_to_validator() { + let mut crypto_basics = crypto_basics(NUM_NODES).await; + let address = random_address(); + let mut handler0 = Handler::new( + None, + crypto_basics.1.clone(), + SessionId(43), + address.clone(), + ) + .await; + assert!(matches!( + handler0 + .update( + Some(crypto_basics.0.pop().unwrap()), + crypto_basics.1.clone(), + address, + ) + .await, + Err(HandlerError::TypeChange) + )); + } + + #[tokio::test] + async fn does_not_keep_own_peer_id_or_authentication() { + let mut crypto_basics = crypto_basics(NUM_NODES).await; + let handler0 = Handler::new( + Some(crypto_basics.0.pop().unwrap()), + crypto_basics.1, + SessionId(43), + random_address(), + ) + .await; + assert!(handler0.peer_id(&NodeIndex(0)).is_none()); + } + + #[tokio::test] + async fn misses_all_other_nodes_initially() { + let mut crypto_basics = crypto_basics(NUM_NODES).await; + let handler0 = Handler::new( + Some(crypto_basics.0.pop().unwrap()), + crypto_basics.1, + SessionId(43), + random_address(), + ) + .await; + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (0..NUM_NODES - 1).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + assert!(handler0.peer_id(&NodeIndex(1)).is_none()); + } + + #[tokio::test] + async fn accepts_correct_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(crypto_basics.0[0].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let address = random_address(); + let handler1 = Handler::new( + Some(crypto_basics.0[1].clone()), + crypto_basics.1.clone(), + SessionId(43), + address.clone(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler1)) + .is_some()); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (2..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + let peer_id1 = address.peer_id(); + assert_eq!(handler0.peer_id(&NodeIndex(1)), Some(peer_id1)); + } + + #[tokio::test] + async fn non_validator_accepts_correct_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + None, + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let address = random_address(); + let handler1 = Handler::new( + Some(crypto_basics.0[1].clone()), + crypto_basics.1.clone(), + SessionId(43), + address.clone(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler1)) + .is_some()); + let missing_nodes = handler0.missing_nodes(); + let mut expected_missing: Vec<_> = (0..NUM_NODES).map(NodeIndex).collect(); + expected_missing.remove(1); + assert_eq!(missing_nodes, expected_missing); + let peer_id1 = address.peer_id(); + assert_eq!(handler0.peer_id(&NodeIndex(1)), Some(peer_id1)); + } + + #[tokio::test] + async fn ignores_invalid_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(crypto_basics.0[0].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let handler1 = Handler::new( + Some(crypto_basics.0[1].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_invalid_address(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler1)) + .is_none()); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + } + + #[tokio::test] + async fn ignores_badly_signed_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(crypto_basics.0[0].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let handler1 = Handler::new( + Some(crypto_basics.0[1].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let mut bad_authentication = authentication(&handler1); + bad_authentication.1 = authentication(&handler0).1; + assert!(handler0.handle_authentication(bad_authentication).is_none()); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + } + + #[tokio::test] + async fn ignores_wrong_session_authentication() { + let crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(crypto_basics.0[0].clone()), + crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let handler1 = Handler::new( + Some(crypto_basics.0[1].clone()), + crypto_basics.1.clone(), + SessionId(44), + random_address(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler1)) + .is_none()); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + } + + #[tokio::test] + async fn ignores_own_authentication() { + let awaited_crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(awaited_crypto_basics.0[0].clone()), + awaited_crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler0)) + .is_none()); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + } + + #[tokio::test] + async fn invalidates_obsolete_authentication() { + let awaited_crypto_basics = crypto_basics(NUM_NODES).await; + let mut handler0 = Handler::new( + Some(awaited_crypto_basics.0[0].clone()), + awaited_crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + let handler1 = Handler::new( + Some(awaited_crypto_basics.0[1].clone()), + awaited_crypto_basics.1.clone(), + SessionId(43), + random_address(), + ) + .await; + assert!(handler0 + .handle_authentication(authentication(&handler1)) + .is_some()); + let new_crypto_basics = crypto_basics(NUM_NODES).await; + handler0 + .update( + Some(new_crypto_basics.0[0].clone()), + new_crypto_basics.1.clone(), + random_address(), + ) + .await + .unwrap(); + let missing_nodes = handler0.missing_nodes(); + let expected_missing: Vec<_> = (1..NUM_NODES).map(NodeIndex).collect(); + assert_eq!(missing_nodes, expected_missing); + assert!(handler0.peer_id(&NodeIndex(1)).is_none()); + } +} diff --git a/finality-aleph/src/network/session/manager.rs b/finality-aleph/src/network/session/manager.rs new file mode 100644 index 0000000000..e9483c7f69 --- /dev/null +++ b/finality-aleph/src/network/session/manager.rs @@ -0,0 +1,627 @@ +use std::{ + collections::{HashMap, HashSet}, + fmt::Debug, + time::Duration, +}; + +use futures::channel::mpsc; +use log::{debug, info}; + +use crate::{ + abft::Recipient, + crypto::{AuthorityPen, AuthorityVerifier}, + network::{ + session::{ + data::DataInSession, Authentication, Connections, Discovery, DiscoveryMessage, + SessionHandler, SessionHandlerError, + }, + AddressingInformation, Data, NetworkIdentity, PeerId, + }, + NodeIndex, SessionId, +}; + +/// Commands for manipulating the reserved peers set. +#[derive(Debug, PartialEq, Eq)] +pub enum ConnectionCommand { + AddReserved(HashSet), + DelReserved(HashSet), +} + +// In practice D: Data and P: PeerId, but we cannot require that in type aliases. +pub type AddressedData = (D, P); + +struct Session { + handler: SessionHandler, + discovery: Discovery, + data_for_user: Option>, +} + +#[derive(Clone)] +/// Stores all data needed for starting validator session +pub struct PreValidatorSession { + pub session_id: SessionId, + pub verifier: AuthorityVerifier, + pub node_id: NodeIndex, + pub pen: AuthorityPen, +} + +#[derive(Clone)] +/// Stores all data needed for starting non-validator session +pub struct PreNonvalidatorSession { + pub session_id: SessionId, + pub verifier: AuthorityVerifier, +} + +/// Actions that the manager wants to take as the result of some information. Might contain a +/// command for connecting to or disconnecting from some peers or a message to broadcast for +/// discovery purposes. +pub struct ManagerActions { + pub maybe_command: Option>, + pub maybe_message: Option>, +} + +impl ManagerActions { + fn noop() -> Self { + ManagerActions { + maybe_command: None, + maybe_message: None, + } + } +} + +/// The connection manager. It handles the abstraction over the network we build to support +/// separate sessions. This includes: +/// 1. Starting and ending specific sessions on user demand. +/// 2. Forwarding in-session user messages to the network using session handlers for address +/// translation. +/// 3. Handling network messages: +/// 1. In-session messages are forwarded to the user. +/// 2. Authentication messages forwarded to session handlers. +/// 4. Running periodic maintenance, mostly related to node discovery. +pub struct Manager { + network_identity: NI, + connections: Connections, + sessions: HashMap>, + discovery_cooldown: Duration, +} + +/// Error when trying to forward data from the network to the user, should never be fatal. +#[derive(Debug, PartialEq, Eq)] +pub enum SendError { + UserSend, + NoSession, +} + +impl Manager { + /// Create a new connection manager. + pub fn new(network_identity: NI, discovery_cooldown: Duration) -> Self { + Manager { + network_identity, + connections: Connections::new(), + sessions: HashMap::new(), + discovery_cooldown, + } + } + + fn delete_reserved( + to_remove: HashSet, + ) -> Option> { + match to_remove.is_empty() { + true => None, + false => Some(ConnectionCommand::DelReserved(to_remove)), + } + } + + /// Ends a session. + pub fn finish_session( + &mut self, + session_id: SessionId, + ) -> ManagerActions { + self.sessions.remove(&session_id); + ManagerActions { + maybe_command: Self::delete_reserved(self.connections.remove_session(session_id)), + maybe_message: None, + } + } + + fn discover_authorities( + &mut self, + session_id: &SessionId, + ) -> Option> { + self.sessions.get_mut(session_id).and_then( + |Session { + handler, discovery, .. + }| { discovery.discover_authorities(handler) }, + ) + } + + /// Returns all the network messages that should be sent as part of discovery at this moment. + pub fn discovery(&mut self) -> Vec> { + let sessions: Vec<_> = self.sessions.keys().cloned().collect(); + sessions + .iter() + .flat_map(|session_id| self.discover_authorities(session_id)) + .collect() + } + + async fn start_validator_session( + &mut self, + pre_session: PreValidatorSession, + address: NI::AddressingInformation, + ) -> ( + Option>, + mpsc::UnboundedReceiver, + ) { + let PreValidatorSession { + session_id, + verifier, + node_id, + pen, + } = pre_session; + let handler = + SessionHandler::new(Some((node_id, pen)), verifier, session_id, address).await; + let discovery = Discovery::new(self.discovery_cooldown); + let (data_for_user, data_from_network) = mpsc::unbounded(); + let data_for_user = Some(data_for_user); + self.sessions.insert( + session_id, + Session { + handler, + discovery, + data_for_user, + }, + ); + (self.discover_authorities(&session_id), data_from_network) + } + + /// Starts or updates a validator session. + pub async fn update_validator_session( + &mut self, + pre_session: PreValidatorSession, + ) -> Result< + ( + ManagerActions, + mpsc::UnboundedReceiver, + ), + SessionHandlerError, + > { + let address = self.network_identity.identity(); + let session = match self.sessions.get_mut(&pre_session.session_id) { + Some(session) => session, + None => { + let (maybe_message, data_from_network) = + self.start_validator_session(pre_session, address).await; + return Ok(( + ManagerActions { + maybe_command: None, + maybe_message, + }, + data_from_network, + )); + } + }; + let PreValidatorSession { + session_id, + verifier, + node_id, + pen, + } = pre_session; + let peers_to_stay = session + .handler + .update(Some((node_id, pen)), verifier, address) + .await? + .iter() + .map(|address| address.peer_id()) + .collect(); + let maybe_command = Self::delete_reserved( + self.connections + .remove_session(session_id) + .difference(&peers_to_stay) + .cloned() + .collect(), + ); + let (data_for_user, data_from_network) = mpsc::unbounded(); + session.data_for_user = Some(data_for_user); + self.connections.add_peers(session_id, peers_to_stay); + Ok(( + ManagerActions { + maybe_command, + maybe_message: self.discover_authorities(&session_id), + }, + data_from_network, + )) + } + + async fn start_nonvalidator_session( + &mut self, + pre_session: PreNonvalidatorSession, + address: NI::AddressingInformation, + ) { + let PreNonvalidatorSession { + session_id, + verifier, + } = pre_session; + let handler = SessionHandler::new(None, verifier, session_id, address).await; + let discovery = Discovery::new(self.discovery_cooldown); + self.sessions.insert( + session_id, + Session { + handler, + discovery, + data_for_user: None, + }, + ); + } + + /// Starts or updates a nonvalidator session. + pub async fn update_nonvalidator_session( + &mut self, + pre_session: PreNonvalidatorSession, + ) -> Result, SessionHandlerError> { + let address = self.network_identity.identity(); + match self.sessions.get_mut(&pre_session.session_id) { + Some(session) => { + session + .handler + .update(None, pre_session.verifier, address) + .await?; + } + None => { + self.start_nonvalidator_session(pre_session, address).await; + } + }; + Ok(ManagerActions::noop()) + } + + /// Handle a user request for sending data. + /// Returns a list of data to be sent over the network. + pub fn on_user_message( + &self, + data: D, + session_id: SessionId, + recipient: Recipient, + ) -> Vec, NI::PeerId>> { + if let Some(handler) = self + .sessions + .get(&session_id) + .map(|session| &session.handler) + { + let to_send = DataInSession { data, session_id }; + match recipient { + Recipient::Everyone => (0..handler.node_count().0) + .map(NodeIndex) + .flat_map(|node_id| handler.peer_id(&node_id)) + .map(|peer_id| (to_send.clone(), peer_id)) + .collect(), + Recipient::Node(node_id) => handler + .peer_id(&node_id) + .into_iter() + .map(|peer_id| (to_send.clone(), peer_id)) + .collect(), + } + } else { + Vec::new() + } + } + + /// Handle a discovery message. + /// Returns actions the manager wants to take. + pub fn on_discovery_message( + &mut self, + message: DiscoveryMessage, + ) -> ManagerActions { + let session_id = message.session_id(); + match self.sessions.get_mut(&session_id) { + Some(Session { + handler, discovery, .. + }) => { + let (maybe_address, maybe_message) = + discovery.handle_authentication(message, handler); + let maybe_command = match (maybe_address, handler.is_validator()) { + (Some(address), true) => { + debug!(target: "aleph-network", "Adding addresses for session {:?} to reserved: {:?}", session_id, address); + self.connections.add_peers(session_id, [address.peer_id()]); + Some(ConnectionCommand::AddReserved([address].into())) + } + _ => None, + }; + ManagerActions { + maybe_command, + maybe_message, + } + } + None => { + debug!(target: "aleph-network", "Received message from unknown session: {:?}", message); + ManagerActions::noop() + } + } + } + + /// Sends the data to the identified session. + pub fn send_session_data(&self, session_id: &SessionId, data: D) -> Result<(), SendError> { + match self + .sessions + .get(session_id) + .and_then(|session| session.data_for_user.as_ref()) + { + Some(data_for_user) => data_for_user + .unbounded_send(data) + .map_err(|_| SendError::UserSend), + None => Err(SendError::NoSession), + } + } + + pub fn status_report(&self) { + let mut status = String::from("Connection Manager status report: "); + + let mut authenticated: Vec<_> = self + .sessions + .iter() + .filter(|(_, session)| session.handler.authentication().is_some()) + .map(|(session_id, session)| { + let mut peers = session + .handler + .peers() + .into_iter() + .map(|(node_id, peer_id)| (node_id.0, peer_id)) + .collect::>(); + peers.sort_by(|x, y| x.0.cmp(&y.0)); + (session_id.0, session.handler.node_count().0, peers) + }) + .collect(); + authenticated.sort_by(|x, y| x.0.cmp(&y.0)); + if !authenticated.is_empty() { + let authenticated_status = authenticated + .iter() + .map(|(session_id, node_count, peers)| { + let peer_ids = peers + .iter() + .map(|(node_id, peer_id)| { + format!("{:?}: {}", node_id, peer_id.to_short_string()) + }) + .collect::>() + .join(", "); + + format!( + "{:?}: {}/{} {{{}}}", + session_id, + peers.len() + 1, + node_count, + peer_ids + ) + }) + .collect::>() + .join(", "); + status.push_str(&format!( + "authenticated authorities: {}; ", + authenticated_status + )); + } + + let mut missing: Vec<_> = self + .sessions + .iter() + .filter(|(_, session)| session.handler.authentication().is_some()) + .map(|(session_id, session)| { + ( + session_id.0, + session + .handler + .missing_nodes() + .iter() + .map(|id| id.0) + .collect::>(), + ) + }) + .filter(|(_, missing)| !missing.is_empty()) + .collect(); + missing.sort_by(|x, y| x.0.cmp(&y.0)); + if !missing.is_empty() { + let missing_status = missing + .iter() + .map(|(session_id, missing)| format!("{:?}: {:?}", session_id, missing)) + .collect::>() + .join(", "); + status.push_str(&format!("missing authorities: {}; ", missing_status)); + } + + if !authenticated.is_empty() || !missing.is_empty() { + info!(target: "aleph-network", "{}", status); + } + } +} + +#[cfg(test)] +mod tests { + use std::{iter, time::Duration}; + + use futures::StreamExt; + + use super::{ + ConnectionCommand, Manager, ManagerActions, PreNonvalidatorSession, PreValidatorSession, + SendError, + }; + use crate::{ + network::{ + clique::mock::{random_address, MockAddressingInformation}, + mock::crypto_basics, + session::data::DataInSession, + }, + Recipient, SessionId, + }; + + const NUM_NODES: usize = 7; + const DISCOVERY_PERIOD: Duration = Duration::from_secs(60); + + fn build() -> Manager { + Manager::new(random_address(), DISCOVERY_PERIOD) + } + + #[tokio::test] + async fn starts_nonvalidator_session() { + let mut manager = build(); + let (_, verifier) = crypto_basics(NUM_NODES).await; + let session_id = SessionId(43); + let ManagerActions { + maybe_command, + maybe_message, + } = manager + .update_nonvalidator_session(PreNonvalidatorSession { + session_id, + verifier, + }) + .await + .unwrap(); + assert!(maybe_command.is_none()); + assert!(maybe_message.is_none()); + assert_eq!( + manager.send_session_data(&session_id, -43), + Err(SendError::NoSession) + ); + } + + #[tokio::test] + async fn starts_validator_session() { + let mut manager = build(); + let (validator_data, verifier) = crypto_basics(NUM_NODES).await; + let (node_id, pen) = validator_data[0].clone(); + let session_id = SessionId(43); + let ( + ManagerActions { + maybe_command, + maybe_message, + }, + _data_from_network, + ) = manager + .update_validator_session(PreValidatorSession { + session_id, + verifier, + node_id, + pen, + }) + .await + .unwrap(); + assert!(maybe_command.is_none()); + assert!(maybe_message.is_some()); + assert_eq!(manager.send_session_data(&session_id, -43), Ok(())); + } + + #[tokio::test] + async fn stops_session() { + let mut manager = build(); + let (validator_data, verifier) = crypto_basics(NUM_NODES).await; + let (node_id, pen) = validator_data[0].clone(); + let session_id = SessionId(43); + let ( + ManagerActions { + maybe_command, + maybe_message, + }, + mut data_from_network, + ) = manager + .update_validator_session(PreValidatorSession { + session_id, + verifier, + node_id, + pen, + }) + .await + .unwrap(); + assert!(maybe_command.is_none()); + assert!(maybe_message.is_some()); + assert_eq!(manager.send_session_data(&session_id, -43), Ok(())); + assert_eq!(data_from_network.next().await, Some(-43)); + let ManagerActions { + maybe_command, + maybe_message, + } = manager.finish_session(session_id); + assert!(maybe_command.is_none()); + assert!(maybe_message.is_none()); + assert_eq!( + manager.send_session_data(&session_id, -43), + Err(SendError::NoSession) + ); + assert!(data_from_network.next().await.is_none()); + } + + #[tokio::test] + async fn handles_broadcast() { + let mut manager = build(); + let (validator_data, verifier) = crypto_basics(NUM_NODES).await; + let (node_id, pen) = validator_data[0].clone(); + let session_id = SessionId(43); + manager + .update_validator_session(PreValidatorSession { + session_id, + verifier: verifier.clone(), + node_id, + pen, + }) + .await + .unwrap(); + let mut other_manager = build(); + let (node_id, pen) = validator_data[1].clone(); + let (ManagerActions { maybe_message, .. }, _) = other_manager + .update_validator_session(PreValidatorSession { + session_id, + verifier, + node_id, + pen, + }) + .await + .unwrap(); + let message = maybe_message.expect("there should be a discovery message"); + let (address, message) = (message.0.address(), message); + let ManagerActions { + maybe_command, + maybe_message, + } = manager.on_discovery_message(message); + assert_eq!( + maybe_command, + Some(ConnectionCommand::AddReserved( + iter::once(address).collect() + )) + ); + assert!(maybe_message.is_some()); + } + + #[tokio::test] + async fn sends_user_data() { + let mut manager = build(); + let (validator_data, verifier) = crypto_basics(NUM_NODES).await; + let (node_id, pen) = validator_data[0].clone(); + let session_id = SessionId(43); + manager + .update_validator_session(PreValidatorSession { + session_id, + verifier: verifier.clone(), + node_id, + pen, + }) + .await + .unwrap(); + let mut other_manager = build(); + let (node_id, pen) = validator_data[1].clone(); + let (ManagerActions { maybe_message, .. }, _) = other_manager + .update_validator_session(PreValidatorSession { + session_id, + verifier, + node_id, + pen, + }) + .await + .unwrap(); + let message = maybe_message.expect("there should be a discovery message"); + manager.on_discovery_message(message); + let messages = manager.on_user_message(2137, session_id, Recipient::Everyone); + assert_eq!(messages.len(), 1); + let (network_data, _) = &messages[0]; + assert_eq!( + network_data, + &DataInSession { + data: 2137, + session_id + } + ); + } +} diff --git a/finality-aleph/src/network/session/mod.rs b/finality-aleph/src/network/session/mod.rs new file mode 100644 index 0000000000..1101690f51 --- /dev/null +++ b/finality-aleph/src/network/session/mod.rs @@ -0,0 +1,119 @@ +//! Managing the validator connections in sessions using the gossip network. +use std::fmt::Display; + +use codec::{Decode, Encode}; +use futures::channel::mpsc; + +use crate::{ + crypto::{AuthorityPen, AuthorityVerifier, Signature}, + network::{ + data::{ + component::{Sender, SimpleNetwork}, + SendError, + }, + AddressingInformation, Data, + }, + NodeIndex, Recipient, SessionId, +}; + +mod compatibility; +mod connections; +mod data; +mod discovery; +mod handler; +mod manager; +mod service; + +pub use compatibility::{DiscoveryMessage, VersionedAuthentication}; +use connections::Connections; +#[cfg(test)] +pub use data::DataInSession; +pub use discovery::Discovery; +#[cfg(test)] +pub use handler::tests::authentication; +pub use handler::{Handler as SessionHandler, HandlerError as SessionHandlerError}; +pub use service::{Config as ConnectionManagerConfig, ManagerError, Service as ConnectionManager}; + +/// Data validators use to authenticate themselves for a single session +/// and disseminate their addresses. +#[derive(Clone, Debug, PartialEq, Eq, Hash, Encode, Decode)] +pub struct AuthData { + address: A, + node_id: NodeIndex, + session_id: SessionId, +} + +impl AuthData { + pub fn session(&self) -> SessionId { + self.session_id + } + + pub fn creator(&self) -> NodeIndex { + self.node_id + } + + pub fn address(&self) -> A { + self.address.clone() + } +} + +/// A full authentication, consisting of a signed AuthData. +#[derive(Clone, Decode, Encode, Debug, Eq, PartialEq, Hash)] +pub struct Authentication(AuthData, Signature); + +/// Sends data within a single session. +#[derive(Clone)] +pub struct SessionSender { + session_id: SessionId, + messages_for_network: mpsc::UnboundedSender<(D, SessionId, Recipient)>, +} + +impl Sender for SessionSender { + fn send(&self, data: D, recipient: Recipient) -> Result<(), SendError> { + self.messages_for_network + .unbounded_send((data, self.session_id, recipient)) + .map_err(|_| SendError::SendFailed) + } +} + +/// Sends and receives data within a single session. +type Network = SimpleNetwork, SessionSender>; + +/// An interface for managing session networks for validators and nonvalidators. +#[async_trait::async_trait] +pub trait SessionManager: Send + Sync + 'static { + type Error: Display; + + /// Start participating or update the verifier in the given session where you are not a + /// validator. + fn start_nonvalidator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + ) -> Result<(), Self::Error>; + + /// Start participating or update the information about the given session where you are a + /// validator. Returns a session network to be used for sending and receiving data within the + /// session. + async fn start_validator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + node_id: NodeIndex, + pen: AuthorityPen, + ) -> Result, Self::Error>; + + /// Start participating or update the information about the given session where you are a + /// validator. Used for early starts when you don't yet need the returned network, but would + /// like to start discovery. + fn early_start_validator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + node_id: NodeIndex, + pen: AuthorityPen, + ) -> Result<(), Self::Error>; + + /// Stop participating in the given session. + fn stop_session(&self, session_id: SessionId) -> Result<(), Self::Error>; +} diff --git a/finality-aleph/src/network/session/service.rs b/finality-aleph/src/network/session/service.rs new file mode 100644 index 0000000000..16efd3b017 --- /dev/null +++ b/finality-aleph/src/network/session/service.rs @@ -0,0 +1,406 @@ +use std::{ + cmp, + fmt::{Debug, Display, Error as FmtError, Formatter}, + time::Duration, +}; + +use futures::{ + channel::{mpsc, oneshot}, + StreamExt, +}; +use log::{debug, trace, warn}; +use tokio::time::{self, Instant}; + +use crate::{ + abft::Recipient, + crypto::{AuthorityPen, AuthorityVerifier}, + network::{ + clique::{Network as CliqueNetwork, PublicKey}, + session::{ + data::DataInSession, + manager::{ + AddressedData, ConnectionCommand, Manager, ManagerActions, PreNonvalidatorSession, + PreValidatorSession, SendError, + }, + Network, SessionHandlerError, SessionManager, SessionSender, VersionedAuthentication, + }, + AddressingInformation, Data, GossipNetwork, NetworkIdentity, + }, + MillisecsPerBlock, NodeIndex, SessionId, SessionPeriod, STATUS_REPORT_INTERVAL, +}; + +/// Commands for manipulating sessions, stopping them and starting both validator and non-validator +/// sessions. +enum SessionCommand { + StartValidator( + SessionId, + AuthorityVerifier, + NodeIndex, + AuthorityPen, + Option>>, + ), + StartNonvalidator(SessionId, AuthorityVerifier), + Stop(SessionId), +} + +/// Manages sessions for which the network should be active. +struct ManagerInterface { + commands_for_service: mpsc::UnboundedSender>, + messages_for_service: mpsc::UnboundedSender<(D, SessionId, Recipient)>, +} + +/// What went wrong during a session management operation. +#[derive(Debug)] +pub enum ManagerError { + CommandSendFailed, + NetworkReceiveFailed, +} + +impl Display for ManagerError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use ManagerError::*; + match self { + CommandSendFailed => write!(f, "failed to send a command to the service"), + NetworkReceiveFailed => write!(f, "the service did not return a network"), + } + } +} + +#[async_trait::async_trait] +impl SessionManager for ManagerInterface { + type Error = ManagerError; + + fn start_nonvalidator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + ) -> Result<(), Self::Error> { + self.commands_for_service + .unbounded_send(SessionCommand::StartNonvalidator(session_id, verifier)) + .map_err(|_| ManagerError::CommandSendFailed) + } + + async fn start_validator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + node_id: NodeIndex, + pen: AuthorityPen, + ) -> Result, Self::Error> { + let (result_for_us, result_from_service) = oneshot::channel(); + self.commands_for_service + .unbounded_send(SessionCommand::StartValidator( + session_id, + verifier, + node_id, + pen, + Some(result_for_us), + )) + .map_err(|_| ManagerError::CommandSendFailed)?; + + let data_from_network = result_from_service + .await + .map_err(|_| ManagerError::NetworkReceiveFailed)?; + let messages_for_network = self.messages_for_service.clone(); + + Ok(Network::new( + data_from_network, + SessionSender { + session_id, + messages_for_network, + }, + )) + } + + fn early_start_validator_session( + &self, + session_id: SessionId, + verifier: AuthorityVerifier, + node_id: NodeIndex, + pen: AuthorityPen, + ) -> Result<(), Self::Error> { + self.commands_for_service + .unbounded_send(SessionCommand::StartValidator( + session_id, verifier, node_id, pen, None, + )) + .map_err(|_| ManagerError::CommandSendFailed) + } + + fn stop_session(&self, session_id: SessionId) -> Result<(), Self::Error> { + self.commands_for_service + .unbounded_send(SessionCommand::Stop(session_id)) + .map_err(|_| ManagerError::CommandSendFailed) + } +} + +/// Configuration for the session manager. Controls how often the maintenance and +/// rebroadcasts are triggerred. Also controls when maintenance starts. +pub struct Config { + discovery_cooldown: Duration, + maintenance_period: Duration, + initial_delay: Duration, +} + +impl Config { + fn new( + discovery_cooldown: Duration, + maintenance_period: Duration, + initial_delay: Duration, + ) -> Self { + Config { + discovery_cooldown, + maintenance_period, + initial_delay, + } + } + + /// Returns a configuration that triggers maintenance about 5 times per session. + pub fn with_session_period( + session_period: &SessionPeriod, + millisecs_per_block: &MillisecsPerBlock, + ) -> Self { + let discovery_cooldown = + Duration::from_millis(millisecs_per_block.0 * session_period.0 as u64 / 5); + let maintenance_period = discovery_cooldown / 2; + let initial_delay = cmp::min( + Duration::from_millis(millisecs_per_block.0 * 10), + maintenance_period, + ); + Config::new(discovery_cooldown, maintenance_period, initial_delay) + } +} + +/// The connection manager service. +pub struct Service< + D: Data, + NI: NetworkIdentity, + CN: CliqueNetwork>, + GN: GossipNetwork>, +> where + NI::PeerId: PublicKey, +{ + manager: Manager, + commands_from_user: mpsc::UnboundedReceiver>, + messages_from_user: mpsc::UnboundedReceiver<(D, SessionId, Recipient)>, + validator_network: CN, + gossip_network: GN, + maintenance_period: Duration, + initial_delay: Duration, +} + +/// Errors that can happen during the network service operations. +#[derive(Debug, PartialEq, Eq)] +pub enum Error { + CommandsChannel, + MessageChannel, + ValidatorNetwork, + GossipNetwork(GE), +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use Error::*; + match self { + CommandsChannel => write!(f, "commands channel unexpectedly closed"), + MessageChannel => write!(f, "message channel unexpectedly closed"), + ValidatorNetwork => write!(f, "validator network unexpectedly done"), + GossipNetwork(e) => write!(f, "gossip network unexpectedly done: {}", e), + } + } +} + +impl< + D: Data, + NI: NetworkIdentity, + CN: CliqueNetwork>, + GN: GossipNetwork>, + > Service +where + NI::PeerId: PublicKey, +{ + pub fn new( + network_identity: NI, + validator_network: CN, + gossip_network: GN, + config: Config, + ) -> ( + Service, + impl SessionManager, + ) { + let Config { + discovery_cooldown, + maintenance_period, + initial_delay, + } = config; + let manager = Manager::new(network_identity, discovery_cooldown); + let (commands_for_service, commands_from_user) = mpsc::unbounded(); + let (messages_for_service, messages_from_user) = mpsc::unbounded(); + ( + Service { + manager, + commands_from_user, + messages_from_user, + validator_network, + gossip_network, + maintenance_period, + initial_delay, + }, + ManagerInterface { + commands_for_service, + messages_for_service, + }, + ) + } + + fn send_data(&self, to_send: AddressedData, NI::PeerId>) { + self.validator_network.send(to_send.0, to_send.1) + } + + fn send_authentications( + &mut self, + to_send: Vec>, + ) -> Result<(), Error> { + for auth in to_send { + self.gossip_network + .broadcast(auth) + .map_err(Error::GossipNetwork)?; + } + Ok(()) + } + + fn handle_connection_command( + &mut self, + connection_command: ConnectionCommand, + ) { + match connection_command { + ConnectionCommand::AddReserved(addresses) => { + for address in addresses { + self.validator_network + .add_connection(address.peer_id(), address); + } + } + ConnectionCommand::DelReserved(peers) => { + for peer in peers { + self.validator_network.remove_connection(peer); + } + } + }; + } + + fn handle_manager_actions( + &mut self, + ManagerActions { + maybe_command, + maybe_message, + }: ManagerActions, + ) -> Result<(), Error> { + if let Some(command) = maybe_command { + self.handle_connection_command(command); + } + if let Some(message) = maybe_message { + self.send_authentications(message.into())?; + } + Ok(()) + } + + /// Handle a session command. + /// Returns actions the manager wants to take or an error if the session command is invalid. + async fn handle_command( + &mut self, + command: SessionCommand, + ) -> Result, SessionHandlerError> { + use SessionCommand::*; + match command { + StartValidator(session_id, verifier, node_id, pen, result_for_user) => { + let pre_session = PreValidatorSession { + session_id, + verifier, + node_id, + pen, + }; + let (actions, data_from_network) = + self.manager.update_validator_session(pre_session).await?; + if let Some(result_for_user) = result_for_user { + if result_for_user.send(data_from_network).is_err() { + warn!(target: "aleph-network", "Failed to send started session.") + } + } + Ok(actions) + } + StartNonvalidator(session_id, verifier) => { + let pre_session = PreNonvalidatorSession { + session_id, + verifier, + }; + self.manager.update_nonvalidator_session(pre_session).await + } + Stop(session_id) => Ok(self.manager.finish_session(session_id)), + } + } + + /// Run the connection manager service. + pub async fn run(mut self) -> Result<(), Error> { + // Initial delay is needed so that Network is fully set up and we received some first discovery broadcasts from other nodes. + // Otherwise this might cause first maintenance never working, as it happens before first broadcasts. + let mut maintenance = + time::interval_at(Instant::now() + self.initial_delay, self.maintenance_period); + + let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); + loop { + trace!(target: "aleph-network", "Manager Loop started a next iteration"); + tokio::select! { + maybe_command = self.commands_from_user.next() => { + trace!(target: "aleph-network", "Manager received a command from user"); + match maybe_command { + Some(command) => match self.handle_command(command).await { + Ok(to_send) => self.handle_manager_actions(to_send)?, + Err(e) => warn!(target: "aleph-network", "Failed to update handler: {:?}", e), + }, + None => return Err(Error::CommandsChannel), + } + }, + maybe_message = self.messages_from_user.next() => { + trace!(target: "aleph-network", "Manager received a message from user"); + match maybe_message { + Some((message, session_id, recipient)) => for message in self.manager.on_user_message(message, session_id, recipient) { + self.send_data(message); + }, + None => return Err(Error::MessageChannel), + } + }, + maybe_data = self.validator_network.next() => { + trace!(target: "aleph-network", "Manager received some data from network"); + match maybe_data { + Some(DataInSession{data, session_id}) => if let Err(e) = self.manager.send_session_data(&session_id, data) { + match e { + SendError::UserSend => trace!(target: "aleph-network", "Failed to send to user in session."), + SendError::NoSession => trace!(target: "aleph-network", "Received message for unknown session."), + } + }, + None => return Err(Error::ValidatorNetwork), + } + }, + maybe_authentication = self.gossip_network.next() => { + let (authentication, _) = maybe_authentication.map_err(Error::GossipNetwork)?; + trace!(target: "aleph-network", "Manager received an authentication from network"); + match authentication.try_into() { + Ok(message) => { + let manager_actions = self.manager.on_discovery_message(message); + self.handle_manager_actions(manager_actions)? + }, + Err(e) => warn!(target: "aleph-network", "Error casting versioned authentication to discovery message: {:?}", e), + } + }, + _ = maintenance.tick() => { + debug!(target: "aleph-network", "Manager starts maintenence"); + for to_send in self.manager.discovery() { + self.send_authentications(to_send.into())?; + } + }, + _ = status_ticker.tick() => { + self.manager.status_report(); + } + } + } + } +} diff --git a/finality-aleph/src/network/manager/testing.rs b/finality-aleph/src/network/session/testing.rs similarity index 100% rename from finality-aleph/src/network/manager/testing.rs rename to finality-aleph/src/network/session/testing.rs diff --git a/finality-aleph/src/network/substrate.rs b/finality-aleph/src/network/substrate.rs new file mode 100644 index 0000000000..c0823e36f9 --- /dev/null +++ b/finality-aleph/src/network/substrate.rs @@ -0,0 +1,295 @@ +use std::{collections::HashMap, fmt, iter, pin::Pin, sync::Arc}; + +use async_trait::async_trait; +use futures::stream::{Stream, StreamExt}; +use log::{error, trace}; +use sc_consensus::JustificationSyncLink; +use sc_network::{ + multiaddr::Protocol as MultiaddressProtocol, Event as SubstrateEvent, Multiaddr, + NetworkService, NetworkSyncForkRequest, PeerId, +}; +use sc_network_common::{ + protocol::ProtocolName, + service::{NetworkEventStream as _, NetworkNotification, NetworkPeers, NotificationSender}, + ExHashT, +}; +use sp_api::NumberFor; +use sp_consensus::SyncOracle; +use sp_runtime::traits::Block; + +use crate::network::{ + gossip::{Event, EventStream, NetworkSender, Protocol, RawNetwork}, + RequestBlocks, +}; + +impl RequestBlocks for Arc> { + fn request_justification(&self, hash: &B::Hash, number: NumberFor) { + NetworkService::request_justification(self, hash, number) + } + + fn request_stale_block(&self, hash: B::Hash, number: NumberFor) { + // The below comment is adapted from substrate: + // Notifies the sync service to try and sync the given block from the given peers. If the given vector + // of peers is empty (as in our case) then the underlying implementation should make a best effort to fetch + // the block from any peers it is connected to. + NetworkService::set_sync_fork_request(self, Vec::new(), hash, number) + } + + /// Clear all pending justification requests. + fn clear_justification_requests(&self) { + NetworkService::clear_justification_requests(self) + } + + fn is_major_syncing(&self) -> bool { + NetworkService::is_major_syncing(self) + } +} + +/// Name of the network protocol used by Aleph Zero to disseminate validator +/// authentications. +const AUTHENTICATION_PROTOCOL_NAME: &str = "/auth/0"; + +/// Legacy name of the network protocol used by Aleph Zero to disseminate validator +/// authentications. Might be removed after some updates. +const LEGACY_AUTHENTICATION_PROTOCOL_NAME: &str = "/aleph/1"; + +/// Name of the network protocol used by Aleph Zero to synchronize the block state. +const BLOCK_SYNC_PROTOCOL_NAME: &str = "/sync/0"; + +/// Convert protocols to their names and vice versa. +#[derive(Clone)] +pub struct ProtocolNaming { + authentication_name: ProtocolName, + authentication_fallback_names: Vec, + block_sync_name: ProtocolName, + protocols_by_name: HashMap, +} + +impl ProtocolNaming { + /// Create a new protocol naming scheme with the given chain prefix. + pub fn new(chain_prefix: String) -> Self { + let authentication_name: ProtocolName = + format!("{}{}", chain_prefix, AUTHENTICATION_PROTOCOL_NAME).into(); + let mut protocols_by_name = HashMap::new(); + protocols_by_name.insert(authentication_name.clone(), Protocol::Authentication); + let authentication_fallback_names: Vec = + vec![LEGACY_AUTHENTICATION_PROTOCOL_NAME.into()]; + for protocol_name in &authentication_fallback_names { + protocols_by_name.insert(protocol_name.clone(), Protocol::Authentication); + } + let block_sync_name: ProtocolName = + format!("{}{}", chain_prefix, BLOCK_SYNC_PROTOCOL_NAME).into(); + protocols_by_name.insert(block_sync_name.clone(), Protocol::BlockSync); + ProtocolNaming { + authentication_name, + authentication_fallback_names, + block_sync_name, + protocols_by_name, + } + } + + /// Returns the canonical name of the protocol. + pub fn protocol_name(&self, protocol: &Protocol) -> ProtocolName { + use Protocol::*; + match protocol { + Authentication => self.authentication_name.clone(), + BlockSync => self.block_sync_name.clone(), + } + } + + /// Returns the fallback names of the protocol. + pub fn fallback_protocol_names(&self, protocol: &Protocol) -> Vec { + use Protocol::*; + match protocol { + Authentication => self.authentication_fallback_names.clone(), + _ => Vec::new(), + } + } + + /// Attempts to convert the protocol name to a protocol. + fn to_protocol(&self, protocol_name: &str) -> Option { + self.protocols_by_name.get(protocol_name).copied() + } +} + +#[derive(Debug)] +pub enum SenderError { + CannotCreateSender(PeerId, Protocol), + LostConnectionToPeer(PeerId), + LostConnectionToPeerReady(PeerId), +} + +impl fmt::Display for SenderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + SenderError::CannotCreateSender(peer_id, protocol) => { + write!( + f, + "Can not create sender to peer {:?} with protocol {:?}", + peer_id, protocol + ) + } + SenderError::LostConnectionToPeer(peer_id) => { + write!( + f, + "Lost connection to peer {:?} while preparing sender", + peer_id + ) + } + SenderError::LostConnectionToPeerReady(peer_id) => { + write!( + f, + "Lost connection to peer {:?} after sender was ready", + peer_id + ) + } + } + } +} + +impl std::error::Error for SenderError {} + +pub struct SubstrateNetworkSender { + notification_sender: Box, + peer_id: PeerId, +} + +#[async_trait] +impl NetworkSender for SubstrateNetworkSender { + type SenderError = SenderError; + + async fn send<'a>( + &'a self, + data: impl Into> + Send + Sync + 'static, + ) -> Result<(), SenderError> { + self.notification_sender + .ready() + .await + .map_err(|_| SenderError::LostConnectionToPeer(self.peer_id))? + .send(data.into()) + .map_err(|_| SenderError::LostConnectionToPeerReady(self.peer_id)) + } +} + +pub struct NetworkEventStream { + stream: Pin + Send>>, + naming: ProtocolNaming, + network: Arc>, +} + +#[async_trait] +impl EventStream for NetworkEventStream { + async fn next_event(&mut self) -> Option> { + use Event::*; + use SubstrateEvent::*; + loop { + match self.stream.next().await { + Some(event) => match event { + SyncConnected { remote } => { + let multiaddress: Multiaddr = + iter::once(MultiaddressProtocol::P2p(remote.into())).collect(); + trace!(target: "aleph-network", "Connected event from address {:?}", multiaddress); + if let Err(e) = self.network.add_peers_to_reserved_set( + self.naming.protocol_name(&Protocol::Authentication), + iter::once(multiaddress.clone()).collect(), + ) { + error!(target: "aleph-network", "add_reserved failed for authentications: {}", e); + } + if let Err(e) = self.network.add_peers_to_reserved_set( + self.naming.protocol_name(&Protocol::BlockSync), + iter::once(multiaddress).collect(), + ) { + error!(target: "aleph-network", "add_reserved failed for block sync: {}", e); + } + continue; + } + SyncDisconnected { remote } => { + trace!(target: "aleph-network", "Disconnected event for peer {:?}", remote); + let addresses: Vec<_> = iter::once(remote).collect(); + self.network.remove_peers_from_reserved_set( + self.naming.protocol_name(&Protocol::Authentication), + addresses.clone(), + ); + self.network.remove_peers_from_reserved_set( + self.naming.protocol_name(&Protocol::BlockSync), + addresses, + ); + continue; + } + NotificationStreamOpened { + remote, protocol, .. + } => match self.naming.to_protocol(protocol.as_ref()) { + Some(protocol) => return Some(StreamOpened(remote, protocol)), + None => continue, + }, + NotificationStreamClosed { remote, protocol } => { + match self.naming.to_protocol(protocol.as_ref()) { + Some(protocol) => return Some(StreamClosed(remote, protocol)), + None => continue, + } + } + NotificationsReceived { messages, remote } => { + return Some(Messages( + remote, + messages + .into_iter() + .filter_map(|(protocol, data)| { + self.naming + .to_protocol(protocol.as_ref()) + .map(|protocol| (protocol, data)) + }) + .collect(), + )); + } + Dht(_) => continue, + }, + None => return None, + } + } + } +} + +/// A wrapper around the substrate network that includes information about protocol names. +#[derive(Clone)] +pub struct SubstrateNetwork { + network: Arc>, + naming: ProtocolNaming, +} + +impl SubstrateNetwork { + /// Create a new substrate network wrapper. + pub fn new(network: Arc>, naming: ProtocolNaming) -> Self { + SubstrateNetwork { network, naming } + } +} + +impl RawNetwork for SubstrateNetwork { + type SenderError = SenderError; + type NetworkSender = SubstrateNetworkSender; + type PeerId = PeerId; + type EventStream = NetworkEventStream; + + fn event_stream(&self) -> Self::EventStream { + NetworkEventStream { + stream: Box::pin(self.network.as_ref().event_stream("aleph-network")), + naming: self.naming.clone(), + network: self.network.clone(), + } + } + + fn sender( + &self, + peer_id: Self::PeerId, + protocol: Protocol, + ) -> Result { + Ok(SubstrateNetworkSender { + // Currently method `notification_sender` does not distinguish whether we are not connected to the peer + // or there is no such protocol so we need to have this worthless `SenderError::CannotCreateSender` error here + notification_sender: self + .network + .notification_sender(peer_id, self.naming.protocol_name(&protocol)) + .map_err(|_| SenderError::CannotCreateSender(peer_id, protocol))?, + peer_id, + }) + } +} diff --git a/finality-aleph/src/network/tcp.rs b/finality-aleph/src/network/tcp.rs new file mode 100644 index 0000000000..526400e2ff --- /dev/null +++ b/finality-aleph/src/network/tcp.rs @@ -0,0 +1,272 @@ +use std::{io::Error as IoError, iter, net::ToSocketAddrs as _}; + +use aleph_primitives::AuthorityId; +use codec::{Decode, Encode}; +use log::info; +use sp_core::crypto::KeyTypeId; +use tokio::net::{ + tcp::{OwnedReadHalf, OwnedWriteHalf}, + TcpListener, TcpStream, ToSocketAddrs, +}; + +use crate::{ + crypto::{verify, AuthorityPen, Signature}, + network::{ + clique::{ConnectionInfo, Dialer, Listener, PublicKey, SecretKey, Splittable}, + AddressingInformation, NetworkIdentity, PeerId, + }, +}; + +const LOG_TARGET: &str = "tcp-network"; + +pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"a0vn"); + +impl ConnectionInfo for TcpStream { + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => format!("unknown address: {}", e), + } + } +} + +impl ConnectionInfo for OwnedWriteHalf { + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => e.to_string(), + } + } +} + +impl ConnectionInfo for OwnedReadHalf { + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => e.to_string(), + } + } +} + +impl Splittable for TcpStream { + type Sender = OwnedWriteHalf; + type Receiver = OwnedReadHalf; + + fn split(self) -> (Self::Sender, Self::Receiver) { + let (receiver, sender) = self.into_split(); + (sender, receiver) + } +} + +#[async_trait::async_trait] +impl Listener for TcpListener { + type Connection = TcpStream; + type Error = std::io::Error; + + async fn accept(&mut self) -> Result { + let stream = TcpListener::accept(self).await.map(|(stream, _)| stream)?; + if stream.set_linger(None).is_err() { + info!(target: LOG_TARGET, "stream.set_linger(None) failed."); + }; + Ok(stream) + } +} + +impl PeerId for AuthorityId {} + +impl PublicKey for AuthorityId { + type Signature = Signature; + + fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool { + verify(self, message, signature) + } +} + +#[async_trait::async_trait] +impl SecretKey for AuthorityPen { + type Signature = Signature; + type PublicKey = AuthorityId; + + async fn sign(&self, message: &[u8]) -> Self::Signature { + AuthorityPen::sign(self, message).await + } + + fn public_key(&self) -> Self::PublicKey { + self.authority_id() + } +} + +/// What can go wrong when handling addressing information. +#[derive(Debug, Hash, Clone, PartialEq, Eq)] +pub enum AddressingInformationError { + /// Construction of an addressing information object requires at least one address. + NoAddress, +} + +#[derive(Debug, Hash, Encode, Decode, Clone, PartialEq, Eq)] +struct TcpAddressingInformation { + peer_id: AuthorityId, + // Easiest way to ensure that the Vec below is nonempty... + primary_address: String, + other_addresses: Vec, +} + +impl TcpAddressingInformation { + fn new( + addresses: Vec, + peer_id: AuthorityId, + ) -> Result { + let mut addresses = addresses.into_iter(); + let primary_address = match addresses.next() { + Some(address) => address, + None => return Err(AddressingInformationError::NoAddress), + }; + Ok(TcpAddressingInformation { + primary_address, + other_addresses: addresses.collect(), + peer_id, + }) + } + + fn peer_id(&self) -> AuthorityId { + self.peer_id.clone() + } +} + +/// A representation of TCP addressing information with an associated peer ID, self-signed. +#[derive(Debug, Hash, Encode, Decode, Clone, PartialEq, Eq)] +pub struct SignedTcpAddressingInformation { + addressing_information: TcpAddressingInformation, + signature: Signature, +} + +impl AddressingInformation for SignedTcpAddressingInformation { + type PeerId = AuthorityId; + + fn peer_id(&self) -> Self::PeerId { + self.addressing_information.peer_id() + } + + fn verify(&self) -> bool { + self.peer_id() + .verify(&self.addressing_information.encode(), &self.signature) + } +} + +impl NetworkIdentity for SignedTcpAddressingInformation { + type PeerId = AuthorityId; + type AddressingInformation = SignedTcpAddressingInformation; + + fn identity(&self) -> Self::AddressingInformation { + self.clone() + } +} + +impl SignedTcpAddressingInformation { + async fn new( + addresses: Vec, + authority_pen: &AuthorityPen, + ) -> Result { + let peer_id = authority_pen.authority_id(); + let addressing_information = TcpAddressingInformation::new(addresses, peer_id)?; + let signature = authority_pen.sign(&addressing_information.encode()).await; + Ok(SignedTcpAddressingInformation { + addressing_information, + signature, + }) + } +} + +#[derive(Clone)] +struct TcpDialer; + +#[async_trait::async_trait] +impl Dialer for TcpDialer { + type Connection = TcpStream; + type Error = std::io::Error; + + async fn connect( + &mut self, + address: SignedTcpAddressingInformation, + ) -> Result { + let SignedTcpAddressingInformation { + addressing_information, + .. + } = address; + let TcpAddressingInformation { + primary_address, + other_addresses, + .. + } = addressing_information; + let parsed_addresses: Vec<_> = iter::once(primary_address) + .chain(other_addresses) + .filter_map(|address| address.to_socket_addrs().ok()) + .flatten() + .collect(); + let stream = TcpStream::connect(&parsed_addresses[..]).await?; + if stream.set_linger(None).is_err() { + info!(target: LOG_TARGET, "stream.set_linger(None) failed."); + }; + Ok(stream) + } +} + +/// Possible errors when creating a TCP network. +#[derive(Debug)] +pub enum Error { + Io(IoError), + AddressingInformation(AddressingInformationError), +} + +impl From for Error { + fn from(e: IoError) -> Self { + Error::Io(e) + } +} + +impl From for Error { + fn from(e: AddressingInformationError) -> Self { + Error::AddressingInformation(e) + } +} + +/// Create a new tcp network, including an identity that can be used for constructing +/// authentications for other peers. +pub async fn new_tcp_network( + listening_addresses: A, + external_addresses: Vec, + authority_pen: &AuthorityPen, +) -> Result< + ( + impl Dialer, + impl Listener, + impl NetworkIdentity< + AddressingInformation = SignedTcpAddressingInformation, + PeerId = AuthorityId, + >, + ), + Error, +> { + let listener = TcpListener::bind(listening_addresses).await?; + let identity = SignedTcpAddressingInformation::new(external_addresses, authority_pen).await?; + Ok((TcpDialer {}, listener, identity)) +} + +#[cfg(test)] +pub mod testing { + use aleph_primitives::AuthorityId; + + use super::SignedTcpAddressingInformation; + use crate::{crypto::AuthorityPen, network::NetworkIdentity}; + + /// Creates a realistic identity. + pub async fn new_identity( + external_addresses: Vec, + authority_pen: &AuthorityPen, + ) -> impl NetworkIdentity + { + SignedTcpAddressingInformation::new(external_addresses, authority_pen) + .await + .expect("the provided addresses are fine") + } +} diff --git a/finality-aleph/src/nodes/mod.rs b/finality-aleph/src/nodes/mod.rs index fb36090eea..b377ab4a97 100644 --- a/finality-aleph/src/nodes/mod.rs +++ b/finality-aleph/src/nodes/mod.rs @@ -3,84 +3,38 @@ mod validator_node; use std::{future::Future, sync::Arc}; -use aleph_primitives::{AuthorityId, SessionAuthorityData}; -use codec::Encode; -use log::warn; pub use nonvalidator_node::run_nonvalidator_node; use sc_client_api::Backend; -use sc_network::{ExHashT, NetworkService}; -use sp_runtime::{ - traits::{Block, Header, NumberFor}, - RuntimeAppPublic, -}; +use sc_network::NetworkService; +use sc_network_common::ExHashT; +use sp_runtime::traits::{Block, Header, NumberFor}; pub use validator_node::run_validator_node; use crate::{ - crypto::AuthorityVerifier, finalization::AlephFinalizer, justification::{ - AlephJustification, JustificationHandler, JustificationRequestSchedulerImpl, SessionInfo, - SessionInfoProvider, Verifier, + JustificationHandler, JustificationRequestSchedulerImpl, SessionInfo, SessionInfoProvider, }, last_block_of_session, mpsc, mpsc::UnboundedSender, session_id_from_block_num, session_map::ReadOnlySessionMap, - JustificationNotification, Metrics, MillisecsPerBlock, SessionPeriod, + sync::SessionVerifier, + BlockchainBackend, JustificationNotification, Metrics, MillisecsPerBlock, SessionPeriod, }; -/// Max amount of tries we can not update a finalized block number before we will clear requests queue -const MAX_ATTEMPTS: u32 = 5; - -struct JustificationVerifier { - authority_verifier: AuthorityVerifier, - emergency_signer: Option, +#[cfg(test)] +pub mod testing { + pub use super::validator_node::new_pen; } -impl From for JustificationVerifier { - fn from(authority_data: SessionAuthorityData) -> Self { - JustificationVerifier { - authority_verifier: AuthorityVerifier::new(authority_data.authorities().to_vec()), - emergency_signer: authority_data.emergency_finalizer().clone(), - } - } -} - -impl Verifier for JustificationVerifier { - fn verify(&self, justification: &AlephJustification, hash: B::Hash) -> bool { - use AlephJustification::*; - let encoded_hash = hash.encode(); - match justification { - CommitteeMultisignature(multisignature) => match self - .authority_verifier - .is_complete(&encoded_hash, multisignature) - { - true => true, - false => { - warn!(target: "aleph-justification", "Bad multisignature for block hash #{:?} {:?}", hash, multisignature); - false - } - }, - EmergencySignature(signature) => match &self.emergency_signer { - Some(emergency_signer) => match emergency_signer.verify(&encoded_hash, signature) { - true => true, - false => { - warn!(target: "aleph-justification", "Bad emergency signature for block hash #{:?} {:?}", hash, signature); - false - } - }, - None => { - warn!(target: "aleph-justification", "Received emergency signature for block with hash #{:?}, which has no emergency signer defined.", hash); - false - } - }, - } - } -} +/// Max amount of tries we can not update a finalized block number before we will clear requests queue +const MAX_ATTEMPTS: u32 = 5; -struct JustificationParams { +struct JustificationParams { pub network: Arc>, pub client: Arc, + pub blockchain_backend: BB, pub justification_rx: mpsc::UnboundedReceiver>, pub metrics: Option::Hash>>, pub session_period: SessionPeriod, @@ -103,10 +57,10 @@ impl SessionInfoProviderImpl { } #[async_trait::async_trait] -impl SessionInfoProvider for SessionInfoProviderImpl { - async fn for_block_num(&self, number: NumberFor) -> SessionInfo { - let current_session = session_id_from_block_num::(number, self.session_period); - let last_block_height = last_block_of_session::(current_session, self.session_period); +impl SessionInfoProvider for SessionInfoProviderImpl { + async fn for_block_num(&self, number: NumberFor) -> SessionInfo { + let current_session = session_id_from_block_num(number, self.session_period); + let last_block_height = last_block_of_session(current_session, self.session_period); let verifier = self .session_authorities .get(current_session) @@ -121,8 +75,8 @@ impl SessionInfoProvider for SessionInfoProv } } -fn setup_justification_handler( - just_params: JustificationParams, +fn setup_justification_handler( + just_params: JustificationParams, ) -> ( UnboundedSender>, impl Future, @@ -133,10 +87,12 @@ where C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + 'static + Send, { let JustificationParams { network, client, + blockchain_backend, justification_rx, metrics, session_period, @@ -147,7 +103,7 @@ where let handler = JustificationHandler::new( SessionInfoProviderImpl::new(session_map, session_period), network, - client.clone(), + blockchain_backend, AlephFinalizer::new(client), JustificationRequestSchedulerImpl::new(&session_period, &millisecs_per_block, MAX_ATTEMPTS), metrics, diff --git a/finality-aleph/src/nodes/nonvalidator_node.rs b/finality-aleph/src/nodes/nonvalidator_node.rs index e70c03f6b3..4a8c31e5c3 100644 --- a/finality-aleph/src/nodes/nonvalidator_node.rs +++ b/finality-aleph/src/nodes/nonvalidator_node.rs @@ -1,27 +1,29 @@ use log::{debug, error}; use sc_client_api::Backend; -use sc_network::ExHashT; +use sc_network_common::ExHashT; use sp_consensus::SelectChain; use sp_runtime::traits::Block; use crate::{ nodes::{setup_justification_handler, JustificationParams}, session_map::{AuthorityProviderImpl, FinalityNotificatorImpl, SessionMapUpdater}, - AlephConfig, + AlephConfig, BlockchainBackend, }; -pub async fn run_nonvalidator_node(aleph_config: AlephConfig) +pub async fn run_nonvalidator_node(aleph_config: AlephConfig) where B: Block, H: ExHashT, C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + Send + 'static, SC: SelectChain + 'static, { let AlephConfig { network, client, + blockchain_backend, metrics, session_period, millisecs_per_block, @@ -32,16 +34,18 @@ where let map_updater = SessionMapUpdater::<_, _, B>::new( AuthorityProviderImpl::new(client.clone()), FinalityNotificatorImpl::new(client.clone()), + session_period, ); let session_authorities = map_updater.readonly_session_map(); spawn_handle.spawn("aleph/updater", None, async move { debug!(target: "aleph-party", "SessionMapUpdater has started."); - map_updater.run(session_period).await + map_updater.run().await }); let (_, handler_task) = setup_justification_handler(JustificationParams { justification_rx, network, client, + blockchain_backend, metrics, session_period, millisecs_per_block, diff --git a/finality-aleph/src/nodes/validator_node.rs b/finality-aleph/src/nodes/validator_node.rs index 53697bbccf..6224d2259c 100644 --- a/finality-aleph/src/nodes/validator_node.rs +++ b/finality-aleph/src/nodes/validator_node.rs @@ -1,18 +1,21 @@ -use std::marker::PhantomData; +use std::{marker::PhantomData, sync::Arc}; use bip39::{Language, Mnemonic, MnemonicType}; use futures::channel::oneshot; use log::{debug, error}; use sc_client_api::Backend; -use sc_network::ExHashT; +use sc_network_common::ExHashT; use sp_consensus::SelectChain; +use sp_keystore::CryptoStore; use sp_runtime::traits::Block; use crate::{ crypto::AuthorityPen, network::{ - setup_io, ConnectionManager, ConnectionManagerConfig, Service as NetworkService, - SessionManager, + clique::Service, + session::{ConnectionManager, ConnectionManagerConfig}, + tcp::{new_tcp_network, KEY_TYPE}, + GossipService, SubstrateNetwork, }, nodes::{setup_justification_handler, JustificationParams}, party::{ @@ -21,23 +24,33 @@ use crate::{ ConsensusParty, ConsensusPartyParams, }, session_map::{AuthorityProviderImpl, FinalityNotificatorImpl, SessionMapUpdater}, - tcp_network::new_tcp_network, - validator_network::{Service, KEY_TYPE}, - AlephConfig, + AlephConfig, BlockchainBackend, }; -pub async fn run_validator_node(aleph_config: AlephConfig) +pub async fn new_pen(mnemonic: &str, keystore: Arc) -> AuthorityPen { + let validator_peer_id = keystore + .ed25519_generate_new(KEY_TYPE, Some(mnemonic)) + .await + .expect("generating a key should work"); + AuthorityPen::new_with_key_type(validator_peer_id.into(), keystore, KEY_TYPE) + .await + .expect("we just generated this key so everything should work") +} + +pub async fn run_validator_node(aleph_config: AlephConfig) where B: Block, H: ExHashT, C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + Send + 'static, SC: SelectChain + 'static, { let AlephConfig { network, client, + blockchain_backend, select_chain, spawn_handle, keystore, @@ -49,27 +62,22 @@ where backup_saving_path, external_addresses, validator_port, + protocol_naming, .. } = aleph_config; // We generate the phrase manually to only save the key in RAM, we don't want to have these // relatively low-importance keys getting spammed around the absolutely crucial Aleph keys. // The interface of `ed25519_generate_new` only allows to save in RAM by providing a mnemonic. - let validator_peer_id = keystore - .ed25519_generate_new( - KEY_TYPE, - Some(Mnemonic::new(MnemonicType::Words12, Language::English).phrase()), - ) - .await - .expect("generating a key should work"); - let network_authority_pen = - AuthorityPen::new_with_key_type(validator_peer_id.into(), keystore.clone(), KEY_TYPE) - .await - .expect("we just generated this key so everything should work"); + let network_authority_pen = new_pen( + Mnemonic::new(MnemonicType::Words12, Language::English).phrase(), + keystore.clone(), + ) + .await; let (dialer, listener, network_identity) = new_tcp_network( ("0.0.0.0", validator_port), external_addresses, - validator_peer_id.into(), + &network_authority_pen, ) .await .expect("we should have working networking"); @@ -85,77 +93,55 @@ where validator_network_service.run(exit).await }); + let (gossip_network_service, authentication_network, _block_sync_network) = GossipService::new( + SubstrateNetwork::new(network.clone(), protocol_naming), + spawn_handle.clone(), + ); + let gossip_network_task = async move { gossip_network_service.run().await }; + let block_requester = network.clone(); let map_updater = SessionMapUpdater::<_, _, B>::new( AuthorityProviderImpl::new(client.clone()), FinalityNotificatorImpl::new(client.clone()), + session_period, ); let session_authorities = map_updater.readonly_session_map(); spawn_handle.spawn("aleph/updater", None, async move { debug!(target: "aleph-party", "SessionMapUpdater has started."); - map_updater.run(session_period).await + map_updater.run().await }); let (authority_justification_tx, handler_task) = setup_justification_handler(JustificationParams { justification_rx, - network: network.clone(), + network, client: client.clone(), + blockchain_backend, metrics: metrics.clone(), session_period, millisecs_per_block, session_map: session_authorities.clone(), }); - let (connection_io, network_io, session_io) = setup_io(); - - let connection_manager = ConnectionManager::new( + let (connection_manager_service, connection_manager) = ConnectionManager::new( network_identity, + validator_network, + authentication_network, ConnectionManagerConfig::with_session_period(&session_period, &millisecs_per_block), ); let connection_manager_task = async move { - connection_io - .run(connection_manager) - .await - .expect("Failed to run connection manager") + if let Err(e) = connection_manager_service.run().await { + panic!("Failed to run connection manager: {}", e); + } }; - let (legacy_connection_io, legacy_network_io, legacy_session_io) = setup_io(); - - let legacy_connection_manager = ConnectionManager::new( - network.clone(), - ConnectionManagerConfig::with_session_period(&session_period, &millisecs_per_block), - ); - - let legacy_connection_manager_task = async move { - legacy_connection_io - .run(legacy_connection_manager) - .await - .expect("Failed to legacy connection manager") - }; - - let session_manager = SessionManager::new(session_io, legacy_session_io); - let network = NetworkService::new( - network.clone(), - validator_network, - spawn_handle.clone(), - network_io, - legacy_network_io, - ); - let network_task = async move { network.run().await }; - spawn_handle.spawn("aleph/justification_handler", None, handler_task); debug!(target: "aleph-party", "JustificationHandler has started."); spawn_handle.spawn("aleph/connection_manager", None, connection_manager_task); - spawn_handle.spawn( - "aleph/legacy_connection_manager", - None, - legacy_connection_manager_task, - ); - spawn_handle.spawn("aleph/network", None, network_task); - debug!(target: "aleph-party", "Network has started."); + spawn_handle.spawn("aleph/gossip_network", None, gossip_network_task); + debug!(target: "aleph-party", "Gossip network has started."); let party = ConsensusParty::new(ConsensusPartyParams { session_authorities, @@ -174,7 +160,7 @@ where block_requester, metrics, spawn_handle.into(), - session_manager, + connection_manager, keystore, ), _phantom: PhantomData, diff --git a/finality-aleph/src/party/backup.rs b/finality-aleph/src/party/backup.rs index 36dc69f083..37718753fd 100644 --- a/finality-aleph/src/party/backup.rs +++ b/finality-aleph/src/party/backup.rs @@ -48,8 +48,8 @@ pub type ABFTBackup = (Saver, Loader); /// Find all `*.abfts` files at `session_path` and return their indexes sorted, if all are present. fn get_session_backup_idxs(session_path: &Path) -> Result, BackupLoadError> { - fs::create_dir_all(&session_path)?; - let mut session_backups: Vec<_> = fs::read_dir(&session_path)? + fs::create_dir_all(session_path)?; + let mut session_backups: Vec<_> = fs::read_dir(session_path)? .filter_map(|r| r.ok()) .filter_map(|x| x.file_name().into_string().ok()) .filter_map(|s| usize::from_str(s.strip_suffix(BACKUP_FILE_EXTENSION)?).ok()) @@ -132,7 +132,7 @@ pub fn remove(path: Option, session_id: u32) { Some(path) => path.join(session_id.to_string()), None => return, }; - match fs::remove_dir_all(&path) { + match fs::remove_dir_all(path) { Ok(()) => { debug!(target: "aleph-party", "Removed backup for session {}", session_id); } diff --git a/finality-aleph/src/party/impls.rs b/finality-aleph/src/party/impls.rs index 14000177aa..845f1b5715 100644 --- a/finality-aleph/src/party/impls.rs +++ b/finality-aleph/src/party/impls.rs @@ -1,10 +1,11 @@ use std::{marker::PhantomData, sync::Arc}; use sc_client_api::Backend; -use sp_runtime::traits::{Block as BlockT, NumberFor, SaturatedConversion}; +use sp_runtime::traits::{Block as BlockT, NumberFor}; use crate::{ party::traits::{Block, ChainState, SessionInfo}, + session::{first_block_of_session, last_block_of_session, session_id_from_block_num}, ClientForAleph, SessionId, SessionPeriod, }; @@ -44,14 +45,14 @@ impl SessionInfoImpl { impl SessionInfo for SessionInfoImpl { fn session_id_from_block_num(&self, n: NumberFor) -> SessionId { - SessionId(n.saturated_into::() / self.session_period.0) + session_id_from_block_num(n, self.session_period) } fn last_block_of_session(&self, session_id: SessionId) -> NumberFor { - ((session_id.0 + 1) * self.session_period.0 - 1).into() + last_block_of_session(session_id, self.session_period) } fn first_block_of_session(&self, session_id: SessionId) -> NumberFor { - (session_id.0 * self.session_period.0).into() + first_block_of_session(session_id, self.session_period) } } diff --git a/finality-aleph/src/party/manager/aggregator.rs b/finality-aleph/src/party/manager/aggregator.rs index e947b8dcce..852104bed3 100644 --- a/finality-aleph/src/party/manager/aggregator.rs +++ b/finality-aleph/src/party/manager/aggregator.rs @@ -15,7 +15,7 @@ use crate::{ crypto::Signature, justification::{AlephJustification, JustificationNotification}, metrics::Checkpoint, - network::DataNetwork, + network::data::Network, party::{ manager::aggregator::AggregatorVersion::{Current, Legacy}, AuthoritySubtaskCommon, Task, @@ -36,8 +36,8 @@ async fn process_new_block_data( metrics: &Option::Hash>>, ) where B: Block, - CN: DataNetwork>, - LN: DataNetwork>, + CN: Network>, + LN: Network>, ::Hash: AsRef<[u8]>, { trace!(target: "aleph-party", "Received unit {:?} in aggregator.", block); @@ -83,8 +83,8 @@ async fn run_aggregator( where B: Block, C: HeaderBackend + Send + Sync + 'static, - LN: DataNetwork>, - CN: DataNetwork>, + LN: Network>, + CN: Network>, ::Hash: AsRef<[u8]>, { let IO { @@ -169,8 +169,8 @@ pub fn task( where B: Block, C: HeaderBackend + Send + Sync + 'static, - LN: DataNetwork> + 'static, - CN: DataNetwork> + 'static, + LN: Network> + 'static, + CN: Network> + 'static, { let AuthoritySubtaskCommon { spawn_handle, diff --git a/finality-aleph/src/party/manager/data_store.rs b/finality-aleph/src/party/manager/data_store.rs index 6a46e0a892..be3988b675 100644 --- a/finality-aleph/src/party/manager/data_store.rs +++ b/finality-aleph/src/party/manager/data_store.rs @@ -9,7 +9,7 @@ use sp_runtime::traits::Block; use crate::{ abft::SpawnHandleT, data_io::{AlephNetworkMessage, DataStore}, - network::{ReceiverComponent, RequestBlocks}, + network::{data::component::Receiver, RequestBlocks}, party::{AuthoritySubtaskCommon, Task}, }; @@ -23,7 +23,7 @@ where C: HeaderBackend + BlockchainEvents + Send + Sync + 'static, RB: RequestBlocks + 'static, Message: AlephNetworkMessage + Debug + Send + Sync + Codec + 'static, - R: ReceiverComponent + 'static, + R: Receiver + 'static, { let AuthoritySubtaskCommon { spawn_handle, diff --git a/finality-aleph/src/party/manager/mod.rs b/finality-aleph/src/party/manager/mod.rs index a9321f7f70..20d39c662e 100644 --- a/finality-aleph/src/party/manager/mod.rs +++ b/finality-aleph/src/party/manager/mod.rs @@ -1,9 +1,9 @@ -use std::{collections::HashSet, fmt::Debug, marker::PhantomData, sync::Arc}; +use std::{collections::HashSet, marker::PhantomData, sync::Arc}; use aleph_primitives::{AlephSessionApi, KEY_TYPE}; use async_trait::async_trait; use futures::channel::oneshot; -use log::{debug, trace, warn}; +use log::{debug, info, trace, warn}; use sc_client_api::Backend; use sp_consensus::SelectChain; use sp_keystore::CryptoStore; @@ -21,8 +21,12 @@ use crate::{ data_io::{ChainTracker, DataStore, OrderedDataInterpreter}, mpsc, network::{ - split, ComponentNetworkMap, ManagerError, RequestBlocks, Sender, SessionManager, - SimpleNetwork, + data::{ + component::{Network, NetworkMap, SimpleNetwork}, + split::split, + }, + session::{SessionManager, SessionSender}, + RequestBlocks, }, party::{ backup::ABFTBackup, manager::aggregator::AggregatorVersion, traits::NodeSessionManager, @@ -44,7 +48,6 @@ pub use task::{Handle, Task}; use crate::{ abft::{CURRENT_VERSION, LEGACY_VERSION}, data_io::DataProvider, - network::ComponentNetwork, }; #[cfg(feature = "only_legacy")] @@ -53,12 +56,12 @@ const ONLY_LEGACY_ENV: &str = "ONLY_LEGACY_PROTOCOL"; type LegacyNetworkType = SimpleNetwork< LegacyRmcNetworkData, mpsc::UnboundedReceiver>, - Sender>, + SessionSender>, >; type CurrentNetworkType = SimpleNetwork< CurrentRmcNetworkData, mpsc::UnboundedReceiver>, - Sender>, + SessionSender>, >; struct SubtasksParams @@ -67,7 +70,7 @@ where C: crate::ClientForAleph + Send + Sync + 'static, BE: Backend + 'static, SC: SelectChain + 'static, - N: ComponentNetwork> + 'static, + N: Network> + 'static, { n_members: usize, node_id: NodeIndex, @@ -85,13 +88,14 @@ where phantom: PhantomData, } -pub struct NodeSessionManagerImpl +pub struct NodeSessionManagerImpl where B: BlockT, C: crate::ClientForAleph + Send + Sync + 'static, BE: Backend + 'static, SC: SelectChain + 'static, RB: RequestBlocks, + SM: SessionManager> + 'static, { client: Arc, select_chain: SC, @@ -101,12 +105,12 @@ where block_requester: RB, metrics: Option::Hash>>, spawn_handle: SpawnHandle, - session_manager: SessionManager>, + session_manager: SM, keystore: Arc, _phantom: PhantomData, } -impl NodeSessionManagerImpl +impl NodeSessionManagerImpl where B: BlockT, C: crate::ClientForAleph + Send + Sync + 'static, @@ -114,6 +118,7 @@ where BE: Backend + 'static, SC: SelectChain + 'static, RB: RequestBlocks, + SM: SessionManager>, { #[allow(clippy::too_many_arguments)] pub fn new( @@ -125,7 +130,7 @@ where block_requester: RB, metrics: Option::Hash>>, spawn_handle: SpawnHandle, - session_manager: SessionManager>, + session_manager: SM, keystore: Arc, ) -> Self { Self { @@ -143,7 +148,7 @@ where } } - fn legacy_subtasks> + 'static>( + fn legacy_subtasks> + 'static>( &self, params: SubtasksParams, ) -> Subtasks { @@ -201,7 +206,7 @@ where ) } - fn current_subtasks> + 'static>( + fn current_subtasks> + 'static>( &self, params: SubtasksParams, ) -> Subtasks { @@ -303,11 +308,14 @@ where justifications_for_chain: self.authority_justification_tx.clone(), }; - let data_network = self + let data_network = match self .session_manager .start_validator_session(session_id, authority_verifier, node_id, authority_pen) .await - .expect("Failed to start validator session!"); + { + Ok(data_network) => data_network, + Err(e) => panic!("Failed to start validator session: {}", e), + }; let last_block_of_previous_session = session_boundaries .first_block() @@ -336,9 +344,20 @@ where .next_session_finality_version(&BlockId::Number(last_block_of_previous_session)) { #[cfg(feature = "only_legacy")] - _ if self.only_legacy() => self.legacy_subtasks(params), - Ok(version) if version == CURRENT_VERSION => self.current_subtasks(params), - Ok(version) if version == LEGACY_VERSION => self.legacy_subtasks(params), + _ if self.only_legacy() => { + info!(target: "aleph-party", "Running session with legacy-only AlephBFT version."); + self.legacy_subtasks(params) + } + // The `as`es here should be removed, but this would require a pallet migration and I + // am lazy. + Ok(version) if version == CURRENT_VERSION as u32 => { + info!(target: "aleph-party", "Running session with AlephBFT version {}, which is current.", version); + self.current_subtasks(params) + } + Ok(version) if version == LEGACY_VERSION as u32 => { + info!(target: "aleph-party", "Running session with AlephBFT version {}, which is legacy.", version); + self.legacy_subtasks(params) + } Ok(version) => { panic!("Unsupported version {}. Supported versions: {} or {}. Potentially outdated node.", version, LEGACY_VERSION, CURRENT_VERSION) } @@ -357,14 +376,8 @@ where } } -#[derive(Debug)] -pub enum SessionManagerError { - NotAuthority, - ManagerError(ManagerError), -} - #[async_trait] -impl NodeSessionManager for NodeSessionManagerImpl +impl NodeSessionManager for NodeSessionManagerImpl where B: BlockT, C: crate::ClientForAleph + Send + Sync + 'static, @@ -372,8 +385,9 @@ where BE: Backend + 'static, SC: SelectChain + 'static, RB: RequestBlocks, + SM: SessionManager>, { - type Error = SessionManagerError; + type Error = SM::Error; async fn spawn_authority_task_for_session( &self, @@ -402,20 +416,20 @@ where async fn early_start_validator_session( &self, session: SessionId, + node_id: NodeIndex, authorities: &[AuthorityId], ) -> Result<(), Self::Error> { - let node_id = match self.node_idx(authorities).await { - Some(id) => id, - None => return Err(SessionManagerError::NotAuthority), - }; let authority_verifier = AuthorityVerifier::new(authorities.to_vec()); let authority_pen = AuthorityPen::new(authorities[node_id.0].clone(), self.keystore.clone()) .await .expect("The keys should sign successfully"); - self.session_manager - .early_start_validator_session(session, authority_verifier, node_id, authority_pen) - .map_err(SessionManagerError::ManagerError) + self.session_manager.early_start_validator_session( + session, + authority_verifier, + node_id, + authority_pen, + ) } fn start_nonvalidator_session( @@ -427,13 +441,10 @@ where self.session_manager .start_nonvalidator_session(session, authority_verifier) - .map_err(SessionManagerError::ManagerError) } fn stop_session(&self, session: SessionId) -> Result<(), Self::Error> { - self.session_manager - .stop_session(session) - .map_err(SessionManagerError::ManagerError) + self.session_manager.stop_session(session) } async fn node_idx(&self, authorities: &[AuthorityId]) -> Option { diff --git a/finality-aleph/src/party/mocks.rs b/finality-aleph/src/party/mocks.rs index 2a0d78441b..935dc150b1 100644 --- a/finality-aleph/src/party/mocks.rs +++ b/finality-aleph/src/party/mocks.rs @@ -1,5 +1,6 @@ use std::{ collections::HashSet, + fmt::{Debug, Display, Error as FmtError, Formatter}, hash::Hash, sync::{Arc, Mutex}, }; @@ -13,7 +14,8 @@ use crate::{ manager::AuthorityTask, traits::{Block, ChainState, NodeSessionManager, SessionInfo, SyncState}, }, - AuthorityId, NodeIndex, SessionId, + session::{first_block_of_session, last_block_of_session, session_id_from_block_num}, + AuthorityId, NodeIndex, SessionId, SessionPeriod, }; type AMutex = Arc>; @@ -111,9 +113,17 @@ impl MockNodeSessionManager { } } +pub struct MockNodeSessionManagerError; + +impl Display for MockNodeSessionManagerError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "mock node session manager error") + } +} + #[async_trait] impl NodeSessionManager for Arc { - type Error = (); + type Error = MockNodeSessionManagerError; async fn spawn_authority_task_for_session( &self, @@ -133,6 +143,7 @@ impl NodeSessionManager for Arc { async fn early_start_validator_session( &self, session: SessionId, + _node_id: NodeIndex, _authorities: &[AuthorityId], ) -> Result<(), Self::Error> { self.insert(self.session_early_started.clone(), session); @@ -173,25 +184,27 @@ impl NodeSessionManager for Arc { } pub struct MockSessionInfo { - pub session_period: u32, + pub session_period: SessionPeriod, } impl MockSessionInfo { pub fn new(session_period: u32) -> Self { - Self { session_period } + Self { + session_period: SessionPeriod(session_period), + } } } impl SessionInfo for MockSessionInfo { fn session_id_from_block_num(&self, n: u32) -> SessionId { - SessionId(n / self.session_period) + session_id_from_block_num(n, self.session_period) } fn last_block_of_session(&self, session_id: SessionId) -> u32 { - (session_id.0 + 1) * self.session_period - 1 + last_block_of_session(session_id, self.session_period) } fn first_block_of_session(&self, session_id: SessionId) -> u32 { - session_id.0 * self.session_period + first_block_of_session(session_id, self.session_period) } } diff --git a/finality-aleph/src/party/mod.rs b/finality-aleph/src/party/mod.rs index fd46336da6..50c9c78e3f 100644 --- a/finality-aleph/src/party/mod.rs +++ b/finality-aleph/src/party/mod.rs @@ -154,7 +154,7 @@ where .session_manager .start_nonvalidator_session(session_id, authorities) { - warn!(target: "aleph-party", "Failed to start nonvalidator session{:?}:{:?}", session_id, e); + warn!(target: "aleph-party", "Failed to start nonvalidator session{:?}: {}", session_id, e); } None }; @@ -194,21 +194,22 @@ where } => { let next_session_authorities = next_session_authority_data.authorities(); match self.session_manager.node_idx(next_session_authorities).await { - Some(_) => if let Err(e) = self + Some(next_session_node_id) => if let Err(e) = self .session_manager .early_start_validator_session( next_session_id, + next_session_node_id, next_session_authorities, ).await { - warn!(target: "aleph-party", "Failed to early start validator session{:?}:{:?}", next_session_id, e); + warn!(target: "aleph-party", "Failed to early start validator session{:?}: {}", next_session_id, e); } None => { if let Err(e) = self .session_manager .start_nonvalidator_session(next_session_id, next_session_authorities) { - warn!(target: "aleph-party", "Failed to early start nonvalidator session{:?}:{:?}", next_session_id, e); + warn!(target: "aleph-party", "Failed to early start nonvalidator session{:?}: {}", next_session_id, e); } } } @@ -232,7 +233,7 @@ where } } if let Err(e) = self.session_manager.stop_session(session_id) { - warn!(target: "aleph-party", "Session Manager failed to stop in session {:?}: {:?}", session_id, e) + warn!(target: "aleph-party", "Session Manager failed to stop in session {:?}: {}", session_id, e) } } diff --git a/finality-aleph/src/party/traits.rs b/finality-aleph/src/party/traits.rs index 74c139a284..21198d737f 100644 --- a/finality-aleph/src/party/traits.rs +++ b/finality-aleph/src/party/traits.rs @@ -1,4 +1,4 @@ -use std::fmt::Debug; +use std::fmt::{Debug, Display}; use async_trait::async_trait; use sp_runtime::traits::{Block as BlockT, NumberFor}; @@ -34,7 +34,7 @@ pub trait ChainState { #[async_trait] /// Abstraction over session related tasks. pub trait NodeSessionManager { - type Error: Debug; + type Error: Display; /// Spawns every task needed for an authority to run in a session. async fn spawn_authority_task_for_session( @@ -49,6 +49,7 @@ pub trait NodeSessionManager { async fn early_start_validator_session( &self, session: SessionId, + node_id: NodeIndex, authorities: &[AuthorityId], ) -> Result<(), Self::Error>; diff --git a/finality-aleph/src/session.rs b/finality-aleph/src/session.rs index 3e7cde9ad2..3330c7156e 100644 --- a/finality-aleph/src/session.rs +++ b/finality-aleph/src/session.rs @@ -1,5 +1,8 @@ use codec::{Decode, Encode}; -use sp_runtime::{traits::Block, SaturatedConversion}; +use sp_runtime::{ + traits::{AtLeast32BitUnsigned, Block}, + SaturatedConversion, +}; use crate::NumberFor; @@ -12,8 +15,8 @@ pub struct SessionBoundaries { impl SessionBoundaries { pub fn new(session_id: SessionId, period: SessionPeriod) -> Self { SessionBoundaries { - first_block: first_block_of_session::(session_id, period), - last_block: last_block_of_session::(session_id, period), + first_block: first_block_of_session(session_id, period), + last_block: last_block_of_session(session_id, period), } } @@ -26,22 +29,40 @@ impl SessionBoundaries { } } -pub fn first_block_of_session( +pub fn first_block_of_session( session_id: SessionId, period: SessionPeriod, -) -> NumberFor { +) -> N { (session_id.0 * period.0).into() } -pub fn last_block_of_session( +pub fn last_block_of_session( session_id: SessionId, period: SessionPeriod, -) -> NumberFor { +) -> N { ((session_id.0 + 1) * period.0 - 1).into() } -pub fn session_id_from_block_num(num: NumberFor, period: SessionPeriod) -> SessionId { - SessionId(num.saturated_into::() / period.0) +pub fn session_id_from_block_num( + num: N, + period: SessionPeriod, +) -> SessionId { + SessionId((num / period.0.into()).saturated_into()) +} + +#[cfg(test)] +pub mod testing { + use aleph_primitives::SessionAuthorityData; + use sp_runtime::testing::UintAuthorityId; + + pub fn authority_data(from: u64, to: u64) -> SessionAuthorityData { + SessionAuthorityData::new( + (from..to) + .map(|id| UintAuthorityId(id).to_public_key()) + .collect(), + None, + ) + } } #[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash, Ord, PartialOrd, Encode, Decode)] diff --git a/finality-aleph/src/session_map.rs b/finality-aleph/src/session_map.rs index b6182e3bfa..fc88f2a997 100644 --- a/finality-aleph/src/session_map.rs +++ b/finality-aleph/src/session_map.rs @@ -8,7 +8,6 @@ use sc_utils::mpsc::TracingUnboundedReceiver; use sp_runtime::{ generic::BlockId, traits::{Block, Header, NumberFor}, - SaturatedConversion, }; use tokio::sync::{ oneshot::{Receiver as OneShotReceiver, Sender as OneShotSender}, @@ -31,6 +30,8 @@ pub trait AuthorityProvider { } /// Default implementation of authority provider trait. +/// If state pruning is on and set to `n`, will no longer be able to +/// answer for `num < finalized_number - n`. pub struct AuthorityProviderImpl where C: ClientForAleph + Send + Sync + 'static, @@ -228,26 +229,6 @@ impl ReadOnlySessionMap { } } -fn get_authority_data_for_session( - authority_provider: &AP, - session_id: SessionId, - first_block: NumberFor, -) -> SessionAuthorityData -where - B: Block, - AP: AuthorityProvider>, -{ - if session_id == SessionId(0) { - authority_provider - .authority_data(>::saturated_from(0u32)) - .expect("Authorities for the session 0 must be available from the beginning") - } else { - authority_provider.next_authority_data(first_block).unwrap_or_else(|| - panic!("Authorities for next session {:?} must be available at first block #{:?} of current session", session_id.0, first_block) - ) - } -} - /// Struct responsible for updating session map pub struct SessionMapUpdater where @@ -258,6 +239,7 @@ where session_map: SharedSessionMap, authority_provider: AP, finality_notificator: FN, + period: SessionPeriod, _phantom: PhantomData, } @@ -267,11 +249,12 @@ where FN: FinalityNotificator, NumberFor>, B: Block, { - pub fn new(authority_provider: AP, finality_notificator: FN) -> Self { + pub fn new(authority_provider: AP, finality_notificator: FN, period: SessionPeriod) -> Self { Self { session_map: SharedSessionMap::new(), authority_provider, finality_notificator, + period, _phantom: PhantomData, } } @@ -281,76 +264,95 @@ where self.session_map.read_only() } - /// puts authority data for the next session into the session map - async fn handle_first_block_of_session(&mut self, num: NumberFor, session_id: SessionId) { - debug!(target: "aleph-session-updater", "Handling first block #{:?} of session {:?}", num, session_id.0); - let next_session = SessionId(session_id.0 + 1); - let authority_provider = &self.authority_provider; - self.session_map - .update( - next_session, - get_authority_data_for_session::<_, B>(authority_provider, next_session, num), - ) - .await; - - // if this is the first session we also need to include starting authority data into the map - if session_id.0 == 0 { - let authority_provider = &self.authority_provider; + /// Puts authority data for the next session into the session map + async fn handle_first_block_of_session(&mut self, session_id: SessionId) { + let first_block = first_block_of_session(session_id, self.period); + debug!(target: "aleph-session-updater", + "Handling first block #{:?} of session {:?}", + first_block, session_id.0 + ); + + if let Some(authority_data) = self.authority_provider.next_authority_data(first_block) { self.session_map - .update( - session_id, - get_authority_data_for_session::<_, B>(authority_provider, session_id, num), - ) + .update(SessionId(session_id.0 + 1), authority_data) .await; + } else { + panic!("Authorities for next session {:?} must be available at first block #{:?} of current session", session_id.0, first_block); } - if session_id.0 >= PRUNING_THRESHOLD && session_id.0 % PRUNING_THRESHOLD == 0 { - debug!(target: "aleph-session-updater", "Pruning session map below session #{:?}", session_id.0 - PRUNING_THRESHOLD); + if session_id.0 > PRUNING_THRESHOLD && session_id.0 % PRUNING_THRESHOLD == 0 { + debug!(target: "aleph-session-updater", + "Pruning session map below session #{:?}", + session_id.0 - PRUNING_THRESHOLD + ); self.session_map .prune_below(SessionId(session_id.0 - PRUNING_THRESHOLD)) .await; } } - async fn update_session(&mut self, session_id: SessionId, period: SessionPeriod) { - let first_block = first_block_of_session::(session_id, period); - self.handle_first_block_of_session(first_block, session_id) - .await; + fn authorities_for_session(&mut self, session_id: SessionId) -> Option { + let first_block = first_block_of_session(session_id, self.period); + self.authority_provider.authority_data(first_block) } - fn catch_up_boundaries(&self, period: SessionPeriod) -> (SessionId, SessionId) { + /// Puts current and next session authorities in the session map. + /// If previous authorities are still available in `AuthorityProvider`, also puts them in the session map. + async fn catch_up(&mut self) -> SessionId { let last_finalized = self.finality_notificator.last_finalized(); - let current_session = session_id_from_block_num::(last_finalized, period); - let starting_session = SessionId(current_session.0.saturating_sub(PRUNING_THRESHOLD)); + let current_session = session_id_from_block_num(last_finalized, self.period); + let starting_session = SessionId(current_session.0.saturating_sub(PRUNING_THRESHOLD - 1)); - (starting_session, current_session) - } + debug!(target: "aleph-session-updater", + "Last finalized is {:?}; Catching up with authorities starting from session {:?} up to next session {:?}", + last_finalized, starting_session.0, current_session.0 + 1 + ); - pub async fn run(mut self, period: SessionPeriod) { - let mut notifications = self.finality_notificator.notification_stream(); + // lets catch up with previous sessions + for session in starting_session.0..current_session.0 { + let id = SessionId(session); + if let Some(authority_data) = self.authorities_for_session(id) { + self.session_map.update(id, authority_data).await; + } else { + debug!(target: "aleph-session-updater", "No authorities for session {:?} during catch-up. Most likely already pruned.", id.0) + } + } - let (starting_session, current_session) = self.catch_up_boundaries(period); + // lets catch up with previous session + match self.authorities_for_session(current_session) { + Some(current_authority_data) => { + self.session_map + .update(current_session, current_authority_data) + .await + } + None => panic!( + "Authorities for current session {:?} must be available from the beginning", + current_session.0 + ), + }; - // lets catch up - for session in starting_session.0..=current_session.0 { - self.update_session(SessionId(session), period).await; - } + self.handle_first_block_of_session(current_session).await; - let mut last_updated = current_session; + current_session + } + + pub async fn run(mut self) { + let mut notifications = self.finality_notificator.notification_stream(); + let mut last_updated = self.catch_up().await; while let Some(FinalityNotification { header, .. }) = notifications.next().await { let last_finalized = header.number(); trace!(target: "aleph-session-updater", "got FinalityNotification about #{:?}", last_finalized); - let session_id = session_id_from_block_num::(*last_finalized, period); + let session_id = session_id_from_block_num(*last_finalized, self.period); if last_updated >= session_id { continue; } for session in (last_updated.0 + 1)..=session_id.0 { - self.update_session(SessionId(session), period).await; + self.handle_first_block_of_session(SessionId(session)).await; } last_updated = session_id; @@ -364,9 +366,9 @@ mod tests { use futures_timer::Delay; use sc_block_builder::BlockBuilderProvider; + use sc_client_api::FinalizeSummary; use sc_utils::mpsc::tracing_unbounded; use sp_consensus::BlockOrigin; - use sp_runtime::testing::UintAuthorityId; use substrate_test_runtime_client::{ ClientBlockImportExt, DefaultTestClientBuilderExt, TestClient, TestClientBuilder, TestClientBuilderExt, @@ -374,12 +376,11 @@ mod tests { use tokio::sync::oneshot::error::TryRecvError; use super::*; - use crate::testing::mocks::TBlock; + use crate::{session::testing::authority_data, testing::mocks::TBlock}; struct MockProvider { pub session_map: HashMap, SessionAuthorityData>, pub next_session_map: HashMap, SessionAuthorityData>, - pub asked_for: Arc>>>, } struct MockNotificator { @@ -392,9 +393,15 @@ mod tests { Self { session_map: HashMap::new(), next_session_map: HashMap::new(), - asked_for: Arc::new(Mutex::new(Vec::new())), } } + + fn add_session(&mut self, session_id: u64) { + self.session_map + .insert(session_id, authority_data_for_session(session_id)); + self.next_session_map + .insert(session_id, authority_data_for_session(session_id + 1)); + } } impl MockNotificator { @@ -408,14 +415,10 @@ mod tests { impl AuthorityProvider> for MockProvider { fn authority_data(&self, b: NumberFor) -> Option { - let mut asked = self.asked_for.lock().unwrap(); - asked.push(b); self.session_map.get(&b).cloned() } fn next_authority_data(&self, b: NumberFor) -> Option { - let mut asked = self.asked_for.lock().unwrap(); - asked.push(b); self.next_session_map.get(&b).cloned() } } @@ -432,15 +435,6 @@ mod tests { } } - fn authority_data(from: u64, to: u64) -> SessionAuthorityData { - SessionAuthorityData::new( - (from..to) - .map(|id| UintAuthorityId(id).to_public_key()) - .collect(), - None, - ) - } - fn n_new_blocks(client: &mut Arc, n: u64) -> Vec { (0..n) .map(|_| { @@ -458,48 +452,66 @@ mod tests { .collect() } + fn authority_data_for_session(session_id: u64) -> SessionAuthorityData { + authority_data(session_id * 4, (session_id + 1) * 4) + } + + fn to_notification(block: TBlock) -> FinalityNotification { + let (sender, _) = tracing_unbounded("test", 1); + let summary = FinalizeSummary { + header: block.header, + finalized: vec![], + stale_heads: vec![], + }; + + FinalityNotification::from_summary(summary, sender) + } + + #[tokio::test(flavor = "multi_thread")] + async fn genesis_catch_up() { + let (_sender, receiver) = tracing_unbounded("test", 1_000); + let mut mock_provider = MockProvider::new(); + let mock_notificator = MockNotificator::new(receiver); + + mock_provider.add_session(0); + + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); + let session_map = updater.readonly_session_map(); + + let _handle = tokio::spawn(updater.run()); + + // wait a bit + Delay::new(Duration::from_millis(50)).await; + + assert_eq!( + session_map.get(SessionId(0)).await, + Some(authority_data(0, 4)) + ); + assert_eq!( + session_map.get(SessionId(1)).await, + Some(authority_data(4, 8)) + ); + } + #[tokio::test(flavor = "multi_thread")] async fn updates_session_map_on_notifications() { let mut client = Arc::new(TestClientBuilder::new().build()); - let (sender, receiver) = tracing_unbounded("test"); + let (sender, receiver) = tracing_unbounded("test", 1_000); let mut mock_provider = MockProvider::new(); let mock_notificator = MockNotificator::new(receiver); - mock_provider.session_map.insert(0, authority_data(0, 4)); - mock_provider - .next_session_map - .insert(0, authority_data(4, 8)); - mock_provider - .next_session_map - .insert(1, authority_data(8, 12)); - mock_provider - .next_session_map - .insert(2, authority_data(12, 16)); - - let updater = SessionMapUpdater::new(mock_provider, mock_notificator); + mock_provider.add_session(0); + mock_provider.add_session(1); + mock_provider.add_session(2); + + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); let session_map = updater.readonly_session_map(); - let blocks = n_new_blocks(&mut client, 2); - let block_1 = blocks.get(0).cloned().unwrap(); - let block_2 = blocks.get(1).cloned().unwrap(); - sender - .unbounded_send(FinalityNotification { - hash: block_1.header.hash(), - header: block_1.header, - tree_route: Arc::new([]), - stale_heads: Arc::new([]), - }) - .unwrap(); - sender - .unbounded_send(FinalityNotification { - hash: block_2.header.hash(), - header: block_2.header, - tree_route: Arc::new([]), - stale_heads: Arc::new([]), - }) - .unwrap(); + for block in n_new_blocks(&mut client, 2) { + sender.unbounded_send(to_notification(block)).unwrap(); + } - let _handle = tokio::spawn(updater.run(SessionPeriod(1))); + let _handle = tokio::spawn(updater.run()); // wait a bit Delay::new(Duration::from_millis(50)).await; @@ -523,80 +535,64 @@ mod tests { } #[tokio::test(flavor = "multi_thread")] - async fn updates_session_map_on_catching_up() { - let (_sender, receiver) = tracing_unbounded("test"); + async fn catch_up() { + let (_sender, receiver) = tracing_unbounded("test", 1_000); let mut mock_provider = MockProvider::new(); let mut mock_notificator = MockNotificator::new(receiver); - mock_provider.session_map.insert(0, authority_data(0, 4)); - mock_provider - .next_session_map - .insert(0, authority_data(4, 8)); - mock_provider - .next_session_map - .insert(1, authority_data(8, 12)); - mock_provider - .next_session_map - .insert(2, authority_data(12, 16)); + mock_provider.add_session(0); + mock_provider.add_session(1); + mock_provider.add_session(2); mock_notificator.last_finalized = 2; - let updater = SessionMapUpdater::new(mock_provider, mock_notificator); + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); let session_map = updater.readonly_session_map(); - let _handle = tokio::spawn(updater.run(SessionPeriod(1))); + let _handle = tokio::spawn(updater.run()); // wait a bit Delay::new(Duration::from_millis(50)).await; assert_eq!( session_map.get(SessionId(0)).await, - Some(authority_data(0, 4)) + Some(authority_data_for_session(0)) ); assert_eq!( session_map.get(SessionId(1)).await, - Some(authority_data(4, 8)) + Some(authority_data_for_session(1)) ); assert_eq!( session_map.get(SessionId(2)).await, - Some(authority_data(8, 12)) + Some(authority_data_for_session(2)) ); assert_eq!( session_map.get(SessionId(3)).await, - Some(authority_data(12, 16)) + Some(authority_data_for_session(3)) ); } #[tokio::test(flavor = "multi_thread")] - async fn prunes_old_sessions() { - let (_sender, receiver) = tracing_unbounded("test"); + async fn catch_up_old_sessions() { + let (_sender, receiver) = tracing_unbounded("test", 1_000); let mut mock_provider = MockProvider::new(); let mut mock_notificator = MockNotificator::new(receiver); - mock_provider.session_map.insert(0, authority_data(0, 4)); for i in 0..=2 * PRUNING_THRESHOLD { - mock_provider.next_session_map.insert( - i as u64, - authority_data(4 * (i + 1) as u64, 4 * (i + 2) as u64), - ); + mock_provider.add_session(i as u64); } mock_notificator.last_finalized = 20; - let asked = mock_provider.asked_for.clone(); - let updater = SessionMapUpdater::new(mock_provider, mock_notificator); + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); let session_map = updater.readonly_session_map(); - let _handle = tokio::spawn(updater.run(SessionPeriod(1))); + let _handle = tokio::spawn(updater.run()); // wait a bit Delay::new(Duration::from_millis(50)).await; - { - let asked = asked.lock().unwrap(); - assert_eq!((10..=20).into_iter().collect::>(), *asked); - } - for i in 0..=20 - PRUNING_THRESHOLD { + for i in 0..=PRUNING_THRESHOLD { assert_eq!( session_map.get(SessionId(i)).await, None, @@ -604,16 +600,120 @@ mod tests { i ); } - for i in 21 - PRUNING_THRESHOLD..=20 { + for i in PRUNING_THRESHOLD + 1..=2 * PRUNING_THRESHOLD { assert_eq!( session_map.get(SessionId(i)).await, - Some(authority_data(4 * i as u64, 4 * (i + 1) as u64)), + Some(authority_data_for_session(i as u64)), "Session {:?} should not be pruned", i ); } } + #[tokio::test(flavor = "multi_thread")] + async fn deals_with_database_pruned_authorities() { + let (_sender, receiver) = tracing_unbounded("test", 1_000); + let mut mock_provider = MockProvider::new(); + let mut mock_notificator = MockNotificator::new(receiver); + + mock_provider.add_session(5); + mock_notificator.last_finalized = 5; + + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); + let session_map = updater.readonly_session_map(); + + let _handle = tokio::spawn(updater.run()); + + // wait a bit + Delay::new(Duration::from_millis(50)).await; + + for i in 0..5 { + assert_eq!( + session_map.get(SessionId(i)).await, + None, + "Session {:?} should not be available", + i + ); + } + + assert_eq!( + session_map.get(SessionId(5)).await, + Some(authority_data_for_session(5)) + ); + assert_eq!( + session_map.get(SessionId(6)).await, + Some(authority_data_for_session(6)) + ); + } + + #[tokio::test(flavor = "multi_thread")] + async fn prunes_old_sessions() { + let mut client = Arc::new(TestClientBuilder::new().build()); + let (sender, receiver) = tracing_unbounded("test", 1_000); + let mut mock_provider = MockProvider::new(); + let mock_notificator = MockNotificator::new(receiver); + + for i in 0..=2 * PRUNING_THRESHOLD { + mock_provider.add_session(i as u64); + } + + let updater = SessionMapUpdater::new(mock_provider, mock_notificator, SessionPeriod(1)); + let session_map = updater.readonly_session_map(); + + let _handle = tokio::spawn(updater.run()); + + let mut blocks = n_new_blocks(&mut client, 2 * PRUNING_THRESHOLD as u64); + + for block in blocks.drain(..PRUNING_THRESHOLD as usize) { + sender.unbounded_send(to_notification(block)).unwrap(); + } + + // wait a bit + Delay::new(Duration::from_millis(50)).await; + + for i in 0..=PRUNING_THRESHOLD + 1 { + assert_eq!( + session_map.get(SessionId(i)).await, + Some(authority_data_for_session(i as u64)), + "Session {:?} should be available", + i + ); + } + + for i in PRUNING_THRESHOLD + 2..=21 { + assert_eq!( + session_map.get(SessionId(i)).await, + None, + "Session {:?} should not be avalable yet", + i + ); + } + + for block in blocks { + sender.unbounded_send(to_notification(block)).unwrap(); + } + + Delay::new(Duration::from_millis(50)).await; + + for i in 0..PRUNING_THRESHOLD { + assert_eq!( + session_map.get(SessionId(i)).await, + None, + "Session {:?} should be pruned", + i + ); + } + + for i in PRUNING_THRESHOLD + 1..=21 { + assert_eq!( + session_map.get(SessionId(i)).await, + Some(authority_data_for_session(i as u64)), + "Session {:?} should be avalable", + i + ); + } + } + #[tokio::test(flavor = "multi_thread")] async fn subscription_with_already_defined_session_works() { let mut shared = SharedSessionMap::new(); diff --git a/finality-aleph/src/substrate_network.rs b/finality-aleph/src/substrate_network.rs deleted file mode 100644 index fc8d3a5aef..0000000000 --- a/finality-aleph/src/substrate_network.rs +++ /dev/null @@ -1,465 +0,0 @@ -use std::{borrow::Cow, collections::HashSet, fmt, iter, pin::Pin, sync::Arc}; - -use async_trait::async_trait; -use codec::{Decode, Encode}; -use futures::stream::{Stream, StreamExt}; -use log::error; -use sc_consensus::JustificationSyncLink; -use sc_network::{ - multiaddr::Protocol as MultiaddressProtocol, Event as SubstrateEvent, ExHashT, Multiaddr, - NetworkService, NetworkStateInfo, NetworkSyncForkRequest, PeerId as SubstratePeerId, -}; -use sc_network_common::service::{ - NetworkEventStream as _, NetworkNotification, NetworkPeers, NotificationSender, -}; -use sp_api::NumberFor; -use sp_consensus::SyncOracle; -use sp_runtime::traits::Block; - -use crate::network::{ - Event, EventStream, Multiaddress as MultiaddressT, Network, NetworkIdentity, NetworkSender, - PeerId as PeerIdT, Protocol, RequestBlocks, -}; - -impl RequestBlocks for Arc> { - fn request_justification(&self, hash: &B::Hash, number: NumberFor) { - NetworkService::request_justification(self, hash, number) - } - - fn request_stale_block(&self, hash: B::Hash, number: NumberFor) { - // The below comment is adapted from substrate: - // Notifies the sync service to try and sync the given block from the given peers. If the given vector - // of peers is empty (as in our case) then the underlying implementation should make a best effort to fetch - // the block from any peers it is connected to. - NetworkService::set_sync_fork_request(self, Vec::new(), hash, number) - } - - /// Clear all pending justification requests. - fn clear_justification_requests(&self) { - NetworkService::clear_justification_requests(self) - } - - fn is_major_syncing(&self) -> bool { - NetworkService::is_major_syncing(self) - } -} - -#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] -pub struct PeerId(SubstratePeerId); - -impl From for SubstratePeerId { - fn from(wrapper: PeerId) -> Self { - wrapper.0 - } -} - -impl From for PeerId { - fn from(id: SubstratePeerId) -> Self { - PeerId(id) - } -} - -impl Encode for PeerId { - fn using_encoded R>(&self, f: F) -> R { - self.0.to_bytes().using_encoded(f) - } -} - -impl Decode for PeerId { - fn decode(value: &mut I) -> Result { - let bytes = Vec::::decode(value)?; - SubstratePeerId::from_bytes(&bytes) - .map_err(|_| "PeerId not encoded with to_bytes".into()) - .map(|pid| pid.into()) - } -} - -impl fmt::Display for PeerId { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl PeerIdT for PeerId {} - -fn peer_id(protocol: &MultiaddressProtocol<'_>) -> Option { - match protocol { - MultiaddressProtocol::P2p(hashed_peer_id) => { - SubstratePeerId::from_multihash(*hashed_peer_id) - .ok() - .map(PeerId) - } - _ => None, - } -} - -/// A wrapper for the Substrate multiaddress to allow encoding & decoding. -#[derive(Clone, Debug, Hash, PartialEq, Eq)] -pub struct Multiaddress(Multiaddr); - -impl From for Multiaddress { - fn from(addr: Multiaddr) -> Self { - Multiaddress(addr) - } -} - -impl From for Multiaddr { - fn from(addr: Multiaddress) -> Self { - addr.0 - } -} - -impl Encode for Multiaddress { - fn using_encoded R>(&self, f: F) -> R { - self.0.to_vec().using_encoded(f) - } -} - -impl Decode for Multiaddress { - fn decode(value: &mut I) -> Result { - let bytes = Vec::::decode(value)?; - Multiaddr::try_from(bytes) - .map_err(|_| "Multiaddr not encoded as bytes".into()) - .map(|multiaddr| multiaddr.into()) - } -} - -enum CommonPeerId { - Unknown, - Unique(PeerId), - NotUnique, -} - -impl From for Option { - fn from(cpi: CommonPeerId) -> Self { - use CommonPeerId::*; - match cpi { - Unique(peer_id) => Some(peer_id), - Unknown | NotUnique => None, - } - } -} - -impl CommonPeerId { - fn aggregate(self, peer_id: PeerId) -> Self { - use CommonPeerId::*; - match self { - Unknown => Unique(peer_id), - Unique(current_peer_id) => match peer_id == current_peer_id { - true => Unique(current_peer_id), - false => NotUnique, - }, - NotUnique => NotUnique, - } - } -} - -impl MultiaddressT for Multiaddress { - type PeerId = PeerId; - - fn get_peer_id(&self) -> Option { - self.0 - .iter() - .fold( - CommonPeerId::Unknown, - |common_peer_id, protocol| match peer_id(&protocol) { - Some(peer_id) => common_peer_id.aggregate(peer_id), - None => common_peer_id, - }, - ) - .into() - } - - fn add_matching_peer_id(mut self, peer_id: Self::PeerId) -> Option { - match self.get_peer_id() { - Some(peer) => match peer == peer_id { - true => Some(self), - false => None, - }, - None => { - self.0.push(MultiaddressProtocol::P2p(peer_id.0.into())); - Some(self) - } - } - } -} - -/// Name of the network protocol used by Aleph Zero. This is how messages -/// are subscribed to ensure that we are gossiping and communicating with our -/// own network. -const LEGACY_ALEPH_PROTOCOL_NAME: &str = "/cardinals/aleph/2"; - -/// Name of the network protocol used by Aleph Zero. This is how messages -/// are subscribed to ensure that we are gossiping and communicating with our -/// own network. -const AUTHENTICATION_PROTOCOL_NAME: &str = "/aleph/1"; - -/// Name of the network protocol used by Aleph Zero validators. Similar to -/// ALEPH_PROTOCOL_NAME, but only used by validators that authenticated to each other. -const LEGACY_ALEPH_VALIDATOR_PROTOCOL_NAME: &str = "/cardinals/aleph_validator/1"; - -/// Returns the canonical name of the protocol. -pub fn protocol_name(protocol: &Protocol) -> Cow<'static, str> { - use Protocol::*; - match protocol { - Authentication => Cow::Borrowed(AUTHENTICATION_PROTOCOL_NAME), - Generic => Cow::Borrowed(LEGACY_ALEPH_PROTOCOL_NAME), - Validator => Cow::Borrowed(LEGACY_ALEPH_VALIDATOR_PROTOCOL_NAME), - } -} - -/// Attempts to convert the protocol name to a protocol. -fn to_protocol(protocol_name: &str) -> Result { - match protocol_name { - AUTHENTICATION_PROTOCOL_NAME => Ok(Protocol::Authentication), - LEGACY_ALEPH_PROTOCOL_NAME => Ok(Protocol::Generic), - LEGACY_ALEPH_VALIDATOR_PROTOCOL_NAME => Ok(Protocol::Validator), - _ => Err(()), - } -} - -#[derive(Debug)] -pub enum SenderError { - CannotCreateSender(PeerId, Protocol), - LostConnectionToPeer(PeerId), - LostConnectionToPeerReady(PeerId), -} - -impl fmt::Display for SenderError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - SenderError::CannotCreateSender(peer_id, protocol) => { - write!( - f, - "Can not create sender to peer {:?} with protocol {:?}", - peer_id, protocol - ) - } - SenderError::LostConnectionToPeer(peer_id) => { - write!( - f, - "Lost connection to peer {:?} while preparing sender", - peer_id - ) - } - SenderError::LostConnectionToPeerReady(peer_id) => { - write!( - f, - "Lost connection to peer {:?} after sender was ready", - peer_id - ) - } - } - } -} - -impl std::error::Error for SenderError {} - -pub struct SubstrateNetworkSender { - notification_sender: Box, - peer_id: PeerId, -} - -#[async_trait] -impl NetworkSender for SubstrateNetworkSender { - type SenderError = SenderError; - - async fn send<'a>( - &'a self, - data: impl Into> + Send + Sync + 'static, - ) -> Result<(), SenderError> { - self.notification_sender - .ready() - .await - .map_err(|_| SenderError::LostConnectionToPeer(self.peer_id))? - .send(data.into()) - .map_err(|_| SenderError::LostConnectionToPeerReady(self.peer_id)) - } -} - -type NetworkEventStream = Pin + Send>>; - -#[async_trait] -impl EventStream for NetworkEventStream { - async fn next_event(&mut self) -> Option> { - use Event::*; - use SubstrateEvent::*; - loop { - match self.next().await { - Some(event) => match event { - SyncConnected { remote } => { - return Some(Connected(Multiaddress( - iter::once(MultiaddressProtocol::P2p(remote.into())).collect(), - ))) - } - SyncDisconnected { remote } => return Some(Disconnected(remote.into())), - NotificationStreamOpened { - remote, protocol, .. - } => match to_protocol(protocol.as_ref()) { - Ok(protocol) => return Some(StreamOpened(remote.into(), protocol)), - Err(_) => continue, - }, - NotificationStreamClosed { remote, protocol } => { - match to_protocol(protocol.as_ref()) { - Ok(protocol) => return Some(StreamClosed(remote.into(), protocol)), - Err(_) => continue, - } - } - NotificationsReceived { messages, .. } => { - return Some(Messages( - messages - .into_iter() - .filter_map(|(protocol, data)| { - match to_protocol(protocol.as_ref()) { - Ok(protocol) => Some((protocol, data)), - // This might end with us returning an empty vec, but it's probably not - // worth it to handle this situation here. - Err(_) => None, - } - }) - .collect(), - )); - } - Dht(_) => continue, - }, - None => return None, - } - } - } -} - -impl Network for Arc> { - type SenderError = SenderError; - type NetworkSender = SubstrateNetworkSender; - type PeerId = PeerId; - type Multiaddress = Multiaddress; - type EventStream = NetworkEventStream; - - fn event_stream(&self) -> Self::EventStream { - Box::pin(self.as_ref().event_stream("aleph-network")) - } - - fn sender( - &self, - peer_id: Self::PeerId, - protocol: Protocol, - ) -> Result { - Ok(SubstrateNetworkSender { - // Currently method `notification_sender` does not distinguish whether we are not connected to the peer - // or there is no such protocol so we need to have this worthless `SenderError::CannotCreateSender` error here - notification_sender: self - .notification_sender(peer_id.into(), protocol_name(&protocol)) - .map_err(|_| SenderError::CannotCreateSender(peer_id, protocol))?, - peer_id, - }) - } - - fn add_reserved(&self, addresses: HashSet, protocol: Protocol) { - if let Err(e) = self.add_peers_to_reserved_set( - protocol_name(&protocol), - addresses - .into_iter() - .map(|address| address.into()) - .collect(), - ) { - error!(target: "aleph-network", "add_reserved failed: {}", e); - } - } - - fn remove_reserved(&self, peers: HashSet, protocol: Protocol) { - let addresses = peers.into_iter().map(|peer_id| peer_id.0).collect(); - self.remove_peers_from_reserved_set(protocol_name(&protocol), addresses); - } -} - -impl NetworkIdentity for Arc> { - type PeerId = PeerId; - type Multiaddress = Multiaddress; - - fn identity(&self) -> (Vec, Self::PeerId) { - ( - self.external_addresses() - .into_iter() - .map(|address| address.into()) - .collect(), - self.local_peer_id().into(), - ) - } -} - -#[cfg(test)] -mod tests { - use codec::{Decode, Encode}; - - use super::Multiaddress; - use crate::network::Multiaddress as _; - - fn address(text: &str) -> Multiaddress { - Multiaddress(text.parse().unwrap()) - } - - #[test] - fn non_p2p_addresses_are_not_p2p() { - assert!(address("/dns4/example.com/udt/sctp/5678") - .get_peer_id() - .is_none()); - } - - #[test] - fn p2p_addresses_are_p2p() { - assert!(address( - "/dns4/example.com/tcp/30333/p2p/12D3KooWRkGLz4YbVmrsWK75VjFTs8NvaBu42xhAmQaP4KeJpw1L" - ) - .get_peer_id() - .is_some()); - } - - #[test] - fn non_p2p_address_matches_peer_id() { - let address = address( - "/dns4/example.com/tcp/30333/p2p/12D3KooWRkGLz4YbVmrsWK75VjFTs8NvaBu42xhAmQaP4KeJpw1L", - ); - let peer_id = address.get_peer_id().unwrap(); - let mut peerless_address = address.clone().0; - peerless_address.pop(); - let peerless_address = Multiaddress(peerless_address); - assert!(peerless_address.get_peer_id().is_none()); - assert_eq!( - peerless_address.add_matching_peer_id(peer_id), - Some(address), - ); - } - - #[test] - fn p2p_address_matches_own_peer_id() { - let address = address( - "/dns4/example.com/tcp/30333/p2p/12D3KooWRkGLz4YbVmrsWK75VjFTs8NvaBu42xhAmQaP4KeJpw1L", - ); - let peer_id = address.get_peer_id().unwrap(); - let expected_address = address.clone(); - assert_eq!( - address.add_matching_peer_id(peer_id), - Some(expected_address), - ); - } - - #[test] - fn p2p_address_does_not_match_other_peer_id() { - let nonmatching_address = address( - "/dns4/example.com/tcp/30333/p2p/12D3KooWRkGLz4YbVmrsWK75VjFTs8NvaBu42xhAmQaP4KeJpw1L", - ); - let peer_id = address("/dns4/peer.example.com/tcp/30333/p2p/12D3KooWFVXnvJdPuGnGYMPn5qLQAQYwmRBgo6SmEQsKZSrDoo2k").get_peer_id().unwrap(); - assert!(nonmatching_address.add_matching_peer_id(peer_id).is_none()); - } - - #[test] - fn multiaddr_encode_decode() { - let multiaddr: Multiaddress = address( - "/dns4/example.com/tcp/30333/p2p/12D3KooWRkGLz4YbVmrsWK75VjFTs8NvaBu42xhAmQaP4KeJpw1L", - ); - assert_eq!( - Multiaddress::decode(&mut &multiaddr.encode()[..]).unwrap(), - multiaddr, - ); - } -} diff --git a/finality-aleph/src/sync/data.rs b/finality-aleph/src/sync/data.rs new file mode 100644 index 0000000000..3d6e3eee1b --- /dev/null +++ b/finality-aleph/src/sync/data.rs @@ -0,0 +1,169 @@ +use std::{collections::HashSet, marker::PhantomData, mem::size_of}; + +use aleph_primitives::MAX_BLOCK_SIZE; +use codec::{Decode, Encode, Error as CodecError, Input as CodecInput}; +use log::warn; + +use crate::{ + network::GossipNetwork, + sync::{BlockIdFor, Justification, LOG_TARGET}, + Version, +}; + +/// The representation of the database state to be sent to other nodes. +/// In the first version this only contains the top justification. +#[derive(Clone, Debug, Encode, Decode)] +pub struct State { + top_justification: J::Unverified, +} + +impl State { + pub fn new(top_justification: J::Unverified) -> Self { + State { top_justification } + } + + pub fn top_justification(&self) -> J::Unverified { + self.top_justification.clone() + } +} + +/// Data to be sent over the network. +#[derive(Clone, Debug, Encode, Decode)] +pub enum NetworkData { + /// A periodic state broadcast, so that neighbouring nodes can request what they are missing, + /// send what we are missing, and sometines just use the justifications to update their own + /// state. + StateBroadcast(State), + /// A series of justifications, sent to a node that is clearly behind. + Justifications(Vec, State), + /// An explicit request for data, potentially a lot of it. + Request(BlockIdFor, State), +} + +/// Version wrapper around the network data. +#[derive(Clone, Debug)] +pub enum VersionedNetworkData { + // Most likely from the future. + Other(Version, Vec), + V1(NetworkData), +} + +// We need 32 bits, since blocks can be quite sizeable. +type ByteCount = u32; + +// We want to be able to safely send at least 10 blocks at once, so this gives uss a bit of wiggle +// room. +const MAX_SYNC_MESSAGE_SIZE: u32 = MAX_BLOCK_SIZE * 11; + +fn encode_with_version(version: Version, payload: &[u8]) -> Vec { + let size = payload.len().try_into().unwrap_or(ByteCount::MAX); + + if size > MAX_SYNC_MESSAGE_SIZE { + warn!( + target: LOG_TARGET, + "Versioned sync message v{:?} too big during Encode. Size is {:?}. Should be {:?} at max.", + version, + payload.len(), + MAX_SYNC_MESSAGE_SIZE + ); + } + + let mut result = Vec::with_capacity(version.size_hint() + size.size_hint() + payload.len()); + + version.encode_to(&mut result); + size.encode_to(&mut result); + result.extend_from_slice(payload); + + result +} + +impl Encode for VersionedNetworkData { + fn size_hint(&self) -> usize { + use VersionedNetworkData::*; + let version_size = size_of::(); + let byte_count_size = size_of::(); + version_size + + byte_count_size + + match self { + Other(_, payload) => payload.len(), + V1(data) => data.size_hint(), + } + } + + fn encode(&self) -> Vec { + use VersionedNetworkData::*; + match self { + Other(version, payload) => encode_with_version(*version, payload), + V1(data) => encode_with_version(Version(1), &data.encode()), + } + } +} + +impl Decode for VersionedNetworkData { + fn decode(input: &mut I) -> Result { + use VersionedNetworkData::*; + let version = Version::decode(input)?; + let num_bytes = ByteCount::decode(input)?; + match version { + Version(1) => Ok(V1(NetworkData::decode(input)?)), + _ => { + if num_bytes > MAX_SYNC_MESSAGE_SIZE { + Err("Sync message has unknown version and is encoded as more than the maximum size.")?; + }; + let mut payload = vec![0; num_bytes as usize]; + input.read(payload.as_mut_slice())?; + Ok(Other(version, payload)) + } + } + } +} + +/// Wrap around a network to avoid thinking about versioning. +pub struct VersionWrapper>> { + inner: N, + _phantom: PhantomData, +} + +impl>> VersionWrapper { + /// Wrap the inner network. + pub fn new(inner: N) -> Self { + VersionWrapper { + inner, + _phantom: PhantomData, + } + } +} + +#[async_trait::async_trait] +impl>> GossipNetwork> + for VersionWrapper +{ + type Error = N::Error; + type PeerId = N::PeerId; + + fn send_to(&mut self, data: NetworkData, peer_id: Self::PeerId) -> Result<(), Self::Error> { + self.inner.send_to(VersionedNetworkData::V1(data), peer_id) + } + + fn send_to_random( + &mut self, + data: NetworkData, + peer_ids: HashSet, + ) -> Result<(), Self::Error> { + self.inner + .send_to_random(VersionedNetworkData::V1(data), peer_ids) + } + + fn broadcast(&mut self, data: NetworkData) -> Result<(), Self::Error> { + self.inner.broadcast(VersionedNetworkData::V1(data)) + } + + async fn next(&mut self) -> Result<(NetworkData, Self::PeerId), Self::Error> { + loop { + match self.inner.next().await? { + (VersionedNetworkData::Other(version, _), _) => warn!(target: LOG_TARGET, "Received sync data of unsupported version {:?}, this node might be running outdated software.", version), + (VersionedNetworkData::V1(data), peer_id) => return Ok((data, peer_id)), + } + } + } +} diff --git a/finality-aleph/src/sync/forest/mod.rs b/finality-aleph/src/sync/forest/mod.rs new file mode 100644 index 0000000000..c0648debca --- /dev/null +++ b/finality-aleph/src/sync/forest/mod.rs @@ -0,0 +1,720 @@ +use std::collections::{ + hash_map::{Entry, OccupiedEntry, VacantEntry}, + HashMap, HashSet, +}; + +use crate::sync::{BlockIdFor, BlockIdentifier, Header, Justification, PeerId}; + +mod vertex; + +pub use vertex::JustificationAddResult; +use vertex::Vertex; + +pub struct JustificationWithParent { + pub justification: J, + pub parent: BlockIdFor, +} + +enum VertexHandle<'a, I: PeerId, J: Justification> { + HopelessFork, + BelowMinimal, + HighestFinalized, + Unknown(VacantEntry<'a, BlockIdFor, VertexWithChildren>), + Candidate(OccupiedEntry<'a, BlockIdFor, VertexWithChildren>), +} + +/// Our interest in a block referred to by a vertex, including the information about whom we expect to have the block. +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum Interest { + /// We are not interested in this block. + Uninterested, + /// We would like to have this block. + Required(HashSet), + /// We would like to have this block and its the highest on its branch. + TopRequired(HashSet), +} + +/// What can go wrong when inserting data into the forest. +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum Error { + HeaderMissingParentId, + IncorrectParentState, + IncorrectVertexState, + ParentNotImported, + TooNew, +} + +pub struct VertexWithChildren { + vertex: Vertex, + children: HashSet>, +} + +impl VertexWithChildren { + fn new() -> Self { + Self { + vertex: Vertex::new(), + children: HashSet::new(), + } + } + + fn add_child(&mut self, child: BlockIdFor) { + self.children.insert(child); + } +} + +// How deep can the forest be, vaguely based on two sessions ahead, which is the most we expect to +// ever need worst case scenario. +const MAX_DEPTH: u32 = 1800; + +pub struct Forest { + vertices: HashMap, VertexWithChildren>, + top_required: HashSet>, + root_id: BlockIdFor, + root_children: HashSet>, + compost_bin: HashSet>, +} + +impl Forest { + pub fn new(highest_justified: BlockIdFor) -> Self { + Self { + vertices: HashMap::new(), + top_required: HashSet::new(), + root_id: highest_justified, + root_children: HashSet::new(), + compost_bin: HashSet::new(), + } + } + + fn get_mut(&mut self, id: &BlockIdFor) -> VertexHandle { + use VertexHandle::*; + if id == &self.root_id { + HighestFinalized + } else if id.number() <= self.root_id.number() { + BelowMinimal + } else if self.compost_bin.contains(id) { + HopelessFork + } else { + match self.vertices.entry(id.clone()) { + Entry::Occupied(entry) => Candidate(entry), + Entry::Vacant(entry) => Unknown(entry), + } + } + } + + fn prune(&mut self, id: &BlockIdFor) { + self.top_required.remove(id); + if let Some(VertexWithChildren { children, .. }) = self.vertices.remove(id) { + self.compost_bin.insert(id.clone()); + for child in children { + self.prune(&child); + } + } + } + + fn connect_parent(&mut self, id: &BlockIdFor) { + use VertexHandle::*; + if let Candidate(mut entry) = self.get_mut(id) { + let vertex = entry.get_mut(); + let required = vertex.vertex.required(); + if let Some(parent_id) = vertex.vertex.parent().cloned() { + match self.get_mut(&parent_id) { + Unknown(entry) => { + entry + .insert(VertexWithChildren::new()) + .add_child(id.clone()); + if required { + self.set_required(&parent_id); + } + } + HighestFinalized => { + self.root_children.insert(id.clone()); + } + Candidate(mut entry) => { + entry.get_mut().add_child(id.clone()); + if required { + self.set_required(&parent_id); + } + } + HopelessFork | BelowMinimal => self.prune(id), + }; + }; + }; + } + + fn set_required(&mut self, id: &BlockIdFor) { + self.top_required.remove(id); + if let VertexHandle::Candidate(mut entry) = self.get_mut(id) { + let vertex = entry.get_mut(); + if vertex.vertex.set_required() { + if let Some(id) = vertex.vertex.parent().cloned() { + self.set_required(&id); + } + } + } + } + + fn set_top_required(&mut self, id: &BlockIdFor) -> bool { + match self.get_mut(id) { + VertexHandle::Candidate(mut entry) => match entry.get_mut().vertex.set_required() { + true => { + if let Some(parent_id) = entry.get_mut().vertex.parent().cloned() { + self.set_required(&parent_id); + } + self.top_required.insert(id.clone()); + true + } + false => false, + }, + _ => false, + } + } + + fn insert_id(&mut self, id: BlockIdFor, holder: Option) -> Result<(), Error> { + if id.number() > self.root_id.number() + MAX_DEPTH { + return Err(Error::TooNew); + } + self.vertices + .entry(id) + .or_insert_with(VertexWithChildren::new) + .vertex + .add_block_holder(holder); + Ok(()) + } + + fn process_header( + &mut self, + header: &J::Header, + ) -> Result<(BlockIdFor, BlockIdFor), Error> { + Ok(( + header.id(), + header.parent_id().ok_or(Error::HeaderMissingParentId)?, + )) + } + + /// Updates the provider block identifier, returns whether it became a new top required. + pub fn update_block_identifier( + &mut self, + id: &BlockIdFor, + holder: Option, + required: bool, + ) -> Result { + self.insert_id(id.clone(), holder)?; + match required { + true => Ok(self.set_top_required(id)), + false => Ok(false), + } + } + + /// Updates the provided header, returns whether it became a new top required. + pub fn update_header( + &mut self, + header: &J::Header, + holder: Option, + required: bool, + ) -> Result { + let (id, parent_id) = self.process_header(header)?; + self.insert_id(id.clone(), holder.clone())?; + if let VertexHandle::Candidate(mut entry) = self.get_mut(&id) { + entry.get_mut().vertex.insert_header(parent_id, holder); + self.connect_parent(&id); + } + match required { + true => Ok(self.set_top_required(&id)), + false => Ok(false), + } + } + + /// Updates the vertex related to the provided header marking it as imported. Returns whether + /// it is now finalizable, or errors when it's impossible to do consistently. + pub fn update_body(&mut self, header: &J::Header) -> Result { + use VertexHandle::*; + let (id, parent_id) = self.process_header(header)?; + self.update_header(header, None, false)?; + match self.get_mut(&parent_id) { + Candidate(entry) => { + if !entry.get().vertex.imported() { + return Err(Error::ParentNotImported); + } + } + HighestFinalized => (), + Unknown(_) | HopelessFork | BelowMinimal => return Err(Error::IncorrectParentState), + } + match self.get_mut(&id) { + Candidate(mut entry) => Ok(entry.get_mut().vertex.insert_body(parent_id.clone())), + _ => Err(Error::IncorrectVertexState), + } + } + + /// Updates the provided justification, returns whether either finalization is now possible or + /// the vertex became a new top required. + pub fn update_justification( + &mut self, + justification: J, + holder: Option, + ) -> Result { + use JustificationAddResult::*; + let (id, parent_id) = self.process_header(justification.header())?; + self.update_header(justification.header(), None, false)?; + match self.get_mut(&id) { + VertexHandle::Candidate(mut entry) => { + match entry.get_mut().vertex.insert_justification( + parent_id.clone(), + justification, + holder, + ) { + Noop => Ok(Noop), + Required => { + self.top_required.insert(id.clone()); + self.set_required(&parent_id); + Ok(Required) + } + Finalizable => { + self.top_required.remove(&id); + Ok(Finalizable) + } + } + } + _ => Ok(Noop), + } + } + + fn prune_level(&mut self, level: u32) { + let to_prune: Vec<_> = self + .vertices + .keys() + .filter(|k| k.number() <= level) + .cloned() + .collect(); + for id in to_prune.into_iter() { + self.prune(&id); + } + self.compost_bin.retain(|k| k.number() > level); + } + + /// Attempt to finalize one block, returns the correct justification if successful. + pub fn try_finalize(&mut self) -> Option { + for child_id in self.root_children.clone().into_iter() { + if let Some(VertexWithChildren { vertex, children }) = self.vertices.remove(&child_id) { + match vertex.ready() { + Ok(justification) => { + self.root_id = child_id; + self.root_children = children; + self.prune_level(self.root_id.number()); + return Some(justification); + } + Err(vertex) => { + self.vertices + .insert(child_id, VertexWithChildren { vertex, children }); + } + } + } + } + None + } + + /// How much interest we have for the block. + pub fn state(&mut self, id: &BlockIdFor) -> Interest { + match self.get_mut(id) { + VertexHandle::Candidate(entry) => { + let vertex = &entry.get().vertex; + let know_most = vertex.know_most().clone(); + match vertex.required() { + true => match self.top_required.contains(id) { + true => Interest::TopRequired(know_most), + false => Interest::Required(know_most), + }, + false => Interest::Uninterested, + } + } + _ => Interest::Uninterested, + } + } +} + +#[cfg(test)] +mod tests { + use super::{Error, Forest, Interest::*, JustificationAddResult, MAX_DEPTH}; + use crate::sync::{ + mock::{MockHeader, MockJustification, MockPeerId}, + Header, Justification, + }; + + type MockForest = Forest; + + fn setup() -> (MockHeader, MockForest) { + let header = MockHeader::random_parentless(0); + let forest = Forest::new(header.id()); + (header, forest) + } + + #[test] + fn initially_empty() { + let (initial_header, mut forest) = setup(); + assert!(forest.try_finalize().is_none()); + assert_eq!(forest.state(&initial_header.id()), Uninterested); + } + + #[test] + fn accepts_first_unimportant_id() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + let peer_id = rand::random(); + assert!(!forest + .update_block_identifier(&child.id(), Some(peer_id), false) + .expect("it's not too high")); + assert!(forest.try_finalize().is_none()); + assert_eq!(forest.state(&child.id()), Uninterested); + } + + #[test] + fn accepts_first_important_id() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + let peer_id = rand::random(); + assert!(forest + .update_block_identifier(&child.id(), Some(peer_id), true) + .expect("it's not too high")); + assert!(forest.try_finalize().is_none()); + match forest.state(&child.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert!(!forest + .update_block_identifier(&child.id(), Some(peer_id), true) + .expect("it's not too high")); + } + + #[test] + fn rejects_too_high_id() { + let (initial_header, mut forest) = setup(); + let too_high = initial_header + .random_branch() + .nth(MAX_DEPTH as usize) + .expect("the branch is infinite"); + let peer_id = rand::random(); + assert_eq!( + forest.update_block_identifier(&too_high.id(), Some(peer_id), true), + Err(Error::TooNew) + ); + } + + #[test] + fn accepts_first_unimportant_header() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + let peer_id = rand::random(); + assert!(!forest + .update_header(&child, Some(peer_id), false) + .expect("header was correct")); + assert!(forest.try_finalize().is_none()); + assert_eq!(forest.state(&child.id()), Uninterested); + } + + #[test] + fn accepts_first_important_header() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + let peer_id = rand::random(); + assert!(forest + .update_header(&child, Some(peer_id), true) + .expect("header was correct")); + assert!(forest.try_finalize().is_none()); + match forest.state(&child.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert!(!forest + .update_block_identifier(&child.id(), Some(peer_id), true) + .expect("it's not too high")); + } + + #[test] + fn rejects_parentless_header() { + let (_, mut forest) = setup(); + let parentless = MockHeader::random_parentless(43); + let peer_id = rand::random(); + assert!(matches!( + forest.update_header(&parentless, Some(peer_id), true), + Err(Error::HeaderMissingParentId) + )); + } + + #[test] + fn accepts_first_justification() { + let (initial_header, mut forest) = setup(); + let child = MockJustification::for_header(initial_header.random_child()); + let peer_id = rand::random(); + assert_eq!( + forest + .update_justification(child.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + assert!(forest.try_finalize().is_none()); + match forest.state(&child.header().id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + } + + #[test] + fn rejects_parentless_justification() { + let (_, mut forest) = setup(); + let parentless = MockJustification::for_header(MockHeader::random_parentless(43)); + let peer_id = rand::random(); + assert!(matches!( + forest.update_justification(parentless, Some(peer_id)), + Err(Error::HeaderMissingParentId) + )); + } + + #[test] + fn accepts_first_body() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + assert!(!forest.update_body(&child).expect("header was correct")); + assert!(forest.try_finalize().is_none()); + assert_eq!(forest.state(&child.id()), Uninterested); + } + + #[test] + fn rejects_body_when_parent_unimported() { + let (initial_header, mut forest) = setup(); + let child = initial_header.random_child(); + let grandchild = child.random_child(); + assert!(!forest + .update_header(&child, None, false) + .expect("header was correct")); + assert_eq!( + forest.update_body(&grandchild), + Err(Error::ParentNotImported) + ); + assert!(forest.try_finalize().is_none()); + assert_eq!(forest.state(&child.id()), Uninterested); + assert_eq!(forest.state(&grandchild.id()), Uninterested); + } + + #[test] + fn finalizes_first_block() { + let (initial_header, mut forest) = setup(); + let child = MockJustification::for_header(initial_header.random_child()); + let peer_id = rand::random(); + assert_eq!( + forest + .update_justification(child.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + assert!(forest.try_finalize().is_none()); + match forest.state(&child.header().id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert!(forest + .update_body(child.header()) + .expect("header was correct")); + assert_eq!(forest.try_finalize().expect("the block is ready"), child); + } + + #[test] + fn prunes_forks() { + let (initial_header, mut forest) = setup(); + let child = MockJustification::for_header(initial_header.random_child()); + let fork_child = initial_header.random_child(); + let peer_id = rand::random(); + let fork_peer_id = rand::random(); + assert!(forest + .update_header(&fork_child, Some(fork_peer_id), true) + .expect("header was correct")); + match forest.state(&fork_child.id()) { + TopRequired(holders) => assert!(holders.contains(&fork_peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert_eq!( + forest + .update_justification(child.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + assert!(forest + .update_body(child.header()) + .expect("header was correct")); + assert_eq!(forest.try_finalize().expect("the block is ready"), child); + assert_eq!(forest.state(&fork_child.id()), Uninterested); + assert!(!forest + .update_header(&fork_child, Some(fork_peer_id), true) + .expect("header was correct")); + } + + #[test] + fn uninterested_in_forks() { + let (initial_header, mut forest) = setup(); + let fork_branch: Vec<_> = initial_header.random_branch().take(2).collect(); + for header in &fork_branch { + let peer_id = rand::random(); + assert!(forest + .update_header(header, Some(peer_id), true) + .expect("header was correct")); + match forest.state(&header.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + } + let child = MockJustification::for_header(initial_header.random_child()); + let peer_id = rand::random(); + assert_eq!( + forest + .update_justification(child.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + assert!(forest + .update_body(child.header()) + .expect("header was correct")); + assert_eq!(forest.try_finalize().expect("the block is ready"), child); + for header in fork_branch { + assert_eq!(forest.state(&header.id()), Uninterested); + } + } + + #[test] + fn updates_interest_on_parent_connect() { + let (initial_header, mut forest) = setup(); + let branch: Vec<_> = initial_header.random_branch().take(4).collect(); + let header = &branch[0]; + let peer_id = rand::random(); + assert!(forest + .update_header(header, Some(peer_id), true) + .expect("header was correct")); + match forest.state(&header.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + let header = &branch[1]; + let peer_id = rand::random(); + assert!(!forest + .update_header(header, Some(peer_id), false) + .expect("header was correct")); + assert_eq!(forest.state(&header.id()), Uninterested); + let header = &branch[3]; + let peer_id = rand::random(); + assert!(forest + .update_header(header, Some(peer_id), true) + .expect("header was correct")); + match forest.state(&header.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + let header = &branch[2]; + let peer_id = rand::random(); + assert!(!forest + .update_header(header, Some(peer_id), false) + .expect("header was correct")); + for header in branch.iter().take(3) { + assert!(matches!(forest.state(&header.id()), Required(_))); + } + assert!(matches!(forest.state(&branch[3].id()), TopRequired(_))); + } + + const HUGE_BRANCH_LENGTH: usize = MAX_DEPTH as usize; + + #[test] + fn finalizes_huge_branch() { + let (initial_header, mut forest) = setup(); + let justifications: Vec<_> = initial_header + .random_branch() + .map(MockJustification::for_header) + .take(HUGE_BRANCH_LENGTH) + .collect(); + for justification in &justifications { + let peer_id = rand::random(); + assert_eq!( + forest + .update_justification(justification.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + match forest.state(&justification.header().id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert!(forest + .update_body(justification.header()) + .expect("header was correct")); + } + for justification in justifications { + assert_eq!( + forest.try_finalize().expect("the block is ready"), + justification + ); + } + } + + #[test] + fn prunes_huge_branch() { + let (initial_header, mut forest) = setup(); + let fork: Vec<_> = initial_header + .random_branch() + .take(HUGE_BRANCH_LENGTH) + .collect(); + for header in &fork { + let peer_id = rand::random(); + assert!(forest + .update_header(header, Some(peer_id), true) + .expect("header was correct")); + assert!(forest.try_finalize().is_none()); + match forest.state(&header.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + } + let child = MockJustification::for_header(initial_header.random_child()); + let peer_id = rand::random(); + assert_eq!( + forest + .update_justification(child.clone(), Some(peer_id)) + .expect("header was correct"), + JustificationAddResult::Required + ); + assert!(forest.try_finalize().is_none()); + match forest.state(&child.header().id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + assert!(forest + .update_body(child.header()) + .expect("header was correct")); + assert_eq!(forest.try_finalize().expect("the block is ready"), child); + for header in &fork { + assert_eq!(forest.state(&header.id()), Uninterested); + } + } + + #[test] + fn updates_interest_on_huge_branch() { + let (initial_header, mut forest) = setup(); + let branch: Vec<_> = initial_header + .random_branch() + .take(HUGE_BRANCH_LENGTH) + .collect(); + for header in branch.iter().take(HUGE_BRANCH_LENGTH - 1) { + let peer_id = rand::random(); + assert!(!forest + .update_header(header, Some(peer_id), false) + .expect("header was correct")); + assert_eq!(forest.state(&header.id()), Uninterested); + } + let header = &branch[HUGE_BRANCH_LENGTH - 1]; + let peer_id = rand::random(); + assert!(forest + .update_header(header, Some(peer_id), true) + .expect("header was correct")); + match forest.state(&header.id()) { + TopRequired(holders) => assert!(holders.contains(&peer_id)), + other_state => panic!("Expected top required, got {:?}.", other_state), + } + for header in branch.iter().take(HUGE_BRANCH_LENGTH - 1) { + assert!(matches!(forest.state(&header.id()), Required(_))); + } + } +} diff --git a/finality-aleph/src/sync/forest/vertex.rs b/finality-aleph/src/sync/forest/vertex.rs new file mode 100644 index 0000000000..7d26d66bdc --- /dev/null +++ b/finality-aleph/src/sync/forest/vertex.rs @@ -0,0 +1,474 @@ +use std::collections::HashSet; + +use crate::sync::{BlockIdFor, Justification, PeerId}; + +#[derive(Clone, Debug, Copy, PartialEq, Eq)] +enum HeaderImportance { + Auxiliary, + Required, + Imported, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +enum InnerVertex { + /// Empty Vertex. + Empty { required: bool }, + /// Vertex with added Header. + Header { + importance: HeaderImportance, + parent: BlockIdFor, + }, + /// Vertex with added Header and Justification. + Justification { + imported: bool, + justification: J, + parent: BlockIdFor, + }, +} + +/// The complete vertex, including metadata about peers that know most about the data it refers to. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Vertex { + inner: InnerVertex, + know_most: HashSet, +} + +/// What can happen when we add a justification. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum JustificationAddResult { + Noop, + Required, + Finalizable, +} + +impl Vertex { + /// Create a new empty vertex. + pub fn new() -> Self { + Vertex { + inner: InnerVertex::Empty { required: false }, + know_most: HashSet::new(), + } + } + + /// Whether the vertex is required. + pub fn required(&self) -> bool { + use InnerVertex::*; + matches!( + self.inner, + Empty { required: true } + | Header { + importance: HeaderImportance::Required, + .. + } + | Justification { + imported: false, + .. + } + ) + } + + /// Whether the vertex is imported. + pub fn imported(&self) -> bool { + use InnerVertex::*; + matches!( + self.inner, + Header { + importance: HeaderImportance::Imported, + .. + } | Justification { imported: true, .. } + ) + } + + /// Deconstructs the vertex into a justification if it is ready to be imported, + /// i.e. the related block has already been imported, otherwise returns it. + pub fn ready(self) -> Result { + match self.inner { + InnerVertex::Justification { + imported: true, + justification, + .. + } => Ok(justification), + _ => Err(self), + } + } + + /// The parent of the vertex, if known. + pub fn parent(&self) -> Option<&BlockIdFor> { + match &self.inner { + InnerVertex::Empty { .. } => None, + InnerVertex::Header { parent, .. } => Some(parent), + InnerVertex::Justification { parent, .. } => Some(parent), + } + } + + /// The list of peers which know most about the data this vertex refers to. + pub fn know_most(&self) -> &HashSet { + &self.know_most + } + + /// Set the vertex to be required, returns whether anything changed, i.e. the vertex was not + /// required or imported before. + pub fn set_required(&mut self) -> bool { + use InnerVertex::*; + match &self.inner { + Empty { required: false } => { + self.inner = Empty { required: true }; + true + } + Header { + importance: HeaderImportance::Auxiliary, + parent, + } => { + self.inner = Header { + importance: HeaderImportance::Required, + parent: parent.clone(), + }; + true + } + _ => false, + } + } + + /// Adds a peer that knows most about the block this vertex refers to. Does nothing if we + /// already have a justification. + pub fn add_block_holder(&mut self, holder: Option) { + if let Some(holder) = holder { + if !matches!(self.inner, InnerVertex::Justification { .. }) { + self.know_most.insert(holder); + } + } + } + + /// Adds the information the header provides to the vertex. + pub fn insert_header(&mut self, parent: BlockIdFor, holder: Option) { + self.add_block_holder(holder); + if let InnerVertex::Empty { required } = self.inner { + let importance = match required { + false => HeaderImportance::Auxiliary, + true => HeaderImportance::Required, + }; + self.inner = InnerVertex::Header { importance, parent }; + } + } + + /// Adds the information the header provides to the vertex and marks it as imported. Returns + /// whether finalization is now possible. + pub fn insert_body(&mut self, parent: BlockIdFor) -> bool { + use InnerVertex::*; + match &self.inner { + Empty { .. } | Header { .. } => { + self.inner = Header { + parent, + importance: HeaderImportance::Imported, + }; + false + } + Justification { + imported: false, + parent, + justification, + } => { + self.inner = Justification { + imported: true, + parent: parent.clone(), + justification: justification.clone(), + }; + true + } + _ => false, + } + } + + /// Adds a justification to the vertex. Returns whether either the finalization is now possible + /// or the vertex became required. + pub fn insert_justification( + &mut self, + parent: BlockIdFor, + justification: J, + holder: Option, + ) -> JustificationAddResult { + use InnerVertex::*; + match self.inner { + Justification { .. } => { + if let Some(holder) = holder { + self.know_most.insert(holder); + } + JustificationAddResult::Noop + } + Empty { required: true } + | Header { + importance: HeaderImportance::Required, + .. + } => { + self.inner = Justification { + imported: false, + parent, + justification, + }; + self.know_most = holder.into_iter().collect(); + JustificationAddResult::Noop + } + Empty { required: false } + | Header { + importance: HeaderImportance::Auxiliary, + .. + } => { + self.inner = Justification { + imported: false, + parent, + justification, + }; + self.know_most = holder.into_iter().collect(); + JustificationAddResult::Required + } + Header { + importance: HeaderImportance::Imported, + .. + } => { + self.inner = Justification { + imported: true, + parent, + justification, + }; + // No need to modify know_most, as we now know everything we need. + JustificationAddResult::Finalizable + } + } + } +} + +#[cfg(test)] +mod tests { + use super::{JustificationAddResult, Vertex}; + use crate::sync::{ + mock::{MockHeader, MockIdentifier, MockJustification, MockPeerId}, + Header, + }; + + type MockVertex = Vertex; + + #[test] + fn initially_empty() { + let vertex = MockVertex::new(); + assert!(!vertex.required()); + assert!(!vertex.imported()); + assert!(vertex.parent().is_none()); + assert!(vertex.know_most().is_empty()); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn empty_remembers_block_holders() { + let mut vertex = MockVertex::new(); + let peer_id = rand::random(); + vertex.add_block_holder(Some(peer_id)); + assert!(vertex.know_most().contains(&peer_id)); + } + + #[test] + fn empty_set_required() { + let mut vertex = MockVertex::new(); + assert!(vertex.set_required()); + assert!(vertex.required()); + assert!(!vertex.set_required()); + assert!(vertex.required()); + } + + #[test] + fn empty_to_header() { + let mut vertex = MockVertex::new(); + let peer_id = rand::random(); + let parent = MockIdentifier::new_random(43); + vertex.insert_header(parent.clone(), Some(peer_id)); + assert!(!vertex.required()); + assert!(!vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert!(vertex.know_most().contains(&peer_id)); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn header_remembers_block_holders() { + let mut vertex = MockVertex::new(); + let peer_id = rand::random(); + let parent = MockIdentifier::new_random(43); + vertex.insert_header(parent, Some(peer_id)); + let other_peer_id = rand::random(); + vertex.add_block_holder(Some(other_peer_id)); + assert!(vertex.know_most().contains(&peer_id)); + assert!(vertex.know_most().contains(&other_peer_id)); + } + + #[test] + fn header_set_required() { + let mut vertex = MockVertex::new(); + let peer_id = rand::random(); + let parent = MockIdentifier::new_random(43); + vertex.insert_header(parent, Some(peer_id)); + assert!(vertex.set_required()); + assert!(vertex.required()); + assert!(!vertex.set_required()); + assert!(vertex.required()); + } + + #[test] + fn header_still_required() { + let mut vertex = MockVertex::new(); + assert!(vertex.set_required()); + let peer_id = rand::random(); + let parent = MockIdentifier::new_random(43); + vertex.insert_header(parent, Some(peer_id)); + assert!(vertex.required()); + assert!(!vertex.set_required()); + assert!(vertex.required()); + } + + #[test] + fn empty_to_body() { + let mut vertex = MockVertex::new(); + let parent = MockIdentifier::new_random(43); + assert!(!vertex.insert_body(parent.clone())); + assert!(!vertex.required()); + assert!(vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn header_to_body() { + let mut vertex = MockVertex::new(); + let peer_id = rand::random(); + let parent = MockIdentifier::new_random(43); + vertex.insert_header(parent.clone(), Some(peer_id)); + assert!(!vertex.insert_body(parent.clone())); + assert!(!vertex.required()); + assert!(vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn body_set_required() { + let mut vertex = MockVertex::new(); + let parent = MockIdentifier::new_random(43); + assert!(!vertex.insert_body(parent)); + assert!(!vertex.set_required()); + assert!(!vertex.required()); + } + + #[test] + fn body_no_longer_required() { + let mut vertex = MockVertex::new(); + assert!(vertex.set_required()); + let parent = MockIdentifier::new_random(43); + assert!(!vertex.insert_body(parent)); + assert!(!vertex.required()); + } + + #[test] + fn empty_to_justification() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + let peer_id = rand::random(); + assert_eq!( + vertex.insert_justification(parent.clone(), justification, Some(peer_id)), + JustificationAddResult::Required + ); + assert!(vertex.required()); + assert!(!vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert!(vertex.know_most().contains(&peer_id)); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn header_to_justification() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + let peer_id = rand::random(); + vertex.insert_header(parent.clone(), Some(peer_id)); + assert_eq!( + vertex.insert_justification(parent.clone(), justification, None), + JustificationAddResult::Required + ); + assert!(vertex.required()); + assert!(!vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert!(vertex.know_most().is_empty()); + assert_eq!(vertex.clone().ready(), Err(vertex)); + } + + #[test] + fn body_to_justification() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + assert!(!vertex.insert_body(parent.clone())); + assert_eq!( + vertex.insert_justification(parent.clone(), justification.clone(), None), + JustificationAddResult::Finalizable + ); + assert!(!vertex.required()); + assert!(vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert_eq!(vertex.ready(), Ok(justification)); + } + + #[test] + fn justification_set_required() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + let peer_id = rand::random(); + assert_eq!( + vertex.insert_justification(parent, justification, Some(peer_id)), + JustificationAddResult::Required + ); + assert!(!vertex.set_required()); + assert!(vertex.required()); + } + + #[test] + fn justification_still_required() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + let peer_id = rand::random(); + assert!(vertex.set_required()); + assert_eq!( + vertex.insert_justification(parent, justification, Some(peer_id)), + JustificationAddResult::Noop + ); + assert!(vertex.required()); + } + + #[test] + fn my_body_is_ready() { + let mut vertex = MockVertex::new(); + let parent_header = MockHeader::random_parentless(0); + let header = parent_header.random_child(); + let parent = header.parent_id().expect("born of a parent"); + let justification = MockJustification::for_header(header); + assert_eq!( + vertex.insert_justification(parent.clone(), justification.clone(), None), + JustificationAddResult::Required + ); + assert!(vertex.insert_body(parent.clone())); + assert!(!vertex.required()); + assert!(vertex.imported()); + assert_eq!(vertex.parent(), Some(&parent)); + assert_eq!(vertex.ready(), Ok(justification)); + } +} diff --git a/finality-aleph/src/sync/handler.rs b/finality-aleph/src/sync/handler.rs new file mode 100644 index 0000000000..7641d84098 --- /dev/null +++ b/finality-aleph/src/sync/handler.rs @@ -0,0 +1,486 @@ +use crate::{ + session::{last_block_of_session, session_id_from_block_num, SessionId, SessionPeriod}, + sync::{ + data::{NetworkData, State}, + forest::{Error as ForestError, Forest, JustificationAddResult}, + BlockIdFor, BlockIdentifier, ChainStatus, Finalizer, Header, Justification, PeerId, + Verifier, + }, +}; + +/// How many justifications we will send at most in response to a broadcast. +const MAX_SMALL_JUSTIFICATION_BATCH: u32 = 10; +// Silly workaround to make range matching actually work... +const MAX_SMALL_JUSTIFICATION_BATCH_PLUS_ONE: u32 = MAX_SMALL_JUSTIFICATION_BATCH + 1; +/// How many justifications we will send at most in response to an explicit query. +const MAX_JUSTIFICATION_BATCH: u32 = 100; + +/// Handler for data incoming from the network. +pub struct Handler, V: Verifier, F: Finalizer> +{ + chain_status: CS, + verifier: V, + finalizer: F, + forest: Forest, + period: SessionPeriod, +} + +/// What actions can the handler recommend as a reaction to some data. +#[derive(Clone, Debug)] +pub enum SyncActions { + /// A response for the peer that sent us the data. + Response(NetworkData), + /// A task that should be performed periodically. At the moment these are only requests for blocks, + /// so it always contains the id of the block. + Task(BlockIdFor), + /// Do nothing. + Noop, +} + +impl SyncActions { + fn noop() -> Self { + SyncActions::Noop + } + + fn response(response: NetworkData) -> Self { + SyncActions::Response(response) + } + + fn task(id: BlockIdFor) -> Self { + SyncActions::Task(id) + } +} + +/// What can go wrong when handling a piece of data. +#[derive(Clone, Debug)] +pub enum Error, V: Verifier, F: Finalizer> { + Verifier(V::Error), + ChainStatus(CS::Error), + Finalizer(F::Error), + Forest(ForestError), + NoParent, + MissingJustification, +} + +impl, V: Verifier, F: Finalizer> From + for Error +{ + fn from(e: ForestError) -> Self { + Error::Forest(e) + } +} + +impl, V: Verifier, F: Finalizer> + Handler +{ + /// New handler with the provided chain interfaces. + pub fn new( + chain_status: CS, + verifier: V, + finalizer: F, + period: SessionPeriod, + ) -> Result> { + let top_finalized = chain_status + .top_finalized() + .map_err(Error::ChainStatus)? + .header() + .id(); + let forest = Forest::new(top_finalized); + Ok(Handler { + chain_status, + verifier, + finalizer, + forest, + period, + }) + } + + fn large_justification_batch_from( + &self, + id: BlockIdFor, + ) -> Result, Error> { + use Error::*; + let mut result = Vec::with_capacity(MAX_SMALL_JUSTIFICATION_BATCH as usize); + let mut number = id.number() + 1; + let top_finalized_number = self + .chain_status + .top_finalized() + .map_err(ChainStatus)? + .header() + .id() + .number(); + while result.len() < MAX_JUSTIFICATION_BATCH as usize && number <= top_finalized_number { + number = match self + .chain_status + .finalized_at(number) + .map_err(ChainStatus)? + { + Some(justification) => { + result.push(justification.into_unverified()); + number + 1 + } + // We might skip all blocks of a session if we are missing a justification, but + // this will happen only for sessions where we don't have all the justifications. + // The last block of a session was always guaranteed to contain a justification, so + // we only share that one. It can be missing only if the last block is above the + // top finalized, in which case this will break the loop. + None => last_block_of_session( + session_id_from_block_num(number, self.period), + self.period, + ), + } + } + Ok(NetworkData::Justifications(result, self.state()?)) + } + + fn small_justification_batch_from( + &self, + id: BlockIdFor, + ) -> Result, Error> { + let mut result = Vec::with_capacity(MAX_SMALL_JUSTIFICATION_BATCH as usize); + let mut number = id.number() + 1; + while result.len() < MAX_SMALL_JUSTIFICATION_BATCH as usize { + match self + .chain_status + .finalized_at(number) + .map_err(Error::ChainStatus)? + { + Some(justification) => result.push(justification.into_unverified()), + None => break, + } + number += 1; + } + Ok(NetworkData::Justifications(result, self.state()?)) + } + + fn top_understandable_for( + &self, + id: BlockIdFor, + ) -> Result, Error> { + use Error::*; + let block_session = session_id_from_block_num(id.number(), self.period); + let understandable_session = SessionId(block_session.0 + 1); + let last_understandable_block_number = + last_block_of_session(understandable_session, self.period); + match self + .chain_status + .finalized_at(last_understandable_block_number) + .map_err(ChainStatus)? + { + Some(justification) => Ok(NetworkData::Justifications( + vec![justification.into_unverified()], + self.state()?, + )), + None => { + let justification = self.chain_status.top_finalized().map_err(ChainStatus)?; + match justification.header().id().number() <= last_understandable_block_number { + true => Ok(NetworkData::Justifications( + vec![justification.into_unverified()], + self.state()?, + )), + false => Err(Error::MissingJustification), + } + } + } + } + + fn try_finalize(&mut self) -> Result<(), Error> { + while let Some(justification) = self.forest.try_finalize() { + self.finalizer + .finalize(justification) + .map_err(Error::Finalizer)?; + } + Ok(()) + } + + fn handle_verified_justification( + &mut self, + justification: J, + peer: I, + ) -> Result, Error> { + use JustificationAddResult::*; + let id = justification.header().id(); + match self + .forest + .update_justification(justification, Some(peer))? + { + Noop => Ok(SyncActions::noop()), + Required => Ok(SyncActions::task(id)), + Finalizable => { + self.try_finalize()?; + Ok(SyncActions::noop()) + } + } + } + + /// Inform the handler that a block has been imported. + pub fn block_imported(&mut self, header: J::Header) -> Result<(), Error> { + match self.forest.update_body(&header)? { + true => self.try_finalize(), + false => Ok(()), + } + } + + /// Handle a request for potentially substantial amounts of data. + /// + /// Currently ignores the requested id, it will only become important once we can request + /// blocks. + pub fn handle_request( + &mut self, + _requested_id: BlockIdFor, + state: State, + ) -> Result, Error> { + let remote_top_id = self + .verifier + .verify(state.top_justification()) + .map_err(Error::Verifier)? + .header() + .id(); + Ok(SyncActions::response( + self.large_justification_batch_from(remote_top_id)?, + )) + } + + /// Handle a single justification. + pub fn handle_justification( + &mut self, + justification: J::Unverified, + peer: I, + ) -> Result, Error> { + let justification = self + .verifier + .verify(justification) + .map_err(Error::Verifier)?; + self.handle_verified_justification(justification, peer) + } + + /// Handle a state broadcast returning the actions we should take in response. + pub fn handle_state( + &mut self, + state: State, + peer: I, + ) -> Result, Error> { + use Error::*; + let remote_top = self + .verifier + .verify(state.top_justification()) + .map_err(Verifier)?; + let local_top = self.chain_status.top_finalized().map_err(ChainStatus)?; + match local_top + .header() + .id() + .number() + .checked_sub(remote_top.header().id().number()) + { + // If we are just one behind then normal broadcasts should remedy the situation. + Some(0..=1) => Ok(SyncActions::noop()), + Some(2..=MAX_SMALL_JUSTIFICATION_BATCH) => Ok(SyncActions::response( + self.small_justification_batch_from(remote_top.header().id())?, + )), + Some(MAX_SMALL_JUSTIFICATION_BATCH_PLUS_ONE..) => Ok(SyncActions::response( + self.top_understandable_for(remote_top.header().id())?, + )), + None => self.handle_verified_justification(remote_top, peer), + } + } + + /// The current state of our database. + pub fn state(&self) -> Result, Error> { + let top_justification = self + .chain_status + .top_finalized() + .map_err(Error::ChainStatus)? + .into_unverified(); + Ok(State::new(top_justification)) + } +} + +#[cfg(test)] +mod tests { + use super::{Handler, SyncActions}; + use crate::{ + sync::{ + data::NetworkData, + mock::{Backend, MockHeader, MockJustification, MockPeerId, MockVerifier}, + ChainStatus, Header, Justification, + }, + SessionPeriod, + }; + + type MockHandler = Handler; + + const SESSION_PERIOD: usize = 20; + + fn setup() -> (MockHandler, Backend, impl Send) { + let (backend, _keep) = Backend::setup(); + let verifier = MockVerifier {}; + let handler = Handler::new( + backend.clone(), + verifier, + backend.clone(), + SessionPeriod(20), + ) + .expect("mock backend works"); + (handler, backend, _keep) + } + + fn import_branch(backend: &Backend, branch_length: usize) -> Vec { + let result: Vec<_> = backend + .best_block() + .expect("mock backend works") + .random_branch() + .take(branch_length) + .collect(); + for header in &result { + backend.import(header.clone()); + } + result + } + + #[test] + fn finalizes_imported_and_justified() { + let (mut handler, backend, _keep) = setup(); + let header = import_branch(&backend, 1)[0].clone(); + handler + .block_imported(header.clone()) + .expect("importing in order"); + let justification = MockJustification::for_header(header); + let peer = rand::random(); + assert!(matches!( + handler + .handle_justification(justification.clone().into_unverified(), peer) + .expect("correct justification"), + SyncActions::Noop + )); + assert_eq!( + backend.top_finalized().expect("mock backend works"), + justification + ); + } + + #[test] + fn finalizes_justified_and_imported() { + let (mut handler, backend, _keep) = setup(); + let header = import_branch(&backend, 1)[0].clone(); + let justification = MockJustification::for_header(header.clone()); + let peer = rand::random(); + match handler + .handle_justification(justification.clone().into_unverified(), peer) + .expect("correct justification") + { + SyncActions::Task(id) => assert_eq!(id, header.id()), + other_action => panic!("expected a task, got {:?}", other_action), + } + handler.block_imported(header).expect("importing in order"); + assert_eq!( + backend.top_finalized().expect("mock backend works"), + justification + ); + } + + #[test] + fn handles_state_with_small_difference() { + let (mut handler, backend, _keep) = setup(); + let initial_state = handler.state().expect("state works"); + let peer = rand::random(); + for justification in import_branch(&backend, 5) + .into_iter() + .map(MockJustification::for_header) + { + handler + .block_imported(justification.header().clone()) + .expect("importing in order"); + handler + .handle_justification(justification.clone().into_unverified(), peer) + .expect("correct justification"); + } + match handler + .handle_state(initial_state, peer) + .expect("correct justification") + { + SyncActions::Response(NetworkData::Justifications(justifications, _)) => { + assert_eq!(justifications.len(), 5) + } + other_action => panic!( + "expected a response with justifications, got {:?}", + other_action + ), + } + } + + #[test] + fn handles_state_with_large_difference() { + let (mut handler, backend, _keep) = setup(); + let initial_state = handler.state().expect("state works"); + let peer = rand::random(); + let justifications: Vec<_> = import_branch(&backend, 500) + .into_iter() + .map(MockJustification::for_header) + .collect(); + for justification in &justifications { + handler + .block_imported(justification.header().clone()) + .expect("importing in order"); + handler + .handle_justification(justification.clone().into_unverified(), peer) + .expect("correct justification"); + } + match handler + .handle_state(initial_state, peer) + .expect("correct justification") + { + SyncActions::Response(NetworkData::Justifications(sent_justifications, _)) => { + assert_eq!(sent_justifications.len(), 1); + assert_eq!( + sent_justifications[0].header().id(), + justifications[SESSION_PERIOD * 2 - 2].header().id() + ); + } + other_action => panic!( + "expected a response with justifications, got {:?}", + other_action + ), + } + } + + #[test] + fn handles_request() { + let (mut handler, backend, _keep) = setup(); + let initial_state = handler.state().expect("state works"); + let peer = rand::random(); + let justifications: Vec<_> = import_branch(&backend, 500) + .into_iter() + .map(MockJustification::for_header) + .collect(); + for justification in &justifications { + handler + .block_imported(justification.header().clone()) + .expect("importing in order"); + handler + .handle_justification(justification.clone().into_unverified(), peer) + .expect("correct justification"); + } + // currently ignored, so picking a random one + let requested_id = justifications[43].header().id(); + match handler + .handle_request(requested_id, initial_state) + .expect("correct request") + { + SyncActions::Response(NetworkData::Justifications(sent_justifications, _)) => { + assert_eq!(sent_justifications.len(), 100); + for (sent_justification, justification) in + sent_justifications.iter().zip(justifications) + { + assert_eq!( + sent_justification.header().id(), + justification.header().id() + ); + } + } + other_action => panic!( + "expected a response with justifications, got {:?}", + other_action + ), + } + } +} diff --git a/finality-aleph/src/sync/mock/backend.rs b/finality-aleph/src/sync/mock/backend.rs new file mode 100644 index 0000000000..65325c607c --- /dev/null +++ b/finality-aleph/src/sync/mock/backend.rs @@ -0,0 +1,287 @@ +use std::{ + collections::HashMap, + fmt::{Display, Error as FmtError, Formatter}, + sync::Arc, +}; + +use futures::channel::mpsc::{self, UnboundedSender}; +use parking_lot::Mutex; + +use crate::sync::{ + mock::{MockHeader, MockIdentifier, MockJustification, MockNotification}, + BlockIdentifier, BlockStatus, ChainStatus, ChainStatusNotifier, Finalizer, Header, + Justification as JustificationT, +}; + +#[derive(Clone, Debug)] +struct MockBlock { + header: MockHeader, + justification: Option, +} + +impl MockBlock { + fn new(header: MockHeader) -> Self { + Self { + header, + justification: None, + } + } + + fn header(&self) -> MockHeader { + self.header.clone() + } + + fn finalize(&mut self, justification: MockJustification) { + self.justification = Some(justification); + } +} + +#[derive(Clone, Debug)] +struct BackendStorage { + blockchain: HashMap, + finalized: Vec, + best_block: MockIdentifier, + genesis_block: MockIdentifier, +} + +#[derive(Clone, Debug)] +pub struct Backend { + inner: Arc>, + notification_sender: UnboundedSender, +} + +fn is_predecessor( + storage: &HashMap, + mut header: MockHeader, + maybe_predecessor: MockIdentifier, +) -> bool { + while let Some(parent) = header.parent_id() { + if header.id().number() != parent.number() + 1 { + break; + } + if parent == maybe_predecessor { + return true; + } + + header = match storage.get(&parent) { + Some(block) => block.header(), + None => return false, + } + } + false +} + +impl Backend { + pub fn setup() -> (Self, impl ChainStatusNotifier) { + let (notification_sender, notification_receiver) = mpsc::unbounded(); + + (Backend::new(notification_sender), notification_receiver) + } + + fn new(notification_sender: UnboundedSender) -> Self { + let header = MockHeader::random_parentless(0); + let id = header.id(); + + let block = MockBlock { + header: header.clone(), + justification: Some(MockJustification::for_header(header)), + }; + + let storage = Arc::new(Mutex::new(BackendStorage { + blockchain: HashMap::from([(id.clone(), block)]), + finalized: vec![id.clone()], + best_block: id.clone(), + genesis_block: id, + })); + + Self { + inner: storage, + notification_sender, + } + } + + fn notify_imported(&self, id: MockIdentifier) { + self.notification_sender + .unbounded_send(MockNotification::BlockImported(id)) + .expect("notification receiver is open"); + } + + fn notify_finalized(&self, id: MockIdentifier) { + self.notification_sender + .unbounded_send(MockNotification::BlockFinalized(id)) + .expect("notification receiver is open"); + } + + pub fn import(&self, header: MockHeader) { + let mut storage = self.inner.lock(); + + let parent_id = match header.parent_id() { + Some(id) => id, + None => panic!("importing block without a parent: {:?}", header), + }; + + if storage.blockchain.contains_key(&header.id()) { + panic!("importing an already imported block: {:?}", header) + } + + if !storage.blockchain.contains_key(&parent_id) { + panic!("importing block without an imported parent: {:?}", header) + } + + if header.id().number() != parent_id.number() + 1 { + panic!("importing block without a correct parent: {:?}", header) + } + + if header.id().number() > storage.best_block.number() + && is_predecessor( + &storage.blockchain, + header.clone(), + storage.best_block.clone(), + ) + { + storage.best_block = header.id(); + } + + storage + .blockchain + .insert(header.id(), MockBlock::new(header.clone())); + + self.notify_imported(header.id()); + } +} + +#[derive(Debug)] +pub struct FinalizerError; + +impl Display for FinalizerError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "{:?}", self) + } +} + +impl Finalizer for Backend { + type Error = FinalizerError; + + fn finalize(&self, justification: MockJustification) -> Result<(), Self::Error> { + if !justification.is_correct { + panic!( + "finalizing block with an incorrect justification: {:?}", + justification + ); + } + + let mut storage = self.inner.lock(); + + let header = justification.header(); + let parent_id = match justification.header().parent_id() { + Some(id) => id, + None => panic!("finalizing block without a parent: {:?}", header), + }; + + let parent_block = match storage.blockchain.get(&parent_id) { + Some(block) => block, + None => panic!("finalizing block without an imported parent: {:?}", header), + }; + + if parent_block.justification.is_none() { + panic!("finalizing block without a finalized parent: {:?}", header); + } + + if &parent_id != storage.finalized.last().expect("there is a top finalized") { + panic!( + "finalizing block whose parent is not top finalized: {:?}. Top is {:?}", + header, + storage.finalized.last().expect("there is a top finalized") + ); + } + + let id = justification.header().id(); + let block = match storage.blockchain.get_mut(&id) { + Some(block) => block, + None => panic!("finalizing a not imported block: {:?}", header), + }; + + block.finalize(justification); + storage.finalized.push(id.clone()); + // In case finalization changes best block, we set best block, to top finalized. + // Whenever a new import happens, best block will update anyway. + if !is_predecessor( + &storage.blockchain, + storage + .blockchain + .get(&storage.best_block) + .unwrap() + .header(), + id.clone(), + ) { + storage.best_block = id.clone() + } + self.notify_finalized(id); + + Ok(()) + } +} + +#[derive(Debug)] +pub struct StatusError; + +impl Display for StatusError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "{:?}", self) + } +} + +impl ChainStatus for Backend { + type Error = StatusError; + + fn status_of(&self, id: MockIdentifier) -> Result, Self::Error> { + let storage = self.inner.lock(); + let block = match storage.blockchain.get(&id) { + Some(block) => block, + None => return Ok(BlockStatus::Unknown), + }; + + if let Some(justification) = block.justification.clone() { + Ok(BlockStatus::Justified(justification)) + } else { + Ok(BlockStatus::Present(block.header())) + } + } + + fn finalized_at(&self, number: u32) -> Result, Self::Error> { + let storage = self.inner.lock(); + let id = match storage.finalized.get(number as usize) { + Some(id) => id, + None => return Ok(None), + }; + storage + .blockchain + .get(id) + .ok_or(StatusError) + .map(|b| b.justification.clone()) + } + + fn best_block(&self) -> Result { + let storage = self.inner.lock(); + let id = storage.best_block.clone(); + storage + .blockchain + .get(&id) + .map(|b| b.header()) + .ok_or(StatusError) + } + + fn top_finalized(&self) -> Result { + let storage = self.inner.lock(); + let id = storage + .finalized + .last() + .expect("there is a top finalized") + .clone(); + storage + .blockchain + .get(&id) + .and_then(|b| b.justification.clone()) + .ok_or(StatusError) + } +} diff --git a/finality-aleph/src/sync/mock/mod.rs b/finality-aleph/src/sync/mock/mod.rs new file mode 100644 index 0000000000..f7bd4a1cbb --- /dev/null +++ b/finality-aleph/src/sync/mock/mod.rs @@ -0,0 +1,135 @@ +use std::hash::Hash; + +use codec::{Decode, Encode}; +use sp_core::H256; + +use crate::sync::{ + BlockIdentifier, BlockStatus, ChainStatusNotification, Header, Justification as JustificationT, +}; + +mod backend; +mod status_notifier; +mod verifier; + +type MockNumber = u32; +type MockHash = H256; + +pub use backend::Backend; +pub use verifier::MockVerifier; + +pub type MockPeerId = u32; + +#[derive(Clone, Hash, Debug, PartialEq, Eq, Encode, Decode)] +pub struct MockIdentifier { + number: MockNumber, + hash: MockHash, +} + +impl MockIdentifier { + fn new(number: MockNumber, hash: MockHash) -> Self { + MockIdentifier { number, hash } + } + + pub fn new_random(number: MockNumber) -> Self { + MockIdentifier::new(number, MockHash::random()) + } +} + +impl BlockIdentifier for MockIdentifier { + fn number(&self) -> u32 { + self.number + } +} + +#[derive(Clone, Hash, Debug, PartialEq, Eq, Encode, Decode)] +pub struct MockHeader { + id: MockIdentifier, + parent: Option, +} + +impl MockHeader { + fn new(id: MockIdentifier, parent: Option) -> Self { + MockHeader { id, parent } + } + + pub fn random_parentless(number: MockNumber) -> Self { + let id = MockIdentifier::new_random(number); + MockHeader { id, parent: None } + } + + pub fn random_child(&self) -> Self { + let id = MockIdentifier::new_random(self.id.number() + 1); + let parent = Some(self.id.clone()); + MockHeader { id, parent } + } + + pub fn random_branch(&self) -> impl Iterator { + RandomBranch { + parent: self.clone(), + } + } +} + +struct RandomBranch { + parent: MockHeader, +} + +impl Iterator for RandomBranch { + type Item = MockHeader; + + fn next(&mut self) -> Option { + let result = self.parent.random_child(); + self.parent = result.clone(); + Some(result) + } +} + +impl Header for MockHeader { + type Identifier = MockIdentifier; + + fn id(&self) -> Self::Identifier { + self.id.clone() + } + + fn parent_id(&self) -> Option { + self.parent.clone() + } +} + +#[derive(Clone, Hash, Debug, PartialEq, Eq, Encode, Decode)] +pub struct MockJustification { + header: MockHeader, + is_correct: bool, +} + +impl MockJustification { + pub fn for_header(header: MockHeader) -> Self { + Self { + header, + is_correct: true, + } + } + + pub fn for_header_incorrect(header: MockHeader) -> Self { + Self { + header, + is_correct: false, + } + } +} + +impl JustificationT for MockJustification { + type Header = MockHeader; + type Unverified = Self; + + fn header(&self) -> &Self::Header { + &self.header + } + + fn into_unverified(self) -> Self::Unverified { + self + } +} + +type MockNotification = ChainStatusNotification; +type MockBlockStatus = BlockStatus; diff --git a/finality-aleph/src/sync/mock/status_notifier.rs b/finality-aleph/src/sync/mock/status_notifier.rs new file mode 100644 index 0000000000..e915e1849e --- /dev/null +++ b/finality-aleph/src/sync/mock/status_notifier.rs @@ -0,0 +1,30 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use futures::channel::mpsc::UnboundedReceiver; + +use crate::sync::{ + mock::{MockIdentifier, MockNotification}, + ChainStatusNotifier, +}; + +#[derive(Debug)] +pub enum Error { + StreamClosed, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "{:?}", self) + } +} + +#[async_trait::async_trait] +impl ChainStatusNotifier for UnboundedReceiver { + type Error = Error; + + async fn next(&mut self) -> Result { + ::next(self) + .await + .ok_or(Error::StreamClosed) + } +} diff --git a/finality-aleph/src/sync/mock/verifier.rs b/finality-aleph/src/sync/mock/verifier.rs new file mode 100644 index 0000000000..b4089e260a --- /dev/null +++ b/finality-aleph/src/sync/mock/verifier.rs @@ -0,0 +1,32 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use crate::sync::{mock::MockJustification, Verifier}; + +#[derive(Debug)] +pub struct MockVerifier; + +#[derive(Debug)] +pub enum Error { + IncorrectJustification, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "{:?}", self) + } +} + +impl Verifier for MockVerifier { + type Error = Error; + + fn verify( + &mut self, + justification: MockJustification, + ) -> Result { + if justification.is_correct { + Ok(justification) + } else { + Err(Error::IncorrectJustification) + } + } +} diff --git a/finality-aleph/src/sync/mod.rs b/finality-aleph/src/sync/mod.rs new file mode 100644 index 0000000000..b33c990685 --- /dev/null +++ b/finality-aleph/src/sync/mod.rs @@ -0,0 +1,128 @@ +use std::{ + fmt::{Debug, Display}, + hash::Hash, +}; + +use codec::Codec; + +mod data; +mod forest; +mod handler; +#[cfg(test)] +mod mock; +mod substrate; +mod task_queue; +mod ticker; + +pub use substrate::SessionVerifier; + +const LOG_TARGET: &str = "aleph-block-sync"; + +/// The identifier of a connected peer. +pub trait PeerId: Clone + Hash + Eq {} + +impl PeerId for T {} + +/// The identifier of a block, the least amount of knowledge we can have about a block. +pub trait BlockIdentifier: Clone + Hash + Debug + Eq + Codec + Send + Sync + 'static { + /// The block number, useful when reasoning about hopeless forks. + fn number(&self) -> u32; +} + +/// Informs the sync that it should attempt to acquire the specified data. +pub trait Requester { + /// The sync should attempt to acquire justifications for this block. + fn request_justification(&self, id: BI); +} + +/// The header of a block, containing information about the parent relation. +pub trait Header: Clone + Codec + Send + Sync + 'static { + type Identifier: BlockIdentifier; + + /// The identifier of this block. + fn id(&self) -> Self::Identifier; + + /// The identifier of this block's parent. + fn parent_id(&self) -> Option; +} + +/// The verified justification of a block, including a header. +pub trait Justification: Clone + Send + Sync + 'static { + type Header: Header; + type Unverified: Clone + Codec + Debug + Send + Sync + 'static; + + /// The header of the block. + fn header(&self) -> &Self::Header; + + /// Return an unverified version of this, for sending over the network. + fn into_unverified(self) -> Self::Unverified; +} + +type BlockIdFor = <::Header as Header>::Identifier; + +/// A verifier of justifications. +pub trait Verifier { + type Error: Display; + + /// Verifies the raw justification and returns a full justification if successful, otherwise an + /// error. + fn verify(&mut self, justification: J::Unverified) -> Result; +} + +/// A facility for finalizing blocks using justifications. +pub trait Finalizer { + type Error: Display; + + /// Finalize a block using this justification. Since the justification contains the header, we + /// don't need to additionally specify the block. + fn finalize(&self, justification: J) -> Result<(), Self::Error>; +} + +/// A notification about the chain status changing. +#[derive(Clone, Debug)] +pub enum ChainStatusNotification { + /// A block has been imported. + BlockImported(BI), + /// A block has been finalized. + BlockFinalized(BI), +} + +/// A stream of notifications about the chain status in the database changing. +#[async_trait::async_trait] +pub trait ChainStatusNotifier { + type Error: Display; + + /// Returns a chain status notification when it is available. + async fn next(&mut self) -> Result, Self::Error>; +} + +/// The status of a block in the database. +pub enum BlockStatus { + /// The block is justified and thus finalized. + Justified(J), + /// The block is present, might be finalized if a descendant is justified. + Present(J::Header), + /// The block is not known. + Unknown, +} + +/// The knowledge about the chain status. +pub trait ChainStatus { + type Error: Display; + + /// The status of the block. + fn status_of( + &self, + id: ::Identifier, + ) -> Result, Self::Error>; + + /// The justification at this block number, if we have it. Should return None if the + /// request is above the top finalized. + fn finalized_at(&self, number: u32) -> Result, Self::Error>; + + /// The header of the best block. + fn best_block(&self) -> Result; + + /// The justification of the top finalized block. + fn top_finalized(&self) -> Result; +} diff --git a/finality-aleph/src/sync/substrate/chain_status.rs b/finality-aleph/src/sync/substrate/chain_status.rs new file mode 100644 index 0000000000..b669837076 --- /dev/null +++ b/finality-aleph/src/sync/substrate/chain_status.rs @@ -0,0 +1,178 @@ +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + marker::PhantomData, +}; + +use aleph_primitives::{BlockNumber, ALEPH_ENGINE_ID}; +use log::warn; +use sp_blockchain::{Backend, Error as ClientError}; +use sp_runtime::traits::{Block as BlockT, Header as SubstrateHeader}; + +use crate::{ + justification::backwards_compatible_decode, + sync::{ + substrate::{BlockId, Justification}, + BlockStatus, ChainStatus, Header, LOG_TARGET, + }, + AlephJustification, +}; + +/// What can go wrong when checking chain status +#[derive(Debug)] +pub enum Error { + MissingHash(B::Hash), + MissingJustification(B::Hash), + Client(ClientError), +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use Error::*; + match self { + MissingHash(hash) => { + write!( + f, + "data availability problem: no block for existing hash {:?}", + hash + ) + } + MissingJustification(hash) => { + write!( + f, + "data availability problem: no justification for finalized block with hash {:?}", + hash + ) + } + Client(e) => { + write!(f, "substrate client error {}", e) + } + } + } +} + +impl From for Error { + fn from(value: ClientError) -> Self { + Error::Client(value) + } +} + +/// Substrate implementation of ChainStatus trait +pub struct SubstrateChainStatus +where + BE: Backend, + B: BlockT, + B::Header: SubstrateHeader, +{ + client: BE, + _phantom: PhantomData, +} + +impl SubstrateChainStatus +where + BE: Backend, + B: BlockT, + B::Header: SubstrateHeader, +{ + fn hash_for_number(&self, number: BlockNumber) -> Result, ClientError> { + self.client.hash(number) + } + + fn header(&self, hash: B::Hash) -> Result, ClientError> { + self.client.header(hash) + } + + fn justification(&self, hash: B::Hash) -> Result, ClientError> { + let justification = match self + .client + .justifications(hash)? + .and_then(|j| j.into_justification(ALEPH_ENGINE_ID)) + { + Some(justification) => justification, + None => return Ok(None), + }; + + match backwards_compatible_decode(justification) { + Ok(justification) => Ok(Some(justification)), + // This should not happen, as we only import correctly encoded justification. + Err(e) => { + warn!( + target: LOG_TARGET, + "Could not decode stored justification for block {:?}: {}", hash, e + ); + Ok(None) + } + } + } + + fn best_hash(&self) -> B::Hash { + self.client.info().best_hash + } + + fn finalized_hash(&self) -> B::Hash { + self.client.info().finalized_hash + } +} + +impl ChainStatus> for SubstrateChainStatus +where + BE: Backend, + B: BlockT, + B::Header: SubstrateHeader, +{ + type Error = Error; + + fn finalized_at( + &self, + number: BlockNumber, + ) -> Result>, Self::Error> { + let id = match self.hash_for_number(number)? { + Some(hash) => BlockId { hash, number }, + None => return Ok(None), + }; + match self.status_of(id)? { + BlockStatus::Justified(justification) => Ok(Some(justification)), + _ => Ok(None), + } + } + + fn status_of( + &self, + id: ::Identifier, + ) -> Result>, Self::Error> { + let header = match self.header(id.hash)? { + Some(header) => header, + None => return Ok(BlockStatus::Unknown), + }; + + if let Some(raw_justification) = self.justification(id.hash)? { + Ok(BlockStatus::Justified(Justification { + header, + raw_justification, + })) + } else { + Ok(BlockStatus::Present(header)) + } + } + + fn best_block(&self) -> Result { + let best_hash = self.best_hash(); + + self.header(best_hash)?.ok_or(Error::MissingHash(best_hash)) + } + + fn top_finalized(&self) -> Result, Self::Error> { + let finalized_hash = self.finalized_hash(); + + let header = self + .header(finalized_hash)? + .ok_or(Error::MissingHash(finalized_hash))?; + let raw_justification = self + .justification(finalized_hash)? + .ok_or(Error::MissingJustification(finalized_hash))?; + + Ok(Justification { + header, + raw_justification, + }) + } +} diff --git a/finality-aleph/src/sync/substrate/finalizer.rs b/finality-aleph/src/sync/substrate/finalizer.rs new file mode 100644 index 0000000000..4bd4c9aa4f --- /dev/null +++ b/finality-aleph/src/sync/substrate/finalizer.rs @@ -0,0 +1,31 @@ +use aleph_primitives::{BlockNumber, ALEPH_ENGINE_ID}; +use sc_client_api::{Backend, Finalizer as SubstrateFinalizer, HeaderBackend, LockImportRun}; +use sp_blockchain::Error as ClientError; +use sp_runtime::traits::{Block as BlockT, Header as SubstrateHeader}; + +use crate::{ + finalization::{AlephFinalizer, BlockFinalizer}, + justification::versioned_encode, + sync::{substrate::Justification, Finalizer}, +}; + +impl Finalizer> for AlephFinalizer +where + B: BlockT, + B::Header: SubstrateHeader, + BE: Backend, + C: HeaderBackend + LockImportRun + SubstrateFinalizer, +{ + type Error = ClientError; + + fn finalize(&self, justification: Justification) -> Result<(), Self::Error> { + self.finalize_block( + justification.header.hash(), + *justification.header.number(), + Some(( + ALEPH_ENGINE_ID, + versioned_encode(justification.raw_justification), + )), + ) + } +} diff --git a/finality-aleph/src/sync/substrate/mod.rs b/finality-aleph/src/sync/substrate/mod.rs new file mode 100644 index 0000000000..fb6da42384 --- /dev/null +++ b/finality-aleph/src/sync/substrate/mod.rs @@ -0,0 +1,79 @@ +use std::hash::{Hash, Hasher}; + +use aleph_primitives::BlockNumber; +use codec::{Decode, Encode}; +use sp_runtime::traits::{CheckedSub, Header as SubstrateHeader, One}; + +use crate::{ + sync::{BlockIdentifier, Header, Justification as JustificationT}, + AlephJustification, +}; + +mod chain_status; +mod finalizer; +mod status_notifier; +mod verification; + +pub use verification::SessionVerifier; + +#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode)] +pub struct BlockId> { + hash: H::Hash, + number: H::Number, +} + +/// An identifier uniquely specifying a block and its height. +impl> Hash for BlockId { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.hash.hash(state); + self.number.hash(state); + } +} + +impl> BlockIdentifier for BlockId { + fn number(&self) -> u32 { + self.number + } +} + +impl> Header for H { + type Identifier = BlockId; + + fn id(&self) -> Self::Identifier { + BlockId { + hash: self.hash(), + number: *self.number(), + } + } + + fn parent_id(&self) -> Option { + let number = self.number().checked_sub(&One::one())?; + Some(BlockId { + hash: *self.parent_hash(), + number, + }) + } +} + +/// A justification, including the related header. +#[derive(Clone, Debug, Encode, Decode)] +pub struct Justification> { + header: H, + raw_justification: AlephJustification, +} + +impl> JustificationT for Justification { + type Header = H; + type Unverified = Self; + + fn header(&self) -> &Self::Header { + &self.header + } + + fn into_unverified(self) -> Self::Unverified { + self + } +} diff --git a/finality-aleph/src/sync/substrate/status_notifier.rs b/finality-aleph/src/sync/substrate/status_notifier.rs new file mode 100644 index 0000000000..042e05104a --- /dev/null +++ b/finality-aleph/src/sync/substrate/status_notifier.rs @@ -0,0 +1,78 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use aleph_primitives::BlockNumber; +use futures::StreamExt; +use sc_client_api::client::{FinalityNotifications, ImportNotifications}; +use sp_runtime::traits::{Block as BlockT, Header as SubstrateHeader}; +use tokio::select; + +use crate::sync::{substrate::BlockId, ChainStatusNotification, ChainStatusNotifier, Header}; + +/// What can go wrong when waiting for next chain status notification. +#[derive(Debug)] +pub enum Error { + JustificationStreamClosed, + ImportStreamClosed, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use Error::*; + match self { + JustificationStreamClosed => { + write!(f, "finalization notification stream has ended") + } + ImportStreamClosed => { + write!(f, "import notification stream has ended") + } + } + } +} + +/// Substrate specific implementation of `ChainStatusNotifier`. +pub struct SubstrateChainStatusNotifier +where + B: BlockT, +{ + finality_notifications: FinalityNotifications, + import_notifications: ImportNotifications, +} + +impl SubstrateChainStatusNotifier +where + B: BlockT, +{ + fn new( + finality_notifications: FinalityNotifications, + import_notifications: ImportNotifications, + ) -> Self { + Self { + finality_notifications, + import_notifications, + } + } +} + +#[async_trait::async_trait] +impl ChainStatusNotifier> for SubstrateChainStatusNotifier +where + B: BlockT, + B::Header: SubstrateHeader, +{ + type Error = Error; + + async fn next(&mut self) -> Result>, Self::Error> { + select! { + maybe_block = self.finality_notifications.next() => { + maybe_block + .map(|block| ChainStatusNotification::BlockFinalized(block.header.id())) + .ok_or(Error::JustificationStreamClosed) + }, + maybe_block = self.import_notifications.next() => { + maybe_block + .map(|block| ChainStatusNotification::BlockImported(block.header.id())) + .ok_or(Error::ImportStreamClosed) + } + } + } +} diff --git a/finality-aleph/src/sync/substrate/verification/cache.rs b/finality-aleph/src/sync/substrate/verification/cache.rs new file mode 100644 index 0000000000..acd48a20a6 --- /dev/null +++ b/finality-aleph/src/sync/substrate/verification/cache.rs @@ -0,0 +1,358 @@ +use std::{ + collections::{hash_map::Entry, HashMap}, + fmt::{Display, Error as FmtError, Formatter}, +}; + +use aleph_primitives::BlockNumber; +use sp_runtime::SaturatedConversion; + +use crate::{ + session::{first_block_of_session, session_id_from_block_num, SessionId}, + session_map::AuthorityProvider, + sync::substrate::verification::{verifier::SessionVerifier, FinalizationInfo}, + SessionPeriod, +}; + +/// Ways in which a justification can fail verification. +#[derive(Debug, PartialEq, Eq)] +pub enum CacheError { + UnknownAuthorities(SessionId), + SessionTooOld(SessionId, SessionId), + SessionInFuture(SessionId, SessionId), +} + +impl Display for CacheError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use CacheError::*; + match self { + SessionTooOld(session, lower_bound) => write!( + f, + "session {:?} is too old. Should be at least {:?}", + session, lower_bound + ), + SessionInFuture(session, upper_bound) => write!( + f, + "session {:?} without known authorities. Should be at most {:?}", + session, upper_bound + ), + UnknownAuthorities(session) => { + write!( + f, + "authorities for session {:?} not known even though they should be", + session + ) + } + } + } +} + +/// Cache storing SessionVerifier structs for multiple sessions. Keeps up to `cache_size` verifiers of top sessions. +/// If the session is too new or ancient it will fail to return a SessionVerifier. +/// Highest session verifier this cache returns is for the session after the current finalization session. +/// Lowest session verifier this cache returns is for `top_returned_session` - `cache_size`. +pub struct VerifierCache +where + AP: AuthorityProvider, + FI: FinalizationInfo, +{ + sessions: HashMap, + session_period: SessionPeriod, + finalization_info: FI, + authority_provider: AP, + cache_size: usize, + /// Lowest currently available session. + lower_bound: SessionId, +} + +impl VerifierCache +where + AP: AuthorityProvider, + FI: FinalizationInfo, +{ + pub fn new( + session_period: SessionPeriod, + finalization_info: FI, + authority_provider: AP, + cache_size: usize, + ) -> Self { + Self { + sessions: HashMap::new(), + session_period, + finalization_info, + authority_provider, + cache_size, + lower_bound: SessionId(0), + } + } +} + +/// Download authorities for the session and return `SessionVerifier` for them. `session_id` should be the first session, +/// or the first block from the session number `session_id - 1` should be finalized. +fn download_session_verifier>( + authority_provider: &AP, + session_id: SessionId, + session_period: SessionPeriod, +) -> Option { + let maybe_authority_data = match session_id { + SessionId(0) => authority_provider.authority_data(0), + SessionId(id) => { + let prev_first = first_block_of_session(SessionId(id - 1), session_period); + authority_provider.next_authority_data(prev_first) + } + }; + + maybe_authority_data.map(|a| a.into()) +} + +impl VerifierCache +where + AP: AuthorityProvider, + FI: FinalizationInfo, +{ + /// Prune all sessions with a number smaller than `session_id` + fn prune(&mut self, session_id: SessionId) { + self.sessions.retain(|&id, _| id >= session_id); + self.lower_bound = session_id; + } + + /// Returns session verifier for block number if available. Updates cache if necessary. + pub fn get(&mut self, number: BlockNumber) -> Result<&SessionVerifier, CacheError> { + let session_id = session_id_from_block_num(number, self.session_period); + + if session_id < self.lower_bound { + return Err(CacheError::SessionTooOld(session_id, self.lower_bound)); + } + + // We are sure about authorities in all session that have first block from previous session finalized. + let upper_bound = SessionId( + session_id_from_block_num( + self.finalization_info.finalized_number(), + self.session_period, + ) + .0 + 1, + ); + if session_id > upper_bound { + return Err(CacheError::SessionInFuture(session_id, upper_bound)); + } + + if session_id.0 + >= self + .lower_bound + .0 + .saturating_add(self.cache_size.saturated_into()) + { + self.prune(SessionId( + session_id + .0 + .saturating_sub(self.cache_size.saturated_into()) + + 1, + )); + } + + let verifier = match self.sessions.entry(session_id) { + Entry::Occupied(occupied) => occupied.into_mut(), + Entry::Vacant(vacant) => { + let verifier = download_session_verifier( + &self.authority_provider, + session_id, + self.session_period, + ) + .ok_or(CacheError::UnknownAuthorities(session_id))?; + vacant.insert(verifier) + } + }; + + Ok(verifier) + } +} + +#[cfg(test)] +mod tests { + use std::{cell::Cell, collections::HashMap}; + + use aleph_primitives::SessionAuthorityData; + use sp_runtime::SaturatedConversion; + + use super::{ + AuthorityProvider, BlockNumber, CacheError, FinalizationInfo, SessionVerifier, + VerifierCache, + }; + use crate::{ + session::{session_id_from_block_num, testing::authority_data, SessionId}, + SessionPeriod, + }; + + const SESSION_PERIOD: u32 = 30; + const CACHE_SIZE: usize = 2; + + type TestVerifierCache<'a> = VerifierCache>; + + struct MockFinalizationInfo<'a> { + finalized_number: &'a Cell, + } + + impl<'a> FinalizationInfo for MockFinalizationInfo<'a> { + fn finalized_number(&self) -> BlockNumber { + self.finalized_number.get() + } + } + + struct MockAuthorityProvider { + session_map: HashMap, + session_period: SessionPeriod, + } + + fn authority_data_for_session(session_id: u64) -> SessionAuthorityData { + authority_data(session_id * 4, (session_id + 1) * 4) + } + + impl MockAuthorityProvider { + fn new(session_n: u64) -> Self { + let session_map = (0..session_n + 1) + .map(|s| (SessionId(s.saturated_into()), authority_data_for_session(s))) + .collect(); + + Self { + session_map, + session_period: SessionPeriod(SESSION_PERIOD), + } + } + } + + impl AuthorityProvider for MockAuthorityProvider { + fn authority_data(&self, block: BlockNumber) -> Option { + self.session_map + .get(&session_id_from_block_num(block, self.session_period)) + .cloned() + } + + fn next_authority_data(&self, block: BlockNumber) -> Option { + self.session_map + .get(&SessionId( + session_id_from_block_num(block, self.session_period).0 + 1, + )) + .cloned() + } + } + + fn setup_test(max_session_n: u64, finalized_number: &'_ Cell) -> TestVerifierCache<'_> { + let finalization_info = MockFinalizationInfo { finalized_number }; + let authority_provider = MockAuthorityProvider::new(max_session_n); + + VerifierCache::new( + SessionPeriod(SESSION_PERIOD), + finalization_info, + authority_provider, + CACHE_SIZE, + ) + } + + fn finalize_first_in_session(finalized_number: &Cell, session_id: u32) { + finalized_number.set(session_id * SESSION_PERIOD); + } + + fn session_verifier( + verifier: &mut TestVerifierCache, + session_id: u32, + ) -> Result { + verifier.get((session_id + 1) * SESSION_PERIOD - 1).cloned() + } + + fn check_session_verifier(verifier: &mut TestVerifierCache, session_id: u32) { + let session_verifier = + session_verifier(verifier, session_id).expect("Should return verifier. Got error"); + let expected_verifier: SessionVerifier = + authority_data_for_session(session_id as u64).into(); + assert_eq!(session_verifier, expected_verifier); + } + + #[test] + fn genesis_session() { + let finalized_number = Cell::new(0); + + let mut verifier = setup_test(0, &finalized_number); + + check_session_verifier(&mut verifier, 0); + } + + #[test] + fn normal_session() { + let finalized_number = Cell::new(0); + + let mut verifier = setup_test(3, &finalized_number); + + check_session_verifier(&mut verifier, 0); + check_session_verifier(&mut verifier, 1); + + finalize_first_in_session(&finalized_number, 1); + check_session_verifier(&mut verifier, 0); + check_session_verifier(&mut verifier, 1); + check_session_verifier(&mut verifier, 2); + + finalize_first_in_session(&finalized_number, 2); + check_session_verifier(&mut verifier, 1); + check_session_verifier(&mut verifier, 2); + check_session_verifier(&mut verifier, 3); + } + + #[test] + fn prunes_old_sessions() { + let finalized_number = Cell::new(0); + + let mut verifier = setup_test(3, &finalized_number); + + check_session_verifier(&mut verifier, 0); + check_session_verifier(&mut verifier, 1); + + finalize_first_in_session(&finalized_number, 1); + check_session_verifier(&mut verifier, 2); + + // Should no longer have verifier for session 0 + assert_eq!( + session_verifier(&mut verifier, 0), + Err(CacheError::SessionTooOld(SessionId(0), SessionId(1))) + ); + + finalize_first_in_session(&finalized_number, 2); + check_session_verifier(&mut verifier, 3); + + // Should no longer have verifier for session 1 + assert_eq!( + session_verifier(&mut verifier, 1), + Err(CacheError::SessionTooOld(SessionId(1), SessionId(2))) + ); + } + + #[test] + fn session_from_future() { + let finalized_number = Cell::new(0); + + let mut verifier = setup_test(3, &finalized_number); + + finalize_first_in_session(&finalized_number, 1); + + // Did not finalize first block in session 2 yet + assert_eq!( + session_verifier(&mut verifier, 3), + Err(CacheError::SessionInFuture(SessionId(3), SessionId(2))) + ); + } + + #[test] + fn authority_provider_error() { + let finalized_number = Cell::new(0); + let mut verifier = setup_test(0, &finalized_number); + + assert_eq!( + session_verifier(&mut verifier, 1), + Err(CacheError::UnknownAuthorities(SessionId(1))) + ); + + finalize_first_in_session(&finalized_number, 1); + + assert_eq!( + session_verifier(&mut verifier, 2), + Err(CacheError::UnknownAuthorities(SessionId(2))) + ); + } +} diff --git a/finality-aleph/src/sync/substrate/verification/mod.rs b/finality-aleph/src/sync/substrate/verification/mod.rs new file mode 100644 index 0000000000..eefb6af68d --- /dev/null +++ b/finality-aleph/src/sync/substrate/verification/mod.rs @@ -0,0 +1,114 @@ +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + marker::PhantomData, + sync::Arc, +}; + +use aleph_primitives::BlockNumber; +use codec::Encode; +use sc_client_api::HeaderBackend; +use sp_runtime::traits::{Block as BlockT, Header as SubstrateHeader}; + +use crate::{ + session_map::AuthorityProvider, + sync::{ + substrate::{ + verification::{ + cache::{CacheError, VerifierCache}, + verifier::SessionVerificationError, + }, + Justification, + }, + Verifier, + }, +}; + +mod cache; +mod verifier; + +pub use verifier::SessionVerifier; + +/// Supplies finalized number. Will be unified together with other traits we used in A0-1839. +pub trait FinalizationInfo { + fn finalized_number(&self) -> BlockNumber; +} + +/// Substrate specific implementation of `FinalizationInfo` +pub struct SubstrateFinalizationInfo +where + BE: HeaderBackend, + B: BlockT, + B::Header: SubstrateHeader, +{ + client: Arc, + _phantom: PhantomData, +} + +impl SubstrateFinalizationInfo +where + BE: HeaderBackend, + B: BlockT, + B::Header: SubstrateHeader, +{ + pub fn new(client: Arc) -> Self { + Self { + client, + _phantom: PhantomData, + } + } +} + +impl FinalizationInfo for SubstrateFinalizationInfo +where + BE: HeaderBackend, + B: BlockT, + B::Header: SubstrateHeader, +{ + fn finalized_number(&self) -> BlockNumber { + self.client.info().finalized_number + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum VerificationError { + Verification(SessionVerificationError), + Cache(CacheError), +} + +impl From for VerificationError { + fn from(e: SessionVerificationError) -> Self { + VerificationError::Verification(e) + } +} + +impl From for VerificationError { + fn from(e: CacheError) -> Self { + VerificationError::Cache(e) + } +} + +impl Display for VerificationError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use VerificationError::*; + match self { + Verification(e) => write!(f, "{}", e), + Cache(e) => write!(f, "{}", e), + } + } +} + +impl Verifier> for VerifierCache +where + H: SubstrateHeader, + AP: AuthorityProvider, + FS: FinalizationInfo, +{ + type Error = VerificationError; + + fn verify(&mut self, justification: Justification) -> Result, Self::Error> { + let header = &justification.header; + let verifier = self.get(*header.number())?; + verifier.verify_bytes(&justification.raw_justification, header.hash().encode())?; + Ok(justification) + } +} diff --git a/finality-aleph/src/sync/substrate/verification/verifier.rs b/finality-aleph/src/sync/substrate/verification/verifier.rs new file mode 100644 index 0000000000..004ef9b536 --- /dev/null +++ b/finality-aleph/src/sync/substrate/verification/verifier.rs @@ -0,0 +1,90 @@ +use std::fmt::{Display, Error as FmtError, Formatter}; + +use aleph_primitives::SessionAuthorityData; +use codec::Encode; +use log::warn; +use sp_runtime::{traits::Block as BlockT, RuntimeAppPublic}; + +use crate::{ + crypto::AuthorityVerifier, + justification::{AlephJustification, Verifier as LegacyVerifier}, + AuthorityId, +}; + +/// A justification verifier within a single session. +#[derive(Clone, PartialEq, Debug)] +pub struct SessionVerifier { + authority_verifier: AuthorityVerifier, + emergency_signer: Option, +} + +impl From for SessionVerifier { + fn from(authority_data: SessionAuthorityData) -> Self { + SessionVerifier { + authority_verifier: AuthorityVerifier::new(authority_data.authorities().to_vec()), + emergency_signer: authority_data.emergency_finalizer().clone(), + } + } +} + +/// Ways in which a justification can be wrong. +#[derive(Debug, PartialEq, Eq)] +pub enum SessionVerificationError { + BadMultisignature, + BadEmergencySignature, + NoEmergencySigner, +} + +impl Display for SessionVerificationError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + use SessionVerificationError::*; + match self { + BadMultisignature => write!(f, "bad multisignature"), + BadEmergencySignature => write!(f, "bad emergency signature"), + NoEmergencySigner => write!(f, "no emergency signer defined"), + } + } +} + +impl SessionVerifier { + /// Verifies the correctness of a justification for supplied bytes. + pub fn verify_bytes( + &self, + justification: &AlephJustification, + bytes: Vec, + ) -> Result<(), SessionVerificationError> { + use AlephJustification::*; + use SessionVerificationError::*; + match justification { + CommitteeMultisignature(multisignature) => { + match self.authority_verifier.is_complete(&bytes, multisignature) { + true => Ok(()), + false => Err(BadMultisignature), + } + } + EmergencySignature(signature) => match self + .emergency_signer + .as_ref() + .ok_or(NoEmergencySigner)? + .verify(&bytes, signature) + { + true => Ok(()), + false => Err(BadEmergencySignature), + }, + } + } +} + +// This shouldn't be necessary after we remove the legacy justification sync. Then we can also +// rewrite the implementation above and make it simpler. +impl LegacyVerifier for SessionVerifier { + fn verify(&self, justification: &AlephJustification, hash: B::Hash) -> bool { + match self.verify_bytes(justification, hash.encode()) { + Ok(()) => true, + Err(e) => { + warn!(target: "aleph-justification", "Bad justification for block {:?}: {}", hash, e); + false + } + } + } +} diff --git a/finality-aleph/src/sync/task_queue.rs b/finality-aleph/src/sync/task_queue.rs new file mode 100644 index 0000000000..8f28521a5e --- /dev/null +++ b/finality-aleph/src/sync/task_queue.rs @@ -0,0 +1,118 @@ +use std::{ + cmp::Ordering, + collections::BinaryHeap, + fmt::{Debug, Formatter}, +}; + +use log::warn; +use tokio::time::{sleep, Duration, Instant}; + +use crate::sync::LOG_TARGET; + +#[derive(Clone)] +struct ScheduledTask { + task: T, + scheduled_time: Instant, +} + +impl Eq for ScheduledTask {} + +impl PartialEq for ScheduledTask { + fn eq(&self, other: &Self) -> bool { + other.scheduled_time.eq(&self.scheduled_time) + } +} + +impl PartialOrd for ScheduledTask { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for ScheduledTask { + /// Compare tasks so that earlier times come first in a max-heap. + fn cmp(&self, other: &Self) -> Ordering { + other.scheduled_time.cmp(&self.scheduled_time) + } +} + +#[derive(Clone, Default)] +pub struct TaskQueue { + queue: BinaryHeap>, +} + +impl Debug for TaskQueue { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("TaskQueue") + .field("task count", &self.queue.len()) + .finish() + } +} + +/// Implements a queue allowing for scheduling tasks for some time in the future. +/// +/// Does not actually execute any tasks, is used for ordering in time only. +impl TaskQueue { + /// Creates an empty queue. + pub fn new() -> Self { + Self { + queue: BinaryHeap::new(), + } + } + + /// Schedules `task` for after `delay`. + pub fn schedule_in(&mut self, task: T, delay: Duration) { + let scheduled_time = match Instant::now().checked_add(delay) { + Some(time) => time, + None => { + warn!( + target: LOG_TARGET, + "Could not schedule task in {:?}. Instant out of bound.", delay + ); + return; + } + }; + self.queue.push(ScheduledTask { + task, + scheduled_time, + }); + } + + /// Awaits for the first and most overdue task and returns it. Returns `None` if there are no tasks. + pub async fn pop(&mut self) -> Option { + let scheduled_task = self.queue.peek()?; + + let duration = scheduled_task + .scheduled_time + .saturating_duration_since(Instant::now()); + if !duration.is_zero() { + sleep(duration).await; + } + self.queue.pop().map(|t| t.task) + } +} + +#[cfg(test)] +mod tests { + use tokio::time::{timeout, Duration}; + + use super::TaskQueue; + + #[tokio::test] + async fn test_scheduling() { + let mut q = TaskQueue::new(); + q.schedule_in(2, Duration::from_millis(50)); + q.schedule_in(1, Duration::from_millis(20)); + + assert!(timeout(Duration::from_millis(5), q.pop()).await.is_err()); + assert_eq!( + timeout(Duration::from_millis(20), q.pop()).await, + Ok(Some(1)) + ); + assert!(timeout(Duration::from_millis(10), q.pop()).await.is_err()); + assert_eq!( + timeout(Duration::from_millis(50), q.pop()).await, + Ok(Some(2)) + ); + } +} diff --git a/finality-aleph/src/sync/ticker.rs b/finality-aleph/src/sync/ticker.rs new file mode 100644 index 0000000000..3120a0f13a --- /dev/null +++ b/finality-aleph/src/sync/ticker.rs @@ -0,0 +1,137 @@ +use tokio::time::{sleep, Duration, Instant}; + +/// This struct is used for rate limiting as an on-demand ticker. It can be used for ticking +/// at least once `max_timeout` but not more than once every `min_timeout`. +/// Example usage would be to use `wait` method in main select loop and `try_tick` whenever +/// you would like to tick sooner in another branch of select. +pub struct Ticker { + last_tick: Instant, + current_timeout: Duration, + max_timeout: Duration, + min_timeout: Duration, +} + +impl Ticker { + /// Retruns new Ticker struct. Behaves as if last tick happened during creation of TIcker. + /// Requires `max_timeout` >= `min_timeout`. + pub fn new(mut max_timeout: Duration, min_timeout: Duration) -> Self { + if max_timeout < min_timeout { + max_timeout = min_timeout; + }; + Self { + last_tick: Instant::now(), + current_timeout: max_timeout, + max_timeout, + min_timeout, + } + } + + /// Returns whether at least `min_timeout` time elapsed since the last tick. + /// If `min_timeout` elapsed since the last tick, returns true and records a tick. + /// If not, returns false and calls to `wait` will return when `min_timeout` + /// elapses until the next tick. + pub fn try_tick(&mut self) -> bool { + let now = Instant::now(); + if now.saturating_duration_since(self.last_tick) >= self.min_timeout { + self.last_tick = now; + self.current_timeout = self.max_timeout; + true + } else { + self.current_timeout = self.min_timeout; + false + } + } + + /// Sleeps until next tick should happen. + /// When enough time elapsed, returns and records a tick. + pub async fn wait_and_tick(&mut self) { + let since_last = Instant::now().saturating_duration_since(self.last_tick); + sleep(self.current_timeout.saturating_sub(since_last)).await; + self.current_timeout = self.max_timeout; + self.last_tick = Instant::now(); + } +} + +#[cfg(test)] +mod tests { + use tokio::time::{sleep, timeout, Duration}; + + use super::Ticker; + + const MAX_TIMEOUT: Duration = Duration::from_millis(700); + const MIN_TIMEOUT: Duration = Duration::from_millis(100); + + const MAX_TIMEOUT_PLUS: Duration = Duration::from_millis(800); + const MIN_TIMEOUT_PLUS: Duration = Duration::from_millis(200); + + fn setup_ticker() -> Ticker { + Ticker::new(MAX_TIMEOUT, MIN_TIMEOUT) + } + + #[tokio::test] + async fn try_tick() { + let mut ticker = setup_ticker(); + + assert!(!ticker.try_tick()); + sleep(MIN_TIMEOUT).await; + assert!(ticker.try_tick()); + assert!(!ticker.try_tick()); + } + + #[tokio::test] + async fn wait() { + let mut ticker = setup_ticker(); + + assert_ne!( + timeout(MIN_TIMEOUT_PLUS, ticker.wait_and_tick()).await, + Ok(()) + ); + assert_eq!(timeout(MAX_TIMEOUT, ticker.wait_and_tick()).await, Ok(())); + } + + #[tokio::test] + async fn wait_after_try_tick_true() { + let mut ticker = setup_ticker(); + + assert!(!ticker.try_tick()); + sleep(MIN_TIMEOUT).await; + assert!(ticker.try_tick()); + + assert_ne!( + timeout(MIN_TIMEOUT_PLUS, ticker.wait_and_tick()).await, + Ok(()) + ); + assert_eq!(timeout(MAX_TIMEOUT, ticker.wait_and_tick()).await, Ok(())); + } + + #[tokio::test] + async fn wait_after_try_tick_false() { + let mut ticker = setup_ticker(); + + assert!(!ticker.try_tick()); + + assert_eq!( + timeout(MIN_TIMEOUT_PLUS, ticker.wait_and_tick()).await, + Ok(()) + ); + assert_ne!( + timeout(MIN_TIMEOUT_PLUS, ticker.wait_and_tick()).await, + Ok(()) + ); + assert_eq!(timeout(MAX_TIMEOUT, ticker.wait_and_tick()).await, Ok(())); + } + + #[tokio::test] + async fn try_tick_after_wait() { + let mut ticker = setup_ticker(); + + assert_eq!( + timeout(MAX_TIMEOUT_PLUS, ticker.wait_and_tick()).await, + Ok(()) + ); + + assert!(!ticker.try_tick()); + sleep(MIN_TIMEOUT).await; + assert!(ticker.try_tick()); + } +} diff --git a/finality-aleph/src/tcp_network.rs b/finality-aleph/src/tcp_network.rs deleted file mode 100644 index d04bd4da6d..0000000000 --- a/finality-aleph/src/tcp_network.rs +++ /dev/null @@ -1,126 +0,0 @@ -use std::{io::Result as IoResult, net::ToSocketAddrs as _}; - -use aleph_primitives::AuthorityId; -use codec::{Decode, Encode}; -use log::info; -use tokio::net::{ - tcp::{OwnedReadHalf, OwnedWriteHalf}, - TcpListener, TcpStream, ToSocketAddrs, -}; - -use crate::{ - network::{Multiaddress, NetworkIdentity, PeerId}, - validator_network::{Dialer, Listener, Splittable}, -}; - -impl Splittable for TcpStream { - type Sender = OwnedWriteHalf; - type Receiver = OwnedReadHalf; - - fn split(self) -> (Self::Sender, Self::Receiver) { - let (receiver, sender) = self.into_split(); - (sender, receiver) - } -} - -#[async_trait::async_trait] -impl Listener for TcpListener { - type Connection = TcpStream; - type Error = std::io::Error; - - async fn accept(&mut self) -> Result { - let stream = TcpListener::accept(self).await.map(|(stream, _)| stream)?; - if stream.set_linger(None).is_err() { - info!(target: "validator-network", "stream.set_linger(None) failed."); - }; - Ok(stream) - } -} - -impl PeerId for AuthorityId {} - -/// A representation of a single TCP address with an associated peer ID. -#[derive(Debug, Hash, Encode, Decode, Clone, PartialEq, Eq)] -pub struct TcpMultiaddress { - peer_id: AuthorityId, - address: String, -} - -impl Multiaddress for TcpMultiaddress { - type PeerId = AuthorityId; - - fn get_peer_id(&self) -> Option { - Some(self.peer_id.clone()) - } - - fn add_matching_peer_id(self, peer_id: Self::PeerId) -> Option { - match self.peer_id == peer_id { - true => Some(self), - false => None, - } - } -} - -#[derive(Clone)] -struct TcpDialer; - -#[async_trait::async_trait] -impl Dialer for TcpDialer { - type Connection = TcpStream; - type Error = std::io::Error; - - async fn connect( - &mut self, - addresses: Vec, - ) -> Result { - let parsed_addresses: Vec<_> = addresses - .into_iter() - .filter_map(|address| address.address.to_socket_addrs().ok()) - .flatten() - .collect(); - let stream = TcpStream::connect(&parsed_addresses[..]).await?; - if stream.set_linger(None).is_err() { - info!(target: "validator-network", "stream.set_linger(None) failed."); - }; - Ok(stream) - } -} - -struct TcpNetworkIdentity { - peer_id: AuthorityId, - addresses: Vec, -} - -impl NetworkIdentity for TcpNetworkIdentity { - type PeerId = AuthorityId; - type Multiaddress = TcpMultiaddress; - - fn identity(&self) -> (Vec, Self::PeerId) { - (self.addresses.clone(), self.peer_id.clone()) - } -} - -/// Create a new tcp network, including an identity that can be used for constructing -/// authentications for other peers. -pub async fn new_tcp_network( - listening_addresses: A, - external_addresses: Vec, - peer_id: AuthorityId, -) -> IoResult<( - impl Dialer, - impl Listener, - impl NetworkIdentity, -)> { - let listener = TcpListener::bind(listening_addresses).await?; - let identity = TcpNetworkIdentity { - addresses: external_addresses - .into_iter() - .map(|address| TcpMultiaddress { - peer_id: peer_id.clone(), - address, - }) - .collect(), - peer_id, - }; - Ok((TcpDialer {}, listener, identity)) -} diff --git a/finality-aleph/src/testing/client_chain_builder.rs b/finality-aleph/src/testing/client_chain_builder.rs index af99b08be7..36a36a4517 100644 --- a/finality-aleph/src/testing/client_chain_builder.rs +++ b/finality-aleph/src/testing/client_chain_builder.rs @@ -26,7 +26,7 @@ pub struct ClientChainBuilder { fn assert_no_blocks_except_genesis(client: &TestClient) { assert!( - client.header(&BlockId::Number(1)).unwrap().is_none(), + client.hash(1).unwrap().is_none(), "Client is aware of some blocks beyond genesis" ); } @@ -54,9 +54,7 @@ impl ClientChainBuilder { /// Finalize block with given hash without providing justification. pub fn finalize_block(&self, hash: &H256) { - self.client - .finalize_block(BlockId::Hash(*hash), None) - .unwrap(); + self.client.finalize_block(*hash, None).unwrap(); } pub fn genesis_hash_num(&self) -> BlockHashNum { @@ -119,7 +117,7 @@ impl ClientChainBuilder { pub fn get_header_at(&self, num: u64) -> Header { self.client_builder - .header(&BlockId::Number(num)) + .header(self.client_builder.hash(num).unwrap().unwrap()) .unwrap() .unwrap() } diff --git a/finality-aleph/src/testing/clique_network.rs b/finality-aleph/src/testing/clique_network.rs new file mode 100644 index 0000000000..a30c840f3e --- /dev/null +++ b/finality-aleph/src/testing/clique_network.rs @@ -0,0 +1,312 @@ +use std::{ + collections::{BTreeMap, HashSet}, + sync::Once, +}; + +use futures::{ + channel::{mpsc, oneshot}, + StreamExt, +}; +use log::info; +use rand::{thread_rng, Rng}; +use sc_service::{SpawnTaskHandle, TaskManager}; +use tokio::{ + runtime::Handle, + time::{error::Elapsed, interval, timeout, Duration}, +}; + +use crate::network::{ + clique::{ + mock::{ + random_keys, Addresses, MockDialer, MockListener, MockPublicKey, MockSecretKey, + UnreliableConnectionMaker, + }, + Network, SecretKey, Service, + }, + mock::MockData, +}; + +pub const LOG_TARGET: &str = "clique-network-test"; + +const TWICE_MAX_DATA_SIZE: usize = 32 * 1024 * 1024; + +#[allow(clippy::too_many_arguments)] +fn spawn_peer( + secret_key: MockSecretKey, + addr: Addresses, + n_msg: usize, + large_message_interval: Option, + corrupted_message_interval: Option, + dialer: MockDialer, + listener: MockListener, + report: mpsc::UnboundedSender<(MockPublicKey, usize)>, + spawn_handle: SpawnTaskHandle, +) { + let our_id = secret_key.public_key(); + let (service, mut interface) = Service::new(dialer, listener, secret_key, spawn_handle); + // run the service + tokio::spawn(async { + let (_exit, rx) = oneshot::channel(); + service.run(rx).await; + }); + // start connecting with the peers + let mut peer_ids = Vec::with_capacity(addr.len()); + for (id, addrs) in addr.into_iter() { + interface.add_connection(id.clone(), addrs); + peer_ids.push(id); + } + // peer main loop + // we send random messages to random peers + // a message is a number in range 0..n_msg + // we also keep a list of messages received at least once + // on receiving a message we report the total number of distinct messages received so far + // the goal is to receive every message at least once + tokio::spawn(async move { + let mut received: HashSet = HashSet::with_capacity(n_msg); + let mut send_ticker = tokio::time::interval(Duration::from_millis(5)); + let mut counter: usize = 0; + loop { + tokio::select! { + _ = send_ticker.tick() => { + counter += 1; + // generate random message + let filler_size = match large_message_interval { + Some(lmi) if counter % lmi == 0 => TWICE_MAX_DATA_SIZE, + _ => 0, + }; + let data = match corrupted_message_interval { + Some(cmi) if counter % cmi == 0 => MockData::new_undecodable(thread_rng().gen_range(0..n_msg) as u32, filler_size), + _ => MockData::new(thread_rng().gen_range(0..n_msg) as u32, filler_size), + }; + // choose a peer + let peer: MockPublicKey = peer_ids[thread_rng().gen_range(0..peer_ids.len())].clone(); + // send + interface.send(data, peer); + }, + data = interface.next() => { + // receive the message + let data: MockData = data.expect("next should not be closed"); + // mark the message as received, we do not care about sender's identity + received.insert(data.data() as usize); + // report the number of received messages + report.unbounded_send((our_id.clone(), received.len())).expect("should send"); + }, + }; + } + }); +} + +/// Takes O(n log n) rounds to finish, where n = n_peers * n_msg. +async fn scenario( + n_peers: usize, + n_msg: usize, + broken_connection_interval: Option, + large_message_interval: Option, + corrupted_message_interval: Option, + status_report_interval: Duration, +) { + // create spawn_handle, we need to keep the task_manager + let task_manager = + TaskManager::new(Handle::current(), None).expect("should create TaskManager"); + let spawn_handle = task_manager.spawn_handle(); + // create peer identities + info!(target: LOG_TARGET, "generating keys..."); + let keys = random_keys(n_peers); + info!(target: LOG_TARGET, "done"); + // prepare and run the manager + let (mut connection_manager, mut callers, addr) = + UnreliableConnectionMaker::new(keys.keys().cloned().collect()); + tokio::spawn(async move { + connection_manager.run(broken_connection_interval).await; + }); + // channel for receiving status updates from spawned peers + let (tx_report, mut rx_report) = mpsc::unbounded::<(MockPublicKey, usize)>(); + let mut reports: BTreeMap = + keys.keys().cloned().map(|id| (id, 0)).collect(); + // spawn peers + for (id, secret_key) in keys.into_iter() { + let mut addr = addr.clone(); + // do not connect with itself + addr.remove(&secret_key.public_key()); + let (dialer, listener) = callers.remove(&id).expect("should contain all ids"); + spawn_peer( + secret_key, + addr, + n_msg, + large_message_interval, + corrupted_message_interval, + dialer, + listener, + tx_report.clone(), + spawn_handle.clone(), + ); + } + let mut status_ticker = interval(status_report_interval); + loop { + tokio::select! { + maybe_report = rx_report.next() => match maybe_report { + Some((peer_id, peer_n_msg)) => { + reports.insert(peer_id, peer_n_msg); + if reports.values().all(|&x| x == n_msg) { + info!(target: LOG_TARGET, "Peers received {:?} messages out of {}, finishing.", reports.values(), n_msg); + return; + } + }, + None => panic!("should receive"), + }, + _ = status_ticker.tick() => { + info!(target: LOG_TARGET, "Peers received {:?} messages out of {}.", reports.values(), n_msg); + } + }; + } +} + +/// Takes O(n log n) rounds to finish, where n = n_peers * n_msg. +async fn scenario_with_timeout( + n_peers: usize, + n_msg: usize, + broken_connection_interval: Option, + large_message_interval: Option, + corrupted_message_interval: Option, + status_report_interval: Duration, + scenario_timeout: Duration, +) -> Result<(), Elapsed> { + timeout( + scenario_timeout, + scenario( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + ), + ) + .await +} + +static INIT: Once = Once::new(); + +/// Required to capture logs from the tests e.g. by running +/// `RUST_LOG=info cargo test -- --nocapture testing::clique_network` +fn setup() { + // env_logger::init can be called at most once + INIT.call_once(|| { + env_logger::init(); + }); +} + +#[tokio::test(flavor = "multi_thread")] +async fn normal_conditions() { + setup(); + let n_peers: usize = 10; + let n_msg: usize = 30; + let broken_connection_interval: Option = None; + let large_message_interval: Option = None; + let corrupted_message_interval: Option = None; + let status_report_interval: Duration = Duration::from_secs(1); + let timeout: Duration = Duration::from_secs(300); + scenario_with_timeout( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + timeout, + ) + .await + .expect("timeout"); +} + +#[tokio::test(flavor = "multi_thread")] +async fn connections_break() { + setup(); + let n_peers: usize = 10; + let n_msg: usize = 30; + let broken_connection_interval: Option = Some(10); + let large_message_interval: Option = None; + let corrupted_message_interval: Option = None; + let status_report_interval: Duration = Duration::from_secs(1); + let timeout: Duration = Duration::from_secs(300); + scenario_with_timeout( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + timeout, + ) + .await + .expect("timeout"); +} + +#[tokio::test(flavor = "multi_thread")] +async fn large_messages_being_sent() { + setup(); + let n_peers: usize = 10; + let n_msg: usize = 30; + let broken_connection_interval: Option = None; + let large_message_interval: Option = Some(10); + let corrupted_message_interval: Option = None; + let status_report_interval: Duration = Duration::from_secs(1); + let timeout: Duration = Duration::from_secs(300); + scenario_with_timeout( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + timeout, + ) + .await + .expect("timeout"); +} + +#[tokio::test(flavor = "multi_thread")] +async fn corrupted_messages_being_sent() { + setup(); + let n_peers: usize = 10; + let n_msg: usize = 30; + let broken_connection_interval: Option = None; + let large_message_interval: Option = None; + let corrupted_message_interval: Option = Some(10); + let status_report_interval: Duration = Duration::from_secs(1); + let timeout: Duration = Duration::from_secs(300); + scenario_with_timeout( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + timeout, + ) + .await + .expect("timeout"); +} + +#[tokio::test(flavor = "multi_thread")] +async fn everything_fails_all_the_time() { + setup(); + let n_peers: usize = 3; + let n_msg: usize = 10; + let broken_connection_interval: Option = Some(5); + let large_message_interval: Option = Some(7); + let corrupted_message_interval: Option = Some(8); + let status_report_interval: Duration = Duration::from_secs(1); + let timeout: Duration = Duration::from_secs(600); + scenario_with_timeout( + n_peers, + n_msg, + broken_connection_interval, + large_message_interval, + corrupted_message_interval, + status_report_interval, + timeout, + ) + .await + .expect("timeout"); +} diff --git a/finality-aleph/src/testing/data_store.rs b/finality-aleph/src/testing/data_store.rs index 1342392751..ceb32cfde3 100644 --- a/finality-aleph/src/testing/data_store.rs +++ b/finality-aleph/src/testing/data_store.rs @@ -18,7 +18,10 @@ use tokio::time::timeout; use crate::{ data_io::{AlephData, AlephNetworkMessage, DataStore, DataStoreConfig, MAX_DATA_BRANCH_LEN}, - network::{ComponentNetwork, Data, DataNetwork, RequestBlocks}, + network::{ + data::{component::Network as ComponentNetwork, Network as DataNetwork}, + Data, RequestBlocks, + }, session::{SessionBoundaries, SessionId, SessionPeriod}, testing::{ client_chain_builder::ClientChainBuilder, @@ -257,7 +260,7 @@ async fn correct_messages_go_through() { .await; for i in 1..=MAX_DATA_BRANCH_LEN { - let blocks_branch = blocks[0..(i as usize)].to_vec(); + let blocks_branch = blocks[0..i].to_vec(); let test_data: TestData = vec![aleph_data_from_blocks(blocks_branch)]; test_handler.send_data(test_data.clone()); @@ -279,7 +282,7 @@ async fn too_long_branch_message_does_not_go_through() { test_handler.finalize_block(&blocks[MAX_DATA_BRANCH_LEN + 2].hash()); - let blocks_branch = blocks[0..((MAX_DATA_BRANCH_LEN + 1) as usize)].to_vec(); + let blocks_branch = blocks[0..(MAX_DATA_BRANCH_LEN + 1)].to_vec(); let test_data: TestData = vec![aleph_data_from_blocks(blocks_branch)]; test_handler.send_data(test_data.clone()); test_handler @@ -378,7 +381,7 @@ async fn branch_with_not_finalized_ancestor_correctly_handled() { fn send_proposals_of_each_len(blocks: Vec, test_handler: &mut TestHandler) { for i in 1..=MAX_DATA_BRANCH_LEN { - let blocks_branch = blocks[0..(i as usize)].to_vec(); + let blocks_branch = blocks[0..i].to_vec(); let test_data: TestData = vec![aleph_data_from_blocks(blocks_branch)]; test_handler.send_data(test_data.clone()); } diff --git a/finality-aleph/src/testing/justification.rs b/finality-aleph/src/testing/justification.rs index 5777d4e72d..9cb3fd4373 100644 --- a/finality-aleph/src/testing/justification.rs +++ b/finality-aleph/src/testing/justification.rs @@ -1,4 +1,4 @@ -use std::{cell::RefCell, collections::VecDeque, sync::Arc, time::Duration}; +use std::{cell::RefCell, collections::VecDeque, time::Duration}; use futures::{ channel::mpsc::{unbounded, UnboundedSender}, @@ -12,7 +12,7 @@ use AcceptancePolicy::*; use crate::{ justification::{AlephJustification, JustificationHandler, JustificationHandlerConfig}, testing::mocks::{ - create_block, AcceptancePolicy, Client, JustificationRequestSchedulerImpl, + create_block, AcceptancePolicy, Backend, JustificationRequestSchedulerImpl, MockedBlockFinalizer, MockedBlockRequester, SessionInfoProviderImpl, TBlock, VerifierWrapper, }, @@ -26,15 +26,15 @@ type TJustHandler = JustificationHandler< TBlock, VerifierWrapper, MockedBlockRequester, - Client, JustificationRequestSchedulerImpl, SessionInfoProviderImpl, MockedBlockFinalizer, + Backend, >; type Sender = UnboundedSender>; type Environment = ( TJustHandler, - Client, + Backend, MockedBlockRequester, MockedBlockFinalizer, JustificationRequestSchedulerImpl, @@ -67,7 +67,7 @@ fn prepare_env( verification_policy: AcceptancePolicy, request_policy: AcceptancePolicy, ) -> Environment { - let client = Client::new(finalization_height); + let backend = Backend::new(finalization_height); let info_provider = SessionInfoProviderImpl::new(SESSION_PERIOD, verification_policy); let finalizer = MockedBlockFinalizer::new(); let requester = MockedBlockRequester::new(); @@ -77,7 +77,7 @@ fn prepare_env( let justification_handler = JustificationHandler::new( info_provider, requester.clone(), - Arc::new(client.clone()), + backend.clone(), finalizer.clone(), justification_request_scheduler.clone(), None, @@ -86,7 +86,7 @@ fn prepare_env( ( justification_handler, - client, + backend, requester, finalizer, justification_request_scheduler, @@ -125,19 +125,19 @@ where S: FnOnce( Sender, Sender, - Client, + Backend, MockedBlockRequester, MockedBlockFinalizer, JustificationRequestSchedulerImpl, ) -> F, { - let (justification_handler, client, requester, finalizer, justification_request_scheduler) = + let (justification_handler, backend, requester, finalizer, justification_request_scheduler) = env; let (handle_run, auth_just_tx, imp_just_tx) = run_justification_handler(justification_handler); scenario( auth_just_tx.clone(), imp_just_tx.clone(), - client, + backend, requester, finalizer, justification_request_scheduler, @@ -186,8 +186,8 @@ async fn expect_not_requested( async fn leads_to_finalization_when_appropriate_justification_comes() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message).unwrap(); expect_finalized(&finalizer, &justification_request_scheduler, block).await; @@ -201,8 +201,8 @@ async fn waits_for_verifier_before_finalizing() { let verification_policy = FromSequence(RefCell::new(VecDeque::from(vec![false, false, true]))); run_test( prepare_env(FINALIZED_HEIGHT, verification_policy, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message.clone()).unwrap(); @@ -222,8 +222,8 @@ async fn waits_for_verifier_before_finalizing() { async fn keeps_finalizing_block_if_not_finalized_yet() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |auth_just_tx, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |auth_just_tx, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message.clone()).unwrap(); @@ -240,8 +240,8 @@ async fn keeps_finalizing_block_if_not_finalized_yet() { async fn ignores_notifications_for_old_blocks() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.get_block(BlockId::Number(1u64)).unwrap(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.get_block(BlockId::Number(1u64)).unwrap(); let message = create_justification_notification_for(block); imp_just_tx.unbounded_send(message).unwrap(); expect_not_finalized(&finalizer, &justification_request_scheduler).await; @@ -268,8 +268,8 @@ async fn ignores_notifications_from_future_session() { async fn does_not_buffer_notifications_from_future_session() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let current_block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let current_block = backend.next_block_to_finalize(); let future_block = create_block(current_block.hash(), SESSION_PERIOD.0 as u64); let message = create_justification_notification_for(future_block); @@ -290,8 +290,8 @@ async fn does_not_buffer_notifications_from_future_session() { async fn requests_for_session_ending_justification() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysReject, AlwaysAccept), - |_, imp_just_tx, client, requester, _, justification_request_scheduler| async move { - let last_block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, requester, _, justification_request_scheduler| async move { + let last_block = backend.next_block_to_finalize(); // doesn't need any notification passed to keep asking expect_requested( @@ -321,14 +321,14 @@ async fn requests_for_session_ending_justification() { async fn does_not_request_for_session_ending_justification_too_often() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysReject, AlwaysReject), - |_, _, client, requester, _, justification_request_scheduler| async move { + |_, _, backend, requester, _, justification_request_scheduler| async move { expect_not_requested(&requester, &justification_request_scheduler).await; justification_request_scheduler.update_policy(AlwaysAccept); expect_requested( &requester, &justification_request_scheduler, - client.next_block_to_finalize(), + backend.next_block_to_finalize(), ) .await; @@ -343,10 +343,10 @@ async fn does_not_request_for_session_ending_justification_too_often() { async fn does_not_request_nor_finalize_when_verifier_is_not_available() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, Unavailable, AlwaysAccept), - |_, imp_just_tx, client, requester, finalizer, justification_request_scheduler| async move { + |_, imp_just_tx, backend, requester, finalizer, justification_request_scheduler| async move { expect_not_requested(&requester, &justification_request_scheduler).await; - let block = client.next_block_to_finalize(); + let block = backend.next_block_to_finalize(); imp_just_tx .unbounded_send(create_justification_notification_for(block)) .unwrap(); diff --git a/finality-aleph/src/testing/mocks/header_backend.rs b/finality-aleph/src/testing/mocks/backend.rs similarity index 72% rename from finality-aleph/src/testing/mocks/header_backend.rs rename to finality-aleph/src/testing/mocks/backend.rs index 4adaf2c8f2..a2365ad7b4 100644 --- a/finality-aleph/src/testing/mocks/header_backend.rs +++ b/finality-aleph/src/testing/mocks/backend.rs @@ -1,11 +1,14 @@ use sp_api::BlockId; -use sp_blockchain::{BlockStatus, HeaderBackend, Info}; +use sp_blockchain::Info; use sp_runtime::traits::Block; -use crate::testing::mocks::{TBlock, THash, THeader, TNumber}; +use crate::{ + testing::mocks::{TBlock, THash, THeader, TNumber}, + BlockchainBackend, +}; #[derive(Clone)] -pub(crate) struct Client { +pub(crate) struct Backend { blocks: Vec, next_block_to_finalize: TBlock, } @@ -25,7 +28,7 @@ pub(crate) fn create_block(parent_hash: THash, number: TNumber) -> TBlock { const GENESIS_HASH: [u8; 32] = [0u8; 32]; -impl Client { +impl Backend { pub(crate) fn new(finalized_height: u64) -> Self { let mut blocks: Vec = vec![]; @@ -40,7 +43,7 @@ impl Client { let next_block_to_finalize = create_block(blocks.last().unwrap().hash(), finalized_height + 1); - Client { + Backend { blocks, next_block_to_finalize, } @@ -70,11 +73,30 @@ impl Client { } } -impl HeaderBackend for Client { +impl BlockchainBackend for Backend { + fn children(&self, parent_hash: THash) -> Vec { + if self.next_block_to_finalize.hash() == parent_hash { + Vec::new() + } else if self + .blocks + .last() + .map(|b| b.hash()) + .unwrap() + .eq(&parent_hash) + { + vec![self.next_block_to_finalize.hash()] + } else { + self.blocks + .windows(2) + .flat_map(<&[TBlock; 2]>::try_from) + .find(|[parent, _]| parent.header.hash().eq(&parent_hash)) + .map(|[_, c]| vec![c.hash()]) + .unwrap_or_default() + } + } fn header(&self, id: BlockId) -> sp_blockchain::Result> { Ok(self.get_block(id).map(|b| b.header)) } - fn info(&self) -> Info { Info { best_hash: self.next_block_to_finalize.hash(), @@ -87,23 +109,8 @@ impl HeaderBackend for Client { block_gap: None, } } - - fn status(&self, id: BlockId) -> sp_blockchain::Result { - Ok(match self.get_block(id) { - Some(_) => BlockStatus::InChain, - _ => BlockStatus::Unknown, - }) - } - - fn number(&self, hash: THash) -> sp_blockchain::Result> { - Ok(self.get_block(BlockId::hash(hash)).map(|b| b.header.number)) - } - - fn hash(&self, number: TNumber) -> sp_blockchain::Result> { - Ok(self.get_block(BlockId::Number(number)).map(|b| b.hash())) - } } -unsafe impl Send for Client {} +unsafe impl Send for Backend {} -unsafe impl Sync for Client {} +unsafe impl Sync for Backend {} diff --git a/finality-aleph/src/testing/mocks/justification_handler_config.rs b/finality-aleph/src/testing/mocks/justification_handler_config.rs index 49dee9543e..6db2ec7f16 100644 --- a/finality-aleph/src/testing/mocks/justification_handler_config.rs +++ b/finality-aleph/src/testing/mocks/justification_handler_config.rs @@ -5,7 +5,7 @@ use std::{ use crate::{ justification::{JustificationHandlerConfig, JustificationRequestScheduler, SchedulerActions}, - testing::mocks::{single_action_mock::SingleActionMock, AcceptancePolicy, TBlock}, + testing::mocks::{single_action_mock::SingleActionMock, AcceptancePolicy}, }; #[derive(Clone)] @@ -58,12 +58,11 @@ impl JustificationRequestScheduler for JustificationRequestSchedulerImpl { const DEFAULT_VERIFIER_TIMEOUT_MS: u64 = 10u64; const DEFAULT_NOTIFICATION_TIMEOUT_MS: u64 = 10u64; -impl JustificationHandlerConfig { +impl JustificationHandlerConfig { pub fn test() -> Self { JustificationHandlerConfig::new( Duration::from_millis(DEFAULT_VERIFIER_TIMEOUT_MS), Duration::from_millis(DEFAULT_NOTIFICATION_TIMEOUT_MS), - 3u32.into(), ) } } diff --git a/finality-aleph/src/testing/mocks/mod.rs b/finality-aleph/src/testing/mocks/mod.rs index 3a95478e8d..fdd4d2a098 100644 --- a/finality-aleph/src/testing/mocks/mod.rs +++ b/finality-aleph/src/testing/mocks/mod.rs @@ -1,7 +1,7 @@ pub(crate) use acceptance_policy::AcceptancePolicy; +pub(crate) use backend::{create_block, Backend}; pub(crate) use block_finalizer::MockedBlockFinalizer; pub(crate) use block_request::MockedBlockRequester; -pub(crate) use header_backend::{create_block, Client}; pub(crate) use justification_handler_config::JustificationRequestSchedulerImpl; pub(crate) use proposal::{ aleph_data_from_blocks, aleph_data_from_headers, unvalidated_proposal_from_headers, @@ -14,11 +14,10 @@ pub(crate) type THash = substrate_test_runtime::Hash; pub(crate) type TNumber = substrate_test_runtime::BlockNumber; mod acceptance_policy; +mod backend; mod block_finalizer; mod block_request; -mod header_backend; mod justification_handler_config; mod proposal; mod session_info; mod single_action_mock; -pub mod validator_network; diff --git a/finality-aleph/src/testing/mocks/session_info.rs b/finality-aleph/src/testing/mocks/session_info.rs index 97e9c7a5a5..9e86190521 100644 --- a/finality-aleph/src/testing/mocks/session_info.rs +++ b/finality-aleph/src/testing/mocks/session_info.rs @@ -34,13 +34,10 @@ impl SessionInfoProviderImpl { #[async_trait::async_trait] impl SessionInfoProvider for SessionInfoProviderImpl { async fn for_block_num(&self, number: TNumber) -> SessionInfo { - let current_session = session_id_from_block_num::(number, self.session_period); + let current_session = session_id_from_block_num(number, self.session_period); SessionInfo { current_session, - last_block_height: last_block_of_session::( - current_session, - self.session_period, - ), + last_block_height: last_block_of_session(current_session, self.session_period), verifier: match &*self.acceptance_policy.lock().unwrap() { AcceptancePolicy::Unavailable => None, _ => Some(VerifierWrapper { diff --git a/finality-aleph/src/testing/mocks/validator_network.rs b/finality-aleph/src/testing/mocks/validator_network.rs deleted file mode 100644 index 17bc72cbd0..0000000000 --- a/finality-aleph/src/testing/mocks/validator_network.rs +++ /dev/null @@ -1,522 +0,0 @@ -use std::{ - collections::{BTreeMap, HashMap, HashSet}, - io::Result as IoResult, - pin::Pin, - sync::Arc, - task::{Context, Poll}, -}; - -use aleph_primitives::{AuthorityId, KEY_TYPE}; -use codec::{Decode, Encode, Output}; -use futures::{ - channel::{mpsc, oneshot}, - StreamExt, -}; -use log::info; -use rand::{thread_rng, Rng}; -use sc_service::{SpawnTaskHandle, TaskManager}; -use sp_keystore::{testing::KeyStore, CryptoStore}; -use tokio::{ - io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf}, - runtime::Handle, - time::{error::Elapsed, interval, timeout, Duration}, -}; - -use crate::{ - crypto::AuthorityPen, - network::{mock::Channel, Data, Multiaddress, NetworkIdentity}, - validator_network::{ - mock::random_keys, Dialer as DialerT, Listener as ListenerT, Network, Service, Splittable, - }, -}; - -pub type MockMultiaddress = (AuthorityId, String); - -impl Multiaddress for MockMultiaddress { - type PeerId = AuthorityId; - - fn get_peer_id(&self) -> Option { - Some(self.0.clone()) - } - - fn add_matching_peer_id(self, peer_id: Self::PeerId) -> Option { - match self.0 == peer_id { - true => Some(self), - false => None, - } - } -} - -#[derive(Clone)] -pub struct MockNetwork { - pub add_connection: Channel<(AuthorityId, Vec)>, - pub remove_connection: Channel, - pub send: Channel<(D, AuthorityId)>, - pub next: Channel, - id: AuthorityId, - addresses: Vec, -} - -#[async_trait::async_trait] -impl Network for MockNetwork { - fn add_connection(&mut self, peer: AuthorityId, addresses: Vec) { - self.add_connection.send((peer, addresses)); - } - - fn remove_connection(&mut self, peer: AuthorityId) { - self.remove_connection.send(peer); - } - - fn send(&self, data: D, recipient: AuthorityId) { - self.send.send((data, recipient)); - } - - async fn next(&mut self) -> Option { - self.next.next().await - } -} - -impl NetworkIdentity for MockNetwork { - type PeerId = AuthorityId; - type Multiaddress = MockMultiaddress; - - fn identity(&self) -> (Vec, Self::PeerId) { - (self.addresses.clone(), self.id.clone()) - } -} - -impl MockNetwork { - pub async fn new(address: &str) -> Self { - let key_store = Arc::new(KeyStore::new()); - let id: AuthorityId = key_store - .ed25519_generate_new(KEY_TYPE, None) - .await - .unwrap() - .into(); - let addresses = vec![(id.clone(), String::from(address))]; - MockNetwork { - add_connection: Channel::new(), - remove_connection: Channel::new(), - send: Channel::new(), - next: Channel::new(), - addresses, - id, - } - } - - // Consumes the network asserting there are no unreceived messages in the channels. - pub async fn _close_channels(self) { - assert!(self.add_connection.close().await.is_none()); - assert!(self.remove_connection.close().await.is_none()); - assert!(self.send.close().await.is_none()); - assert!(self.next.close().await.is_none()); - } -} - -/// Bidirectional in-memory stream that closes abruptly after a specified -/// number of poll_write calls. -#[derive(Debug)] -pub struct UnreliableDuplexStream { - stream: DuplexStream, - counter: Option, -} - -impl AsyncWrite for UnreliableDuplexStream { - fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { - let this = self.get_mut(); - if let Some(ref mut c) = this.counter { - if c == &0 { - if Pin::new(&mut this.stream).poll_shutdown(cx).is_pending() { - return Poll::Pending; - } - } else { - *c -= 1; - } - } - Pin::new(&mut this.stream).poll_write(cx, buf) - } - - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().stream).poll_flush(cx) - } - - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().stream).poll_shutdown(cx) - } -} - -impl AsyncRead for UnreliableDuplexStream { - fn poll_read( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut ReadBuf<'_>, - ) -> Poll> { - Pin::new(&mut self.get_mut().stream).poll_read(cx, buf) - } -} - -/// A stream that can be split into two instances of UnreliableDuplexStream. -#[derive(Debug)] -pub struct UnreliableSplittable { - incoming_data: UnreliableDuplexStream, - outgoing_data: UnreliableDuplexStream, -} - -impl UnreliableSplittable { - /// Create a pair of mock splittables connected to each other. - pub fn new(max_buf_size: usize, ends_after: Option) -> (Self, Self) { - let (in_a, out_b) = duplex(max_buf_size); - let (in_b, out_a) = duplex(max_buf_size); - ( - UnreliableSplittable { - incoming_data: UnreliableDuplexStream { - stream: in_a, - counter: ends_after, - }, - outgoing_data: UnreliableDuplexStream { - stream: out_a, - counter: ends_after, - }, - }, - UnreliableSplittable { - incoming_data: UnreliableDuplexStream { - stream: in_b, - counter: ends_after, - }, - outgoing_data: UnreliableDuplexStream { - stream: out_b, - counter: ends_after, - }, - }, - ) - } -} - -impl AsyncRead for UnreliableSplittable { - fn poll_read( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut ReadBuf<'_>, - ) -> Poll> { - Pin::new(&mut self.get_mut().incoming_data).poll_read(cx, buf) - } -} - -impl AsyncWrite for UnreliableSplittable { - fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_write(cx, buf) - } - - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_flush(cx) - } - - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_shutdown(cx) - } -} - -impl Splittable for UnreliableSplittable { - type Sender = UnreliableDuplexStream; - type Receiver = UnreliableDuplexStream; - - fn split(self) -> (Self::Sender, Self::Receiver) { - (self.outgoing_data, self.incoming_data) - } -} - -type Address = u32; -type Addresses = HashMap>; -type Callers = HashMap; -type Connection = UnreliableSplittable; - -const TWICE_MAX_DATA_SIZE: usize = 32 * 1024 * 1024; - -#[derive(Clone)] -pub struct MockDialer { - channel_connect: mpsc::UnboundedSender<(Address, oneshot::Sender)>, -} - -#[async_trait::async_trait] -impl DialerT

for MockDialer { - type Connection = Connection; - type Error = std::io::Error; - - async fn connect(&mut self, addresses: Vec
) -> Result { - let (tx, rx) = oneshot::channel(); - self.channel_connect - .unbounded_send((addresses[0], tx)) - .expect("should send"); - Ok(rx.await.expect("should receive")) - } -} - -pub struct MockListener { - channel_accept: mpsc::UnboundedReceiver, -} - -#[async_trait::async_trait] -impl ListenerT for MockListener { - type Connection = Connection; - type Error = std::io::Error; - - async fn accept(&mut self) -> Result { - Ok(self.channel_accept.next().await.expect("should receive")) - } -} - -pub struct UnreliableConnectionMaker { - dialers: mpsc::UnboundedReceiver<(Address, oneshot::Sender)>, - listeners: Vec>, -} - -impl UnreliableConnectionMaker { - pub fn new(ids: Vec) -> (Self, Callers, Addresses) { - let mut listeners = Vec::with_capacity(ids.len()); - let mut callers = HashMap::with_capacity(ids.len()); - let (tx_dialer, dialers) = mpsc::unbounded(); - // create peer addresses that will be understood by the main loop in method run - // each peer gets a one-element vector containing its index, so we'll be able - // to retrieve proper communication channels - let addr: Addresses = ids - .clone() - .into_iter() - .zip(0..ids.len()) - .map(|(id, u)| (id, vec![u as u32])) - .collect(); - // create callers for every peer, keep channels for communicating with them - for id in ids.into_iter() { - let (tx_listener, rx_listener) = mpsc::unbounded(); - let dialer = MockDialer { - channel_connect: tx_dialer.clone(), - }; - let listener = MockListener { - channel_accept: rx_listener, - }; - listeners.push(tx_listener); - callers.insert(id, (dialer, listener)); - } - ( - UnreliableConnectionMaker { dialers, listeners }, - callers, - addr, - ) - } - - pub async fn run(&mut self, connections_end_after: Option) { - loop { - info!(target: "validator-network", "UnreliableConnectionMaker: waiting for new request..."); - let (addr, c) = self.dialers.next().await.expect("should receive"); - info!(target: "validator-network", "UnreliableConnectionMaker: received request"); - let (l_stream, r_stream) = Connection::new(4096, connections_end_after); - info!(target: "validator-network", "UnreliableConnectionMaker: sending stream"); - c.send(l_stream).expect("should send"); - self.listeners[addr as usize] - .unbounded_send(r_stream) - .expect("should send"); - } - } -} - -#[derive(Clone)] -struct MockData { - data: u32, - filler: Vec, - decodes: bool, -} - -impl MockData { - fn new(data: u32, filler_size: usize, decodes: bool) -> MockData { - MockData { - data, - filler: vec![0; filler_size], - decodes, - } - } -} - -impl Encode for MockData { - fn size_hint(&self) -> usize { - self.data.size_hint() + self.filler.size_hint() + self.decodes.size_hint() - } - - fn encode_to(&self, dest: &mut T) { - // currently this is exactly the default behaviour, but we still - // need it here to make sure that decode works in the future - self.data.encode_to(dest); - self.filler.encode_to(dest); - self.decodes.encode_to(dest); - } -} - -impl Decode for MockData { - fn decode(value: &mut I) -> Result { - let data = u32::decode(value)?; - let filler = Vec::::decode(value)?; - let decodes = bool::decode(value)?; - if !decodes { - return Err("Simulated decode failure.".into()); - } - Ok(Self { - data, - filler, - decodes, - }) - } -} - -#[allow(clippy::too_many_arguments)] -fn spawn_peer( - pen: AuthorityPen, - addr: Addresses, - n_msg: usize, - large_message_interval: Option, - corrupted_message_interval: Option, - dialer: MockDialer, - listener: MockListener, - report: mpsc::UnboundedSender<(AuthorityId, usize)>, - spawn_handle: SpawnTaskHandle, -) { - let our_id = pen.authority_id(); - let (service, mut interface) = Service::new(dialer, listener, pen, spawn_handle); - // run the service - tokio::spawn(async { - let (_exit, rx) = oneshot::channel(); - service.run(rx).await; - }); - // start connecting with the peers - let mut peer_ids = Vec::with_capacity(addr.len()); - for (id, addrs) in addr.into_iter() { - interface.add_connection(id.clone(), addrs); - peer_ids.push(id); - } - // peer main loop - // we send random messages to random peers - // a message is a number in range 0..n_msg - // we also keep a list of messages received at least once - // on receiving a message we report the total number of distinct messages received so far - // the goal is to receive every message at least once - tokio::spawn(async move { - let mut received: HashSet = HashSet::with_capacity(n_msg); - let mut send_ticker = tokio::time::interval(Duration::from_millis(5)); - let mut counter: usize = 0; - loop { - tokio::select! { - _ = send_ticker.tick() => { - counter += 1; - // generate random message - let mut filler_size = 0; - if let Some(lmi) = large_message_interval && counter % lmi == 0 { - filler_size = TWICE_MAX_DATA_SIZE; - } - let mut decodes = true; - if let Some(cmi) = corrupted_message_interval && counter % cmi == 0 { - decodes = false; - } - let data: MockData = MockData::new(thread_rng().gen_range(0..n_msg) as u32, filler_size, decodes); - // choose a peer - let peer: AuthorityId = peer_ids[thread_rng().gen_range(0..peer_ids.len())].clone(); - // send - interface.send(data, peer); - }, - data = interface.next() => { - // receive the message - let data: MockData = data.expect("next should not be closed"); - // mark the message as received, we do not care about sender's identity - received.insert(data.data as usize); - // report the number of received messages - report.unbounded_send((our_id.clone(), received.len())).expect("should send"); - }, - }; - } - }); -} - -/// Takes O(n log n) rounds to finish, where n = n_peers * n_msg. -pub async fn scenario( - n_peers: usize, - n_msg: usize, - broken_connection_interval: Option, - large_message_interval: Option, - corrupted_message_interval: Option, - status_report_interval: Duration, -) { - // create spawn_handle, we need to keep the task_manager - let task_manager = - TaskManager::new(Handle::current(), None).expect("should create TaskManager"); - let spawn_handle = task_manager.spawn_handle(); - // create peer identities - info!(target: "validator-network", "generating keys..."); - let keys = random_keys(n_peers).await; - info!(target: "validator-network", "done"); - // prepare and run the manager - let (mut connection_manager, mut callers, addr) = - UnreliableConnectionMaker::new(keys.keys().cloned().collect()); - tokio::spawn(async move { - connection_manager.run(broken_connection_interval).await; - }); - // channel for receiving status updates from spawned peers - let (tx_report, mut rx_report) = mpsc::unbounded::<(AuthorityId, usize)>(); - let mut reports: BTreeMap = - keys.keys().cloned().map(|id| (id, 0)).collect(); - // spawn peers - for (id, pen) in keys.into_iter() { - let mut addr = addr.clone(); - // do not connect with itself - addr.remove(&pen.authority_id()); - let (dialer, listener) = callers.remove(&id).expect("should contain all ids"); - spawn_peer( - pen, - addr, - n_msg, - large_message_interval, - corrupted_message_interval, - dialer, - listener, - tx_report.clone(), - spawn_handle.clone(), - ); - } - let mut status_ticker = interval(status_report_interval); - loop { - tokio::select! { - maybe_report = rx_report.next() => match maybe_report { - Some((peer_id, peer_n_msg)) => { - reports.insert(peer_id, peer_n_msg); - if reports.values().all(|&x| x == n_msg) { - info!(target: "validator-network", "Peers received {:?} messages out of {}, finishing.", reports.values(), n_msg); - return; - } - }, - None => panic!("should receive"), - }, - _ = status_ticker.tick() => { - info!(target: "validator-network", "Peers received {:?} messages out of {}.", reports.values(), n_msg); - } - }; - } -} - -/// Takes O(n log n) rounds to finish, where n = n_peers * n_msg. -pub async fn scenario_with_timeout( - n_peers: usize, - n_msg: usize, - broken_connection_interval: Option, - large_message_interval: Option, - corrupted_message_interval: Option, - status_report_interval: Duration, - scenario_timeout: Duration, -) -> Result<(), Elapsed> { - timeout( - scenario_timeout, - scenario( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - ), - ) - .await -} diff --git a/finality-aleph/src/testing/mod.rs b/finality-aleph/src/testing/mod.rs index 2c5cc9680d..a247ab5ca1 100644 --- a/finality-aleph/src/testing/mod.rs +++ b/finality-aleph/src/testing/mod.rs @@ -1,6 +1,6 @@ pub mod client_chain_builder; +mod clique_network; mod data_store; mod justification; pub mod mocks; mod network; -mod validator_network; diff --git a/finality-aleph/src/testing/network.rs b/finality-aleph/src/testing/network.rs index c1672ad2b7..1e5fe7e774 100644 --- a/finality-aleph/src/testing/network.rs +++ b/finality-aleph/src/testing/network.rs @@ -12,16 +12,18 @@ use tokio::{runtime::Handle, task::JoinHandle, time::timeout}; use crate::{ crypto::{AuthorityPen, AuthorityVerifier}, network::{ - mock::{ - crypto_basics, MockData, MockEvent, MockMultiaddress, MockNetwork, MockNetworkIdentity, - MockPeerId, + clique::mock::{ + key, random_address_from, MockAddressingInformation, MockNetwork as MockCliqueNetwork, + MockPublicKey, }, - setup_io, - testing::{Authentication, DataInSession, DiscoveryMessage, NetworkData, SessionHandler}, - ConnectionManager, ConnectionManagerConfig, DataNetwork, NetworkIdentity, Protocol, - Service as NetworkService, SessionManager, + data::Network, + mock::{crypto_basics, MockData}, + session::{ + authentication, ConnectionManager, ConnectionManagerConfig, DataInSession, + ManagerError, SessionHandler, SessionManager, VersionedAuthentication, + }, + AddressingInformation, GossipService, MockEvent, MockRawNetwork, Protocol, }, - testing::mocks::validator_network::MockNetwork as MockValidatorNetwork, MillisecsPerBlock, NodeIndex, Recipient, SessionId, SessionPeriod, }; @@ -33,8 +35,9 @@ const NODES_N: usize = 3; #[derive(Clone)] struct Authority { pen: AuthorityPen, - addresses: Vec, - peer_id: MockPeerId, + address: MockAddressingInformation, + peer_id: MockPublicKey, + auth_peer_id: MockPublicKey, } impl Authority { @@ -42,38 +45,29 @@ impl Authority { self.pen.clone() } - fn addresses(&self) -> Vec { - self.addresses.clone() + fn address(&self) -> MockAddressingInformation { + self.address.clone() } - fn peer_id(&self) -> MockPeerId { - self.peer_id + fn peer_id(&self) -> MockPublicKey { + self.peer_id.clone() } -} - -impl NetworkIdentity for Authority { - type PeerId = MockPeerId; - type Multiaddress = MockMultiaddress; - fn identity(&self) -> (Vec, Self::PeerId) { - (self.addresses.clone(), self.peer_id) + fn auth_peer_id(&self) -> MockPublicKey { + self.auth_peer_id.clone() } } -type MockNetworkData = NetworkData; - struct TestData { pub authorities: Vec, pub authority_verifier: AuthorityVerifier, - pub session_manager: SessionManager, - pub network: MockNetwork, - pub _validator_network: MockValidatorNetwork>, + pub session_manager: Box>, + pub network: MockRawNetwork, + pub validator_network: MockCliqueNetwork>, network_manager_exit_tx: oneshot::Sender<()>, - legacy_network_manager_exit_tx: oneshot::Sender<()>, - network_service_exit_tx: oneshot::Sender<()>, + gossip_service_exit_tx: oneshot::Sender<()>, network_manager_handle: JoinHandle<()>, - legacy_network_manager_handle: JoinHandle<()>, - network_service_handle: JoinHandle<()>, + gossip_service_handle: JoinHandle<()>, // `TaskManager` can't be dropped for `SpawnTaskHandle` to work _task_manager: TaskManager, } @@ -81,74 +75,51 @@ struct TestData { async fn prepare_one_session_test_data() -> TestData { let task_manager = TaskManager::new(Handle::current(), None).unwrap(); let (authority_pens, authority_verifier) = crypto_basics(NODES_N).await; - let authorities: Vec<_> = authority_pens - .into_iter() - .map(|(_, p)| { - let identity = MockNetworkIdentity::new().identity(); - Authority { - pen: p, - addresses: identity.0, - peer_id: identity.1, - } - }) - .collect(); + let mut authorities = Vec::new(); + for (index, p) in authority_pens { + let address = random_address_from(index.0.to_string(), true); + let auth_peer_id = key().0; + authorities.push(Authority { + pen: p, + peer_id: address.peer_id(), + address, + auth_peer_id, + }); + } // Prepare Network let (event_stream_tx, event_stream_rx) = oneshot::channel(); let (network_manager_exit_tx, network_manager_exit_rx) = oneshot::channel(); - let (legacy_network_manager_exit_tx, legacy_network_manager_exit_rx) = oneshot::channel(); - let (network_service_exit_tx, network_service_exit_rx) = oneshot::channel(); - let network = MockNetwork::new(event_stream_tx); - let validator_network = MockValidatorNetwork::new("address").await; + let (gossip_service_exit_tx, gossip_service_exit_rx) = oneshot::channel(); + let network = MockRawNetwork::new(event_stream_tx); + let validator_network = MockCliqueNetwork::new(); - let (connection_io, network_io, session_io) = setup_io(); - let (legacy_connection_io, legacy_network_io, legacy_session_io) = setup_io(); + let (gossip_service, gossip_network, _) = + GossipService::new(network.clone(), task_manager.spawn_handle()); - let connection_manager = ConnectionManager::new( + let (connection_manager_service, session_manager) = ConnectionManager::new( + authorities[0].address(), validator_network.clone(), + gossip_network, ConnectionManagerConfig::with_session_period(&SESSION_PERIOD, &MILLISECS_PER_BLOCK), ); - - let legacy_connection_manager = ConnectionManager::::new( - authorities[0].clone(), - ConnectionManagerConfig::with_session_period(&SESSION_PERIOD, &MILLISECS_PER_BLOCK), - ); - - let session_manager = SessionManager::new(session_io, legacy_session_io); - - let network_service = NetworkService::new( - network.clone(), - validator_network.clone(), - task_manager.spawn_handle(), - network_io, - legacy_network_io, - ); + let session_manager = Box::new(session_manager); let network_manager_task = async move { tokio::select! { - _ = connection_io - .run(connection_manager) => { }, + _ =connection_manager_service.run() => { }, _ = network_manager_exit_rx => { }, }; }; - let legacy_network_manager_task = async move { - tokio::select! { - _ = legacy_connection_io - .run(legacy_connection_manager) => { }, - _ = legacy_network_manager_exit_rx => { }, - }; - }; - - let network_service_task = async move { + let gossip_service_task = async move { tokio::select! { - _ = network_service.run() => { }, - _ = network_service_exit_rx => { }, + _ = gossip_service.run() => { }, + _ = gossip_service_exit_rx => { }, }; }; let network_manager_handle = tokio::spawn(network_manager_task); - let legacy_network_manager_handle = tokio::spawn(legacy_network_manager_task); - let network_service_handle = tokio::spawn(network_service_task); + let gossip_service_handle = tokio::spawn(gossip_service_task); event_stream_rx.await.unwrap(); @@ -157,19 +128,17 @@ async fn prepare_one_session_test_data() -> TestData { authority_verifier, session_manager, network, - _validator_network: validator_network, + validator_network, network_manager_exit_tx, - legacy_network_manager_exit_tx, - network_service_exit_tx, + gossip_service_exit_tx, network_manager_handle, - legacy_network_manager_handle, - network_service_handle, + gossip_service_handle, _task_manager: task_manager, } } impl TestData { - fn connect_identity_to_network(&mut self, peer_id: MockPeerId, protocol: Protocol) { + fn connect_identity_to_network(&mut self, peer_id: MockPublicKey, protocol: Protocol) { self.network .emit_event(MockEvent::StreamOpened(peer_id, protocol)); } @@ -178,8 +147,9 @@ impl TestData { &self, node_id: usize, session_id: u32, - ) -> impl DataNetwork { - self.session_manager + ) -> impl Network { + match self + .session_manager .start_validator_session( SessionId(session_id), self.authority_verifier.clone(), @@ -187,141 +157,101 @@ impl TestData { self.authorities[node_id].pen(), ) .await - .expect("Failed to start validator session!") + { + Ok(network) => network, + Err(e) => panic!("Failed to start validator session: {}", e), + } } fn early_start_validator_session(&self, node_id: usize, session_id: u32) { - self.session_manager - .early_start_validator_session( - SessionId(session_id), - self.authority_verifier.clone(), - NodeIndex(node_id), - self.authorities[node_id].pen(), - ) - .expect("Failed to start validator session!"); + if let Err(e) = self.session_manager.early_start_validator_session( + SessionId(session_id), + self.authority_verifier.clone(), + NodeIndex(node_id), + self.authorities[node_id].pen(), + ) { + panic!("Failed to start validator session: {}", e); + } } async fn get_session_handler( &self, node_id: usize, session_id: u32, - ) -> SessionHandler { + ) -> SessionHandler { SessionHandler::new( Some((NodeIndex(node_id), self.authorities[node_id].pen())), self.authority_verifier.clone(), SessionId(session_id), - self.authorities[node_id].addresses().to_vec(), + self.authorities[node_id].address(), ) .await - .unwrap() } - async fn check_sends_add_reserved_node(&mut self) { + async fn check_add_connection(&mut self) { let mut reserved_addresses = HashSet::new(); for _ in self.authorities.iter().skip(1) { - let (addresses, protocol) = timeout(DEFAULT_TIMEOUT, self.network.add_reserved.next()) + let (_, address) = self + .validator_network + .add_connection + .next() .await - .ok() - .flatten() .expect("Should add reserved nodes"); - assert_eq!(protocol, Protocol::Validator); - reserved_addresses.extend(addresses.into_iter()); + reserved_addresses.insert(address); } let mut expected_addresses = HashSet::new(); for authority in self.authorities.iter().skip(1) { - expected_addresses.extend(authority.addresses()); + expected_addresses.insert(authority.address()); } assert_eq!(reserved_addresses, expected_addresses); } - async fn check_sends_authentication( - &mut self, - authentication: Authentication, - ) { - let mut sent_auth = HashMap::new(); - while sent_auth.len() < NODES_N - 1 { - if let Some(( - MockNetworkData::Meta(DiscoveryMessage::Authentication(auth_data)), - peer_id, - _, - )) = timeout( - DEFAULT_TIMEOUT, - self.next_sent_authentication(Protocol::Generic), - ) - .await - .expect("Should send authentication") - { - sent_auth.insert(peer_id, auth_data); - } - } - - let mut expected_auth = HashMap::new(); - for authority in self.authorities.iter().skip(1) { - expected_auth.insert(authority.peer_id(), authentication.clone()); - } - - assert_eq!(sent_auth, expected_auth); - } - async fn connect_session_authorities(&mut self, session_id: u32) { for (index, authority) in self.authorities.clone().into_iter().enumerate().skip(1) { let handler = self.get_session_handler(index, session_id).await; - self.connect_identity_to_network(authority.peer_id(), Protocol::Generic); - self.connect_identity_to_network(authority.peer_id(), Protocol::Validator); - - self.network.emit_event(MockEvent::Messages(vec![( - Protocol::Generic, - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast( - handler.authentication().unwrap(), - )) - .encode() - .into(), - )])); + self.connect_identity_to_network(authority.auth_peer_id(), Protocol::Authentication); + + for versioned_authentication in + Vec::>::from(handler.authentication().unwrap()) + { + self.network.emit_event(MockEvent::Messages( + authority.auth_peer_id(), + vec![( + Protocol::Authentication, + versioned_authentication.encode().into(), + )], + )); + } } } - async fn start_session(&mut self, session_id: u32) -> impl DataNetwork { + async fn start_session(&mut self, session_id: u32) -> impl Network { let data_network = self.start_validator_session(0, session_id).await; self.connect_session_authorities(session_id).await; - self.check_sends_add_reserved_node().await; - self.check_sends_authentication( - self.get_session_handler(0, session_id) - .await - .authentication() - .unwrap(), - ) - .await; + self.check_add_connection().await; data_network } - fn emit_notifications_received(&mut self, messages: Vec) { - self.network.emit_event(MockEvent::Messages( - messages - .iter() - .map(|m| (Protocol::Generic, m.encode().into())) - .collect(), - )); - } - - async fn next_sent( + async fn next_sent_auth( &mut self, - p: Protocol, ) -> Option<( - NetworkData, - MockPeerId, + VersionedAuthentication, + MockPublicKey, Protocol, )> { loop { match self.network.send_message.next().await { Some((data, peer_id, protocol)) => { - if protocol == p { + if protocol == Protocol::Authentication { return Some(( - NetworkData::::decode(&mut data.as_slice()) - .expect("should decode"), + VersionedAuthentication::::decode( + &mut data.as_slice(), + ) + .expect("should decode"), peer_id, protocol, )); @@ -332,97 +262,14 @@ impl TestData { } } - async fn next_sent_authentication_broadcast( - &mut self, - p: Protocol, - ) -> Option<( - NetworkData, - MockPeerId, - Protocol, - )> { - loop { - match self.next_sent(p).await { - Some(( - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast(auth_data)), - peer_id, - protocol, - )) => { - return Some(( - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast(auth_data)), - peer_id, - protocol, - )); - } - None => return None, - _ => {} - } - } - } - - async fn next_sent_authentication( - &mut self, - p: Protocol, - ) -> Option<( - NetworkData, - MockPeerId, - Protocol, - )> { - loop { - match self.next_sent(p).await { - Some(( - MockNetworkData::Meta(DiscoveryMessage::Authentication(auth_data)), - peer_id, - protocol, - )) => { - return Some(( - MockNetworkData::Meta(DiscoveryMessage::Authentication(auth_data)), - peer_id, - protocol, - )); - } - None => return None, - _ => {} - } - } - } - - async fn next_sent_data_message( - &mut self, - p: Protocol, - ) -> Option<( - NetworkData, - MockPeerId, - Protocol, - )> { - loop { - match self.next_sent(p).await { - Some((MockNetworkData::Data(data, session_id), peer_id, protocol)) => { - return Some((MockNetworkData::Data(data, session_id), peer_id, protocol)) - } - None => return None, - _ => {} - } - } - } - async fn cleanup(self) { self.network_manager_exit_tx.send(()).unwrap(); - self.legacy_network_manager_exit_tx.send(()).unwrap(); - self.network_service_exit_tx.send(()).unwrap(); + self.gossip_service_exit_tx.send(()).unwrap(); self.network_manager_handle.await.unwrap(); - self.legacy_network_manager_handle.await.unwrap(); - self.network_service_handle.await.unwrap(); - while let Some((data, peer_id, protocol)) = self.network.send_message.try_next().await { - if protocol == Protocol::Validator { - if let Ok(MockNetworkData::Data(data, session_id)) = - MockNetworkData::decode(&mut data.as_slice()) - { - panic!("No Data messages to validators should be sent during cleanup. All data messages should be handled before.\ - Got: {:?} in {:?} to {:?} with protocol {:?}", data, session_id, peer_id, protocol); - } - } - } + self.gossip_service_handle.await.unwrap(); + while self.network.send_message.try_next().await.is_some() {} self.network.close_channels().await; + self.validator_network.close_channels().await; } } @@ -430,88 +277,22 @@ impl TestData { async fn test_sends_discovery_message() { let session_id = 43; let mut test_data = prepare_one_session_test_data().await; - let connected_peer_id = test_data.authorities[1].peer_id(); - test_data.connect_identity_to_network(connected_peer_id, Protocol::Generic); + let connected_peer_id = test_data.authorities[1].auth_peer_id(); + test_data.connect_identity_to_network(connected_peer_id.clone(), Protocol::Authentication); let mut data_network = test_data.start_validator_session(0, session_id).await; let handler = test_data.get_session_handler(0, session_id).await; - let mut sent_legacy_authentications = 0; - for _ in 0..10 { - match timeout( - DEFAULT_TIMEOUT, - test_data.next_sent_authentication_broadcast(Protocol::Generic), - ) - .await - .ok() - .flatten() - { - Some(( - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast(auth_data)), - peer_id, - _, - )) => { + for _ in 0..4 { + match test_data.next_sent_auth().await { + Some((VersionedAuthentication::V2(new_authentication), peer_id, _)) => { assert_eq!(peer_id, connected_peer_id); - assert_eq!(auth_data, handler.authentication().unwrap()); - sent_legacy_authentications += 1; + assert_eq!(new_authentication, authentication(&handler)); } - Some(_) => {} - None => panic!("Should broadcast authentication"), + None => panic!("Not sending authentications"), + _ => panic!("Should broadcast own authentication, nothing else"), } } - if sent_legacy_authentications < 3 { - panic!("Should broadcast legacy authentications") - } - test_data.cleanup().await; - assert_eq!( - timeout(DEFAULT_TIMEOUT, data_network.next()).await, - Ok(None) - ); -} - -#[tokio::test] -async fn test_sends_authentication_on_receiving_broadcast() { - let session_id = 43; - let mut test_data = prepare_one_session_test_data().await; - let mut data_network = test_data.start_validator_session(0, session_id).await; - let handler = test_data.get_session_handler(0, session_id).await; - let sending_peer_handler = test_data.get_session_handler(1, session_id).await; - let sending_peer = test_data.authorities[1].clone(); - test_data.connect_identity_to_network(sending_peer.peer_id(), Protocol::Generic); - - test_data.network.emit_event(MockEvent::Messages(vec![( - Protocol::Generic, - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast( - sending_peer_handler.authentication().unwrap(), - )) - .encode() - .into(), - )])); - - assert_eq!( - timeout(DEFAULT_TIMEOUT, test_data.network.add_reserved.next()) - .await - .ok() - .flatten() - .expect("Should add reserved nodes"), - ( - sending_peer.addresses().into_iter().collect(), - Protocol::Validator - ), - ); - - if let Some((MockNetworkData::Meta(DiscoveryMessage::Authentication(auth_data)), peer_id, _)) = - timeout( - DEFAULT_TIMEOUT, - test_data.next_sent_authentication(Protocol::Generic), - ) - .await - .expect("Should send authentication") - { - assert_eq!(peer_id, sending_peer.peer_id()); - assert_eq!(auth_data, handler.authentication().unwrap()); - } - test_data.cleanup().await; assert_eq!( timeout(DEFAULT_TIMEOUT, data_network.next()).await, @@ -529,54 +310,49 @@ async fn test_forwards_authentication_broadcast() { let sending_peer_handler = test_data.get_session_handler(1, session_id).await; for authority in test_data.authorities.clone().iter().skip(1) { - test_data.connect_identity_to_network(authority.peer_id(), Protocol::Generic); + test_data.connect_identity_to_network(authority.auth_peer_id(), Protocol::Authentication); } - test_data.network.emit_event(MockEvent::Messages(vec![( - Protocol::Generic, - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast( - sending_peer_handler.authentication().unwrap(), - )) - .encode() - .into(), - )])); + for versioned_authentication in + Vec::>::from(sending_peer_handler.authentication().unwrap()) + { + test_data.network.emit_event(MockEvent::Messages( + sending_peer.auth_peer_id(), + vec![( + Protocol::Authentication, + versioned_authentication.encode().into(), + )], + )); + } assert_eq!( - timeout(DEFAULT_TIMEOUT, test_data.network.add_reserved.next()) + test_data + .validator_network + .add_connection + .next() .await - .ok() - .flatten() .expect("Should add reserved nodes"), - ( - sending_peer.addresses().into_iter().collect(), - Protocol::Validator - ), + (sending_peer.peer_id(), sending_peer.address()), ); let mut expected_authentication = HashMap::new(); for authority in test_data.authorities.iter().skip(1) { expected_authentication.insert( - authority.peer_id(), - sending_peer_handler.authentication().unwrap(), + authority.auth_peer_id(), + authentication(&sending_peer_handler), ); } let mut sent_authentication = HashMap::new(); while sent_authentication.len() < NODES_N - 1 { - if let Some(( - MockNetworkData::Meta(DiscoveryMessage::AuthenticationBroadcast(auth_data)), - peer_id, - _, - )) = timeout( - DEFAULT_TIMEOUT, - test_data.next_sent_authentication_broadcast(Protocol::Generic), - ) - .await - .expect("Should send Authentication Broadcast") - { - if auth_data != handler.authentication().unwrap() { - sent_authentication.insert(peer_id, auth_data); + match test_data.next_sent_auth().await { + Some((VersionedAuthentication::V2(auth), peer_id, _)) => { + if auth != authentication(&handler) { + sent_authentication.insert(peer_id, auth); + } } + None => panic!("not enough authentications sent"), + _ => (), } } @@ -595,11 +371,12 @@ async fn test_connects_to_others() { let mut test_data = prepare_one_session_test_data().await; let mut data_network = test_data.start_session(session_id).await; - let data = vec![1, 2, 3]; - test_data.emit_notifications_received(vec![MockNetworkData::Data( - data.clone(), - SessionId(session_id), - )]); + let data = MockData::new(43, 3); + test_data.validator_network.next.send(DataInSession { + data: data.clone(), + session_id: SessionId(session_id), + }); + assert_eq!( timeout(DEFAULT_TIMEOUT, data_network.next()).await, Ok(Some(data)) @@ -615,23 +392,15 @@ async fn test_connects_to_others_early_validator() { let mut test_data = prepare_one_session_test_data().await; test_data.early_start_validator_session(0, session_id); test_data.connect_session_authorities(session_id).await; - test_data.check_sends_add_reserved_node().await; - test_data - .check_sends_authentication( - test_data - .get_session_handler(0, session_id) - .await - .authentication() - .unwrap(), - ) - .await; + test_data.check_add_connection().await; + let mut data_network = test_data.start_validator_session(0, session_id).await; - let data = vec![1, 2, 3]; - test_data.emit_notifications_received(vec![MockNetworkData::Data( - data.clone(), - SessionId(session_id), - )]); + let data = MockData::new(43, 3); + test_data.validator_network.next.send(DataInSession { + data: data.clone(), + session_id: SessionId(session_id), + }); assert_eq!( timeout(DEFAULT_TIMEOUT, data_network.next()).await, Ok(Some(data.clone())) @@ -651,20 +420,23 @@ async fn test_stops_session() { .session_manager .stop_session(SessionId(session_id)) .unwrap(); - assert_eq!( - timeout(DEFAULT_TIMEOUT, test_data.network.remove_reserved.next()) + + let removed = HashSet::<_>::from_iter( + test_data + .validator_network + .remove_connection + .take(NODES_N - 1) .await - .ok() - .flatten(), - Some(( - HashSet::from_iter(test_data.authorities.iter().skip(1).map(|a| a.peer_id())), - Protocol::Validator - )) + .into_iter(), + ); + assert_eq!( + removed, + HashSet::from_iter(test_data.authorities.iter().skip(1).map(|a| a.peer_id())), ); // This assert should be before cleanup. We want to check whether `session_manager.stop_session(...)` // drops the sender. After cleanup all network tasks end and senders will be dropped. - // If assert was after cleanup we wouldn't know whether data_network receiver is droopped + // If assert was after cleanup we wouldn't know whether data_network receiver is dropped // because of `session_manager.stop_session(...)` or because of cleanup. assert_eq!( timeout(DEFAULT_TIMEOUT, data_network.next()).await, @@ -682,18 +454,27 @@ async fn test_receives_data_in_correct_session() { let mut data_network_2 = test_data.start_session(session_id_2).await; - let data_1_1 = vec![1, 2, 3]; - let data_1_2 = vec![4, 5, 6]; - let data_2_1 = vec![7, 8, 9]; - let data_2_2 = vec![10, 11, 12]; - test_data.emit_notifications_received(vec![ - MockNetworkData::Data(data_1_1.clone(), SessionId(session_id_1)), - MockNetworkData::Data(data_2_1.clone(), SessionId(session_id_2)), - ]); - test_data.emit_notifications_received(vec![ - MockNetworkData::Data(data_2_2.clone(), SessionId(session_id_2)), - MockNetworkData::Data(data_1_2.clone(), SessionId(session_id_1)), - ]); + let data_1_1 = MockData::new(43, 3); + let data_1_2 = MockData::new(44, 3); + let data_2_1 = MockData::new(45, 3); + let data_2_2 = MockData::new(46, 3); + test_data.validator_network.next.send(DataInSession { + data: data_1_1.clone(), + session_id: SessionId(session_id_1), + }); + test_data.validator_network.next.send(DataInSession { + data: data_2_1.clone(), + session_id: SessionId(session_id_2), + }); + + test_data.validator_network.next.send(DataInSession { + data: data_2_2.clone(), + session_id: SessionId(session_id_2), + }); + test_data.validator_network.next.send(DataInSession { + data: data_1_2.clone(), + session_id: SessionId(session_id_1), + }); assert_eq!( timeout(DEFAULT_TIMEOUT, data_network_1.next()).await, @@ -734,8 +515,8 @@ async fn test_sends_data_to_correct_session() { let mut expected_data = HashSet::new(); for node_id in 1..NODES_N { - let data_1 = vec![2 * node_id as u8 - 1]; - let data_2 = vec![2 * node_id as u8]; + let data_1 = MockData::new((node_id - 1) as u32, 1); + let data_2 = MockData::new(node_id as u32, 1); expected_data.insert(( data_1.clone(), @@ -758,14 +539,9 @@ async fn test_sends_data_to_correct_session() { let mut sent_data = HashSet::new(); while sent_data.len() < 2 * (NODES_N - 1) { - if let Some((MockNetworkData::Data(data, session_id), peer_id, _)) = timeout( - DEFAULT_TIMEOUT, - test_data.next_sent_data_message(Protocol::Validator), - ) - .await - .expect("Should send data") + if let Some((DataInSession { data, session_id }, peer_id)) = + test_data.validator_network.send.next().await { - println!("{:?} {:?}", data, peer_id); sent_data.insert((data, session_id, peer_id)); } } @@ -791,8 +567,8 @@ async fn test_broadcasts_data_to_correct_session() { let mut data_network_1 = test_data.start_session(session_id_1).await; let mut data_network_2 = test_data.start_session(session_id_2).await; - let data_1 = vec![1, 2, 3]; - let data_2 = vec![4, 5, 6]; + let data_1 = MockData::new(43, 3); + let data_2 = MockData::new(44, 3); data_network_1 .send(data_1.clone(), Recipient::Everyone) .expect("Should send"); @@ -808,12 +584,8 @@ async fn test_broadcasts_data_to_correct_session() { let mut sent_data = HashSet::new(); while sent_data.len() < 2 * (NODES_N - 1) { - if let Some((MockNetworkData::Data(data, session_id), peer_id, _)) = timeout( - DEFAULT_TIMEOUT, - test_data.next_sent_data_message(Protocol::Validator), - ) - .await - .expect("Should send data") + if let Some((DataInSession { data, session_id }, peer_id)) = + test_data.validator_network.send.next().await { sent_data.insert((data, session_id, peer_id)); } diff --git a/finality-aleph/src/testing/validator_network.rs b/finality-aleph/src/testing/validator_network.rs deleted file mode 100644 index 68a8dcfdca..0000000000 --- a/finality-aleph/src/testing/validator_network.rs +++ /dev/null @@ -1,131 +0,0 @@ -use std::sync::Once; - -use tokio::time::Duration; - -use crate::testing::mocks::validator_network::scenario_with_timeout; - -static INIT: Once = Once::new(); - -/// Required to capture logs from the tests e.g. by running -/// `RUST_LOG=info cargo test -- --nocapture testing::validator_network` -fn setup() { - // env_logger::init can be called at most once - INIT.call_once(|| { - env_logger::init(); - }); -} - -#[tokio::test(flavor = "multi_thread")] -async fn normal_conditions() { - setup(); - let n_peers: usize = 10; - let n_msg: usize = 30; - let broken_connection_interval: Option = None; - let large_message_interval: Option = None; - let corrupted_message_interval: Option = None; - let status_report_interval: Duration = Duration::from_secs(1); - let timeout: Duration = Duration::from_secs(300); - scenario_with_timeout( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - timeout, - ) - .await - .expect("timeout"); -} - -#[tokio::test(flavor = "multi_thread")] -async fn connections_break() { - setup(); - let n_peers: usize = 10; - let n_msg: usize = 30; - let broken_connection_interval: Option = Some(10); - let large_message_interval: Option = None; - let corrupted_message_interval: Option = None; - let status_report_interval: Duration = Duration::from_secs(1); - let timeout: Duration = Duration::from_secs(300); - scenario_with_timeout( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - timeout, - ) - .await - .expect("timeout"); -} - -#[tokio::test(flavor = "multi_thread")] -async fn large_messages_being_sent() { - setup(); - let n_peers: usize = 10; - let n_msg: usize = 30; - let broken_connection_interval: Option = None; - let large_message_interval: Option = Some(10); - let corrupted_message_interval: Option = None; - let status_report_interval: Duration = Duration::from_secs(1); - let timeout: Duration = Duration::from_secs(300); - scenario_with_timeout( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - timeout, - ) - .await - .expect("timeout"); -} - -#[tokio::test(flavor = "multi_thread")] -async fn corrupted_messages_being_sent() { - setup(); - let n_peers: usize = 10; - let n_msg: usize = 30; - let broken_connection_interval: Option = None; - let large_message_interval: Option = None; - let corrupted_message_interval: Option = Some(10); - let status_report_interval: Duration = Duration::from_secs(1); - let timeout: Duration = Duration::from_secs(300); - scenario_with_timeout( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - timeout, - ) - .await - .expect("timeout"); -} - -#[tokio::test(flavor = "multi_thread")] -async fn everything_fails_all_the_time() { - setup(); - let n_peers: usize = 3; - let n_msg: usize = 10; - let broken_connection_interval: Option = Some(5); - let large_message_interval: Option = Some(7); - let corrupted_message_interval: Option = Some(8); - let status_report_interval: Duration = Duration::from_secs(1); - let timeout: Duration = Duration::from_secs(600); - scenario_with_timeout( - n_peers, - n_msg, - broken_connection_interval, - large_message_interval, - corrupted_message_interval, - status_report_interval, - timeout, - ) - .await - .expect("timeout"); -} diff --git a/finality-aleph/src/validator_network/heartbeat.rs b/finality-aleph/src/validator_network/heartbeat.rs deleted file mode 100644 index ba8fb183e0..0000000000 --- a/finality-aleph/src/validator_network/heartbeat.rs +++ /dev/null @@ -1,74 +0,0 @@ -use codec::{Decode, Encode}; -use tokio::{ - io::{AsyncRead, AsyncWrite}, - time::{sleep, timeout, Duration}, -}; - -use crate::validator_network::io::{receive_data, send_data}; - -const HEARTBEAT_TIMEOUT: Duration = Duration::from_secs(5); -const MAX_MISSED_HEARTBEATS: u32 = 4; - -/// Represents the heartbeat message. Holds a single integer, so that it encodes into a nonempty -/// string of bytes. -#[derive(Debug, Clone, Encode, Decode)] -struct Heartbeat(u32); - -/// Sends heartbeat messages at regular intervals, indefinitely. -/// Fails if the communication channel is closed. -pub async fn heartbeat_sender(mut stream: S) { - loop { - // Random number so the message contains something. - stream = match send_data(stream, Heartbeat(43)).await { - Ok(stream) => stream, - // If anything at all went wrong, the heartbeat is dead. - Err(_) => return, - }; - sleep(HEARTBEAT_TIMEOUT).await; - } -} - -/// Receives heartbeat messages indefinitely. -/// Fails if the communication channel is closed, or if no message is received -/// for too long. -pub async fn heartbeat_receiver(mut stream: S) { - loop { - stream = match timeout( - HEARTBEAT_TIMEOUT * MAX_MISSED_HEARTBEATS, - receive_data::(stream), - ) - .await - { - Ok(Ok((stream, _))) => stream, - // If anything at all went wrong the heartbeat is dead. - _ => return, - }; - } -} - -#[cfg(test)] -mod tests { - use tokio::{ - self, - time::{timeout, Duration}, - }; - - use super::{heartbeat_receiver, heartbeat_sender}; - use crate::validator_network::mock::MockSplittable; - - #[tokio::test] - async fn sender_closed_on_broken_connection() { - let (stream, _) = MockSplittable::new(4096); - timeout(Duration::from_secs(10), heartbeat_sender(stream)) - .await - .expect("should end immediately"); - } - - #[tokio::test] - async fn receiver_closed_on_broken_connection() { - let (stream, _) = MockSplittable::new(4096); - timeout(Duration::from_secs(10), heartbeat_receiver(stream)) - .await - .expect("should end immediately"); - } -} diff --git a/finality-aleph/src/validator_network/incoming.rs b/finality-aleph/src/validator_network/incoming.rs deleted file mode 100644 index 2200c41b8b..0000000000 --- a/finality-aleph/src/validator_network/incoming.rs +++ /dev/null @@ -1,71 +0,0 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; - -use aleph_primitives::AuthorityId; -use futures::channel::{mpsc, oneshot}; -use log::{debug, info}; - -use crate::{ - crypto::AuthorityPen, - validator_network::{ - protocol_negotiation::{protocol, ProtocolNegotiationError}, - protocols::ProtocolError, - Data, Splittable, - }, -}; - -enum IncomingError { - ProtocolNegotiationError(ProtocolNegotiationError), - ProtocolError(ProtocolError), -} - -impl Display for IncomingError { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - use IncomingError::*; - match self { - ProtocolNegotiationError(e) => write!(f, "protocol negotiation error: {}", e), - ProtocolError(e) => write!(f, "protocol error: {}", e), - } - } -} - -impl From for IncomingError { - fn from(e: ProtocolNegotiationError) -> Self { - IncomingError::ProtocolNegotiationError(e) - } -} - -impl From for IncomingError { - fn from(e: ProtocolError) -> Self { - IncomingError::ProtocolError(e) - } -} - -async fn manage_incoming( - authority_pen: AuthorityPen, - stream: S, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, - data_for_user: mpsc::UnboundedSender, -) -> Result<(), IncomingError> { - debug!(target: "validator-network", "Performing incoming protocol negotiation."); - let (stream, protocol) = protocol(stream).await?; - debug!(target: "validator-network", "Negotiated protocol, running."); - Ok(protocol - .manage_incoming(stream, authority_pen, result_for_parent, data_for_user) - .await?) -} - -/// Manage an incoming connection. After the handshake it will send the recognized AuthorityId to -/// the parent, together with an exit channel for this process. When this channel is dropped the -/// process ends. Whenever data arrives on this connection it will be passed to the user. Any -/// failures in receiving data result in the process stopping, we assume the other side will -/// reestablish it if necessary. -pub async fn incoming( - authority_pen: AuthorityPen, - stream: S, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, - data_for_user: mpsc::UnboundedSender, -) { - if let Err(e) = manage_incoming(authority_pen, stream, result_for_parent, data_for_user).await { - info!(target: "validator-network", "Incoming connection failed: {}", e); - } -} diff --git a/finality-aleph/src/validator_network/manager.rs b/finality-aleph/src/validator_network/manager.rs deleted file mode 100644 index c765c33a78..0000000000 --- a/finality-aleph/src/validator_network/manager.rs +++ /dev/null @@ -1,345 +0,0 @@ -use std::{ - collections::{HashMap, HashSet}, - fmt::{Display, Error as FmtError, Formatter}, -}; - -use aleph_primitives::AuthorityId; -use futures::channel::{mpsc, oneshot}; - -use crate::{network::PeerId, validator_network::Data}; - -/// Network component responsible for holding the list of peers that we -/// want to connect to, and managing the established connections. -pub struct Manager { - addresses: HashMap>, - outgoing: HashMap>, - incoming: HashMap>, -} - -/// Error during sending data through the Manager -#[derive(Debug, PartialEq, Eq)] -pub enum SendError { - /// Outgoing network connection closed - ConnectionClosed, - /// Peer not added to the manager - PeerNotFound, -} - -impl Display for SendError { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - use SendError::*; - match self { - ConnectionClosed => write!(f, "worker dead"), - PeerNotFound => write!(f, "peer not found"), - } - } -} - -struct ManagerStatus { - wanted_peers: usize, - both_ways_peers: HashSet, - outgoing_peers: HashSet, - incoming_peers: HashSet, - missing_peers: HashSet, -} - -impl ManagerStatus { - fn new(manager: &Manager) -> Self { - let incoming: HashSet<_> = manager - .incoming - .iter() - .filter(|(_, exit)| !exit.is_canceled()) - .map(|(k, _)| k.clone()) - .collect(); - let outgoing: HashSet<_> = manager - .outgoing - .iter() - .filter(|(_, exit)| !exit.is_closed()) - .map(|(k, _)| k.clone()) - .collect(); - - let both_ways = incoming.intersection(&outgoing).cloned().collect(); - let incoming: HashSet<_> = incoming.difference(&both_ways).cloned().collect(); - let outgoing: HashSet<_> = outgoing.difference(&both_ways).cloned().collect(); - let missing = manager - .addresses - .keys() - .filter(|a| !both_ways.contains(a) && !incoming.contains(a) && !outgoing.contains(a)) - .cloned() - .collect(); - - ManagerStatus { - wanted_peers: manager.addresses.len(), - both_ways_peers: both_ways, - incoming_peers: incoming, - outgoing_peers: outgoing, - missing_peers: missing, - } - } -} - -impl Display for ManagerStatus { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - if self.wanted_peers == 0 { - return write!(f, "not maintaining any connections; "); - } - - write!(f, "target - {:?} connections; ", self.wanted_peers)?; - - if self.both_ways_peers.is_empty() && self.incoming_peers.is_empty() { - write!(f, "WARNING! No incoming peers even though we expected tham, maybe connecting to us is impossible; ")?; - } - - if !self.both_ways_peers.is_empty() { - let peers = self - .both_ways_peers - .iter() - .map(|authority_id| authority_id.to_short_string()) - .collect::>() - .join(", "); - write!( - f, - "both ways - {:?} [{}]; ", - self.both_ways_peers.len(), - peers, - )?; - } - - if !self.incoming_peers.is_empty() { - let peers = self - .incoming_peers - .iter() - .map(|authority_id| authority_id.to_short_string()) - .collect::>() - .join(", "); - write!( - f, - "incoming only - {:?} [{}]; ", - self.incoming_peers.len(), - peers - )?; - } - - if !self.outgoing_peers.is_empty() { - let peers = self - .outgoing_peers - .iter() - .map(|authority_id| authority_id.to_short_string()) - .collect::>() - .join(", "); - write!( - f, - "outgoing only - {:?} [{}];", - self.outgoing_peers.len(), - peers - )?; - } - - if !self.missing_peers.is_empty() { - let peers = self - .missing_peers - .iter() - .map(|authority_id| authority_id.to_short_string()) - .collect::>() - .join(", "); - write!(f, "missing - {:?} [{}];", self.missing_peers.len(), peers)?; - } - - Ok(()) - } -} - -/// Possible results of adding connections. -#[derive(Debug, PartialEq, Eq)] -pub enum AddResult { - /// We do not want to maintain a connection with this peer. - Uninterested, - /// Connection added. - Added, - /// Old connection replaced with new one. - Replaced, -} - -impl Manager { - /// Create a new Manager with empty list of peers. - pub fn new() -> Self { - Manager { - addresses: HashMap::new(), - outgoing: HashMap::new(), - incoming: HashMap::new(), - } - } - - /// Add a peer to the list of peers we want to stay connected to, or - /// update the list of addresses if the peer was already added. - /// Returns whether this peer is a new peer. - pub fn add_peer(&mut self, peer_id: AuthorityId, addresses: Vec) -> bool { - self.addresses.insert(peer_id, addresses).is_none() - } - - /// Return Option containing addresses of the given peer, or None if - /// the peer is unknown. - pub fn peer_addresses(&self, peer_id: &AuthorityId) -> Option> { - self.addresses.get(peer_id).cloned() - } - - /// Add an established outgoing connection with a known peer, - /// but only if the peer is on the list of peers that we want to stay connected with. - pub fn add_outgoing( - &mut self, - peer_id: AuthorityId, - data_for_network: mpsc::UnboundedSender, - ) -> AddResult { - use AddResult::*; - if !self.addresses.contains_key(&peer_id) { - return Uninterested; - } - match self.outgoing.insert(peer_id, data_for_network) { - Some(_) => Replaced, - None => Added, - } - } - - /// Add an established incoming connection with a known peer, - /// but only if the peer is on the list of peers that we want to stay connected with. - pub fn add_incoming(&mut self, peer_id: AuthorityId, exit: oneshot::Sender<()>) -> AddResult { - use AddResult::*; - if !self.addresses.contains_key(&peer_id) { - return Uninterested; - }; - match self.incoming.insert(peer_id, exit) { - Some(_) => Replaced, - None => Added, - } - } - - /// Remove a peer from the list of peers that we want to stay connected with. - /// Close any incoming and outgoing connections that were established. - pub fn remove_peer(&mut self, peer_id: &AuthorityId) { - self.addresses.remove(peer_id); - self.incoming.remove(peer_id); - self.outgoing.remove(peer_id); - } - - /// Send data to a peer. - /// Returns error if there is no outgoing connection to the peer, - /// or if the connection is dead. - pub fn send_to(&mut self, peer_id: &AuthorityId, data: D) -> Result<(), SendError> { - self.outgoing - .get(peer_id) - .ok_or(SendError::PeerNotFound)? - .unbounded_send(data) - .map_err(|_| SendError::ConnectionClosed) - } - - /// A status of the manager, to be displayed somewhere. - pub fn status_report(&self) -> impl Display { - ManagerStatus::new(self) - } -} - -#[cfg(test)] -mod tests { - use futures::{ - channel::{mpsc, oneshot}, - StreamExt, - }; - - use super::{AddResult::*, Manager, SendError}; - use crate::validator_network::mock::key; - - type Data = String; - type Address = String; - - #[tokio::test] - async fn add_remove() { - let mut manager = Manager::::new(); - let (peer_id, _) = key().await; - let (peer_id_b, _) = key().await; - let addresses = vec![ - String::from(""), - String::from("a/b/c"), - String::from("43.43.43.43:43000"), - ]; - // add new peer - returns true - assert!(manager.add_peer(peer_id.clone(), addresses.clone())); - // add known peer - returns false - assert!(!manager.add_peer(peer_id.clone(), addresses.clone())); - // get address - assert_eq!(manager.peer_addresses(&peer_id), Some(addresses)); - // try to get address of an unknown peer - assert_eq!(manager.peer_addresses(&peer_id_b), None); - // remove peer - manager.remove_peer(&peer_id); - // try to get address of removed peer - assert_eq!(manager.peer_addresses(&peer_id), None); - // remove again - manager.remove_peer(&peer_id); - // remove unknown peer - manager.remove_peer(&peer_id_b); - } - - #[tokio::test] - async fn outgoing() { - let mut manager = Manager::::new(); - let data = String::from("DATA"); - let (peer_id, _) = key().await; - let addresses = vec![ - String::from(""), - String::from("a/b/c"), - String::from("43.43.43.43:43000"), - ]; - let (tx, _rx) = mpsc::unbounded(); - // try add unknown peer - manager.add_outgoing(peer_id.clone(), tx); - // sending should fail - assert_eq!( - manager.send_to(&peer_id, data.clone()), - Err(SendError::PeerNotFound) - ); - // add peer, this time for real - assert!(manager.add_peer(peer_id.clone(), addresses.clone())); - let (tx, mut rx) = mpsc::unbounded(); - assert_eq!(manager.add_outgoing(peer_id.clone(), tx), Added); - // send and receive - assert!(manager.send_to(&peer_id, data.clone()).is_ok()); - assert_eq!(data, rx.next().await.expect("should receive")); - // remove peer - manager.remove_peer(&peer_id); - // receiving should fail - assert!(rx.next().await.is_none()); - } - - #[tokio::test] - async fn incoming() { - let mut manager = Manager::::new(); - let (peer_id, _) = key().await; - let addresses = vec![ - String::from(""), - String::from("a/b/c"), - String::from("43.43.43.43:43000"), - ]; - let (tx, rx) = oneshot::channel(); - // try add unknown peer - assert_eq!(manager.add_incoming(peer_id.clone(), tx), Uninterested); - // rx should fail - assert!(rx.await.is_err()); - // add peer, this time for real - assert!(manager.add_peer(peer_id.clone(), addresses.clone())); - let (tx, mut rx) = oneshot::channel(); - // should just add - assert_eq!(manager.add_incoming(peer_id.clone(), tx), Added); - // the exit channel should be open - assert!(rx.try_recv().is_ok()); - let (tx, mut rx2) = oneshot::channel(); - // should replace now - assert_eq!(manager.add_incoming(peer_id.clone(), tx), Replaced); - // receiving should fail on old, but work on new channel - assert!(rx.try_recv().is_err()); - assert!(rx2.try_recv().is_ok()); - // remove peer - manager.remove_peer(&peer_id); - // receiving should fail - assert!(rx2.try_recv().is_err()); - } -} diff --git a/finality-aleph/src/validator_network/mock.rs b/finality-aleph/src/validator_network/mock.rs deleted file mode 100644 index 81b1269e24..0000000000 --- a/finality-aleph/src/validator_network/mock.rs +++ /dev/null @@ -1,96 +0,0 @@ -use std::sync::Arc; -#[cfg(test)] -use std::{ - collections::HashMap, - io::Result as IoResult, - pin::Pin, - task::{Context, Poll}, -}; - -use aleph_primitives::{AuthorityId, KEY_TYPE}; -use sp_keystore::{testing::KeyStore, CryptoStore}; -use tokio::io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf}; - -use crate::{crypto::AuthorityPen, validator_network::Splittable}; - -/// Create a random authority id and pen pair. -pub async fn key() -> (AuthorityId, AuthorityPen) { - let keystore = Arc::new(KeyStore::new()); - let id: AuthorityId = keystore - .ed25519_generate_new(KEY_TYPE, None) - .await - .unwrap() - .into(); - let pen = AuthorityPen::new(id.clone(), keystore) - .await - .expect("keys shoud sign successfully"); - (id, pen) -} - -/// Create a HashMap with authority ids as keys and pens as values. -pub async fn random_keys(n_peers: usize) -> HashMap { - let mut result = HashMap::with_capacity(n_peers); - for _ in 0..n_peers { - let (id, pen) = key().await; - result.insert(id, pen); - } - assert_eq!(result.len(), n_peers); - result -} - -/// A mock that can be split into two streams. -pub struct MockSplittable { - incoming_data: DuplexStream, - outgoing_data: DuplexStream, -} - -impl MockSplittable { - /// Create a pair of mock splittables connected to each other. - pub fn new(max_buf_size: usize) -> (Self, Self) { - let (in_a, out_b) = duplex(max_buf_size); - let (in_b, out_a) = duplex(max_buf_size); - ( - MockSplittable { - incoming_data: in_a, - outgoing_data: out_a, - }, - MockSplittable { - incoming_data: in_b, - outgoing_data: out_b, - }, - ) - } -} - -impl AsyncRead for MockSplittable { - fn poll_read( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut ReadBuf<'_>, - ) -> Poll> { - Pin::new(&mut self.get_mut().incoming_data).poll_read(cx, buf) - } -} - -impl AsyncWrite for MockSplittable { - fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_write(cx, buf) - } - - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_flush(cx) - } - - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.get_mut().outgoing_data).poll_shutdown(cx) - } -} - -impl Splittable for MockSplittable { - type Sender = DuplexStream; - type Receiver = DuplexStream; - - fn split(self) -> (Self::Sender, Self::Receiver) { - (self.outgoing_data, self.incoming_data) - } -} diff --git a/finality-aleph/src/validator_network/outgoing.rs b/finality-aleph/src/validator_network/outgoing.rs deleted file mode 100644 index 36115181ab..0000000000 --- a/finality-aleph/src/validator_network/outgoing.rs +++ /dev/null @@ -1,93 +0,0 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; - -use aleph_primitives::AuthorityId; -use futures::channel::mpsc; -use log::{debug, info}; -use tokio::time::{sleep, Duration}; - -use crate::{ - crypto::AuthorityPen, - validator_network::{ - protocol_negotiation::{protocol, ProtocolNegotiationError}, - protocols::ProtocolError, - Data, Dialer, - }, -}; - -enum OutgoingError> { - Dial(ND::Error), - ProtocolNegotiation(ProtocolNegotiationError), - Protocol(ProtocolError), -} - -impl> Display for OutgoingError { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - use OutgoingError::*; - match self { - Dial(e) => write!(f, "dial error: {}", e), - ProtocolNegotiation(e) => write!(f, "protocol negotiation error: {}", e), - Protocol(e) => write!(f, "protocol error: {}", e), - } - } -} - -impl> From for OutgoingError { - fn from(e: ProtocolNegotiationError) -> Self { - OutgoingError::ProtocolNegotiation(e) - } -} - -impl> From for OutgoingError { - fn from(e: ProtocolError) -> Self { - OutgoingError::Protocol(e) - } -} - -async fn manage_outgoing>( - authority_pen: AuthorityPen, - peer_id: AuthorityId, - mut dialer: ND, - addresses: Vec, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, Option>)>, -) -> Result<(), OutgoingError> { - debug!(target: "validator-network", "Trying to connect to {}.", peer_id); - let stream = dialer - .connect(addresses) - .await - .map_err(OutgoingError::Dial)?; - debug!(target: "validator-network", "Performing outgoing protocol negotiation."); - let (stream, protocol) = protocol(stream).await?; - debug!(target: "validator-network", "Negotiated protocol, running."); - Ok(protocol - .manage_outgoing(stream, authority_pen, peer_id, result_for_parent) - .await?) -} - -const RETRY_DELAY: Duration = Duration::from_secs(10); - -/// Establish an outgoing connection to the provided peer using the dialer and then manage it. -/// While this works it will send any data from the user to the peer. Any failures will be reported -/// to the parent, so that connections can be reestablished if necessary. -pub async fn outgoing>( - authority_pen: AuthorityPen, - peer_id: AuthorityId, - dialer: ND, - addresses: Vec, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, Option>)>, -) { - if let Err(e) = manage_outgoing( - authority_pen, - peer_id.clone(), - dialer, - addresses, - result_for_parent.clone(), - ) - .await - { - info!(target: "validator-network", "Outgoing connection to {} failed: {}, will retry after {}s.", peer_id, e, RETRY_DELAY.as_secs()); - sleep(RETRY_DELAY).await; - if result_for_parent.unbounded_send((peer_id, None)).is_err() { - debug!(target: "validator-network", "Could not send the closing message, we've probably been terminated by the parent service."); - } - } -} diff --git a/finality-aleph/src/validator_network/protocols.rs b/finality-aleph/src/validator_network/protocols.rs deleted file mode 100644 index 54581c20bb..0000000000 --- a/finality-aleph/src/validator_network/protocols.rs +++ /dev/null @@ -1,529 +0,0 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; - -use aleph_primitives::AuthorityId; -use futures::{ - channel::{mpsc, oneshot}, - StreamExt, -}; -use log::{debug, info, trace}; -use tokio::io::{AsyncRead, AsyncWrite}; - -use crate::{ - crypto::AuthorityPen, - validator_network::{ - handshake::{v0_handshake_incoming, v0_handshake_outgoing, HandshakeError}, - heartbeat::{heartbeat_receiver, heartbeat_sender}, - io::{receive_data, send_data, ReceiveError, SendError}, - Data, Splittable, - }, -}; - -/// Defines the protocol for communication. -#[derive(Debug, PartialEq, Eq)] -pub enum Protocol { - /// The current version of the protocol. - V0, -} - -/// Protocol error. -#[derive(Debug)] -pub enum ProtocolError { - /// Error during performing a handshake. - HandshakeError(HandshakeError), - /// Sending failed. - SendError(SendError), - /// Receiving failed. - ReceiveError(ReceiveError), - /// Heartbeat stopped. - CardiacArrest, - /// Channel to the parent service closed. - NoParentConnection, - /// Data channel closed. - NoUserConnection, -} - -impl Display for ProtocolError { - fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { - use ProtocolError::*; - match self { - HandshakeError(e) => write!(f, "handshake error: {}", e), - SendError(e) => write!(f, "send error: {}", e), - ReceiveError(e) => write!(f, "receive error: {}", e), - CardiacArrest => write!(f, "heartbeat stopped"), - NoParentConnection => write!(f, "cannot send result to service"), - NoUserConnection => write!(f, "cannot send data to user"), - } - } -} - -impl From for ProtocolError { - fn from(e: HandshakeError) -> Self { - ProtocolError::HandshakeError(e) - } -} - -impl From for ProtocolError { - fn from(e: SendError) -> Self { - ProtocolError::SendError(e) - } -} - -impl From for ProtocolError { - fn from(e: ReceiveError) -> Self { - ProtocolError::ReceiveError(e) - } -} - -/// Receives data from the parent service and sends it over the network. -/// Exits when the parent channel is closed, or if the network connection is broken. -async fn sending( - mut sender: S, - mut data_from_user: mpsc::UnboundedReceiver, -) -> Result<(), ProtocolError> { - loop { - sender = match data_from_user.next().await { - Some(data) => send_data(sender, data).await?, - // We have been closed by the parent service, all good. - None => return Ok(()), - }; - } -} - -/// Performs the handshake, and then keeps sending data received from the parent service. -/// Exits on parent request, or in case of broken or dead network connection. -async fn v0_outgoing( - stream: S, - authority_pen: AuthorityPen, - peer_id: AuthorityId, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, Option>)>, -) -> Result<(), ProtocolError> { - trace!(target: "validator-network", "Extending hand to {}.", peer_id); - let (sender, receiver) = v0_handshake_outgoing(stream, authority_pen, peer_id.clone()).await?; - info!(target: "validator-network", "Outgoing handshake with {} finished successfully.", peer_id); - let (data_for_network, data_from_user) = mpsc::unbounded::(); - result_for_parent - .unbounded_send((peer_id.clone(), Some(data_for_network))) - .map_err(|_| ProtocolError::NoParentConnection)?; - - let sending = sending(sender, data_from_user); - let heartbeat = heartbeat_receiver(receiver); - - debug!(target: "validator-network", "Starting worker for sending to {}.", peer_id); - loop { - tokio::select! { - _ = heartbeat => return Err(ProtocolError::CardiacArrest), - result = sending => return result, - } - } -} - -/// Receives data from the network and sends it to the parent service. -/// Exits when the parent channel is closed, or if the network connection is broken. -async fn receiving( - mut stream: S, - data_for_user: mpsc::UnboundedSender, -) -> Result<(), ProtocolError> { - loop { - let (old_stream, data) = receive_data(stream).await?; - stream = old_stream; - data_for_user - .unbounded_send(data) - .map_err(|_| ProtocolError::NoUserConnection)?; - } -} - -/// Performs the handshake, and then keeps sending data received from the network to the parent service. -/// Exits on parent request, or in case of broken or dead network connection. -async fn v0_incoming( - stream: S, - authority_pen: AuthorityPen, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, - data_for_user: mpsc::UnboundedSender, -) -> Result<(), ProtocolError> { - trace!(target: "validator-network", "Waiting for extended hand..."); - let (sender, receiver, peer_id) = v0_handshake_incoming(stream, authority_pen).await?; - info!(target: "validator-network", "Incoming handshake with {} finished successfully.", peer_id); - - let (tx_exit, exit) = oneshot::channel(); - result_for_parent - .unbounded_send((peer_id.clone(), tx_exit)) - .map_err(|_| ProtocolError::NoParentConnection)?; - - let receiving = receiving(receiver, data_for_user); - let heartbeat = heartbeat_sender(sender); - - debug!(target: "validator-network", "Starting worker for receiving from {}.", peer_id); - loop { - tokio::select! { - _ = heartbeat => return Err(ProtocolError::CardiacArrest), - result = receiving => return result, - _ = exit => return Ok(()), - } - } -} - -impl Protocol { - /// Launches the proper variant of the protocol (receiver half). - pub async fn manage_incoming( - &self, - stream: S, - authority_pen: AuthorityPen, - result_for_service: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, - data_for_user: mpsc::UnboundedSender, - ) -> Result<(), ProtocolError> { - use Protocol::*; - match self { - V0 => v0_incoming(stream, authority_pen, result_for_service, data_for_user).await, - } - } - - /// Launches the proper variant of the protocol (sender half). - pub async fn manage_outgoing( - &self, - stream: S, - authority_pen: AuthorityPen, - peer_id: AuthorityId, - result_for_service: mpsc::UnboundedSender<(AuthorityId, Option>)>, - ) -> Result<(), ProtocolError> { - use Protocol::*; - match self { - V0 => v0_outgoing(stream, authority_pen, peer_id, result_for_service).await, - } - } -} - -#[cfg(test)] -mod tests { - use aleph_primitives::AuthorityId; - use futures::{ - channel::{mpsc, mpsc::UnboundedReceiver, oneshot}, - pin_mut, FutureExt, StreamExt, - }; - - use super::{Protocol, ProtocolError}; - use crate::{ - crypto::AuthorityPen, - validator_network::{ - mock::{key, MockSplittable}, - Data, - }, - }; - - async fn prepare() -> ( - AuthorityId, - AuthorityPen, - AuthorityId, - AuthorityPen, - impl futures::Future>, - impl futures::Future>, - UnboundedReceiver, - UnboundedReceiver<(AuthorityId, oneshot::Sender<()>)>, - UnboundedReceiver<(AuthorityId, Option>)>, - ) { - let (stream_incoming, stream_outgoing) = MockSplittable::new(4096); - let (id_incoming, pen_incoming) = key().await; - let (id_outgoing, pen_outgoing) = key().await; - assert_ne!(id_incoming, id_outgoing); - let (incoming_result_for_service, result_from_incoming) = - mpsc::unbounded::<(AuthorityId, oneshot::Sender<()>)>(); - let (outgoing_result_for_service, result_from_outgoing) = mpsc::unbounded(); - let (data_for_user, data_from_incoming) = mpsc::unbounded::(); - let incoming_handle = Protocol::V0.manage_incoming( - stream_incoming, - pen_incoming.clone(), - incoming_result_for_service, - data_for_user, - ); - let outgoing_handle = Protocol::V0.manage_outgoing( - stream_outgoing, - pen_outgoing.clone(), - id_incoming.clone(), - outgoing_result_for_service, - ); - ( - id_incoming, - pen_incoming, - id_outgoing, - pen_outgoing, - incoming_handle, - outgoing_handle, - data_from_incoming, - result_from_incoming, - result_from_outgoing, - ) - } - - #[tokio::test] - async fn send_data() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - mut data_from_incoming, - _result_from_incoming, - mut result_from_outgoing, - ) = prepare::>().await; - let incoming_handle = incoming_handle.fuse(); - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(incoming_handle); - pin_mut!(outgoing_handle); - let _data_for_outgoing = tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - result = result_from_outgoing.next() => { - let (_, maybe_data_for_outgoing) = result.expect("outgoing should have resturned Some"); - let data_for_outgoing = maybe_data_for_outgoing.expect("successfully connected"); - data_for_outgoing - .unbounded_send(vec![4, 3, 43]) - .expect("should send"); - data_for_outgoing - .unbounded_send(vec![2, 1, 3, 7]) - .expect("should send"); - data_for_outgoing - }, - }; - tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - v = data_from_incoming.next() => { - assert_eq!(v, Some(vec![4, 3, 43])); - }, - }; - tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - v = data_from_incoming.next() => { - assert_eq!(v, Some(vec![2, 1, 3, 7])); - }, - }; - } - - #[tokio::test] - async fn closed_by_parent_service() { - let ( - _id_incoming, - _pen_incoming, - id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - mut result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - let incoming_handle = incoming_handle.fuse(); - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(incoming_handle); - pin_mut!(outgoing_handle); - tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - received = result_from_incoming.next() => { - // we drop the exit oneshot channel, thus finishing incoming_handle - let (received_id, _) = received.expect("should receive"); - assert_eq!(received_id, id_outgoing); - }, - }; - incoming_handle - .await - .expect("closed manually, should finish with no error"); - } - - #[tokio::test] - async fn parent_service_dead() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - std::mem::drop(result_from_incoming); - let incoming_handle = incoming_handle.fuse(); - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(incoming_handle); - pin_mut!(outgoing_handle); - tokio::select! { - e = &mut incoming_handle => match e { - Err(ProtocolError::NoParentConnection) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when parent dead"), - }, - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - }; - } - - #[tokio::test] - async fn parent_user_dead() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - data_from_incoming, - _result_from_incoming, - mut result_from_outgoing, - ) = prepare::>().await; - std::mem::drop(data_from_incoming); - let incoming_handle = incoming_handle.fuse(); - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(incoming_handle); - pin_mut!(outgoing_handle); - let _data_for_outgoing = tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - result = result_from_outgoing.next() => { - let (_, maybe_data_for_outgoing) = result.expect("outgoing should have resturned Some"); - let data_for_outgoing = maybe_data_for_outgoing.expect("successfully connected"); - data_for_outgoing - .unbounded_send(vec![2, 1, 3, 7]) - .expect("should send"); - data_for_outgoing - }, - }; - tokio::select! { - e = &mut incoming_handle => match e { - Err(ProtocolError::NoUserConnection) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when user dead"), - }, - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - }; - } - - #[tokio::test] - async fn sender_dead_before_handshake() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - _result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - std::mem::drop(outgoing_handle); - match incoming_handle.await { - Err(ProtocolError::HandshakeError(_)) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when connection dead"), - }; - } - - #[tokio::test] - async fn sender_dead_after_handshake() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - mut result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - let incoming_handle = incoming_handle.fuse(); - pin_mut!(incoming_handle); - let (_, _exit) = tokio::select! { - _ = &mut incoming_handle => panic!("incoming process unexpectedly finished"), - _ = outgoing_handle => panic!("outgoing process unexpectedly finished"), - out = result_from_incoming.next() => out.expect("should receive"), - }; - // outgoing_handle got consumed by tokio::select!, the sender is dead - match incoming_handle.await { - Err(ProtocolError::ReceiveError(_)) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when connection dead"), - }; - } - - #[tokio::test] - async fn receiver_dead_before_handshake() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - _result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - std::mem::drop(incoming_handle); - match outgoing_handle.await { - Err(ProtocolError::HandshakeError(_)) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when connection dead"), - }; - } - - #[tokio::test] - async fn receiver_dead_after_handshake() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - mut result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(outgoing_handle); - let (_, _exit) = tokio::select! { - _ = incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - out = result_from_incoming.next() => out.expect("should receive"), - }; - // incoming_handle got consumed by tokio::select!, the receiver is dead - match outgoing_handle.await { - // We never get the SendError variant here, because we did not send anything - // through data_for_outgoing. - Err(ProtocolError::CardiacArrest) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when connection dead"), - }; - } - - #[tokio::test] - async fn receiver_dead_after_handshake_try_send_error() { - let ( - _id_incoming, - _pen_incoming, - _id_outgoing, - _pen_outgoing, - incoming_handle, - outgoing_handle, - _data_from_incoming, - mut result_from_incoming, - _result_from_outgoing, - ) = prepare::>().await; - let outgoing_handle = outgoing_handle.fuse(); - pin_mut!(outgoing_handle); - let (_, _exit) = tokio::select! { - _ = incoming_handle => panic!("incoming process unexpectedly finished"), - _ = &mut outgoing_handle => panic!("outgoing process unexpectedly finished"), - out = result_from_incoming.next() => out.expect("should receive"), - }; - match outgoing_handle.await { - Err(ProtocolError::CardiacArrest) => (), - Err(e) => panic!("unexpected error: {}", e), - Ok(_) => panic!("successfully finished when connection dead"), - }; - } -} diff --git a/finality-aleph/src/validator_network/service.rs b/finality-aleph/src/validator_network/service.rs deleted file mode 100644 index ead09e5256..0000000000 --- a/finality-aleph/src/validator_network/service.rs +++ /dev/null @@ -1,217 +0,0 @@ -use aleph_primitives::AuthorityId; -use futures::{ - channel::{mpsc, oneshot}, - StreamExt, -}; -use log::{info, trace, warn}; -use tokio::time; - -use crate::{ - crypto::AuthorityPen, - validator_network::{ - incoming::incoming, - manager::{AddResult, Manager}, - outgoing::outgoing, - Data, Dialer, Listener, Network, - }, - SpawnTaskHandle, STATUS_REPORT_INTERVAL, -}; - -enum ServiceCommand { - AddConnection(AuthorityId, Vec), - DelConnection(AuthorityId), - SendData(D, AuthorityId), -} - -struct ServiceInterface { - commands_for_service: mpsc::UnboundedSender>, - next_from_service: mpsc::UnboundedReceiver, -} - -#[async_trait::async_trait] -impl Network for ServiceInterface { - /// Add the peer to the set of connected peers. - fn add_connection(&mut self, peer: AuthorityId, addresses: Vec) { - if self - .commands_for_service - .unbounded_send(ServiceCommand::AddConnection(peer, addresses)) - .is_err() - { - info!(target: "validator-network", "Service is dead."); - }; - } - - /// Remove the peer from the set of connected peers and close the connection. - fn remove_connection(&mut self, peer: AuthorityId) { - if self - .commands_for_service - .unbounded_send(ServiceCommand::DelConnection(peer)) - .is_err() - { - info!(target: "validator-network", "Service is dead."); - }; - } - - /// Send a message to a single peer. - /// This function should be implemented in a non-blocking manner. - fn send(&self, data: D, recipient: AuthorityId) { - if self - .commands_for_service - .unbounded_send(ServiceCommand::SendData(data, recipient)) - .is_err() - { - info!(target: "validator-network", "Service is dead."); - }; - } - - /// Receive a message from the network. - async fn next(&mut self) -> Option { - self.next_from_service.next().await - } -} - -/// A service that has to be run for the validator network to work. -pub struct Service, NL: Listener> { - commands_from_interface: mpsc::UnboundedReceiver>, - next_to_interface: mpsc::UnboundedSender, - manager: Manager, - dialer: ND, - listener: NL, - spawn_handle: SpawnTaskHandle, - authority_pen: AuthorityPen, -} - -impl, NL: Listener> Service { - /// Create a new validator network service plus an interface for interacting with it. - pub fn new( - dialer: ND, - listener: NL, - authority_pen: AuthorityPen, - spawn_handle: SpawnTaskHandle, - ) -> (Self, impl Network) { - // Channel for sending commands between the service and interface - let (commands_for_service, commands_from_interface) = mpsc::unbounded(); - // Channel for receiving data from the network - let (next_to_interface, next_from_service) = mpsc::unbounded(); - ( - Self { - commands_from_interface, - next_to_interface, - manager: Manager::new(), - dialer, - listener, - spawn_handle, - authority_pen, - }, - ServiceInterface { - commands_for_service, - next_from_service, - }, - ) - } - - fn spawn_new_outgoing( - &self, - peer_id: AuthorityId, - addresses: Vec, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, Option>)>, - ) { - let authority_pen = self.authority_pen.clone(); - let dialer = self.dialer.clone(); - self.spawn_handle - .spawn("aleph/validator_network_outgoing", None, async move { - outgoing(authority_pen, peer_id, dialer, addresses, result_for_parent).await; - }); - } - - fn spawn_new_incoming( - &self, - stream: NL::Connection, - result_for_parent: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, - ) { - let authority_pen = self.authority_pen.clone(); - let next_to_interface = self.next_to_interface.clone(); - self.spawn_handle - .spawn("aleph/validator_network_incoming", None, async move { - incoming(authority_pen, stream, result_for_parent, next_to_interface).await; - }); - } - - /// Run the service until a signal from exit. - pub async fn run(mut self, mut exit: oneshot::Receiver<()>) { - let mut status_ticker = time::interval(STATUS_REPORT_INTERVAL); - // channel used to receive tuple (peer_id, exit_handle) from a spawned worker - // that has just established an incoming connection - // exit_handle may be used to kill the worker later - let (incoming_result_for_parent, mut incoming_workers) = mpsc::unbounded(); - // channel used to receive information about failure from a spawned worker - // that managed an outgoing connection - // the received peer_id can be used to spawn another worker - let (outgoing_result_for_parent, mut outgoing_workers) = mpsc::unbounded(); - use ServiceCommand::*; - loop { - tokio::select! { - // got new incoming connection from the listener - spawn an incoming worker - maybe_stream = self.listener.accept() => match maybe_stream { - Ok(stream) => self.spawn_new_incoming(stream, incoming_result_for_parent.clone()), - Err(e) => warn!(target: "validator-network", "Listener failed to accept connection: {}", e), - }, - // got a new command from the interface - Some(command) = self.commands_from_interface.next() => match command { - // register new peer in manager or update its list of addresses if already there - // spawn a worker managing outgoing connection if the peer was not known - AddConnection(peer_id, addresses) => { - if self.manager.add_peer(peer_id.clone(), addresses.clone()) { - self.spawn_new_outgoing(peer_id, addresses, outgoing_result_for_parent.clone()); - }; - }, - // remove the peer from the manager all workers will be killed automatically, due to closed channels - DelConnection(peer_id) => { - self.manager.remove_peer(&peer_id); - }, - // pass the data to the manager - SendData(data, peer_id) => { - match self.manager.send_to(&peer_id, data) { - Ok(_) => trace!(target: "validator-network", "Sending data to {}.", peer_id), - Err(e) => trace!(target: "validator-network", "Failed sending to {}: {}", peer_id, e), - } - }, - }, - // received tuple (peer_id, exit_handle) from a spawned worker - // that has just established an incoming connection - // pass the tuple to the manager to register the connection - // the manager will be responsible for killing the worker if necessary - Some((peer_id, exit)) = incoming_workers.next() => { - use AddResult::*; - match self.manager.add_incoming(peer_id.clone(), exit) { - Uninterested => info!(target: "validator-network", "Peer {} connected to us despite out lack of interest.", peer_id), - Added => info!(target: "validator-network", "New incoming connection for peer {}.", peer_id), - Replaced => info!(target: "validator-network", "Replaced incoming connection for peer {}.", peer_id), - } - }, - // received information from a spawned worker managing an outgoing connection - // check if we still want to be connected to the peer, and if so, spawn a new worker or actually add proper connection - Some((peer_id, maybe_data_for_network)) = outgoing_workers.next() => { - use AddResult::*; - if let Some(addresses) = self.manager.peer_addresses(&peer_id) { - match maybe_data_for_network { - Some(data_for_network) => match self.manager.add_outgoing(peer_id.clone(), data_for_network) { - Uninterested => warn!(target: "validator-network", "We connected to peer {} for unknown reasons.", peer_id), - Added => info!(target: "validator-network", "New outgoing connection to peer {}.", peer_id), - Replaced => info!(target: "validator-network", "Replaced outgoing connection to peer {}.", peer_id), - }, - None => self.spawn_new_outgoing(peer_id, addresses, outgoing_result_for_parent.clone()), - } - }; - }, - // periodically reporting what we are trying to do - _ = status_ticker.tick() => { - info!(target: "validator-network", "Validator Network status: {}", self.manager.status_report()) - } - // received exit signal, stop the network - // all workers will be killed automatically after the manager gets dropped - _ = &mut exit => break, - }; - } - } -} diff --git a/flooder/Cargo.lock b/flooder/Cargo.lock index 39ec0dda25..00ac34699b 100644 --- a/flooder/Cargo.lock +++ b/flooder/Cargo.lock @@ -13,61 +13,21 @@ dependencies = [ ] [[package]] -name = "ac-compose-macros" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "log", - "parity-scale-codec", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-node-api" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-primitives", - "derive_more", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "ac-primitives" -version = "0.1.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "hex", - "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "gimli 0.26.2", ] [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.2", ] [[package]] @@ -87,42 +47,47 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aleph_client" -version = "1.11.0" +version = "2.13.0" dependencies = [ - "ac-node-api", - "ac-primitives", "anyhow", - "contract-metadata 1.5.0", + "async-trait", + "contract-metadata 2.0.1", "contract-transcode", "frame-support", + "futures", "hex", "ink_metadata", "log", - "pallet-aleph", - "pallet-balances", - "pallet-elections", - "pallet-multisig", - "pallet-staking", - "pallet-treasury", - "pallet-vesting", + "pallet-contracts-primitives", "parity-scale-codec", "primitives", - "rayon", + "serde", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "subxt", "thiserror", ] @@ -146,18 +111,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] -name = "approx" -version = "0.5.1" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "arrayref" @@ -165,15 +127,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -186,11 +139,21 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -203,7 +166,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi 0.3.9", ] @@ -216,16 +179,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -247,6 +210,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -267,21 +260,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -334,15 +317,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -368,15 +351,15 @@ dependencies = [ [[package]] name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "bzip2" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" dependencies = [ "bzip2-sys", "libc", @@ -395,9 +378,18 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -413,9 +405,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", @@ -425,9 +417,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.21" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -474,22 +466,16 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "contract-metadata" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36318b44d658ee23a2daf66811822bdf6ac686aa534ea87eb9e16e7430ca6928" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -499,10 +485,11 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f25bdb57a728064a0e4909dfbb29957ebb06d205307e337d3b5596c7e67dd3a" +checksum = "f5997814dd5d45804757a616e938c28586875ac793ffc140e57e7ae9f421a066" dependencies = [ + "anyhow", "impl-serde", "semver", "serde", @@ -512,35 +499,37 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa6db9d18dd5ef92d29c52d30c8503c857d390d9e4043e12466f1490c43c05e" +version = "2.0.0-beta.1" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ "anyhow", - "contract-metadata 0.6.0", - "env_logger 0.9.1", + "contract-metadata 2.0.0-beta.1", "escape8259", "hex", "indexmap", "ink_env", "ink_metadata", "itertools", - "log", "nom", "nom-supreme", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "core-foundation" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation-sys" @@ -549,62 +538,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "cpufeatures" -version = "0.2.5" +name = "cpp_demangle" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "libc", + "cfg-if 1.0.0", ] [[package]] -name = "crc32fast" -version = "1.3.2" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if 1.0.0", + "libc", ] [[package]] -name = "crossbeam-channel" -version = "0.5.6" +name = "cranelift-entity" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "serde", ] [[package]] -name = "crossbeam-deque" -version = "0.8.2" +name = "crc32fast" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.11" +name = "crossbeam-channel" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -617,9 +600,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -685,9 +668,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -697,9 +680,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -712,28 +695,86 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", "syn", ] [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -742,10 +783,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", ] @@ -769,9 +808,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -807,15 +846,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -825,9 +864,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -840,27 +879,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -884,23 +936,31 @@ dependencies = [ ] [[package]] -name = "env_logger" -version = "0.9.1" +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "errno-dragonfly", + "libc", + "winapi 0.3.9", ] [[package]] -name = "environmental" -version = "1.1.3" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "escape8259" @@ -911,17 +971,38 @@ dependencies = [ "rustversion", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -929,9 +1010,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -941,9 +1022,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "miniz_oxide", @@ -951,26 +1032,32 @@ dependencies = [ [[package]] name = "flooder" -version = "0.2.1" +version = "0.2.4" dependencies = [ "aleph_client", "anyhow", "clap", - "env_logger 0.8.4", + "env_logger", "futures", "hdrhistogram", "log", - "mio", + "mio 0.6.23", "parity-scale-codec", - "rayon", "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "substrate-api-client", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "subxt", + "tokio", "ws", "zip", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foreign-types" version = "0.3.2" @@ -996,70 +1083,10 @@ dependencies = [ ] [[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "linregress", - "log", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "frame-election-provider-solution-type" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-election-provider-support" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-solution-type", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-npos-elections", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "git+https://github.com/integritee-network/frame-metadata#3b43da9821238681f9431276d55b92a079142083" +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ "cfg-if 1.0.0", "parity-scale-codec", @@ -1070,10 +1097,10 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "bitflags", - "frame-metadata 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -1085,26 +1112,30 @@ dependencies = [ "serde", "smallvec", "sp-api", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "sp-core-hashing-proc-macro", "sp-inherents", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "sp-staking", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -1113,7 +1144,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1125,30 +1156,13 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", -] - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1173,9 +1187,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1188,9 +1202,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1198,15 +1212,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1216,15 +1230,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-lite" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1233,15 +1262,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1251,9 +1280,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1306,8 +1335,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1315,18 +1346,47 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes 1.4.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1348,16 +1408,22 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "hdrhistogram" version = "7.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8" dependencies = [ - "base64", + "base64 0.13.1", "byteorder", "crossbeam-channel", "flate2", @@ -1367,9 +1433,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1380,6 +1446,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -1406,6 +1481,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1417,23 +1501,91 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes 1.4.0", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.4.0", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes 1.4.0", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1453,6 +1605,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1474,9 +1632,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -1500,43 +1658,44 @@ checksum = "0cfe9645a18782869361d9c8732246be7b410ad4e919d3609ebabdac00ba12c3" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] name = "ink_allocator" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9588a59a0e8997c0b2153cd11b5aaa77c06a0537a6b18f3811d1f1aa098b12" +checksum = "5323d4f43900266f2d5462cbe2a96d4182d634da0cfc1078d26c74d4117e0ce9" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "ink_engine" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487c3b390b7feb0620496b0cd38683433c7d7e6946b1caabda51e1f23eb24b30" +checksum = "de001b0907475ab10211093569d8b92726ef7a37d04b6e90c8a2864fbe14d050" dependencies = [ "blake2", "derive_more", + "ink_primitives", "parity-scale-codec", - "rand 0.8.5", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", ] [[package]] name = "ink_env" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a891d34301a3dbb1c7b7424c49ae184282b163491c54f9acd17fcbe14a80447b" +checksum = "b0354567725e4f635a5c5694e4e4cac105e3e78cefd948ca5ab6cc92ea3d8231" dependencies = [ "arrayref", "blake2", @@ -1547,13 +1706,13 @@ dependencies = [ "ink_metadata", "ink_prelude", "ink_primitives", + "ink_storage_traits", "num-traits", "parity-scale-codec", "paste", - "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.0", + "secp256k1 0.26.0", "sha2 0.10.6", "sha3", "static_assertions", @@ -1561,9 +1720,9 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74913aaed5751f5615af4631b7559328b8ed56c9cb821b89e14af0706176e849" +checksum = "9dfb4d5448446656ebf83d800c06effeffc063967ef5986d7d1a277e3e507dae" dependencies = [ "derive_more", "impl-serde", @@ -1575,23 +1734,47 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f031e6b8495594a7288b089bf4122e76c26b994959d1b2b693bdfe846b14c0e" +checksum = "c2626fb0c922f923965774cdd8cddeaaa204931d0ed19e0bf43702b033924173" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "ink_primitives" -version = "3.4.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12cf42dce81d060401c7cec95a392ad6d3c2f18661fa3083f619ce135133c33" +checksum = "91066af898fe4c59b2ed0aca678238928b551dc75f5284bf1422e9f1bb6b2204" dependencies = [ - "cfg-if 1.0.0", + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage_traits" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da15ceaef6bdbece3e8b6338df899ef94e3921d03387fa941af8df3b38803523" +dependencies = [ + "ink_metadata", "ink_prelude", + "ink_primitives", "parity-scale-codec", "scale-info", + "syn", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", ] [[package]] @@ -1603,6 +1786,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + [[package]] name = "iovec" version = "0.1.4" @@ -1623,9 +1812,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "joinery" @@ -1635,30 +1824,122 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if 1.0.0", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] [[package]] name = "kernel32-sys" @@ -1684,15 +1965,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1701,7 +1982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1744,22 +2025,18 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] [[package]] -name = "linregress" -version = "0.4.4" +name = "linux-raw-sys" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" -dependencies = [ - "nalgebra", - "statrs", -] +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "lock_api" @@ -1781,21 +2058,30 @@ dependencies = [ ] [[package]] -name = "matchers" -version = "0.0.1" +name = "lru" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "regex-automata", + "hashbrown 0.12.3", ] [[package]] -name = "matrixmultiply" +name = "mach" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ - "rawpointer", + "libc", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", ] [[package]] @@ -1815,20 +2101,30 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown 0.12.3", +] + [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1850,9 +2146,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -1876,6 +2172,18 @@ dependencies = [ "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", +] + [[package]] name = "mio-extras" version = "2.0.6" @@ -1884,7 +2192,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", "log", - "mio", + "mio 0.6.23", "slab", ] @@ -1900,35 +2208,6 @@ dependencies = [ "ws2_32-sys", ] -[[package]] -name = "nalgebra" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational 0.4.1", - "num-traits", - "rand 0.8.5", - "rand_distr", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "net2" version = "0.2.38" @@ -1941,16 +2220,16 @@ dependencies = [ ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1970,30 +2249,30 @@ dependencies = [ ] [[package]] -name = "num-bigint" -version = "0.2.6" +name = "nom8" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "memchr", ] [[package]] -name = "num-complex" -version = "0.4.2" +name = "num-bigint" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ + "autocfg", + "num-integer", "num-traits", ] [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -2009,18 +2288,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2028,6 +2295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -2039,16 +2307,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", ] [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -2057,15 +2324,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -2081,9 +2360,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2105,11 +2384,17 @@ dependencies = [ "syn", ] +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -2120,215 +2405,32 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" - -[[package]] -name = "pallet-aleph" -version = "0.5.0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "pallet-session", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "serde", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-authorship", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-elections" -version = "0.5.0" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-balances", - "pallet-session", - "pallet-staking", - "pallets-support", - "parity-scale-codec", - "primitives", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-session" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "log", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-session", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-staking" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec", - "scale-info", - "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-timestamp", -] - -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "serde", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "pallet-contracts-primitives" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "frame-support", - "frame-system", - "log", + "bitflags", "parity-scale-codec", - "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", -] - -[[package]] -name = "pallets-support" -version = "0.1.0" -dependencies = [ - "frame-support", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes 1.4.0", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2336,9 +2438,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2348,12 +2450,12 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ "cfg-if 1.0.0", - "hashbrown", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", @@ -2374,9 +2476,15 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -2390,22 +2498,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -2425,12 +2533,41 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -2443,23 +2580,33 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -2470,28 +2617,27 @@ dependencies = [ [[package]] name = "primitives" -version = "0.5.0" +version = "0.5.5" dependencies = [ "parity-scale-codec", "scale-info", "serde", "sp-api", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2520,18 +2666,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2605,16 +2760,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -2633,36 +2778,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2674,18 +2789,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2694,9 +2809,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2714,21 +2829,36 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", +] + [[package]] name = "rlibc" version = "1.0.0" @@ -2754,31 +2884,92 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "semver", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -2790,9 +2981,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2800,6 +2991,43 @@ dependencies = [ "syn", ] +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if 1.0.0", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2826,54 +3054,66 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.6.1", ] [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "secp256k1-sys 0.6.1", + "secp256k1-sys 0.8.0", ] [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "642a62736682fdd8c71da0eb273e453c8ac74e33b9fb310e22ba5b03ec7651ff" dependencies = [ "cc", ] @@ -2887,29 +3127,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2918,9 +3181,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -2939,6 +3202,19 @@ dependencies = [ "opaque-debug 0.2.3", ] +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + [[package]] name = "sha2" version = "0.8.2" @@ -2972,7 +3248,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2981,7 +3257,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -2995,32 +3271,29 @@ dependencies = [ ] [[package]] -name = "signature" -version = "1.4.0" +name = "signal-hook-registry" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", + "libc", ] [[package]] -name = "simba" -version = "0.5.1" +name = "signature" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", + "digest 0.10.6", + "rand_core 0.6.4", ] [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -3031,19 +3304,45 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes 1.4.0", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1 0.9.8", +] + [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "hash-db", "log", "parity-scale-codec", "sp-api-proc-macro", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "sp-version", "thiserror", ] @@ -3051,7 +3350,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "blake2", "proc-macro-crate", @@ -3062,90 +3361,104 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-application-crypto" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "static_assertions", ] [[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-arithmetic" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", + "integer-sqrt", + "num-traits", "parity-scale-codec", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "scale-info", + "serde", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "static_assertions", ] [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -3153,120 +3466,172 @@ dependencies = [ "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core-hashing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", + "tiny-bip39 0.8.2", "wasmi", "zeroize", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.0", + "secp256k1 0.24.3", "secrecy", "serde", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", - "wasmi", + "tiny-bip39 1.0.0", "zeroize", ] [[package]] -name = "sp-core-hashing" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +name = "sp-core" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "blake2-rfc", - "byteorder", - "sha2 0.9.9", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", - "twox-hash", + "array-bytes", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1 0.24.3", + "secrecy", + "serde", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39 1.0.0", + "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash", ] [[package]] -name = "sp-core-hashing-proc-macro" +name = "sp-core-hashing" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", - "sp-core-hashing 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core-hashing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "syn", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3275,8 +3640,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "proc-macro2", "quote", @@ -3285,98 +3660,134 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes 1.4.0", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-keystore 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-state-machine 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-state-machine 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "secp256k1 0.24.0", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-keystore 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-state-machine 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes 1.4.0", + "ed25519", + "ed25519-dalek", + "futures", + "libsecp256k1", + "log", + "parity-scale-codec", + "secp256k1 0.24.3", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-keystore 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-state-machine 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3384,15 +3795,15 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "futures", @@ -3400,30 +3811,32 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", ] [[package]] -name = "sp-npos-elections" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-keystore" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ + "async-trait", + "futures", + "merlin", "parity-scale-codec", - "scale-info", - "serde", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "parking_lot", + "schnorrkel", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "thiserror", ] [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", @@ -3432,8 +3845,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", @@ -3441,20 +3854,20 @@ dependencies = [ ] [[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-panic-handler" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "rustc-hash", - "serde", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "backtrace", + "lazy_static", + "regex", ] [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3466,76 +3879,118 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-io 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-application-crypto 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-io 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-runtime" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-arithmetic 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-io 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-application-crypto 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-io 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-weights 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes 1.4.0", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-storage 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-tracing 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-wasm-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "bytes 1.4.0", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime-interface-proc-macro 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-storage 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-tracing 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-wasm-interface 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3546,8 +4001,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", "proc-macro-crate", @@ -3557,35 +4012,34 @@ dependencies = [ ] [[package]] -name = "sp-session" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-runtime-interface-proc-macro" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-staking", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3594,101 +4048,120 @@ dependencies = [ "parking_lot", "rand 0.7.3", "smallvec", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-panic-handler 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-trie 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-panic-handler 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-externalities 0.12.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-panic-handler 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-trie 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "thiserror", + "tracing", +] + +[[package]] +name = "sp-state-machine" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand 0.8.5", + "smallvec", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-externalities 0.13.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-panic-handler 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-trie 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", ] [[package]] -name = "sp-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ - "async-trait", - "futures-timer", - "log", + "impl-serde", "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "thiserror", + "ref-cast", + "serde", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", ] [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-core", "tracing-subscriber", @@ -3696,44 +4169,94 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "tracing", "tracing-core", "tracing-subscriber", ] [[package]] -name = "sp-trie" +name = "sp-tracing" version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash 0.7.6", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "lru", + "memory-db 0.30.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "ahash 0.8.3", "hash-db", - "memory-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "ahash 0.8.3", + "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "memory-db 0.31.0", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "schnellru", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3741,7 +4264,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3749,8 +4272,8 @@ dependencies = [ "scale-info", "serde", "sp-core-hashing-proc-macro", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-runtime 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", "sp-version-proc-macro", "thiserror", ] @@ -3758,7 +4281,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3768,34 +4291,111 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38)", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38#140608987761992352ba19e9e0883f5cb8bd6d2a" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-core 7.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-debug-derive 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", + "sp-std 5.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=wip-v0.9.38)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3807,23 +4407,16 @@ dependencies = [ ] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "statrs" -version = "0.15.0" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.5", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" @@ -3831,36 +4424,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "substrate-api-client" -version = "0.6.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate-api-client.git?branch=aleph-v0.9.28#92bc66b75428213e4bcdb2484616cf458455813a" -dependencies = [ - "ac-compose-macros", - "ac-node-api", - "ac-primitives", - "frame-metadata 15.0.0 (git+https://github.com/integritee-network/frame-metadata)", - "frame-support", - "frame-system", - "hex", - "log", - "pallet-balances", - "pallet-staking", - "pallet-transaction-payment", - "parity-scale-codec", - "primitive-types", - "serde", - "serde_json", - "sp-core 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-rpc", - "sp-runtime 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-runtime-interface 6.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-std 4.0.0 (git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28)", - "sp-version", - "thiserror", - "ws", -] - [[package]] name = "substrate-bip39" version = "0.4.4" @@ -3880,11 +4443,84 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subxt" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +dependencies = [ + "bitvec", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tracing", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +dependencies = [ + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3909,35 +4545,41 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -3946,18 +4588,19 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if 1.0.0", "once_cell", ] [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -3984,12 +4627,22 @@ dependencies = [ ] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "tiny-bip39" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" dependencies = [ - "crunchy", + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", ] [[package]] @@ -4003,19 +4656,90 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "toml" -version = "0.5.9" +name = "tokio" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ - "serde", + "autocfg", + "bytes 1.4.0", + "libc", + "memchr", + "mio 0.8.6", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-util" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +dependencies = [ + "bytes 1.4.0", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -4094,12 +4818,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -4114,11 +4838,17 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -4126,23 +4856,23 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", - "digest 0.10.5", + "cfg-if 1.0.0", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -4152,15 +4882,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -4183,6 +4913,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -4213,6 +4949,22 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4233,9 +4985,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -4243,9 +4995,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -4258,9 +5010,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4268,9 +5020,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4281,34 +5033,203 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if 1.0.0", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "winapi" version = "0.2.8" @@ -4352,6 +5273,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4359,55 +5293,109 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "ws" @@ -4419,11 +5407,11 @@ dependencies = [ "bytes 0.4.12", "httparse", "log", - "mio", + "mio 0.6.23", "mio-extras", "openssl", "rand 0.7.3", - "sha-1", + "sha-1 0.8.2", "slab", "url", ] @@ -4440,13 +5428,25 @@ dependencies = [ [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + [[package]] name = "zeroize" version = "1.5.7" @@ -4458,9 +5458,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/flooder/Cargo.toml b/flooder/Cargo.toml index 92694e075b..a172d2509c 100644 --- a/flooder/Cargo.toml +++ b/flooder/Cargo.toml @@ -1,15 +1,13 @@ [package] name = "flooder" -version = "0.2.1" +version = "0.2.4" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" [dependencies] -substrate-api-client = { git = "https://github.com/Cardinal-Cryptography/substrate-api-client.git", branch = "aleph-v0.9.28" } - -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", features = ["full_crypto"] } -sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38", features = ["full_crypto"] } +sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } # other dependencies serde_json = { version = "1.0" } @@ -23,6 +21,7 @@ env_logger = "0.8" futures = { version = "0.3", features = ["alloc"] } hdrhistogram = "7.3" log = "0.4" -rayon = "1.5" +subxt = "0.25.0" +tokio = { version = "1.21.2", features = ["full"] } aleph_client = { path = "../aleph-client" } diff --git a/flooder/src/config.rs b/flooder/src/config.rs index 3d6e4b84a6..48cc3ae413 100644 --- a/flooder/src/config.rs +++ b/flooder/src/config.rs @@ -6,7 +6,7 @@ use clap::Parser; #[clap(version = "1.0")] pub struct Config { /// URL address(es) of the nodes to send transactions to - #[clap(long, default_value = "127.0.0.1:9944")] + #[clap(long, default_value = "ws://127.0.0.1:9944")] pub nodes: Vec, /// how many transactions to send @@ -21,7 +21,7 @@ pub struct Config { #[clap(long, conflicts_with_all = &["phrase"])] pub seed: Option, - /// allows to skip accounts initialization process and just attempt to download their nonces + /// allows to skip accounts #[clap(long)] pub skip_initialization: bool, @@ -29,30 +29,10 @@ pub struct Config { #[clap(long, default_value = "0")] pub first_account_in_range: u64, - /// load transactions from file or generate ad-hoc - #[clap(long)] - pub load_txs: bool, - - /// path to encoded txs - #[clap(long)] - pub tx_store_path: Option, - - /// number of threads spawn during the flooding process - #[clap(long)] - pub threads: Option, - - /// allows to download nonces instead of using zeros for each account - #[clap(long)] - pub download_nonces: bool, - /// changes the awaited status of every transaction from `SubmitOnly` to `Ready` #[clap(long)] pub wait_for_ready: bool, - /// store txs after generation - #[clap(long)] - pub store_txs: bool, - /// How many transactions to put in the interval #[clap(long)] pub transactions_in_interval: Option, diff --git a/flooder/src/main.rs b/flooder/src/main.rs index a932b45888..b616610597 100644 --- a/flooder/src/main.rs +++ b/flooder/src/main.rs @@ -1,41 +1,104 @@ -use std::{ - convert::TryInto, - io::{Read, Write}, - iter::{once, repeat}, - path::Path, - sync::{Arc, Mutex}, - thread, - time::{Duration, Instant}, -}; +use std::time::Duration; -use aleph_client::{create_custom_connection, Extrinsic}; +use aleph_client::{ + account_from_keypair, pallets::balances::BalanceUserApi, raw_keypair_from_string, AccountId, + Balance, KeyPair, SignedConnection, SignedConnectionApi, TxStatus, +}; use clap::Parser; -use codec::{Compact, Decode, Encode}; use config::Config; -use hdrhistogram::Histogram as HdrHistogram; -use log::{debug, info}; -use rayon::prelude::*; -use sp_core::{sr25519, Pair}; -use sp_runtime::{generic, traits::BlakeTwo256, MultiAddress, OpaqueExtrinsic}; -use substrate_api_client::{ - compose_call, compose_extrinsic_offline, AccountId, Api, GenericAddress, - PlainTipExtrinsicParams, XtStatus, -}; -use ws_rpc_client::WsRpcClient; +use futures::future::join_all; +use log::info; +use subxt::ext::sp_core::{sr25519, Pair}; +use tokio::{time, time::sleep}; mod config; -mod ws_rpc_client; -type TransferTransaction = Extrinsic<([u8; 2], MultiAddress, codec::Compact)>; -type BlockNumber = u32; -type Header = generic::Header; -type Block = generic::Block; -type Nonce = u32; -type Connection = Api; +async fn flood( + connections: Vec, + dest: AccountId, + transfer_amount: Balance, + tx_count: u64, + rate_limiting: Option<(u64, u64)>, + status: TxStatus, +) -> anyhow::Result<()> { + let handles: Vec<_> = connections + .into_iter() + .map(|conn| { + let dest = dest.clone(); + tokio::spawn(async move { + let (time, (tx_count, round_count)) = match rate_limiting { + Some((tx_in_interval, interval_secs)) => ( + interval_secs, + (tx_in_interval, (tx_count + tx_in_interval) / tx_in_interval), + ), + _ => (0, (tx_count, 1)), + }; + + for i in 0..round_count { + info!("starting round #{}", i); + let start = time::Instant::now(); + + info!("sending #{} transactions", tx_count); + for _ in 0..tx_count { + conn.transfer(dest.clone(), transfer_amount, status) + .await + .unwrap(); + } + + let dur = time::Instant::now().saturating_duration_since(start); + + let left_duration = Duration::from_secs(time).saturating_sub(dur); + + info!("sleeping for {}ms", left_duration.as_millis()); + sleep(left_duration).await; + } + }) + }) + .collect(); + + join_all(handles).await; + + Ok(()) +} + +async fn initialize_n_accounts String>( + connection: SignedConnection, + n: u32, + node: F, + account_balance: Balance, + skip: bool, +) -> Vec { + let mut connections = vec![]; + for i in 0..n { + let seed = i.to_string(); + let signer = KeyPair::new(raw_keypair_from_string(&("//".to_string() + &seed))); + connections.push(SignedConnection::new(&node(i), signer).await); + } + + if skip { + return connections; + } + for conn in connections.iter() { + connection + .transfer( + conn.account_id().clone(), + account_balance, + TxStatus::Submitted, + ) + .await + .unwrap(); + } + + connection + .transfer(connection.account_id().clone(), 1, TxStatus::Finalized) + .await + .unwrap(); -fn main() -> Result<(), anyhow::Error> { - let time_stats = Instant::now(); + connections +} +#[tokio::main(flavor = "multi_thread")] +async fn main() -> anyhow::Result<()> { env_logger::init(); let config: Config = Config::parse(); info!("Starting benchmark with config {:#?}", &config); @@ -44,258 +107,20 @@ fn main() -> Result<(), anyhow::Error> { if !config.skip_initialization && config.phrase.is_none() && config.seed.is_none() { panic!("Needs --phrase or --seed"); } + + let tx_count = config.transactions; + let accounts = (tx_count + 1) / 100; + let tx_per_account = 100; let rate_limiting = match (config.transactions_in_interval, config.interval_secs) { (Some(tii), Some(is)) => Some((tii, is)), (None, None) => None, _ => panic!("--transactions-in-interval needs to be specified with --interval-secs"), }; let tx_status = match config.wait_for_ready { - true => XtStatus::Ready, - false => XtStatus::SubmitOnly, - }; - info!( - "initializing thread-pool: {}ms", - time_stats.elapsed().as_millis() - ); - let mut thread_pool_builder = rayon::ThreadPoolBuilder::new(); - if let Some(threads) = config.threads { - let threads = threads.try_into().expect("`threads` within usize range"); - thread_pool_builder = thread_pool_builder.num_threads(threads); - } - let thread_pool = thread_pool_builder - .build() - .expect("thread-pool should be created"); - - info!( - "thread-pool initialized: {}ms", - time_stats.elapsed().as_millis() - ); - let threads = thread_pool.current_num_threads(); - info!("thread-pool reported {} threads", threads); - // each thread should have its own connection - info!( - "creating connection-pool: {}ms", - time_stats.elapsed().as_millis() - ); - let pool = create_connection_pool(&config.nodes, threads); - info!( - "connection-pool created: {}ms", - time_stats.elapsed().as_millis() - ); - let connection = pool.get(0).unwrap().get(0).unwrap().clone(); - - info!( - "preparing transactions: {}ms", - time_stats.elapsed().as_millis() - ); - let txs = thread_pool.install(|| prepare_txs(&config, &connection)); - info!( - "transactions prepared: {}ms", - time_stats.elapsed().as_millis() - ); - - let histogram = Arc::new(Mutex::new( - HdrHistogram::::new_with_bounds(1, u64::MAX, 3).unwrap(), - )); - - let (transactions_in_interval, interval_duration) = rate_limiting.map_or( - (txs.len(), Duration::from_secs(0)), - |(transactions_in_interval, secs)| { - ( - transactions_in_interval - .try_into() - .expect("`transactions_in_interval` should be within usize range"), - Duration::from_secs(secs), - ) - }, - ); - - let pool_getter = |thread_id: ThreadId, tx_ix: usize| { - pool.get(thread_id % pool.len()) - .and_then(|threads_pool| threads_pool.get(tx_ix % threads_pool.len())) - .unwrap() - }; - - info!("flooding: {}ms", time_stats.elapsed().as_millis()); - let tick = Instant::now(); - - flood( - pool_getter, - txs, - tx_status, - &histogram, - transactions_in_interval, - interval_duration, - &thread_pool, - ); - - let tock = tick.elapsed().as_millis(); - let histogram = histogram.lock().unwrap(); - - println!( - "Summary:\n\ - TransferTransactions sent: {}\n\ - Total time: {} ms\n\ - Slowest tx: {} ms\n\ - Fastest tx: {} ms\n\ - Average: {:.1} ms\n\ - Throughput: {:.1} tx/s", - histogram.len(), - tock, - histogram.max(), - histogram.min(), - histogram.mean(), - 1000.0 * histogram.len() as f64 / tock as f64 - ); - - Ok(()) -} - -type ThreadId = usize; - -fn flood<'a>( - pool: impl Fn(ThreadId, usize) -> &'a Connection + Sync, - txs: Vec, - status: XtStatus, - histogram: &Arc>>, - transactions_in_interval: usize, - interval_duration: Duration, - thread_pool: &rayon::ThreadPool, -) { - let mut current_start_ix = 0; - thread_pool.install(|| { - txs - .chunks(transactions_in_interval) - .enumerate() - .for_each(|(interval_idx, interval)| { - let start = Instant::now(); - info!("Starting {} interval", interval_idx); - - let interval_len = interval.len(); - - interval. - into_par_iter() - .enumerate() - .map(|(tx_ix, tx)| (tx_ix + current_start_ix, tx)) - .for_each(|(tx_ix, tx)| { - const DEFAULT_THREAD_ID: usize = 0; - let thread_id = thread_pool.current_thread_index().unwrap_or(DEFAULT_THREAD_ID); - send_tx( - pool(thread_id, tx_ix), - tx, - status, - Arc::clone(histogram), - ); - }); - - let exec_time = start.elapsed(); - - if let Some(remaining_time) = interval_duration.checked_sub(exec_time) { - debug!("Sleeping for {}ms", remaining_time.as_millis()); - thread::sleep(remaining_time); - } else { - debug!( - "Execution for interval {} was slower than desired the target {}ms, was {}ms", - interval_idx, - interval_duration.as_millis(), - exec_time.as_millis() - ); - } - current_start_ix += interval_len; - }); - }); -} - -fn estimate_tx_fee(connection: &Connection, tx: &TransferTransaction) -> u128 { - let block = connection.get_block::(None).unwrap().unwrap(); - let block_hash = block.header.hash(); - let fee = connection - .get_fee_details(&tx.hex_encode(), Some(block_hash)) - .unwrap() - .unwrap(); - - let inclusion_fee = fee.inclusion_fee.unwrap(); - - fee.tip + inclusion_fee.base_fee + inclusion_fee.len_fee + inclusion_fee.adjusted_weight_fee -} - -fn load_transactions(file_path: impl AsRef) -> Vec { - let zipfile = std::fs::File::open(file_path).expect("Missing file with txs"); - let mut archive = zip::ZipArchive::new(zipfile).expect("Zipfile is not properly created"); - assert!(archive.len() == 1, "There should be one file with txs"); - - let mut file = archive.by_index(0).unwrap(); - let mut bytes = Vec::with_capacity(file.size() as usize); - file.read_to_end(&mut bytes).expect("buffer overflow"); - - Vec::::decode(&mut &bytes[..]).expect("Error while decoding txs") -} - -fn prepare_txs(config: &Config, connection: &Connection) -> Vec { - match config.load_txs { - true => { - let path = match &config.tx_store_path { - Some(path) => path, - None => panic!("tx_store_path is not set"), - }; - load_transactions(path) - } - false => generate_txs(config, connection), - } -} - -fn generate_txs(config: &Config, connection: &Connection) -> Vec { - let tx_store_path = match (config.store_txs, &config.tx_store_path) { - (true, None) => panic!("tx_store_path is not set"), - (true, path) => path, - (false, _) => &None, + true => TxStatus::InBlock, + false => TxStatus::Submitted, }; - let first_account_in_range = config.first_account_in_range; - let total_users = config.transactions; - let transfer_amount = 1u128; - let initialize_accounts_flag = !config.skip_initialization; - let accounts = (first_account_in_range..first_account_in_range + total_users) - .into_par_iter() - .map(derive_user_account) - .collect::>(); - - if initialize_accounts_flag { - initialize_accounts(config, connection, transfer_amount, &accounts); - } - - let nonces: Vec<_> = match config.download_nonces { - false => repeat(0).take(accounts.len()).collect(), - true => accounts - .par_iter() - .map(|account| get_nonce(connection, &AccountId::from(account.public()))) - .collect(), - }; - let receiver = accounts - .first() - .expect("we should have some accounts available for this test, but the list is empty") - .clone(); - let txs: Vec<_> = sign_transactions( - connection, - receiver, - accounts.into_par_iter().zip(nonces), - transfer_amount, - ) - .collect(); - - if let Some(tx_store_path) = tx_store_path { - zip_and_store_txs(&txs, tx_store_path); - } - - txs -} - -fn initialize_accounts( - config: &Config, - connection: &Connection, - transfer_amount: u128, - accounts: &[sr25519::Pair], -) { let account = match &config.phrase { Some(phrase) => { sr25519::Pair::from_phrase(&config::read_phrase(phrase.clone()), None) @@ -308,251 +133,29 @@ fn initialize_accounts( ) .unwrap(), }; - let source_account_id = AccountId::from(account.public()); - let source_account_nonce = get_nonce(connection, &source_account_id); - let total_amount = estimate_amount(connection, &account, source_account_nonce, transfer_amount); - - assert!( - get_funds(connection, &source_account_id) - .ge(&(total_amount * u128::from(config.transactions))), - "Account is too poor" - ); - - initialize_accounts_on_chain( - connection, - &account, - source_account_nonce, - accounts, - total_amount, - ); - debug!("all accounts have received funds"); -} - -fn sign_tx( - connection: &Connection, - signer: &sr25519::Pair, - nonce: Nonce, - to: &AccountId, - amount: u128, -) -> TransferTransaction { - let call = compose_call!( - connection.metadata, - "Balances", - "transfer", - GenericAddress::Id(to.clone()), - Compact(amount) - ); - - compose_extrinsic_offline!(signer, call, connection.extrinsic_params(nonce)) -} - -/// prepares payload for flooding -fn sign_transactions<'a>( - connection: &'a Connection, - account: sr25519::Pair, - users_and_nonces: impl IntoParallelIterator + 'a, - transfer_amount: u128, -) -> impl ParallelIterator + 'a { - let to = AccountId::from(account.public()); - // NOTE : assumes one tx per derived user account - // but we could create less accounts and send them round robin fashion - // (will need to seed them with more funds as well, tx_per_account times more to be exact) - users_and_nonces - .into_par_iter() - .map(move |(from, nonce)| sign_tx(connection, &from, nonce, &to, transfer_amount)) -} - -fn estimate_amount( - connection: &Connection, - account: &sr25519::Pair, - account_nonce: u32, - transfer_amount: u128, -) -> u128 { - let existential_deposit = connection.get_existential_deposit().unwrap(); - // start with a heuristic tx fee - let total_amount = existential_deposit + (transfer_amount + 375_000_000); + let main_connection = + SignedConnection::new(&config.nodes[0], KeyPair::new(account.clone())).await; - let tx = sign_tx( - connection, - account, - account_nonce, - &AccountId::from(account.public()), - total_amount, - ); - - // estimate fees - let tx_fee = estimate_tx_fee(connection, &tx); - info!("Estimated transfer tx fee {}", tx_fee); - // adjust with estimated tx fee - existential_deposit + (transfer_amount + tx_fee) -} - -fn initialize_accounts_on_chain( - connection: &Connection, - source_account: &sr25519::Pair, - mut source_account_nonce: u32, - accounts: &[sr25519::Pair], - total_amount: u128, -) { - // NOTE: use a new connection for the last transaction. - // This is a workaround for issues with accounts initialization using our hacky - // single-threaded WsRpcClient. It seems like `subscriptions` - // for all `wait-until-Ready` transactions should be cancelled, - // otherwise they are producing a lot of noise, which can be incorrectly - // interpreted by the `substrate-api-client` library. Creating a separate - // connection for the last `wait-until-Finalized` transaction should `partially` - // fix this issue. - let conn_copy = connection.clone(); - let connections = repeat(connection) - .take(accounts.len() - 1) - .chain(once(&conn_copy)); - // ensure all txs are finalized by waiting for the last one sent - let status = repeat(XtStatus::Ready) - .take(accounts.len() - 1) - .chain(once(XtStatus::Finalized)); - for ((derived, status), connection) in accounts.iter().zip(status).zip(connections) { - source_account_nonce = initialize_account( - connection, - source_account, - source_account_nonce, - derived, - total_amount, - status, - ); - } -} - -fn initialize_account( - connection: &Connection, - account: &sr25519::Pair, - account_nonce: Nonce, - derived: &sr25519::Pair, - total_amount: u128, - status: XtStatus, -) -> Nonce { - let tx = sign_tx( - connection, - account, - account_nonce, - &AccountId::from(derived.public()), - total_amount, - ); - - info!("sending funds to account {}", &derived.public()); - - let hash = connection - .send_extrinsic(tx.hex_encode(), status) - .expect("Could not send transaction"); - - info!( - "account {} will receive funds, tx hash {:?}", - &derived.public(), - hash - ); - - account_nonce + 1 -} + let nodes = config.nodes.clone(); -fn derive_user_account(seed: u64) -> sr25519::Pair { - debug!("deriving an account from seed={}", seed); - let seed = seed.to_string(); - sr25519::Pair::from_string(&("//".to_string() + &seed), None).unwrap() -} - -fn send_tx( - connection: &Connection, - tx: &Extrinsic, - status: XtStatus, - histogram: Arc>>, -) where - Call: Encode, -{ - let start_time = Instant::now(); - - connection - .send_extrinsic(tx.hex_encode(), status) - .expect("Could not send transaction"); - - let elapsed_time = start_time.elapsed().as_millis(); - - let mut hist = histogram.lock().unwrap(); - *hist += elapsed_time as u64; -} - -fn create_connection_pool(nodes: &[String], threads: usize) -> Vec> { - repeat(nodes) - .cycle() - .take(threads) - .map(|urls| { - urls.iter() - .map(|url| { - create_custom_connection(url).expect("it should return initialized connection") - }) - .collect() - }) - .collect() -} - -fn get_nonce(connection: &Connection, account: &AccountId) -> u32 { - connection - .get_account_info(account) - .map(|acc_opt| acc_opt.map_or_else(|| 0, |acc| acc.nonce)) - .expect("retrieved nonce's value") -} - -fn get_funds(connection: &Connection, account: &AccountId) -> u128 { - match connection.get_account_data(account).unwrap() { - Some(data) => data.free, - None => 0, - } -} - -fn zip_and_store_txs(txs: &[TransferTransaction], path: impl AsRef) { - let file = std::fs::File::create(path).unwrap(); - let mut zip = zip::ZipWriter::new(file); - let options = - zip::write::FileOptions::default().compression_method(zip::CompressionMethod::Deflated); - zip.start_file("tx_store", options) - .expect("Failed to initialize accounts"); - zip.write_all(&txs.encode()) - .expect("Failed to store encoded bytes"); - zip.finish().expect("Failed to zip the encoded txs"); -} - -#[cfg(test)] -mod tests { - use super::*; - - #[ignore] // requires access to a chain - #[test] - fn write_read_txs() { - env_logger::init(); - - let url = "127.0.0.1:9944".to_string(); - let mut config = Config { - nodes: vec![url.clone()], - transactions: 313, - phrase: None, - seed: None, - skip_initialization: true, - first_account_in_range: 0, - load_txs: false, - tx_store_path: Some("/tmp/tx_store".to_string()), - threads: None, - download_nonces: false, - wait_for_ready: false, - store_txs: true, - interval_secs: None, - transactions_in_interval: None, - }; - let conn = create_custom_connection(&url).unwrap(); - - let txs_gen = prepare_txs(&config, &conn); - - config.load_txs = true; + let connections = initialize_n_accounts( + main_connection, + accounts as u32, + |i| nodes[i as usize % nodes.len()].clone(), + tx_per_account + tx_per_account * 10_000, + config.skip_initialization, + ) + .await; - let txs_read = prepare_txs(&config, &conn); + flood( + connections, + account_from_keypair(&account), + 1, + tx_per_account as u64, + rate_limiting, + tx_status, + ) + .await?; - assert!(txs_gen == txs_read) - } + Ok(()) } diff --git a/flooder/src/ws_rpc_client.rs b/flooder/src/ws_rpc_client.rs deleted file mode 100644 index 21dd16c6a3..0000000000 --- a/flooder/src/ws_rpc_client.rs +++ /dev/null @@ -1,249 +0,0 @@ -use std::{ - sync::{mpsc::channel, Arc, Mutex}, - thread, - thread::JoinHandle, -}; - -use aleph_client::FromStr; -use log::info; -use serde_json::Value; -use sp_core::H256 as Hash; -use substrate_api_client::{ - rpc::{ - json_req, - ws_client::{ - on_extrinsic_msg_submit_only, on_extrinsic_msg_until_broadcast, - on_extrinsic_msg_until_finalized, on_extrinsic_msg_until_in_block, - on_extrinsic_msg_until_ready, on_get_request_msg, OnMessageFn, RpcClient, - }, - }, - ApiClientError, ApiResult, FromHexString, RpcClient as RpcClientTrait, XtStatus, -}; -use ws::{ - connect, Error as WsError, ErrorKind, Handler, Message, Result as WsResult, Sender as WsSender, -}; - -// It attempts to run a single thread with a single WebSocket connection that processes all outgoing requests. -// The upstream approach is to open a new socket for every request, but the number of sockets ends -// up being the bottleneck for flooding, so we need to do it better. -pub struct WsRpcClient { - mux: Mutex<()>, - next_handler: Arc>>, - join_handle: Option>>, - out: WsSender, - url: String, -} - -impl WsRpcClient { - pub fn new(url: &str) -> Result { - let RunningRpcClient { - ws_sender, - client_handle, - client, - } = start_rpc_client_thread(url.to_string())?; - - Ok(WsRpcClient { - next_handler: client, - join_handle: Some(client_handle), - out: ws_sender, - mux: Mutex::new(()), - url: url.to_string(), - }) - } -} - -impl Clone for WsRpcClient { - fn clone(&self) -> Self { - Self::new(&self.url).unwrap() - } -} - -impl Drop for WsRpcClient { - fn drop(&mut self) { - self.close(); - } -} - -impl RpcClientTrait for WsRpcClient { - fn get_request(&self, jsonreq: Value) -> ApiResult { - let _mux = self.mux.lock(); - - Ok(self.get(jsonreq.to_string())?) - } - - fn send_extrinsic( - &self, - xthex_prefixed: String, - exit_on: XtStatus, - ) -> ApiResult> { - let _mux = self.mux.lock(); - - let jsonreq = match exit_on { - XtStatus::SubmitOnly => json_req::author_submit_extrinsic(&xthex_prefixed).to_string(), - _ => json_req::author_submit_and_watch_extrinsic(&xthex_prefixed).to_string(), - }; - - let result = match exit_on { - XtStatus::Finalized => { - let res = self.send_extrinsic_and_wait_until_finalized(jsonreq)?; - info!("finalized: {}", res); - Ok(Some(Hash::from_hex(res)?)) - } - XtStatus::InBlock => { - let res = self.send_extrinsic_and_wait_until_in_block(jsonreq)?; - info!("inBlock: {}", res); - Ok(Some(Hash::from_hex(res)?)) - } - XtStatus::Broadcast => { - let res = self.send_extrinsic_and_wait_until_broadcast(jsonreq)?; - info!("broadcast: {}", res); - Ok(None) - } - XtStatus::Ready => { - let res = self.send_extrinsic_until_ready(jsonreq)?; - info!("ready: {}", res); - Ok(None) - } - XtStatus::SubmitOnly => { - let res = self.send_extrinsic(jsonreq)?; - info!("submitted xt: {}", res); - Ok(None) - } - _ => Err(ApiClientError::UnsupportedXtStatus(exit_on)), - }; - - self.set_next_handler(None); - result - } -} - -impl FromStr for WsRpcClient { - type Err = String; - - fn from_str(url: &str) -> Result { - WsRpcClient::new(url) - } -} - -impl WsRpcClient { - fn get(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_get_request_msg) - } - - fn send_extrinsic(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_extrinsic_msg_submit_only) - } - - fn send_extrinsic_until_ready(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_extrinsic_msg_until_ready) - } - - fn send_extrinsic_and_wait_until_broadcast(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_extrinsic_msg_until_broadcast) - } - - fn send_extrinsic_and_wait_until_in_block(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_extrinsic_msg_until_in_block) - } - - fn send_extrinsic_and_wait_until_finalized(&self, json_req: String) -> WsResult { - self.send_rpc_request(json_req, on_extrinsic_msg_until_finalized) - } - - // FIXME: - // here we are using a deprecated `mio::channel::sync_channel` instead of the - // now-recommended `mio-extras` channel, because the ws library (in the latest version) - // is not yet updated to use the `mio-extras` version (and no conversion exists). - // We need to change it to `mio-extras` as soon as `ws` is updated. - #[allow(deprecated)] - fn send_rpc_request(&self, jsonreq: String, on_message_fn: OnMessageFn) -> WsResult { - // ws_sender below is used by the RpcClient while being executed by another thread, - // but we don't want it actually to do anything, since we are sending the given request here - // 1 used by `on_open` of RpcClient + 1 for `close` - const MAGIC_SEND_CONST: usize = 2; - let (ws_tx, _ws_rx) = mio::channel::sync_channel(MAGIC_SEND_CONST); - let ws_sender = ws::Sender::new(0.into(), ws_tx, 0); - - let (result_in, result_out) = channel(); - let rpc_client = RpcClient { - out: ws_sender, - request: jsonreq.clone(), - result: result_in, - on_message_fn, - }; - self.set_next_handler(Some(rpc_client)); - self.out.send(jsonreq)?; - let res = result_out.recv().map_err(|err| { - WsError::new( - ErrorKind::Custom(Box::new(err)), - "unable to read an answer from the `result_out` channel", - ) - })?; - self.set_next_handler(None); - WsResult::Ok(res) - } - - pub fn close(&mut self) { - self.out - .shutdown() - .expect("unable to send close on the WebSocket"); - self.join_handle - .take() - .map(|handle| handle.join().expect("unable to join WebSocket's thread")); - } - - fn set_next_handler(&self, handler: Option) { - *self - .next_handler - .lock() - .expect("unable to acquire a lock on RpcClient") = handler; - } -} - -struct RunningRpcClient { - ws_sender: WsSender, - client_handle: JoinHandle>, - client: Arc>>, -} - -fn start_rpc_client_thread(url: String) -> Result { - let (tx, rx) = std::sync::mpsc::sync_channel(0); - let rpc_client = Arc::new(Mutex::new(None)); - let connect_rpc_client = Arc::clone(&rpc_client); - let join = thread::Builder::new() - .name("client".to_owned()) - .spawn(|| -> WsResult<()> { - connect(url, move |out| { - tx.send(out).expect("main thread was already stopped"); - WsHandler { - next_handler: connect_rpc_client.clone(), - } - }) - }) - .map_err(|_| "unable to spawn WebSocket's thread")?; - let out = rx.recv().map_err(|_| "WebSocket's unexpectedly died")?; - Ok(RunningRpcClient { - ws_sender: out, - client_handle: join, - client: rpc_client, - }) -} - -struct WsHandler { - next_handler: Arc>>, -} - -impl Handler for WsHandler { - fn on_message(&mut self, msg: Message) -> WsResult<()> { - if let Some(handler) = self - .next_handler - .lock() - .expect("main thread probably died") - .as_mut() - { - handler.on_message(msg) - } else { - Ok(()) - } - } -} diff --git a/fork-off/Cargo.lock b/fork-off/Cargo.lock index a526b238c9..3d642c5593 100644 --- a/fork-off/Cargo.lock +++ b/fork-off/Cargo.lock @@ -18,7 +18,16 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli", + "gimli 0.26.2", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.2", ] [[package]] @@ -33,16 +42,28 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", + "once_cell", + "version_check 0.9.4", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "getrandom 0.2.8", "once_cell", "version_check 0.9.4", ] [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -67,9 +88,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -81,19 +102,16 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" +name = "array-bytes" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "arrayref" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" @@ -109,9 +127,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-channel" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ "concurrent-queue", "event-listener", @@ -120,9 +138,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -135,7 +153,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi 0.3.9", ] @@ -162,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", - "getrandom 0.2.7", + "getrandom 0.2.8", "instant", "pin-project-lite", "rand 0.8.5", @@ -171,16 +189,16 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.30.3", "rustc-demangle", ] @@ -217,9 +235,30 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "bincode" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] [[package]] name = "bitflags" @@ -241,21 +280,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.5", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", + "digest 0.10.6", ] [[package]] @@ -299,15 +328,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -333,21 +362,24 @@ dependencies = [ [[package]] name = "bytes" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] -name = "cache-padded" -version = "1.2.0" +name = "cc" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "cc" -version = "1.0.73" +name = "cfg-expr" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec 1.10.0", +] [[package]] name = "cfg-if" @@ -363,9 +395,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "num-integer", @@ -375,9 +407,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.22" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -422,25 +454,29 @@ dependencies = [ ] [[package]] -name = "concurrent-queue" -version = "1.2.4" +name = "codespan-reporting" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ - "cache-padded", + "termcolor", + "unicode-width", ] [[package]] -name = "const-oid" -version = "0.7.1" +name = "concurrent-queue" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +dependencies = [ + "crossbeam-utils 0.8.14", +] [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "const-oid" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "convert_case" @@ -464,6 +500,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "cpufeatures" version = "0.2.5" @@ -473,6 +518,24 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-entity" +version = "0.88.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +dependencies = [ + "serde", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -484,6 +547,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -492,9 +564,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -558,13 +630,69 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cxx" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -600,9 +728,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -638,15 +766,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -656,9 +784,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -671,27 +799,40 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", "ed25519", - "rand 0.7.3", - "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -703,9 +844,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ "cfg-if 1.0.0", ] @@ -725,9 +866,30 @@ dependencies = [ [[package]] name = "environmental" -version = "1.1.3" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] [[package]] name = "event-listener" @@ -741,20 +903,26 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -762,9 +930,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -795,7 +963,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-off" -version = "1.3.0" +version = "1.4.0" dependencies = [ "anyhow", "async-channel", @@ -804,7 +972,7 @@ dependencies = [ "env_logger", "frame-support", "frame-system", - "futures 0.3.24", + "futures 0.3.26", "hex", "jsonrpc-core", "jsonrpc-core-client", @@ -832,9 +1000,10 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log 0.4.17", @@ -844,11 +1013,13 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", "sp-std", "sp-storage", + "static_assertions", ] [[package]] @@ -866,7 +1037,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "bitflags", "frame-metadata", @@ -879,7 +1050,7 @@ dependencies = [ "paste", "scale-info", "serde", - "smallvec 1.9.0", + "smallvec 1.10.0", "sp-api", "sp-arithmetic", "sp-core", @@ -891,16 +1062,20 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-tracing", + "sp-weights", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -909,10 +1084,10 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 1.2.1", + "proc-macro-crate 1.3.0", "proc-macro2", "quote", "syn", @@ -921,7 +1096,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", @@ -931,7 +1106,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-support", "log 0.4.17", @@ -943,6 +1118,7 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version", + "sp-weights", ] [[package]] @@ -981,9 +1157,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -996,9 +1172,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1006,15 +1182,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1024,15 +1200,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1041,21 +1217,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures 0.1.31", "futures-channel", @@ -1096,17 +1272,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1118,12 +1292,22 @@ name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", @@ -1132,11 +1316,11 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "fnv", "futures-core", "futures-sink", @@ -1170,14 +1354,20 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1188,6 +1378,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -1214,6 +1413,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1227,13 +1435,13 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "fnv", - "itoa 1.0.3", + "itoa", ] [[package]] @@ -1242,7 +1450,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "http", "pin-project-lite", ] @@ -1286,11 +1494,11 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "futures-channel", "futures-core", "futures-util", @@ -1299,7 +1507,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.3", + "itoa", "pin-project-lite", "socket2", "tokio", @@ -1314,8 +1522,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.2.1", - "hyper 0.14.20", + "bytes 1.4.0", + "hyper 0.14.24", "native-tls", "tokio", "tokio-native-tls", @@ -1323,17 +1531,28 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.50" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi 0.3.9", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.1.5" @@ -1366,9 +1585,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -1386,12 +1605,13 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg 1.1.0", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] @@ -1412,6 +1632,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + [[package]] name = "iovec" version = "0.1.4" @@ -1423,27 +1649,30 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] -name = "itoa" -version = "0.4.8" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1455,7 +1684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" dependencies = [ "derive_more", - "futures 0.3.24", + "futures 0.3.26", "jsonrpc-core", "jsonrpc-pubsub", "log 0.4.17", @@ -1472,7 +1701,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" dependencies = [ - "futures 0.3.24", + "futures 0.3.26", "futures-executor", "futures-util", "log 0.4.17", @@ -1487,7 +1716,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0" dependencies = [ - "futures 0.3.24", + "futures 0.3.26", "jsonrpc-client-transports", ] @@ -1509,7 +1738,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011" dependencies = [ - "futures 0.3.24", + "futures 0.3.26", "jsonrpc-core", "lazy_static", "log 0.4.17", @@ -1520,21 +1749,24 @@ dependencies = [ [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if 1.0.0", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] name = "keccak" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] [[package]] name = "kernel32-sys" @@ -1560,15 +1792,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.134" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libsecp256k1" @@ -1577,7 +1809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64 0.13.0", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -1618,6 +1850,15 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "linregress" version = "0.4.4" @@ -1629,8 +1870,14 @@ dependencies = [ ] [[package]] -name = "lock_api" -version = "0.3.4" +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "lock_api" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ @@ -1665,6 +1912,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "matchers" version = "0.0.1" @@ -1676,9 +1932,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matrixmultiply" @@ -1701,22 +1957,30 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg 1.1.0", +] + [[package]] name = "memory-db" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ "hash-db", - "hashbrown", - "parity-util-mem", + "hashbrown 0.12.3", ] [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -1747,9 +2011,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -1775,14 +2039,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log 0.4.17", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1807,7 +2071,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -1828,9 +2092,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", @@ -1846,9 +2110,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.37" +version = "0.2.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1856,16 +2120,25 @@ dependencies = [ ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg 1.1.0", "num-integer", @@ -1874,21 +2147,21 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -1901,18 +2174,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg 1.1.0", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -1920,6 +2181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg 1.1.0", + "num-bigint", "num-integer", "num-traits", ] @@ -1936,11 +2198,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -1949,15 +2211,27 @@ name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown 0.12.3", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.15.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -1973,9 +2247,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2005,9 +2279,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.76" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5230151e44c0f05157effb743e8d517472843121cf9243e8b81393edb5acd9ce" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg 1.1.0", "cc", @@ -2018,14 +2292,14 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "frame-benchmarking", "frame-support", @@ -2039,14 +2313,14 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", - "bytes 1.2.1", + "bytes 1.4.0", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2054,47 +2328,21 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate 1.3.0", "proc-macro2", "quote", "syn", ] -[[package]] -name = "parity-util-mem" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot 0.12.1", - "primitive-types", - "winapi 0.3.9", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking_lot" @@ -2103,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api 0.3.4", - "parking_lot_core 0.6.2", + "parking_lot_core 0.6.3", "rustc_version 0.2.3", ] @@ -2115,7 +2363,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api 0.4.9", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -2125,14 +2373,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api 0.4.9", - "parking_lot_core 0.9.3", + "parking_lot_core 0.9.7", ] [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" dependencies = [ "cfg-if 0.1.10", "cloudabi", @@ -2145,53 +2393,53 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if 1.0.0", "instant", "libc", "redox_syscall 0.2.16", - "smallvec 1.9.0", + "smallvec 1.10.0", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.16", - "smallvec 1.9.0", - "windows-sys", + "smallvec 1.10.0", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" -version = "0.4.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" dependencies = [ - "crypto-mac 0.8.0", + "crypto-mac 0.11.1", ] [[package]] name = "pbkdf2" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "crypto-mac 0.11.1", + "digest 0.10.6", ] [[package]] @@ -2218,23 +2466,33 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -2254,13 +2512,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2289,18 +2546,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.46" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2325,7 +2591,7 @@ dependencies = [ "rand_isaac", "rand_jitter", "rand_os", - "rand_pcg 0.1.2", + "rand_pcg", "rand_xorshift", "winapi 0.3.9", ] @@ -2341,7 +2607,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", - "rand_pcg 0.2.1", ] [[package]] @@ -2415,7 +2680,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", ] [[package]] @@ -2490,15 +2755,6 @@ dependencies = [ "rand_core 0.4.2", ] -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rand_xorshift" version = "0.1.1" @@ -2540,18 +2796,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13bcd201494ab44900a96490291651d200730904221832b9547d24a87d332b" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -2560,9 +2816,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -2580,9 +2836,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -2595,19 +2851,19 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.12" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64 0.13.0", - "bytes 1.2.1", + "base64 0.21.0", + "bytes 1.4.0", "encoding_rs", "futures-core", "futures-util", "h2", "http", "http-body", - "hyper 0.14.20", + "hyper 0.14.24", "hyper-tls", "ipnet", "js-sys", @@ -2632,12 +2888,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] @@ -2674,14 +2930,28 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", +] + +[[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "safemem" @@ -2691,9 +2961,9 @@ checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -2705,11 +2975,11 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate 1.3.0", "proc-macro2", "quote", "syn", @@ -2717,12 +2987,22 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if 1.0.0", + "hashbrown 0.13.2", ] [[package]] @@ -2749,32 +3029,40 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] @@ -2790,9 +3078,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -2803,9 +3091,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -2822,9 +3110,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "semver-parser" @@ -2834,18 +3122,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2854,11 +3142,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ - "itoa 1.0.3", + "itoa", "ryu", "serde", ] @@ -2870,7 +3158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.3", + "itoa", "ryu", "serde", ] @@ -2923,16 +3211,16 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] name = "sha3" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -2947,20 +3235,20 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] @@ -2978,9 +3266,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg 1.1.0", ] @@ -2996,9 +3284,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" @@ -3013,7 +3301,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log 0.4.17", @@ -3023,6 +3311,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-version", "thiserror", ] @@ -3030,10 +3319,10 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", - "proc-macro-crate 1.2.1", + "proc-macro-crate 1.3.0", "proc-macro2", "quote", "syn", @@ -3041,8 +3330,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", @@ -3054,45 +3343,41 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive", "sp-std", "static_assertions", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", - "byteorder", + "blake2", "dyn-clonable", - "ed25519-dalek", - "futures 0.3.24", + "ed25519-zebra", + "futures 0.3.26", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log 0.4.17", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", @@ -3109,18 +3394,17 @@ dependencies = [ "substrate-bip39", "thiserror", "tiny-bip39", - "wasmi", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", "sp-std", @@ -3130,7 +3414,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", @@ -3140,8 +3424,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "proc-macro2", "quote", @@ -3150,8 +3434,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "environmental", "parity-scale-codec", @@ -3162,7 +3446,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -3175,16 +3459,16 @@ dependencies = [ [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", - "futures 0.3.24", - "hash-db", + "bytes 1.4.0", + "ed25519", + "ed25519-dalek", + "futures 0.3.26", "libsecp256k1", "log 0.4.17", "parity-scale-codec", - "parking_lot 0.12.1", "secp256k1", "sp-core", "sp-externalities", @@ -3194,18 +3478,17 @@ dependencies = [ "sp-std", "sp-tracing", "sp-trie", - "sp-wasm-interface", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "async-trait", - "futures 0.3.24", + "futures 0.3.26", "merlin", "parity-scale-codec", "parking_lot 0.12.1", @@ -3217,8 +3500,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "backtrace", "lazy_static", @@ -3227,17 +3510,16 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log 0.4.17", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", "sp-application-crypto", @@ -3245,14 +3527,15 @@ dependencies = [ "sp-core", "sp-io", "sp-std", + "sp-weights", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", @@ -3267,11 +3550,11 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "Inflector", - "proc-macro-crate 1.2.1", + "proc-macro-crate 1.3.0", "proc-macro2", "quote", "syn", @@ -3280,26 +3563,26 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "scale-info", + "sp-core", "sp-runtime", "sp-std", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "0.13.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "hash-db", "log 0.4.17", - "num-traits", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", - "smallvec 1.9.0", + "rand 0.8.5", + "smallvec 1.10.0", "sp-core", "sp-externalities", "sp-panic-handler", @@ -3307,18 +3590,17 @@ dependencies = [ "sp-trie", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "5.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3330,8 +3612,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "6.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "sp-std", @@ -3342,16 +3624,23 @@ dependencies = [ [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ + "ahash 0.8.3", "hash-db", + "hashbrown 0.12.3", + "lazy_static", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot 0.12.1", "scale-info", + "schnellru", "sp-core", "sp-std", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -3359,7 +3648,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3376,7 +3665,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3386,21 +3675,47 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.28#5e8b6fa2130236497878e53c169e41f1f7871e6b" +version = "7.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" dependencies = [ "impl-trait-for-tuples", "log 0.4.17", "parity-scale-codec", "sp-std", "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=aleph-v0.9.38#85ce0f97d013118e17921af98cbc34ed00ec80e3" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec 1.10.0", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "ss58-registry" -version = "1.29.1" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4f0cb475a8e58d9ed8a963010108768d79e397f7aff79f9a3972ef490f97de" +checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" dependencies = [ "Inflector", "num-format", @@ -3411,6 +3726,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3457,9 +3778,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.101" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -3484,6 +3805,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" + [[package]] name = "tempfile" version = "3.3.0" @@ -3500,33 +3827,33 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -3535,18 +3862,19 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if 1.0.0", "once_cell", ] [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -3555,17 +3883,17 @@ dependencies = [ [[package]] name = "tiny-bip39" -version = "0.8.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" dependencies = [ "anyhow", - "hmac 0.8.1", + "hmac 0.12.1", "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", + "pbkdf2 0.11.0", + "rand 0.8.5", "rustc-hash", - "sha2 0.9.9", + "sha2 0.10.6", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -3583,28 +3911,28 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.21.2" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg 1.1.0", - "bytes 1.2.1", + "bytes 1.4.0", "libc", "memchr", - "mio 0.8.4", + "mio 0.8.6", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] @@ -3624,7 +3952,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.31", ] @@ -3641,9 +3969,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3652,9 +3980,9 @@ dependencies = [ [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -3666,7 +3994,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.31", "lazy_static", "log 0.4.17", @@ -3716,11 +4044,11 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ - "bytes 1.2.1", + "bytes 1.4.0", "futures-core", "futures-sink", "pin-project-lite", @@ -3730,13 +4058,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -3745,9 +4090,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", @@ -3757,9 +4102,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -3768,9 +4113,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", "valuable", @@ -3811,7 +4156,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec 1.9.0", + "smallvec 1.10.0", "thread_local", "tracing", "tracing-core", @@ -3827,15 +4172,15 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log 0.4.17", "rustc-hex", - "smallvec 1.9.0", + "smallvec 1.10.0", ] [[package]] @@ -3849,15 +4194,15 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -3866,7 +4211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 1.0.0", - "digest 0.10.5", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] @@ -3879,15 +4224,15 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -3906,15 +4251,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -3925,6 +4270,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -4007,9 +4358,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -4017,9 +4368,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log 0.4.17", @@ -4032,9 +4383,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -4044,9 +4395,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4054,9 +4405,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -4067,39 +4418,179 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log 0.4.17", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log 0.4.17", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if 1.0.0", + "cpp_demangle", + "gimli 0.26.2", + "log 0.4.17", + "object 0.29.0", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log 0.4.17", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -4195,43 +4686,124 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "winreg" version = "0.10.1" @@ -4253,9 +4825,9 @@ dependencies = [ [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] @@ -4271,9 +4843,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/fork-off/Cargo.toml b/fork-off/Cargo.toml index 88972e5d94..8f46436f7c 100644 --- a/fork-off/Cargo.toml +++ b/fork-off/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-off" -version = "1.3.0" +version = "1.4.0" edition = "2021" license = "Apache 2.0" @@ -19,10 +19,10 @@ serde = "1" serde_json = "1" tokio = { version = "1.0", features = ["full"] } -sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-balances = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-support = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-system = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-balances = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } jsonrpc-core = "18.0" jsonrpc-core-client = { version = "18.0", features = ["ws"] } jsonrpc-derive = "18.0" diff --git a/fork-off/src/account_setting.rs b/fork-off/src/account_setting.rs index 04a39dd60c..4819157717 100644 --- a/fork-off/src/account_setting.rs +++ b/fork-off/src/account_setting.rs @@ -135,7 +135,7 @@ pub fn apply_account_setting(mut state: Storage, setting: AccountSetting) -> Sto let account_hash = account.clone().into(); let key = &account_map.join(&account_hash); - state.insert(key.clone(), info.clone().into()); + state.top.insert(key.clone(), info.clone().into()); info!(target: "fork-off", "Account info of `{:?}` set to `{:?}`", account, info); } state diff --git a/fork-off/src/chainspec_combining.rs b/fork-off/src/chainspec_combining.rs index c1f1d3069e..2734edd261 100644 --- a/fork-off/src/chainspec_combining.rs +++ b/fork-off/src/chainspec_combining.rs @@ -27,6 +27,7 @@ impl Index<&StoragePath> for PathCounter { } } +/// Combines states - ommiting child state as we assume that it is empty in initial chainspec pub fn combine_states( mut state: Storage, initial_state: Storage, @@ -40,7 +41,7 @@ pub fn combine_states( let mut removed_per_path_count = PathCounter::default(); let mut added_per_path_cnt = PathCounter::default(); - state.retain(|k, _v| { + state.top.retain(|k, _v| { match storage_prefixes .iter() .find(|(_, prefix)| prefix.is_prefix_of(k)) @@ -53,13 +54,13 @@ pub fn combine_states( } }); - for (k, v) in initial_state.iter() { + for (k, v) in initial_state.top.iter() { if let Some((path, _)) = storage_prefixes .iter() .find(|(_, prefix)| prefix.is_prefix_of(k)) { added_per_path_cnt.bump(path); - state.insert(k.clone(), v.clone()); + state.top.insert(k.clone(), v.clone()); } } diff --git a/fork-off/src/fetching.rs b/fork-off/src/fetching.rs index 26deca58c8..99a4c7be9c 100644 --- a/fork-off/src/fetching.rs +++ b/fork-off/src/fetching.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, iter::repeat_with, sync::Arc}; +use std::{iter::repeat_with, sync::Arc}; use async_channel::Receiver; use futures::{future::join_all, join}; @@ -37,10 +37,23 @@ impl StateFetcher { .await .unwrap(); + let child_storage_map_res = self + .client + .get_child_storage_for_key(key.clone(), &block) + .await + .unwrap(); + let mut output_guard = output.lock(); - output_guard.insert(key, value); - if output_guard.len() % LOG_PROGRESS_FREQUENCY == 0 { - info!("Fetched {} values", output_guard.len()); + output_guard.top.insert(key.clone(), value); + if let Some(child_storage_map) = child_storage_map_res { + info!("Fetched child trie with {} keys", child_storage_map.len()); + output_guard + .child_storage + .insert(key.without_child_storage_prefix(), child_storage_map); + } + + if output_guard.top.len() % LOG_PROGRESS_FREQUENCY == 0 { + info!("Fetched {} values", output_guard.top.len()); } } } @@ -49,7 +62,7 @@ impl StateFetcher { info!("Fetching state at block {:?}", block_hash); let (input, key_fetcher) = self.client.stream_all_keys(&block_hash); - let output = Arc::new(Mutex::new(HashMap::new())); + let output = Arc::new(Mutex::new(Storage::default())); let workers = repeat_with(|| { self.value_fetching_worker(block_hash.clone(), input.clone(), output.clone()) diff --git a/fork-off/src/fsio.rs b/fork-off/src/fsio.rs index 6758f7ac99..8d8a54eab5 100644 --- a/fork-off/src/fsio.rs +++ b/fork-off/src/fsio.rs @@ -40,7 +40,7 @@ pub fn save_snapshot_to_file(snapshot: Storage, path: String) { let data = serde_json::to_vec_pretty(&snapshot).unwrap(); info!( "Writing snapshot of {} key-val pairs and {} total bytes", - snapshot.len(), + snapshot.top.len(), data.len() ); write_to_file(path, &data); @@ -48,8 +48,8 @@ pub fn save_snapshot_to_file(snapshot: Storage, path: String) { pub fn read_snapshot_from_file(path: String) -> Storage { let snapshot: Storage = - serde_json::from_str(&fs::read_to_string(&path).expect("Could not read snapshot file")) + serde_json::from_str(&fs::read_to_string(path).expect("Could not read snapshot file")) .expect("could not parse from snapshot"); - info!("Read snapshot of {} key-val pairs", snapshot.len()); + info!("Read snapshot of {} key-val pairs", snapshot.top.len()); snapshot } diff --git a/fork-off/src/jsonrpc_client.rs b/fork-off/src/jsonrpc_client.rs index be89f650d9..97e343bd59 100644 --- a/fork-off/src/jsonrpc_client.rs +++ b/fork-off/src/jsonrpc_client.rs @@ -6,7 +6,7 @@ use jsonrpc_core::Error; use jsonrpc_core_client::{transports::ws, RpcError}; use jsonrpc_derive::rpc; -use crate::types::{BlockHash, StorageKey, StorageValue}; +use crate::types::{BlockHash, ChildStorageMap, StorageKey, StorageValue}; #[rpc] pub trait Rpc { @@ -28,6 +28,24 @@ pub trait Rpc { start_key: Option, at: Option, ) -> Result, Error>; + + #[rpc(name = "childstate_getKeysPaged")] + fn get_child_keys_paged( + &self, + child_storage: StorageKey, + prefix: StorageKey, + count: usize, + start_key: Option, + at: Option, + ) -> Result, Error>; + + #[rpc(name = "childstate_getStorageEntries")] + fn get_child_storage_entries( + &self, + child_storage: StorageKey, + keys: Vec, + at: Option, + ) -> Result, Error>; } type RpcResult = Result; @@ -71,6 +89,68 @@ impl Client { (receiver, self.do_stream_all_keys(sender, at.clone())) } + /// Returns a map representing a single child trie + pub async fn get_child_storage_for_key( + &self, + child_key: StorageKey, + at: &BlockHash, + ) -> RpcResult> { + let res = self + .get_child_storage_for_key_inner(child_key, at) + .await + .map(Some); + + if let Err(RpcError::JsonRpcError(err)) = res { + // Empty child storage is returned as error + if err.message == "Client error: Invalid child storage key" { + Ok(None) + } else { + Err(RpcError::JsonRpcError(err)) + } + } else { + res + } + } + + async fn get_child_storage_for_key_inner( + &self, + child_key: StorageKey, + at: &BlockHash, + ) -> RpcResult { + let empty_prefix = StorageKey::new("0x"); + let mut child_storage_map = ChildStorageMap::new(); + let mut start_key = None; + + loop { + let keys = self + .client + .get_child_keys_paged( + child_key.clone(), + empty_prefix.clone(), + CHUNK_SIZE, + start_key, + Some(at.clone()), + ) + .await?; + + let values = self + .client + .get_child_storage_entries(child_key.clone(), keys.clone(), Some(at.clone())) + .await?; + + child_storage_map.append(&mut keys.iter().cloned().zip(values).collect()); + + let fetched = keys.len(); + start_key = keys.last().cloned(); + + if fetched < CHUNK_SIZE { + break; + } + } + + Ok(child_storage_map) + } + async fn do_stream_all_keys(&self, sender: Sender, at: BlockHash) -> RpcResult<()> { let empty_prefix = StorageKey::new("0x"); let mut start_key = None; diff --git a/fork-off/src/main.rs b/fork-off/src/main.rs index 5468dc6ff9..804feb29ec 100644 --- a/fork-off/src/main.rs +++ b/fork-off/src/main.rs @@ -56,9 +56,8 @@ async fn main() -> anyhow::Result<()> { } let state = read_snapshot_from_file(snapshot_path); - let initial_state: Storage = - serde_json::from_value(initial_spec["genesis"]["raw"]["top"].take()) - .expect("Deserialization of state from given chainspec file failed"); + // Initialize with state from chainspec + empty child storage + let initial_state = Storage::new(&initial_spec); let state = combine_states(state, initial_state, storage_keep_state); @@ -77,8 +76,12 @@ async fn main() -> anyhow::Result<()> { }; let state = apply_account_setting(state, account_setting); - let json_state = serde_json::to_value(state).expect("Failed to convert a storage map to json"); + let json_state = + serde_json::to_value(state.top).expect("Failed to convert a storage map to json"); + let json_child_state = + serde_json::to_value(state.child_storage).expect("Failed to convert a storage map to json"); initial_spec["genesis"]["raw"]["top"] = json_state; + initial_spec["genesis"]["raw"]["childrenDefault"] = json_child_state; let new_spec = serde_json::to_vec_pretty(&initial_spec)?; info!(target: "fork-off", "Writing new chainspec to {}", &combined_spec_path); diff --git a/fork-off/src/types.rs b/fork-off/src/types.rs index 8e32066457..1e866cf985 100644 --- a/fork-off/src/types.rs +++ b/fork-off/src/types.rs @@ -5,11 +5,16 @@ //! to a function, as `clippy` screams outrageously about changing it to `&str` and then the alias //! is useless. -use std::{collections::HashMap, fmt::Debug, str::FromStr}; +use std::{ + collections::{BTreeMap, HashMap}, + fmt::Debug, + str::FromStr, +}; use codec::Encode; use frame_support::{sp_runtime::AccountId32, Blake2_128Concat, StorageHasher, Twox128}; -use hex::ToHex; +use hex::{encode, ToHex}; +use jsonrpc_core::Value; use serde::{Deserialize, Serialize}; pub trait Get { @@ -17,7 +22,7 @@ pub trait Get { } /// Remove leading `"0x"`. -fn strip_hex(t: &T) -> String { +pub fn strip_hex(t: &T) -> String { let s = t.to_string(); s.strip_prefix("0x").map(ToString::to_string).unwrap_or(s) } @@ -69,7 +74,7 @@ impl Get for StoragePath { } /// Hex-encoded key in raw chainspec. -#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub struct StorageKey(String); impl From<&StorageKey> for Vec { @@ -78,6 +83,8 @@ impl From<&StorageKey> for Vec { } } +pub const CHILD_STORAGE_PREFIX: &[u8] = b":child_storage:default:"; + impl StorageKey { pub fn new(content: &T) -> Self { Self(as_hex(content)) @@ -96,6 +103,16 @@ impl StorageKey { let longer = as_hex(&other.0); longer.starts_with(&shorter) } + + pub fn without_child_storage_prefix(self) -> Self { + StorageKey::new( + &(as_hex( + &self + .get() + .split_off(as_hex(&encode(CHILD_STORAGE_PREFIX)).len()), + )), + ) + } } /// Convert `AccountId` to `StorageKey` using `Blake2_128Concat` hashing algorithm. @@ -169,6 +186,27 @@ impl FromStr for BlockHash { } /// Content of `chainspec["genesis"]["raw"]["top"]`. -pub type Storage = HashMap; +pub type TopStorage = HashMap; + +/// Content of `chainspec["genesis"]["raw"]["childrenDefault"]`. +pub type ChildStorage = HashMap; + +pub type ChildStorageMap = BTreeMap; + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct Storage { + pub top: TopStorage, + pub child_storage: ChildStorage, +} pub type Balance = u128; + +impl Storage { + pub fn new(initial_spec: &Value) -> Self { + Storage { + top: serde_json::from_value(initial_spec["genesis"]["raw"]["top"].clone()) + .expect("Deserialization of state from initial chainspec has failed"), + child_storage: ChildStorage::new(), + } + } +} diff --git a/local-tests/run_nodes.py b/local-tests/run_nodes.py index 25592e8f15..1cc9cb0103 100755 --- a/local-tests/run_nodes.py +++ b/local-tests/run_nodes.py @@ -35,8 +35,7 @@ unit_creation_delay=500, execution='Native', rpc_cors='all', - rpc_methods='Unsafe', - state_pruning='archive') + rpc_methods='Unsafe') addresses = [n.address() for n in chain] chain.set_flags(bootnodes=addresses[0], public_addr=addresses) diff --git a/local-tests/test_catch_up.py b/local-tests/test_catch_up.py index 1ef727fda9..e971902ed6 100755 --- a/local-tests/test_catch_up.py +++ b/local-tests/test_catch_up.py @@ -3,17 +3,24 @@ import sys from os.path import abspath, join from time import sleep, ctime +import argparse from chainrunner import Chain, Seq, generate_keys, check_finalized + def printt(s): print(ctime() + ' | ' + s) + +argParser = argparse.ArgumentParser() +argParser.add_argument("--state-pruning", help="state pruning argument") +state_pruning = argParser.parse_args().state_pruning + # Path to working directory, where chainspec, logs and nodes' dbs are written: workdir = abspath(os.getenv('WORKDIR', '/tmp/workdir')) # Path to the aleph-node binary (important use short-session feature): binary = abspath(os.getenv('ALEPH_NODE_BINARY', join(workdir, 'aleph-node'))) -phrases = [f'//{i}' for i in range(6)] +phrases = [f'//{i}' for i in range(5)] keys = generate_keys(binary, phrases) all_accounts = list(keys.values()) chain = Chain(workdir) @@ -30,12 +37,15 @@ def printt(s): print(ctime() + ' | ' + s) ws_port=Seq(9944), rpc_port=Seq(9933), unit_creation_delay=200, - execution='Native', - state_pruning='archive') + execution='Native') addresses = [n.address() for n in chain] validator_addresses = [n.validator_address() for n in chain] chain.set_flags(bootnodes=addresses[0]) -chain.set_flags_validator(public_addr=addresses, public_validator_addresses=validator_addresses) +chain.set_flags_validator(public_addr=addresses, + public_validator_addresses=validator_addresses) +if state_pruning is not None: + chain.set_flags('experimental-pruning', state_pruning=state_pruning, + ) chain.set_flags_validator('validator') @@ -44,12 +54,16 @@ def printt(s): print(ctime() + ' | ' + s) sleep(60) -chain.start('aleph', nodes=[4, 5]) +chain.start('aleph', nodes=[4]) printt('Waiting for finalization') chain.wait_for_finalization(0) printt('Waiting for authorities') -chain.wait_for_authorities() +chain.wait_for_authorities(timeout=60) +if state_pruning is not None and state_pruning.isnumeric(): + bound = min(256, int(state_pruning)) + printt(f'Pruning turned on. Waiting for {bound} blocks to finalize') + chain.wait_for_finalization(bound) printt('Killing one validator and one nonvalidator') chain.stop(nodes=[3, 4]) diff --git a/local-tests/test_multiple_restarts.py b/local-tests/test_multiple_restarts.py index 4b062cc8c3..e47091d743 100755 --- a/local-tests/test_multiple_restarts.py +++ b/local-tests/test_multiple_restarts.py @@ -3,11 +3,18 @@ import sys from os.path import abspath, join from time import sleep, ctime +import argparse from chainrunner import Chain, Seq, generate_keys, check_finalized + def printt(s): print(ctime() + ' | ' + s) + +argParser = argparse.ArgumentParser() +argParser.add_argument("--state-pruning", help="state pruning argument") +state_pruning = argParser.parse_args().state_pruning + # Path to working directory, where chainspec, logs and nodes' dbs are written: workdir = abspath(os.getenv('WORKDIR', '/tmp/workdir')) # Path to the aleph-node binary (important DON'T use short-session feature): @@ -28,12 +35,15 @@ def printt(s): print(ctime() + ' | ' + s) ws_port=Seq(9944), rpc_port=Seq(9933), unit_creation_delay=200, - execution='Native', - state_pruning='archive') + execution='Native') addresses = [n.address() for n in chain] validator_addresses = [n.validator_address() for n in chain] chain.set_flags(bootnodes=addresses[0]) -chain.set_flags_validator(public_addr=addresses, public_validator_addresses=validator_addresses) +chain.set_flags_validator(public_addr=addresses, + public_validator_addresses=validator_addresses) +if state_pruning is not None: + chain.set_flags('experimental-pruning', state_pruning=state_pruning, + ) chain.set_flags_validator('validator') @@ -43,7 +53,11 @@ def printt(s): print(ctime() + ' | ' + s) printt('Waiting for finalization') chain.wait_for_finalization(0) printt('Waiting for authorities') -chain.wait_for_authorities() +chain.wait_for_authorities(timeout=120) +if state_pruning is not None and state_pruning.isnumeric(): + bound = min(256, int(state_pruning)) + printt(f'Pruning turned on. Waiting for {bound} blocks to finalize') + chain.wait_for_finalization(bound) delta = 5 @@ -63,7 +77,7 @@ def printt(s): print(ctime() + ' | ' + s) sys.exit(1) printt('Restarting nodes') - chain[3].start('aleph') + chain.start('aleph', nodes=[3]) printt('Waiting for finalization') chain.wait_for_finalization(finalized_before_start[3], nodes=[3]) @@ -73,5 +87,5 @@ def printt(s): print(ctime() + ' | ' + s) # Check if the murdered node started catching up with reasonable nr of blocks. if diff <= delta: - printt(f'Too small catch up for validators: {validator_diff}') + printt(f'Too small catch up for validators: {diff}') sys.exit(1) diff --git a/nix/versions.nix b/nix/versions.nix index ace8103cf5..248c8ce25c 100644 --- a/nix/versions.nix +++ b/nix/versions.nix @@ -3,7 +3,7 @@ rec { rustToolchain = let # use Rust toolchain declared by the rust-toolchain file - rustToolchain = with nixpkgs; overrideRustTarget ( rustChannelOf { rustToolchain = rustToolchainFile; } ); + rustToolchain = with nixpkgs; overrideRustTarget ( rustChannelOf { date = "2022-08-12"; channel = "nightly"; } ); overrideRustTarget = rustChannel: rustChannel // { rust = rustChannel.rust.override { @@ -31,10 +31,6 @@ rec { sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy"; }) { overlays = [ rustOverlay - # we override rust toolchain - (self: super: { - rust = rustToolchain.rust; - }) ]; }; in diff --git a/pallets/aleph/Cargo.toml b/pallets/aleph/Cargo.toml index 3f7d347c53..cc7c882f17 100644 --- a/pallets/aleph/Cargo.toml +++ b/pallets/aleph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aleph" -version = "0.5.0" +version = "0.5.5" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" @@ -10,20 +10,20 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa serde = "1.0" scale-info = { version = "2.0", default-features = false, features = ["derive"] } -frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } pallets-support = { path = "../support", default-features = false } primitives = { path = "../../primitives", default-features = false } [dev-dependencies] -pallet-timestamp = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +pallet-timestamp = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [features] default = ["std"] diff --git a/pallets/aleph/src/lib.rs b/pallets/aleph/src/lib.rs index eed1fc3e6e..49132f0e4d 100644 --- a/pallets/aleph/src/lib.rs +++ b/pallets/aleph/src/lib.rs @@ -31,14 +31,14 @@ use frame_support::{ traits::{OneSessionHandler, StorageVersion}, }; pub use pallet::*; -use primitives::{SessionIndex, Version, VersionChange}; +use primitives::{ + SessionIndex, Version, VersionChange, DEFAULT_FINALITY_VERSION, LEGACY_FINALITY_VERSION, +}; use sp_std::prelude::*; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); -const DEFAULT_FINALITY_VERSION: Version = 0; - #[frame_support::pallet] pub mod pallet { use frame_support::{pallet_prelude::*, sp_runtime::RuntimeAppPublic}; @@ -48,20 +48,22 @@ pub mod pallet { }; use pallet_session::SessionManager; use pallets_support::StorageMigration; + use sp_std::marker::PhantomData; use super::*; - use crate::traits::SessionInfoProvider; + use crate::traits::{NextSessionAuthorityProvider, SessionInfoProvider}; #[pallet::config] pub trait Config: frame_system::Config { type AuthorityId: Member + Parameter + RuntimeAppPublic + MaybeSerializeDeserialize; - type Event: From> + IsType<::Event>; - type SessionInfoProvider: SessionInfoProvider; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + type SessionInfoProvider: SessionInfoProvider; type SessionManager: SessionManager<::AccountId>; + type NextSessionAuthorityProvider: NextSessionAuthorityProvider; } #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::generate_deposit(pub (super) fn deposit_event)] pub enum Event { ChangeEmergencyFinalizer(T::AuthorityId), ScheduleFinalityVersionChange(VersionChange), @@ -79,7 +81,7 @@ pub mod pallet { let on_chain = as GetStorageVersion>::on_chain_storage_version(); T::DbWeight::get().reads(1) + match on_chain { - _ if on_chain == STORAGE_VERSION => 0, + _ if on_chain == STORAGE_VERSION => Weight::zero(), _ if on_chain == StorageVersion::new(1) => { migrations::v1_to_v2::Migration::::migrate() } @@ -93,7 +95,7 @@ pub mod pallet { "On chain storage version of pallet aleph is {:?} but it should not be bigger than 2", on_chain ); - 0 + Weight::zero() } } } @@ -105,10 +107,21 @@ pub mod pallet { DEFAULT_FINALITY_VERSION } + /// Default value for `NextAuthorities` storage. + #[pallet::type_value] + pub(crate) fn DefaultNextAuthorities() -> Vec { + T::NextSessionAuthorityProvider::next_authorities() + } + #[pallet::storage] #[pallet::getter(fn authorities)] pub(super) type Authorities = StorageValue<_, Vec, ValueQuery>; + #[pallet::storage] + #[pallet::getter(fn next_authorities)] + pub(super) type NextAuthorities = + StorageValue<_, Vec, ValueQuery, DefaultNextAuthorities>; + #[pallet::storage] #[pallet::getter(fn emergency_finalizer)] pub(super) type EmergencyFinalizer = StorageValue<_, T::AuthorityId, OptionQuery>; @@ -134,18 +147,29 @@ pub mod pallet { StorageValue<_, VersionChange, OptionQuery>; impl Pallet { - pub(crate) fn initialize_authorities(authorities: &[T::AuthorityId]) { + pub(crate) fn initialize_authorities( + authorities: &[T::AuthorityId], + next_authorities: &[T::AuthorityId], + ) { if !authorities.is_empty() { - assert!( - >::get().is_empty(), - "Authorities are already initialized!" - ); - >::put(authorities); + if !>::get().is_empty() { + log::error!(target: "pallet_aleph","Authorities are already initialized!"); + } else { + >::put(authorities); + } + } + if !next_authorities.is_empty() { + // Storage NextAuthorities has default value so should never be empty. + >::put(next_authorities); } } - pub(crate) fn update_authorities(authorities: &[T::AuthorityId]) { + pub(crate) fn update_authorities( + authorities: &[T::AuthorityId], + next_authorities: &[T::AuthorityId], + ) { >::put(authorities); + >::put(next_authorities); } pub(crate) fn update_emergency_finalizer() { @@ -210,6 +234,7 @@ pub mod pallet { impl Pallet { /// Sets the emergency finalization key. If called in session `N` the key can be used to /// finalize blocks from session `N+2` onwards, until it gets overridden. + #[pallet::call_index(0)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn set_emergency_finalizer( origin: OriginFor, @@ -227,6 +252,7 @@ pub mod pallet { /// advance of the provided session of the version change. /// In order to cancel a scheduled version change, a new version change should be scheduled /// with the same version as the current one. + #[pallet::call_index(1)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn schedule_finality_version_change( origin: OriginFor, @@ -262,10 +288,11 @@ pub mod pallet { T::AccountId: 'a, { let (_, authorities): (Vec<_>, Vec<_>) = validators.unzip(); - Self::initialize_authorities(authorities.as_slice()); + // it is guaranteed that the first validator set will also be used in the next session + Self::initialize_authorities(authorities.as_slice(), authorities.as_slice()); } - fn on_new_session<'a, I: 'a>(changed: bool, validators: I, _queued_validators: I) + fn on_new_session<'a, I: 'a>(changed: bool, validators: I, queued_validators: I) where I: Iterator, T::AccountId: 'a, @@ -273,10 +300,34 @@ pub mod pallet { Self::update_emergency_finalizer(); if changed { let (_, authorities): (Vec<_>, Vec<_>) = validators.unzip(); - Self::update_authorities(authorities.as_slice()); + let (_, next_authorities): (Vec<_>, Vec<_>) = queued_validators.unzip(); + Self::update_authorities(authorities.as_slice(), next_authorities.as_slice()); } } fn on_disabled(_validator_index: u32) {} } + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub finality_version: Version, + pub _marker: PhantomData, + } + + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { + finality_version: LEGACY_FINALITY_VERSION as u32, + _marker: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + >::put(&self.finality_version); + } + } } diff --git a/pallets/aleph/src/migrations/v0_to_v1.rs b/pallets/aleph/src/migrations/v0_to_v1.rs index f38a5474d0..79daed3678 100644 --- a/pallets/aleph/src/migrations/v0_to_v1.rs +++ b/pallets/aleph/src/migrations/v0_to_v1.rs @@ -1,15 +1,16 @@ -#[cfg(feature = "try-runtime")] -use frame_support::ensure; use frame_support::{ log, storage_alias, traits::{Get, OnRuntimeUpgrade, PalletInfoAccess, StorageVersion}, weights::Weight, }; -#[cfg(feature = "try-runtime")] -use pallets_support::ensure_storage_version; -use pallets_support::StorageMigration; use primitives::SessionIndex; use sp_std::vec::Vec; +#[cfg(feature = "try-runtime")] +use { + codec::{Decode, Encode}, + frame_support::ensure, + pallets_support::ensure_storage_version, +}; use crate::Config; @@ -24,9 +25,11 @@ type Validators = StorageValue>; /// Flattening double `Option<>` storage. pub struct Migration(sp_std::marker::PhantomData<(T, P)>); -impl StorageMigration for Migration { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8] = b"PALLET_ALEPH::V0_TO_V1_MIGRATION"; +#[cfg(feature = "try-runtime")] +#[derive(Decode, Encode)] +struct MigrationChecksState { + session: Option>, + validators: Option>>, } impl OnRuntimeUpgrade for Migration { @@ -79,7 +82,7 @@ impl OnRuntimeUpgrade for Migration { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { + fn pre_upgrade() -> Result, &'static str> { #[storage_alias] type SessionForValidatorsChange = StorageValue>; #[storage_alias] @@ -87,18 +90,27 @@ impl OnRuntimeUpgrade for Migration { ensure_storage_version::

(0)?; - Self::store_temp("session", SessionForValidatorsChange::get()); - Self::store_temp("validators", Validators::::get()); + let session = SessionForValidatorsChange::get(); + let validators = Validators::::get(); - Ok(()) + Ok(MigrationChecksState:: { + session, + validators, + } + .encode()) } #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { + fn post_upgrade(state: Vec) -> Result<(), &'static str> { ensure_storage_version::

(1)?; + let MigrationChecksState { + session: old_session, + validators: old_validators, + } = >::decode(&mut &*state) + .map_err(|_| "Failed to decode old state")?; + let new_session = SessionForValidatorsChange::get(); - let old_session = Self::read_temp::>>("session"); match old_session { Some(Some(session)) => ensure!( @@ -106,20 +118,22 @@ impl OnRuntimeUpgrade for Migration { "Mismatch on `SessionForValidatorsChange`", ), _ => ensure!( - None == new_session, + new_session.is_none(), "New `SessionForValidatorsChange` should be `None`" ), }; let new_validators = Validators::::get(); - let old_validators = Self::read_temp::>>>("validators"); match old_validators { Some(Some(validators)) => ensure!( Some(validators) == new_validators, "Mismatch on `Validators`", ), - _ => ensure!(None == new_validators, "New `Validators` should be `None`"), + _ => ensure!( + new_validators.is_none(), + "New `Validators` should be `None`" + ), }; Ok(()) diff --git a/pallets/aleph/src/migrations/v1_to_v2.rs b/pallets/aleph/src/migrations/v1_to_v2.rs index 99b739a1fb..0a8e9d31c4 100644 --- a/pallets/aleph/src/migrations/v1_to_v2.rs +++ b/pallets/aleph/src/migrations/v1_to_v2.rs @@ -1,13 +1,10 @@ -#[cfg(feature = "try-runtime")] -use frame_support::ensure; use frame_support::{ log, storage_alias, traits::{Get, OnRuntimeUpgrade, PalletInfoAccess, StorageVersion}, weights::Weight, }; #[cfg(feature = "try-runtime")] -use pallets_support::ensure_storage_version; -use pallets_support::StorageMigration; +use {frame_support::ensure, pallets_support::ensure_storage_version, sp_std::vec::Vec}; use crate::Config; @@ -30,11 +27,6 @@ type Validators = StorageValue; /// - Validators pub struct Migration(sp_std::marker::PhantomData<(T, P)>); -impl StorageMigration for Migration { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8] = b"PALLET_ALEPH::V1_TO_V2_MIGRATION"; -} - impl OnRuntimeUpgrade for Migration { fn on_runtime_upgrade() -> Weight { let mut writes = 0; @@ -81,12 +73,13 @@ impl OnRuntimeUpgrade for Migration { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { - ensure_storage_version::

(1) + fn pre_upgrade() -> Result, &'static str> { + ensure_storage_version::

(1)?; + Ok(Vec::new()) } #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { + fn post_upgrade(_state: Vec) -> Result<(), &'static str> { ensure_storage_version::

(2)?; ensure!( diff --git a/pallets/aleph/src/mock.rs b/pallets/aleph/src/mock.rs index 2fc82e96e4..6eb744576c 100644 --- a/pallets/aleph/src/mock.rs +++ b/pallets/aleph/src/mock.rs @@ -3,7 +3,7 @@ use frame_support::{ construct_runtime, parameter_types, sp_io, traits::{OnFinalize, OnInitialize}, - weights::RuntimeDbWeight, + weights::{RuntimeDbWeight, Weight}, }; use primitives::AuthorityId; use sp_api_hidden_includes_construct_runtime::hidden_include::traits::GenesisBuild; @@ -44,7 +44,7 @@ impl_opaque_keys! { parameter_types! { pub const BlockHashCount: u64 = 250; pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); + frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024)); pub const TestDbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 25, write: 100 @@ -55,8 +55,8 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -64,7 +64,7 @@ impl frame_system::Config for Test { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = TestDbWeight; type Version = (); @@ -92,7 +92,7 @@ impl pallet_balances::Config for Test { type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); @@ -100,7 +100,7 @@ impl pallet_balances::Config for Test { } impl pallet_session::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ValidatorId = u64; type ValidatorIdOf = ConvertInto; type ShouldEndSession = pallet_session::PeriodicSessions; @@ -113,10 +113,10 @@ impl pallet_session::Config for Test { impl frame_system::offchain::SendTransactionTypes for Test where - Call: From, + RuntimeCall: From, { - type Extrinsic = TestXt; - type OverarchingCall = Call; + type Extrinsic = TestXt; + type OverarchingCall = RuntimeCall; } parameter_types! { @@ -132,9 +132,10 @@ impl pallet_timestamp::Config for Test { impl Config for Test { type AuthorityId = AuthorityId; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SessionInfoProvider = Session; type SessionManager = (); + type NextSessionAuthorityProvider = Session; } pub fn to_authority(id: &u64) -> AuthorityId { diff --git a/pallets/aleph/src/tests.rs b/pallets/aleph/src/tests.rs index 74eb4b1aca..d3ee97827a 100644 --- a/pallets/aleph/src/tests.rs +++ b/pallets/aleph/src/tests.rs @@ -53,9 +53,12 @@ fn test_update_authorities() { initialize_session(); run_session(1); - Aleph::update_authorities(to_authorities(&[2, 3, 4]).as_slice()); + let authorities = to_authorities(&[2, 3, 4]); + + Aleph::update_authorities(authorities.as_slice(), authorities.as_slice()); assert_eq!(Aleph::authorities(), to_authorities(&[2, 3, 4])); + assert_eq!(Aleph::next_authorities(), to_authorities(&[2, 3, 4])); }); } @@ -63,14 +66,18 @@ fn test_update_authorities() { fn test_initialize_authorities() { new_test_ext(&[(1u64, 1u64), (2u64, 2u64)]).execute_with(|| { assert_eq!(Aleph::authorities(), to_authorities(&[1, 2])); + assert_eq!(Aleph::next_authorities(), to_authorities(&[1, 2])); }); } #[test] -#[should_panic] fn fails_to_initialize_again_authorities() { new_test_ext(&[(1u64, 1u64), (2u64, 2u64)]).execute_with(|| { - Aleph::initialize_authorities(&to_authorities(&[1, 2, 3])); + let authorities = to_authorities(&[1, 2, 3]); + Aleph::initialize_authorities(&authorities, &authorities); + + // should not update storage + assert_eq!(Aleph::authorities(), to_authorities(&[1, 2])); }); } @@ -81,15 +88,20 @@ fn test_current_authorities() { run_session(1); - Aleph::update_authorities(to_authorities(&[2, 3, 4]).as_slice()); + let authorities = to_authorities(&[2, 3, 4]); + + Aleph::update_authorities(&authorities, &authorities); assert_eq!(Aleph::authorities(), to_authorities(&[2, 3, 4])); + assert_eq!(Aleph::next_authorities(), to_authorities(&[2, 3, 4])); run_session(2); - Aleph::update_authorities(to_authorities(&[1, 2, 3]).as_slice()); + let authorities = to_authorities(&[1, 2, 3]); + Aleph::update_authorities(&authorities, &authorities); assert_eq!(Aleph::authorities(), to_authorities(&[1, 2, 3])); + assert_eq!(Aleph::next_authorities(), to_authorities(&[1, 2, 3])); }) } @@ -100,9 +112,10 @@ fn test_session_rotation() { run_session(1); let new_validators = new_session_validators(&[3u64, 4u64]); - let queued_validators = new_session_validators(&[]); + let queued_validators = new_session_validators(&[5, 6]); Aleph::on_new_session(true, new_validators, queued_validators); assert_eq!(Aleph::authorities(), to_authorities(&[3, 4])); + assert_eq!(Aleph::next_authorities(), to_authorities(&[5, 6])); }) } diff --git a/pallets/aleph/src/traits.rs b/pallets/aleph/src/traits.rs index 92de3efd4b..58f4fb7da5 100644 --- a/pallets/aleph/src/traits.rs +++ b/pallets/aleph/src/traits.rs @@ -1,11 +1,24 @@ -use primitives::SessionIndex; +use frame_support::{ + log, + sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic}, +}; +use primitives::{AuthorityId, SessionIndex}; +use sp_std::prelude::*; + +use crate::Config; /// Information provider from `pallet_session`. Loose pallet coupling via traits. -pub trait SessionInfoProvider { +pub trait SessionInfoProvider { fn current_session() -> SessionIndex; } -impl SessionInfoProvider for pallet_session::Pallet +/// Authorities provider, used only as default value in case of missing this information in our pallet. This can +/// happen for the session after runtime upgraded. +pub trait NextSessionAuthorityProvider { + fn next_authorities() -> Vec; +} + +impl SessionInfoProvider for pallet_session::Pallet where T: pallet_session::Config, { @@ -13,3 +26,20 @@ where pallet_session::CurrentIndex::::get() } } + +impl NextSessionAuthorityProvider for pallet_session::Pallet +where + T: Config + pallet_session::Config, +{ + fn next_authorities() -> Vec { + let next: Option> = pallet_session::Pallet::::queued_keys() + .iter() + .map(|(_, key)| key.get(AuthorityId::ID)) + .collect(); + + next.unwrap_or_else(|| { + log::error!(target: "pallet_aleph", "Missing next session keys"); + vec![] + }) + } +} diff --git a/pallets/elections/Cargo.toml b/pallets/elections/Cargo.toml index 8ae0a40659..b621d10113 100644 --- a/pallets/elections/Cargo.toml +++ b/pallets/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "0.5.0" +version = "0.5.4" edition = "2021" license = "Apache 2.0" @@ -8,18 +8,18 @@ license = "Apache 2.0" codec = { package = "parity-scale-codec", version = "3.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -frame-election-provider-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-authorship = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -pallet-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-system = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +frame-election-provider-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-authorship = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-balances = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-session = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +pallet-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-io = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } pallets-support = { path = "../support", default-features = false } primitives = { path = "../../primitives", default-features = false } diff --git a/pallets/elections/src/impls.rs b/pallets/elections/src/impls.rs index ee7585b478..c593b3c41f 100644 --- a/pallets/elections/src/impls.rs +++ b/pallets/elections/src/impls.rs @@ -12,7 +12,7 @@ use sp_std::{ }; use crate::{ - traits::{EraInfoProvider, SessionInfoProvider, ValidatorRewardsHandler}, + traits::{EraInfoProvider, SessionInfoProvider, ValidatorExtractor, ValidatorRewardsHandler}, BanConfig, Banned, CommitteeSize, Config, CurrentEraValidators, NextEraCommitteeSize, NextEraNonReservedValidators, NextEraReservedValidators, Pallet, SessionValidatorBlockCount, UnderperformedValidatorSessionCount, ValidatorEraTotalReward, ValidatorTotalRewards, @@ -347,23 +347,28 @@ where } pub fn ban_validator(validator: &T::AccountId, reason: BanReason) { + // we do not ban reserved validators + if NextEraReservedValidators::::get().contains(validator) { + return; + } // current era is the latest planned era for which validators are already chosen // so we ban from the next era let start: EraIndex = T::EraInfoProvider::current_era() .unwrap_or(0) .saturating_add(1); + T::ValidatorExtractor::remove_validator(validator); Banned::::insert(validator, BanInfo { reason, start }); } fn mark_validator_underperformance(thresholds: &BanConfigStruct, validator: &T::AccountId) { - let counter = UnderperformedValidatorSessionCount::::mutate(&validator, |count| { + let counter = UnderperformedValidatorSessionCount::::mutate(validator, |count| { *count += 1; *count }); if counter >= thresholds.underperformed_session_count_threshold { let reason = BanReason::InsufficientUptime(counter); Self::ban_validator(validator, reason); - UnderperformedValidatorSessionCount::::remove(&validator); + UnderperformedValidatorSessionCount::::remove(validator); } } @@ -385,8 +390,6 @@ where *count += 1; }); } - - fn note_uncle(_author: T::AccountId, _age: T::BlockNumber) {} } impl pallet_session::SessionManager for Pallet diff --git a/pallets/elections/src/lib.rs b/pallets/elections/src/lib.rs index a8b96b8f82..aa34e5d4ed 100644 --- a/pallets/elections/src/lib.rs +++ b/pallets/elections/src/lib.rs @@ -64,7 +64,8 @@ pub struct ValidatorTotalRewards(pub BTreeMap); #[frame_support::pallet] pub mod pallet { use frame_election_provider_support::{ - ElectionDataProvider, ElectionProvider, Support, Supports, + BoundedSupportsOf, ElectionDataProvider, ElectionProvider, ElectionProviderBase, Support, + Supports, }; use frame_support::{log, pallet_prelude::*, traits::Get}; use frame_system::{ @@ -79,13 +80,15 @@ pub mod pallet { use sp_runtime::Perbill; use super::*; - use crate::traits::{EraInfoProvider, SessionInfoProvider, ValidatorRewardsHandler}; + use crate::traits::{ + EraInfoProvider, SessionInfoProvider, ValidatorExtractor, ValidatorRewardsHandler, + }; #[pallet::config] pub trait Config: frame_system::Config { /// Something that provides information about ongoing eras. type EraInfoProvider: EraInfoProvider; - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Something that provides data for elections. type DataProvider: ElectionDataProvider< AccountId = Self::AccountId, @@ -100,10 +103,19 @@ pub mod pallet { type SessionInfoProvider: SessionInfoProvider; /// Something that handles addition of rewards for validators. type ValidatorRewardsHandler: ValidatorRewardsHandler; + /// Something that removes validators from candidates in elections + type ValidatorExtractor: ValidatorExtractor; /// Maximum acceptable ban reason length. #[pallet::constant] type MaximumBanReasonLength: Get; + + /// The maximum number of winners that can be elected by this `ElectionProvider` + /// implementation. + /// + /// Note: This must always be greater or equal to `T::DataProvider::desired_targets()`. + #[pallet::constant] + type MaxWinners: Get; } #[pallet::event] @@ -130,7 +142,7 @@ pub mod pallet { let on_chain = as GetStorageVersion>::on_chain_storage_version(); T::DbWeight::get().reads(1) + match on_chain { - _ if on_chain == STORAGE_VERSION => 0, + _ if on_chain == STORAGE_VERSION => Weight::zero(), _ if on_chain == StorageVersion::new(0) => { migrations::v0_to_v1::Migration::::migrate() + migrations::v1_to_v2::Migration::::migrate() @@ -149,7 +161,7 @@ pub mod pallet { "On chain storage version of pallet elections is {:?} but it should not be bigger than 2", on_chain ); - 0 + Weight::zero() } } } @@ -224,6 +236,7 @@ pub mod pallet { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn change_validators( origin: OriginFor, @@ -258,6 +271,7 @@ pub mod pallet { } /// Sets ban config, it has an immediate effect + #[pallet::call_index(1)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn set_ban_config( origin: OriginFor, @@ -308,6 +322,7 @@ pub mod pallet { } /// Schedule a non-reserved node to be banned out from the committee at the end of the era + #[pallet::call_index(2)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn ban_from_committee( origin: OriginFor, @@ -326,6 +341,7 @@ pub mod pallet { } /// Schedule a non-reserved node to be banned out from the committee at the end of the era + #[pallet::call_index(3)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn cancel_ban(origin: OriginFor, banned: T::AccountId) -> DispatchResult { ensure_root(origin)?; @@ -335,6 +351,7 @@ pub mod pallet { } /// Set openness of the elections + #[pallet::call_index(4)] #[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))] pub fn set_elections_openness( origin: OriginFor, @@ -371,8 +388,8 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(&self.committee_seats); - >::put(&self.committee_seats); + >::put(self.committee_seats); + >::put(self.committee_seats); >::put(&self.non_reserved_validators); >::put(&self.reserved_validators); >::put(&EraValidators { @@ -442,6 +459,10 @@ pub mod pallet { #[derive(Debug)] pub enum ElectionError { DataProvider(&'static str), + + /// Winner number is greater than + /// [`Config::MaxWinners`] + TooManyWinners, } #[pallet::error] @@ -462,16 +483,23 @@ pub mod pallet { BanReasonTooBig, } - impl ElectionProvider for Pallet { + impl ElectionProviderBase for Pallet { type AccountId = T::AccountId; type BlockNumber = T::BlockNumber; type Error = ElectionError; type DataProvider = T::DataProvider; + type MaxWinners = T::MaxWinners; + } + + impl ElectionProvider for Pallet { + fn ongoing() -> bool { + false + } /// We calculate the supports for each validator. The external validators are chosen as: /// 1) "`NextEraNonReservedValidators` that are staking and are not banned" in case of Permissioned ElectionOpenness /// 2) "All staking and not banned validators" in case of Permissionless ElectionOpenness - fn elect() -> Result, Self::Error> { + fn elect() -> Result, Self::Error> { Self::emit_fresh_bans_event(); let active_era = ::EraInfoProvider::active_era().unwrap_or(0); let ban_period = BanConfig::::get().ban_period; @@ -539,7 +567,11 @@ pub mod pallet { } } - Ok(supports.into_iter().collect()) + supports + .into_iter() + .collect::>() + .try_into() + .map_err(|_| Self::Error::TooManyWinners) } } } diff --git a/pallets/elections/src/migrations/v0_to_v1.rs b/pallets/elections/src/migrations/v0_to_v1.rs index f9635d06b6..949ece52eb 100644 --- a/pallets/elections/src/migrations/v0_to_v1.rs +++ b/pallets/elections/src/migrations/v0_to_v1.rs @@ -1,14 +1,15 @@ -#[cfg(feature = "try-runtime")] -use frame_support::ensure; use frame_support::{ log, storage_alias, traits::{Get, OnRuntimeUpgrade, PalletInfoAccess, StorageVersion}, weights::Weight, }; -#[cfg(feature = "try-runtime")] -use pallets_support::ensure_storage_version; -use pallets_support::StorageMigration; use sp_std::vec::Vec; +#[cfg(feature = "try-runtime")] +use { + codec::{Decode, Encode}, + frame_support::ensure, + pallets_support::ensure_storage_version, +}; use crate::{ compute_validator_scaled_total_rewards, @@ -39,11 +40,6 @@ type ErasMembers = StorageValue, Validators)>; /// - `ErasMembers` contain tuple of (content of `Members`, empty vector). pub struct Migration(sp_std::marker::PhantomData<(T, P)>); -impl StorageMigration for Migration { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8] = b"PALLET_ELECTIONS::V0_TO_V1_MIGRATION"; -} - impl OnRuntimeUpgrade for Migration { fn on_runtime_upgrade() -> Weight { log::info!(target: "pallet_elections", "Running migration from STORAGE_VERSION 0 to 1 for pallet elections"); @@ -83,17 +79,14 @@ impl OnRuntimeUpgrade for Migration { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { + fn pre_upgrade() -> Result, &'static str> { ensure_storage_version::

(0)?; - - let members = Members::::get().ok_or("No `Members` storage")?; - Self::store_temp("members", members); - - Ok(()) + let members: Validators = Members::::get().ok_or("No `Members` storage")?; + Ok(members.encode()) } #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { + fn post_upgrade(old_members: Vec) -> Result<(), &'static str> { ensure_storage_version::

(1)?; let mps = MembersPerSession::get().ok_or("No `MembersPerSession` in the storage")?; @@ -103,7 +96,8 @@ impl OnRuntimeUpgrade for Migration { NonReservedMembers::::get().ok_or("No `NonReservedMembers` in the storage")?; let eras_members = ErasMembers::::get().ok_or("No `ErasMembers` in the storage")?; - let old_members = Self::read_temp::>("members"); + let old_members = >::decode(&mut &*old_members) + .map_err(|_| "Failed to decode old members set")?; ensure!( reserved_members == old_members, diff --git a/pallets/elections/src/migrations/v1_to_v2.rs b/pallets/elections/src/migrations/v1_to_v2.rs index 8978a86b87..42c8ade61e 100644 --- a/pallets/elections/src/migrations/v1_to_v2.rs +++ b/pallets/elections/src/migrations/v1_to_v2.rs @@ -1,13 +1,15 @@ -#[cfg(feature = "try-runtime")] -use frame_support::ensure; use frame_support::{ log, storage_alias, traits::{Get, OnRuntimeUpgrade, PalletInfoAccess, StorageVersion}, weights::Weight, }; #[cfg(feature = "try-runtime")] -use pallets_support::ensure_storage_version; -use pallets_support::StorageMigration; +use { + codec::{Decode, Encode}, + frame_support::ensure, + pallets_support::ensure_storage_version, + sp_std::vec::Vec, +}; use crate::{migrations::Validators, Config, EraValidators}; @@ -40,9 +42,13 @@ type CurrentEraValidators = /// - `ErasMembers` `(reserved, non_reserved)` -> `CurrentEraValidators` `ErasValidators { reserved, non_reserved}` pub struct Migration(sp_std::marker::PhantomData<(T, P)>); -impl StorageMigration for Migration { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8] = b"PALLET_ELECTIONS::V1_TO_V2_MIGRATION"; +#[cfg(feature = "try-runtime")] +#[derive(Decode, Encode)] +struct MigrationChecksState { + members_per_session: u32, + reserved_members: Validators, + non_reserved_members: Validators, + eras_members: (Validators, Validators), } impl OnRuntimeUpgrade for Migration { @@ -82,29 +88,28 @@ impl OnRuntimeUpgrade for Migration { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { + fn pre_upgrade() -> Result, &'static str> { ensure_storage_version::

(1)?; let members_per_session = MembersPerSession::get().ok_or("No `MembersPerSession` in the storage")?; - Self::store_temp("members_per_session", members_per_session); - let reserved_members = ReservedMembers::::get().ok_or("No `ReservedMembers` in the storage")?; - Self::store_temp("reserved_members", reserved_members); - let non_reserved_members = NonReservedMembers::::get().ok_or("No `NonReservedMembers` in the storage")?; - Self::store_temp("non_reserved_members", non_reserved_members); - let eras_members = ErasMembers::::get().ok_or("No `ErasMembers` in the storage")?; - Self::store_temp("eras_members", eras_members); - Ok(()) + Ok(MigrationChecksState:: { + members_per_session, + reserved_members, + non_reserved_members, + eras_members, + } + .encode()) } #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { + fn post_upgrade(state: Vec) -> Result<(), &'static str> { ensure_storage_version::

(2)?; let committee_size = CommitteeSize::get().ok_or("No `CommitteeSize` in the storage")?; @@ -115,10 +120,13 @@ impl OnRuntimeUpgrade for Migration { let current_era_validators = CurrentEraValidators::::get().ok_or("No `CurrentEraValidators` in the storage")?; - let members_per_session = Self::read_temp::("members_per_session"); - let reserved_members = Self::read_temp::>("reserved_members"); - let non_reserved_members = Self::read_temp::>("non_reserved_members"); - let eras_members = Self::read_temp::<(Validators, Validators)>("eras_members"); + let MigrationChecksState { + members_per_session, + reserved_members, + non_reserved_members, + eras_members, + } = >::decode(&mut &*state) + .map_err(|_| "Failed to decode old state")?; ensure!( committee_size == members_per_session, diff --git a/pallets/elections/src/migrations/v2_to_v3.rs b/pallets/elections/src/migrations/v2_to_v3.rs index 1044f41f17..b57306ab85 100644 --- a/pallets/elections/src/migrations/v2_to_v3.rs +++ b/pallets/elections/src/migrations/v2_to_v3.rs @@ -1,14 +1,16 @@ -#[cfg(feature = "try-runtime")] -use frame_support::ensure; use frame_support::{ log, storage_alias, traits::{Get, OnRuntimeUpgrade, PalletInfoAccess, StorageVersion}, weights::Weight, }; -#[cfg(feature = "try-runtime")] -use pallets_support::ensure_storage_version; -use pallets_support::StorageMigration; use primitives::CommitteeSeats; +#[cfg(feature = "try-runtime")] +use { + codec::{Decode, Encode}, + frame_support::ensure, + pallets_support::ensure_storage_version, + sp_std::vec::Vec, +}; use crate::{migrations::Validators, Config, EraValidators}; @@ -29,9 +31,11 @@ type NextEraCommitteeSize = StorageValue; /// `CommitteeSeats`. pub struct Migration(sp_std::marker::PhantomData<(T, P)>); -impl StorageMigration for Migration { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8] = b"PALLET_ELECTIONS::V2_TO_V3_MIGRATION"; +#[cfg(feature = "try-runtime")] +#[derive(Decode, Encode)] +struct MigrationChecksState { + committee_size: Option, + next_era_committee_size: Option, } impl OnRuntimeUpgrade for Migration { @@ -97,7 +101,7 @@ impl OnRuntimeUpgrade for Migration { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { + fn pre_upgrade() -> Result, &'static str> { #[storage_alias] type CommitteeSize = StorageValue; #[storage_alias] @@ -106,16 +110,17 @@ impl OnRuntimeUpgrade for Migration { ensure_storage_version::

(2)?; let committee_size = CommitteeSize::get(); - Self::store_temp("committee_size", committee_size); - let next_era_committee_size = NextEraCommitteeSize::get(); - Self::store_temp("next_era_committee_size", next_era_committee_size); - Ok(()) + Ok(MigrationChecksState { + committee_size, + next_era_committee_size, + } + .encode()) } #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { + fn post_upgrade(state: Vec) -> Result<(), &'static str> { ensure_storage_version::

(3)?; let new_committee_size = CommitteeSize::get().ok_or("No `CommitteeSize` in the storage")?; @@ -127,10 +132,11 @@ impl OnRuntimeUpgrade for Migration { let next_era_reserved_validators = NextEraReservedValidators::::get() .ok_or("No `NextEraReservedValidators` in the storage")?; - let old_committee_size = - Self::read_temp::>("committee_size").unwrap_or_default(); - let old_next_era_committee_size = - Self::read_temp::>("next_era_committee_size").unwrap_or_default(); + let MigrationChecksState { + committee_size: old_committee_size, + next_era_committee_size: old_next_era_committee_size, + } = ::decode(&mut &*state) + .map_err(|_| "Failed to decode old state")?; let currently_reserved = current_era_validators.reserved.len(); ensure!( @@ -139,7 +145,9 @@ impl OnRuntimeUpgrade for Migration { ); ensure!( new_committee_size.non_reserved_seats - == old_committee_size.saturating_sub(currently_reserved as u32), + == old_committee_size + .unwrap_or_default() + .saturating_sub(currently_reserved as u32), "Mismatch between `CurrentEraValidators` and `CommitteeSize`" ); @@ -150,7 +158,9 @@ impl OnRuntimeUpgrade for Migration { ); ensure!( new_next_era_committee_size.non_reserved_seats - == old_next_era_committee_size.saturating_sub(next_reserved as u32), + == old_next_era_committee_size + .unwrap_or_default() + .saturating_sub(next_reserved as u32), "Mismatch between `NextEraReservedValidators` and `NextEraCommitteeSize`" ); diff --git a/pallets/elections/src/mock.rs b/pallets/elections/src/mock.rs index daf629c084..c27f5514f5 100644 --- a/pallets/elections/src/mock.rs +++ b/pallets/elections/src/mock.rs @@ -4,10 +4,10 @@ use frame_election_provider_support::{data_provider, ElectionDataProvider, VoteW use frame_support::{ construct_runtime, parameter_types, sp_io, traits::{ConstU32, GenesisBuild}, - weights::RuntimeDbWeight, + weights::{RuntimeDbWeight, Weight}, BasicExternalities, BoundedVec, }; -use primitives::{BanConfig, CommitteeSeats}; +use primitives::{BanConfig, CommitteeSeats, DEFAULT_MAX_WINNERS}; use sp_core::H256; use sp_runtime::{ testing::{Header, TestXt}, @@ -18,7 +18,9 @@ use sp_std::{cell::RefCell, collections::btree_set::BTreeSet}; use super::*; use crate as pallet_elections; -use crate::traits::{EraInfoProvider, SessionInfoProvider, ValidatorRewardsHandler}; +use crate::traits::{ + EraInfoProvider, SessionInfoProvider, ValidatorExtractor, ValidatorRewardsHandler, +}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -41,7 +43,7 @@ pub(crate) type Balance = u128; parameter_types! { pub const BlockHashCount: u64 = 250; pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); + frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024)); pub const TestDbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 25, write: 100 @@ -52,8 +54,8 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -61,7 +63,7 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = TestDbWeight; type Version = (); @@ -84,7 +86,7 @@ impl pallet_balances::Config for Test { type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); @@ -93,10 +95,10 @@ impl pallet_balances::Config for Test { impl frame_system::offchain::SendTransactionTypes for Test where - Call: From, + RuntimeCall: From, { - type Extrinsic = TestXt; - type OverarchingCall = Call; + type Extrinsic = TestXt; + type OverarchingCall = RuntimeCall; } parameter_types! { @@ -168,15 +170,23 @@ impl EraInfoProvider for MockProvider { } } +impl ValidatorExtractor for MockProvider { + type AccountId = AccountId; + + fn remove_validator(_who: &AccountId) {} +} + impl Config for Test { type EraInfoProvider = MockProvider; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DataProvider = StakingMock; type SessionPeriod = SessionPeriod; type SessionManager = (); type SessionInfoProvider = MockProvider; type ValidatorRewardsHandler = MockProvider; + type ValidatorExtractor = MockProvider; type MaximumBanReasonLength = ConstU32<300>; + type MaxWinners = ConstU32; } type MaxVotesPerVoter = ConstU32<1>; @@ -266,10 +276,7 @@ impl TestExtBuilder { .chain(self.reserved_validators.iter()) .collect(); - let balances: Vec<_> = validators - .iter() - .map(|i| (**i as u64, 10_000_000)) - .collect(); + let balances: Vec<_> = validators.iter().map(|i| (**i, 10_000_000)).collect(); pallet_balances::GenesisConfig:: { balances } .assimilate_storage(&mut t) diff --git a/pallets/elections/src/tests.rs b/pallets/elections/src/tests.rs index 8b377780a9..f9f516288d 100644 --- a/pallets/elections/src/tests.rs +++ b/pallets/elections/src/tests.rs @@ -75,7 +75,7 @@ fn validators_are_elected_only_when_staking() { ::elect().expect("`elect()` should succeed"); assert_eq!( - elected, + elected.into_inner(), &[ (1, support(10, vec![(1, 10)])), (2, no_support()), diff --git a/pallets/elections/src/traits.rs b/pallets/elections/src/traits.rs index f60172f266..9767622fe6 100644 --- a/pallets/elections/src/traits.rs +++ b/pallets/elections/src/traits.rs @@ -86,3 +86,21 @@ where pallet_staking::ErasStakers::::iter_key_prefix(era).collect() } } + +pub trait ValidatorExtractor { + type AccountId; + + /// Removes given validator from pallet's staking validators list + fn remove_validator(who: &Self::AccountId); +} + +impl ValidatorExtractor for pallet_staking::Pallet +where + T: pallet_staking::Config, +{ + type AccountId = T::AccountId; + + fn remove_validator(who: &Self::AccountId) { + pallet_staking::Pallet::::do_remove_validator(who); + } +} diff --git a/pallets/support/Cargo.toml b/pallets/support/Cargo.toml index 77d22c6486..64f0ac9ce4 100644 --- a/pallets/support/Cargo.toml +++ b/pallets/support/Cargo.toml @@ -1,15 +1,17 @@ [package] name = "pallets-support" -version = "0.1.0" +version = "0.1.4" edition = "2021" [dependencies] -frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +frame-support = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [features] default = ["std"] std = [ "frame-support/std", + "sp-std/std" ] try-runtime = [ "frame-support/try-runtime", diff --git a/pallets/support/src/migration.rs b/pallets/support/src/migration.rs index c2b10b6a7d..d43a8d5a3e 100644 --- a/pallets/support/src/migration.rs +++ b/pallets/support/src/migration.rs @@ -1,9 +1,3 @@ -#[cfg(feature = "try-runtime")] -use frame_support::{ - codec::{Decode, Encode}, - sp_io, - storage::storage_prefix, -}; use frame_support::{ pallet_prelude::{PalletInfoAccess, StorageVersion, Weight}, traits::OnRuntimeUpgrade, @@ -14,63 +8,23 @@ use frame_support::{ /// /// This way, `try-runtime` no longer triggers checks. We do it by hand. pub trait StorageMigration: OnRuntimeUpgrade { - #[cfg(feature = "try-runtime")] - const MIGRATION_STORAGE_PREFIX: &'static [u8]; - #[allow(clippy::let_and_return)] fn migrate() -> Weight { #[cfg(feature = "try-runtime")] - Self::pre_upgrade().expect("Pre upgrade should succeed"); + let state = Self::pre_upgrade().expect("Pre upgrade should succeed"); let weight = Self::on_runtime_upgrade(); #[cfg(feature = "try-runtime")] - Self::post_upgrade().expect("Post upgrade should succeed"); + Self::post_upgrade(state).expect("Post upgrade should succeed"); weight } - - /// Wrapper for `OnRuntimeUpgradeHelpersExt::set_temp_storage`. - /// - /// Together with the associated const `MIGRATION_STORAGE_PREFIX` they form a shortcut for: - /// ```rust - /// # use frame_support::traits::OnRuntimeUpgradeHelpersExt; - /// # use crate::pallet_elections::Config; - /// # use frame_support::storage::storage_prefix; - /// # use frame_support::pallet_prelude::PalletInfoAccess; - /// # use frame_support::sp_std; - /// - /// #[cfg(feature = "try-runtime")] - /// const MIGRATION_STORAGE_PREFIX: &[u8] = b"..."; - /// - /// # struct Migration(sp_std::marker::PhantomData<(T, P)>); - /// - /// #[cfg(feature = "try-runtime")] - /// impl OnRuntimeUpgradeHelpersExt for Migration { - /// fn storage_key(ident: &str) -> [u8; 32] { - /// storage_prefix(MIGRATION_STORAGE_PREFIX, ident.as_bytes()) - /// } - /// } - /// ``` - /// which would be required for every implementor of `StorageMigration`. - #[cfg(feature = "try-runtime")] - fn store_temp(storage_key: &str, data: T) { - let full_key = storage_prefix(Self::MIGRATION_STORAGE_PREFIX, storage_key.as_bytes()); - sp_io::storage::set(&full_key, &data.encode()); - } - - /// Wrapper for `OnRuntimeUpgradeHelpersExt::get_temp_storage`. - /// - /// Analogous to `Self::store_temp`. - #[cfg(feature = "try-runtime")] - fn read_temp(storage_key: &str) -> T { - let full_key = storage_prefix(Self::MIGRATION_STORAGE_PREFIX, storage_key.as_bytes()); - sp_io::storage::get(&full_key) - .and_then(|bytes| Decode::decode(&mut &*bytes).ok()) - .unwrap_or_else(|| panic!("No `{storage_key}` in the temp storage")) - } } +impl StorageMigration for T {} + +/// Ensure that the current pallet storage version matches `version`. pub fn ensure_storage_version(version: u16) -> Result<(), &'static str> { if StorageVersion::get::

() == StorageVersion::new(version) { Ok(()) diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index da4b29cbae..a0cc3cd31a 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "0.5.0" +version = "0.5.5" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" @@ -10,12 +10,12 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa serde = { version = "1.0", features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-application-crypto = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } -sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-api = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-application-crypto = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-core = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-runtime = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } +sp-staking = { default-features = false, git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.38" } [features] default = ["std"] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index e59bd722e3..48a94559f8 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -38,13 +38,18 @@ pub type BlockNumber = u32; pub type SessionCount = u32; pub type BlockCount = u32; +// Default number of heap pages that gives limit of 256MB for a runtime instance since each page is 64KB +pub const HEAP_PAGES: u64 = 4096; + pub const MILLISECS_PER_BLOCK: u64 = 1000; +// We agreed to 5MB as the block size limit. +pub const MAX_BLOCK_SIZE: u32 = 5 * 1024 * 1024; // Quick sessions for testing purposes #[cfg(feature = "short_session")] pub const DEFAULT_SESSION_PERIOD: u32 = 30; #[cfg(feature = "short_session")] -pub const DEFAULT_SESSIONS_PER_ERA: SessionIndex = 5; +pub const DEFAULT_SESSIONS_PER_ERA: SessionIndex = 3; // Default values outside testing #[cfg(not(feature = "short_session"))] @@ -63,9 +68,18 @@ pub const DEFAULT_COMMITTEE_SIZE: u32 = 4; pub const DEFAULT_BAN_MINIMAL_EXPECTED_PERFORMANCE: Perbill = Perbill::from_percent(0); pub const DEFAULT_BAN_SESSION_COUNT_THRESHOLD: SessionCount = 3; pub const DEFAULT_BAN_REASON_LENGTH: u32 = 300; +pub const DEFAULT_MAX_WINNERS: u32 = u32::MAX; + pub const DEFAULT_CLEAN_SESSION_COUNTER_DELAY: SessionCount = 960; pub const DEFAULT_BAN_PERIOD: EraIndex = 10; +/// Version returned when no version has been set. +pub const DEFAULT_FINALITY_VERSION: Version = 0; +/// Current version of abft. +pub const CURRENT_FINALITY_VERSION: u16 = LEGACY_FINALITY_VERSION + 1; +/// Legacy version of abft. +pub const LEGACY_FINALITY_VERSION: u16 = 1; + /// Openness of the process of the elections #[derive(Decode, Encode, TypeInfo, Debug, Clone, PartialEq, Eq)] pub enum ElectionOpenness { diff --git a/rust-toolchain b/rust-toolchain index 1f1f6b18d9..06f480baab 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-08-12 +nightly-2022-10-30 diff --git a/scripts/catchup_version_upgrade_test.sh b/scripts/catchup_version_upgrade_test.sh new file mode 100755 index 0000000000..9f42d5fb55 --- /dev/null +++ b/scripts/catchup_version_upgrade_test.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +set -euo pipefail + +INIT_BLOCK=${INIT_BLOCK:-3} +UPGRADE_BLOCK=${UPGRADE_BLOCK:-31} +UPGRADE_VERSION=${UPGRADE_VERSION:-1} +NODES=${NODES:-"Node1:Node2"} +PORTS=${PORTS:-9934:9935} +UPGRADE_BEFORE_DISABLE=${UPGRADE_BEFORE_DISABLE:-false} +SEED=${SEED:-"//Alice"} +ALL_NODES=${ALL_NODES:-"Node0:Node1:Node2:Node3:Node4"} +ALL_NODES_PORTS=${ALL_NODES_PORTS:-"9933:9934:9935:9936:9937"} +WAIT_BLOCKS=${WAIT_BLOCKS:-30} +EXT_STATUS=${EXT_STATUS:-"in-block"} + +source ./scripts/common.sh + +function initialize { + wait_for_finalized_block $1 $2 $3 +} + +function set_upgrade_session { + local session=$1 + local version=$2 + local validator=$3 + local port=$4 + local seed=$5 + local status=$6 + + docker run --rm --network container:$validator cliain:latest --node ws://127.0.0.1:$port --seed $seed version-upgrade-schedule --version $version --session $session --expected-state $status +} + +function check_if_disconnected() { + local -n nodes=$1 + local -n ports=$2 + + log "checking if nodes are disconnected" + + for i in "${!nodes[@]}"; do + local node=${nodes[$i]} + local port=${ports[$i]} + + log "checking if node $node is disconnected" + + last_finalized=$(get_best_finalized $node $port) + log "last finalized block at node $node is $last_finalized" + + last_block=$(get_last_block $node $port) + log "last block at node $node is $last_block" + + # what else we can do? + log "sleeping for 20 seconds" + sleep 20 + + new_finalized=$(get_best_finalized $node $port) + log "newest finalized block at node $node after waiting is $new_finalized" + + if [[ $(($new_finalized - $last_finalized)) -ge 1 ]]; then + log "somehow a disconnected node $node was able to finalize new blocks" + exit -1 + fi + done +} + +function connect_nodes { + local -n nodes=$1 + for node in ${nodes[@]}; do + docker network connect main-network $node + done +} + +function disconnect_nodes { + local -n nodes=$1 + + for node in ${nodes[@]}; do + log "disconnecting node $node..." + docker network disconnect main-network $node + log "node $node disconnected" + done +} + +into_array $NODES +NODES=(${result[@]}) + +into_array $PORTS +PORTS=(${result[@]}) + +into_array $ALL_NODES +ALL_NODES=(${result[@]}) + +into_array "$ALL_NODES_PORTS" +ALL_NODES_PORTS=(${result[@]}) + +log "initializing nodes..." +DOCKER_COMPOSE=./docker/docker-compose.bridged.yml ./.github/scripts/run_consensus.sh 1>&2 +sleep 10 +log "awaiting finalization of $INIT_BLOCK blocks..." +initialize $INIT_BLOCK "Node0" 9933 +log "nodes initialized" + +last_block=$(get_last_block "Node0" 9933) +block_for_upgrade=$(($UPGRADE_BLOCK + $last_block)) +if [[ $UPGRADE_BEFORE_DISABLE = true ]]; then + log "setting upgrade at $block_for_upgrade block for version $UPGRADE_VERSION before disconnecting" + set_upgrade_session $block_for_upgrade $UPGRADE_VERSION "Node0" 9943 $SEED $EXT_STATUS +fi + +log "disconnecting nodes..." +disconnect_nodes NODES +log "verifying if nodes are properly disconnected..." +check_if_disconnected NODES PORTS +log "nodes disconnected" + +last_block=$(get_last_block "Node0" 9933) +block_for_upgrade=$(($UPGRADE_BLOCK + $last_block)) +if [[ $UPGRADE_BEFORE_DISABLE = false ]]; then + log "setting upgrade at $block_for_upgrade block for version $UPGRADE_VERSION" + set_upgrade_session $block_for_upgrade $UPGRADE_VERSION "Node0" 9943 $SEED $EXT_STATUS +fi + +last_block=$(get_last_block "Node0" 9933) +awaited_block=$(($WAIT_BLOCKS+$block_for_upgrade)) +log "awaiting block $awaited_block" +wait_for_block $awaited_block "Node0" 9933 +log "awaiting finished" + +log "connecting nodes..." +connect_nodes NODES +log "nodes connected" + +last_block=$(get_last_block "Node0" 9933) +log "checking finalization..." +check_finalization $(($awaited_block+1)) ALL_NODES ALL_NODES_PORTS +log "finalization checked" + +exit $? diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100644 index 0000000000..9df43ce744 --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,112 @@ +#!/bin/env bash + +function log() { + echo $1 1>&2 +} + +function into_array() { + result=() + local tmp=$IFS + IFS=: + for e in $1; do + result+=($e) + done + IFS=$tmp +} + +function check_finalization() { + local block_to_check=$1 + local -n nodes=$2 + local -n ports=$3 + + log "checking finalization for block $block_to_check" + + for i in "${!nodes[@]}"; do + local node=${nodes[$i]} + local rpc_port=${ports[$i]} + + log "checking finalization at node $node" + wait_for_finalized_block $block_to_check $node $rpc_port + done +} + +function check_relative_finalization_at_node() { + local node=$1 + local rpc_port=$2 + local awaited_blocks=$3 + + local last_block=$(get_last_block $node $rpc_port) + local awaited_finalized=$(($last_block+$awaited_blocks)) + + log "Last block seen at node $node was $last_block, awaiting block $awaited_finalized to be finalized" + + wait_for_finalized_block $awaited_finalized $node $rpc_port +} + +function check_relative_finalization() { + local awaited_blocks=$1 + local -n nodes=$2 + local -n ports=$3 + + log "checking finalization for $awaited_blocks block(s) in the future" + + for i in "${!nodes[@]}"; do + local node=${nodes[$i]} + local rpc_port=${ports[$i]} + + log "checking finalization at node $node (${node}:$rpc_port)" + check_relative_finalization_at_node $node $rpc_port $awaited_blocks + done +} + +function get_best_finalized() { + local validator=$1 + local rpc_port=$2 + + local best_finalized=$(VALIDATOR=$validator RPC_HOST="127.0.0.1" RPC_PORT=$rpc_port ./.github/scripts/check_finalization.sh | sed 's/Last finalized block number: "\(.*\)"/\1/') + printf "%d" $best_finalized +} + +function wait_for_finalized_block() { + local block_to_be_finalized=$1 + local node=$2 + local port=$3 + + while [[ $(get_best_finalized $node $port) -le $block_to_be_finalized ]]; do + sleep 3 + done +} + +function wait_for_block() { + local block=$1 + local validator=$2 + local rpc_port=$3 + + local last_block="" + while [[ -z "$last_block" ]]; do + last_block=$(docker run --rm --network container:$validator appropriate/curl:latest \ + -H "Content-Type: application/json" \ + -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlockHash", "params": '$block'}' http://127.0.0.1:$rpc_port | jq '.result') + done +} + +function retrieve_last_block() { + local validator=$1 + local rpc_port=$2 + + docker run --rm --network container:$validator appropriate/curl:latest \ + -H "Content-Type: application/json" \ + -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock"}' http://127.0.0.1:$rpc_port | jq '.result.block.header.number' +} + +function get_last_block() { + local validator=$1 + local rpc_port=$2 + + local last_block="" + while [[ -z "$last_block" ]]; do + last_block=$(retrieve_last_block $validator $rpc_port) + sleep 1 + done + printf "%d" $last_block +} diff --git a/scripts/pricing/README.md b/scripts/pricing/README.md new file mode 100644 index 0000000000..b526b1b651 --- /dev/null +++ b/scripts/pricing/README.md @@ -0,0 +1,24 @@ +Pricing script +============== + +The `./run.py` script in this directory will deploy some contracts and print a summary of how much some basic operations +on them cost. + +It requires `python3` and an Ink 4-compatible version of `cargo contract`, to install: + +```bash +$ cargo install cargo-contract --version 2.0.0-beta.1 +``` + +Afterwards, install the python deps and run the script: + +```bash +$ pip install -r requirements.txt +$ ./run.py +``` + +For more info on options see: + +```bash +$ ./run.py --help +``` diff --git a/scripts/pricing/requirements.txt b/scripts/pricing/requirements.txt new file mode 100644 index 0000000000..a00a1bbfbe --- /dev/null +++ b/scripts/pricing/requirements.txt @@ -0,0 +1 @@ +tabulate==0.9.0 diff --git a/scripts/pricing/run.py b/scripts/pricing/run.py new file mode 100755 index 0000000000..3b65e25ffa --- /dev/null +++ b/scripts/pricing/run.py @@ -0,0 +1,101 @@ +#!/usr/bin/python3 + +import argparse +import random +import subprocess +import json +from tabulate import tabulate +import urllib.request + +AZERO = 1_000_000_000_000 + + +parser = argparse.ArgumentParser( + description='Check the prices of some common contract operations') +parser.add_argument('--url', type=str, + default='ws://localhost:9944', help='URL of the node to connect to') +parser.add_argument('--suri', type=str, default='//Alice', + help='Secret key URI to use for calls') +parser.add_argument('--adder-dir', type=str, + help='Directory of the adder contract', default='../../contracts/adder') + +args = parser.parse_args() + +COMMON_ARGS = ['--suri', args.suri, '--url', + args.url, '--skip-confirm', '--output-json'] + + +def random_salt(): + return ''.join(random.choice('0123456789abcdef') for _ in range(10)) + + +def deploy(directory): + res = subprocess.check_output(['cargo', 'contract', 'instantiate', '--salt', + random_salt()] + COMMON_ARGS, cwd=directory) + return json.loads(res.decode('utf-8')) + + +def call(directory, contract, message, *args): + args = [x for a in args for x in ['--args', a]] + res = subprocess.check_output(['cargo', 'contract', 'call', '--contract', contract, + '--message', message] + args + COMMON_ARGS, cwd=directory) + return json.loads(res.decode('utf-8')) + + +def event_field(event, field): + for f in event['fields']: + if f['name'] == field: + return f['value'] + + +def deployer_account_id(deploy_result): + setup_event = next(filter( + lambda e: e['name'] == 'Transfer' and account_id(event_field(e, 'to')) == adder_address, deploy_result['events']), None) + + return account_id(event_field(setup_event, 'from')) + + +def account_id(value): + match value: + case {'Literal': account_id}: return account_id + case _: raise ValueError(f'Invalid account id: {value}') + + +def uint(value): + match value: + case {'UInt': value}: return value + case _: raise ValueError(f'Invalid uint: {value}') + + +def find_fee(events, by_whom): + fee_event = next(filter(lambda e: e['name'] == 'TransactionFeePaid' and account_id( + event_field(e, 'who')) == by_whom, events), None) + return uint(event_field(fee_event, 'actual_fee')) + + +with urllib.request.urlopen('https://api.coingecko.com/api/v3/simple/price?ids=aleph-zero&vs_currencies=usd') as response: + data = json.load(response) + aleph_usd = data['aleph-zero']['usd'] + + +def format_fee(fee): + return "%f AZERO ($%f)" % (fee / AZERO, fee / AZERO * aleph_usd) + + +deploy_result = deploy(args.adder_dir) + +adder_address = deploy_result['contract'] +suri_address = deployer_account_id(deploy_result) +instantiate_fee = find_fee(deploy_result['events'], suri_address) + +events = call(args.adder_dir, adder_address, 'add', '42') +add_fee = find_fee(events, suri_address) + +headers = ['Operation', 'Fee'] +prices = [ + ["Instantiate contract with single storage value", + format_fee(instantiate_fee)], + ["Call contract with single storage update", format_fee(add_fee)] +] + +print(tabulate(prices, headers=headers, tablefmt="github")) diff --git a/scripts/run_checks_on_aleph_node.sh b/scripts/run_checks_on_aleph_node.sh index 7b0dffe210..c4b1237496 100755 --- a/scripts/run_checks_on_aleph_node.sh +++ b/scripts/run_checks_on_aleph_node.sh @@ -2,6 +2,6 @@ set -e -CARGO_INCREMENTAL=0 cargo clippy --all-targets --all-features --no-deps +CARGO_INCREMENTAL=0 cargo clippy --all-targets --all-features -- --no-deps -D warnings CARGO_INCREMENTAL=0 cargo fmt --all CARGO_INCREMENTAL=0 cargo test --lib diff --git a/scripts/run_checks_on_excluded_packages.sh b/scripts/run_checks_on_excluded_packages.sh index 6b8414b30c..1524b2c81e 100755 --- a/scripts/run_checks_on_excluded_packages.sh +++ b/scripts/run_checks_on_excluded_packages.sh @@ -10,6 +10,14 @@ packages=( "fork-off" "benches/payout-stakers" "bin/cliain" + "contracts/access_control" + "contracts/button" + "contracts/game_token" + "contracts/marketplace" + "contracts/simple_dex" + "contracts/ticket_token" + "contracts/wrapped_azero" + "contracts/adder, " ) for p in ${packages[@]} diff --git a/scripts/run_consensus_network_delay.sh b/scripts/run_consensus_network_delay.sh new file mode 100755 index 0000000000..133a57f643 --- /dev/null +++ b/scripts/run_consensus_network_delay.sh @@ -0,0 +1,110 @@ +#!/bin/env bash + +set -euo pipefail + +source ./scripts/common.sh + +function usage(){ + cat << EOF +Usage: + $0 + --network-delays "500:300" + list of delays for each node in ms; default="500:500:500:500:500" + --no-build-image + skip docker image build + --nodes "Node0:9933:Node1:9934" + list of pairs node:rpc_port; default="Node0:9933:Node1:9934:Node2:9935:Node3:9936:Node4:9937" + --check-block number + check finalization for a given block number, 0 means no-check; default=42 +EOF + exit 0 +} + +function build_test_image() { + docker build -t aleph-node:network_tests -f docker/Dockerfile.network_tests . +} + +function set_network_delay() { + local node=$1 + local delay=$2 + + log "setting network delay for node $node" + docker exec $node tc qdisc add dev eth1 root netem delay ${delay}ms +} + +while [[ $# -gt 0 ]]; do + case $1 in + --network-delays) + NETWORK_DELAYS="$2" + shift;shift + ;; + --no-build-image) + BUILD_IMAGE=false + shift + ;; + --nodes) + NODES="$2" + shift;shift + ;; + --check-block) + CHECK_BLOCK_FINALIZATION="$2" + shift;shift + ;; + --help) + usage + shift + ;; + *) + error "Unrecognized argument $1!" + ;; + esac +done + +NETWORK_DELAYS=${NETWORK_DELAYS:-"500:500:500:500:500"} +BUILD_IMAGE=${BUILD_IMAGE:-true} +NODE_PAIRS=${NODES:-"Node0:9933:Node1:9934:Node2:9935:Node3:9936:Node4:9937"} +NODES_PORTS=${NODES_PORTS:-"9933:9934:9935:9936:9937"} +CHECK_BLOCK_FINALIZATION=${CHECK_BLOCK_FINALIZATION:-44} + +into_array $NETWORK_DELAYS +NETWORK_DELAYS=(${result[@]}) + +into_array $NODE_PAIRS +NODE_PAIRS=(${result[@]}) +NODES=() +NODES_PORTS=() +for ((i=0; i<${#NODE_PAIRS[@]}; i+=2)); do + node=${NODE_PAIRS[$i]} + port=${NODE_PAIRS[(($i + 1))]} + + NODES+=($node) + NODES_PORTS+=($port) +done + + +if [[ "$BUILD_IMAGE" = true ]]; then + log "building custom docker image for network tests" + build_test_image +fi + +log "starting network" +OVERRIDE_DOCKER_COMPOSE=./docker/docker-compose.network_tests.yml DOCKER_COMPOSE=./docker/docker-compose.bridged.yml ./.github/scripts/run_consensus.sh 1>&2 +log "network started" + +for i in "${!NODES[@]}"; do + node=${NODES[$i]} + delay=${NETWORK_DELAYS[$i]} + log "setting network delay for node $node to ${delay}ms" + + set_network_delay $node $delay +done + +if [[ $CHECK_BLOCK_FINALIZATION -gt 0 ]]; then + log "checking finalization" + check_relative_finalization $CHECK_BLOCK_FINALIZATION NODES NODES_PORTS + log "finalization checked" +fi + +log "done" + +exit 0 diff --git a/scripts/run_e2e.sh b/scripts/run_e2e.sh index bf73c7d8a3..3d01b3f153 100755 --- a/scripts/run_e2e.sh +++ b/scripts/run_e2e.sh @@ -4,6 +4,6 @@ set -e cd e2e-tests/ -RUST_LOG=aleph_e2e_client=info,aleph-client=info cargo run -- --node 127.0.0.1:9943 +NODE_URL="ws://127.0.0.1:9944" RUST_LOG=info cargo test -- --nocapture --test-threads 1 exit $? diff --git a/scripts/run_nodes.sh b/scripts/run_nodes.sh index f7885ea417..b7961d0c51 100755 --- a/scripts/run_nodes.sh +++ b/scripts/run_nodes.sh @@ -52,7 +52,7 @@ validator_ids_string="${validator_ids[*]}" validator_ids_string="${validator_ids_string//${IFS:0:1}/,}" echo "Bootstrapping chain for nodes 0..$((N_VALIDATORS - 1))" -./target/release/aleph-node bootstrap-chain --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json" +./target/release/aleph-node bootstrap-chain --raw --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json" for i in $(seq "$N_VALIDATORS" "$(( N_VALIDATORS + N_NON_VALIDATORS - 1 ))"); do echo "Bootstrapping node $i" @@ -83,7 +83,6 @@ run_node() { ./target/release/aleph-node purge-chain --base-path $BASE_PATH/$account_id --chain $BASE_PATH/chainspec.json -y ./target/release/aleph-node \ $validator \ - --state-pruning=archive \ --chain $BASE_PATH/chainspec.json \ --base-path $BASE_PATH/$account_id \ --name $auth \ @@ -101,7 +100,7 @@ run_node() { --validator-port ${validator_port} \ -laleph-party=debug \ -laleph-network=debug \ - -lvalidator-network=debug \ + -lclique-network=debug \ -laleph-finality=debug \ -laleph-justification=debug \ -laleph-data-store=debug \ diff --git a/scripts/synthetic-network/README.md b/scripts/synthetic-network/README.md new file mode 100644 index 0000000000..836457f996 --- /dev/null +++ b/scripts/synthetic-network/README.md @@ -0,0 +1,41 @@ +# synthetic-network + +This folder contains various scripts that allows to spawn and interact with `aleph-node` executed within a so called +synthetic-network. synthetic-network is a tool for docker that allows you to simulate different network conditions, like +variable latency, rate limit, etc. Easiest way to manage parameters of a synthetic-network is to use its web-ui - after +executing `run_consensus_synthetic-network.sh` it should be available at http://localhost:3000 (each node has separate settings +page, i.e. :3001 is Node1, ...). + +# Content of this folder + +Main file in this folder is `run_consensus_synthetic-network.sh`. It builds a docker-image containing `aleph-node` and some +arbitrary set of networking and debugging tools. It also consist of files required to spawn an instance of the +synthetic-network. Its requirements are: docker, docker-compose, git, `aleph-node:latest` docker-image. + +`set_defaults_synthetic-network.sh` allows you to reset settings of the synthetic-network to some sane defaults. You might need +to use it when you set too restrictive values for some of its parameters, i.e. rate limit that make you unable to further +interact with its web-ui. + +Additionally, this folder contains an example .js script introducing API of the synthetic-network. You can use it by executing +`run_script_for_synthetic-network.sh --script-path ./latency.js`. + +# How to run e2e-tests that use synthetic-network + +All following commands are run from within root folder of this repository. + +```shell +# build aleph-node docker-image +# it assumes that aleph-node binary is stored at ./target/release/aleph-node +docker build -t aleph-node:latest -f docker/Dockerfile . + +# run synthetic-network with aleph-node using docker-compose +# by default, it should build for you a docker-image for synthetic-network +# consult its help for available options +./scripts/synthetic-network/run_consensus_synthetic-network.sh + +# run e2e-tests +cd e2e-tests +# set an ENV variable required by the e2e-test, namely a list of URLs for synthetic-network configuration endpoints +export SYNTHETIC_URLS="http://localhost:3000/qos,http://localhost:3001/qos,http://localhost:3002/qos,http://localhost:3003/qos,http://localhost:3004/qos" +cargo test latency +``` diff --git a/scripts/synthetic-network/build_synthetic-network.sh b/scripts/synthetic-network/build_synthetic-network.sh new file mode 100755 index 0000000000..e25eb456c8 --- /dev/null +++ b/scripts/synthetic-network/build_synthetic-network.sh @@ -0,0 +1,25 @@ +#!/bin/env bash + +set -euo pipefail + +source ./scripts/common.sh + +UPDATE=${UPDATE:-true} + +if [[ "$UPDATE" = true ]]; then + git submodule init + git submodule update +fi + +pushd . +cd scripts/synthetic-network/vendor/synthetic-network + +log "building base docker image for synthetic-network with support for synthetic-network" +docker build -t syntheticnet . + +popd + +log "building docker image for aleph-node that supports synthetic-network" +docker build -t aleph-node:syntheticnet -f docker/Dockerfile.synthetic_network . + +exit 0 diff --git a/scripts/synthetic-network/latency.js b/scripts/synthetic-network/latency.js new file mode 100644 index 0000000000..fb34459479 --- /dev/null +++ b/scripts/synthetic-network/latency.js @@ -0,0 +1,22 @@ +const argv = require('node:process').argv; +const inLatency = argv.length <= 2 ? 0 : argv.at(2); +const outLatency = argv.length <= 3 ? 0 : argv.at(3); +console.log("setting in-latency to", inLatency); +console.log("setting out-latency to", outLatency); + +const SyntheticNetwork = require('../vendor/synthetic-network/frontend'); + +async function setLatency(host, port, inLatency, outLatency) { + const synthnet = new SyntheticNetwork({ hostname: host, port: port }); + synthnet.default_link.egress.latency(outLatency); + synthnet.default_link.ingress.latency(inLatency); + await synthnet.commit(); +} + +async function run(inLatency, outLatency) { + for (let it = 0; it < 5; it++) { + await setLatency('localhost', 3000 + it, inLatency, outLatency); + } +} + +run(inLatency, outLatency); diff --git a/scripts/synthetic-network/run_consensus_synthetic-network.sh b/scripts/synthetic-network/run_consensus_synthetic-network.sh new file mode 100755 index 0000000000..6cc4522217 --- /dev/null +++ b/scripts/synthetic-network/run_consensus_synthetic-network.sh @@ -0,0 +1,69 @@ +#!/bin/env bash + +set -euo pipefail + +source ./scripts/common.sh + +function usage(){ + cat << EOF +Usage: + $0 + This script allows you to run aleph-node within docker and simulate some custom network conditions, e.g. delays, rate limit, + package loss. Additionally, each node is preinstalled with the 'stress' tool, that allows to simulate high occupancy of nodes + cpu and io. It should allow us test more realistic high volume network conditions without the need to spawn hundreds of + aws instances. For more details on networking part of this solution, visit https://github.com/daily-co/synthetic-network . + IMPORTANT: this script requires aleph-node:latest docker image. + --no-build-image + skip docker image build + --no-update + skip git-submodule update for the synthetic-network repository +EOF + exit 0 +} + +function build_test_image() { + local path=$1 + + ${path}/build_synthetic-network.sh +} + +while [[ $# -gt 0 ]]; do + case $1 in + --no-build-image) + BUILD_IMAGE=false + shift + ;; + --no-update) + UPDATE=false + shift + ;; + --help) + usage + shift + ;; + *) + error "Unrecognized argument $1!" + ;; + esac +done + +BUILD_IMAGE=${BUILD_IMAGE:-true} +UPDATE=${UPDATE:-true} + +if [[ "$UPDATE" = true ]]; then + git submodule init + git submodule update +fi + +if [[ "$BUILD_IMAGE" = true ]]; then + log "building custom docker image for synthetic-network tests" + path=$(dirname $0) + build_test_image $path +fi + +log "running synthetic-network" +DOCKER_COMPOSE=./docker/docker-compose.synthetic-network.yml ./.github/scripts/run_consensus.sh +log "open a web browser at http://localhost:3000 (port 3000 is Node0, 3001 is Node1, ...)" +xdg-open http://localhost:3000 + +exit 0 diff --git a/scripts/synthetic-network/run_script_for_synthetic-network.sh b/scripts/synthetic-network/run_script_for_synthetic-network.sh new file mode 100755 index 0000000000..7a8e88b487 --- /dev/null +++ b/scripts/synthetic-network/run_script_for_synthetic-network.sh @@ -0,0 +1,58 @@ +#!/bin/env bash + +set -euo pipefail + +source ./scripts/common.sh + +function usage(){ + cat << EOF +Usage: + $0 + This script allows you to run a custom .js script using the synthetic-network network simulation tool. + IMPORTANT: first you need to call 'scripts/run_consensus_synthetic-network.sh' and let it run in background. + It spawns docker-compose configured with synthetic-network. + It requires node.js to run. + --script-path scripts/vendor/synthetic-network/frontend/udp_rate_sine_demo.js + path to a synthetic-network scrypt. Default is a demo scripts/vendor/synthetic-network/frontend/udp_rate_sine_demo.js + from the synthetic-network repo. Please consult synthetic-network repo for details: https://github.com/daily-co/synthetic-network + --no-update + skip git-submodule update for the synthetic-network repository +EOF + exit 0 +} + +while [[ $# -gt 0 ]]; do + case $1 in + --script-path) + SCRIPT_PATH="$2" + shift;shift + ;; + --no-update) + UPDATE=false + shift + ;; + --help) + usage + shift + ;; + *) + break + ;; + esac +done + +SCRIPT_PATH=${SCRIPT_PATH:-scripts/vendor/synthetic-network/frontend/udp_rate_sine_demo.js} +SCRIPT_PATH=$(realpath $SCRIPT_PATH) +UPDATE=${UPDATE:-true} + +if [[ "$UPDATE" = true ]]; then + git submodule init + git submodule update +fi + +cd scripts/synthetic-network/vendor/synthetic-network/frontend + +log "running .js script" +node $SCRIPT_PATH ${@:1} + +exit 0 diff --git a/scripts/synthetic-network/set_defaults_synthetic-network.sh b/scripts/synthetic-network/set_defaults_synthetic-network.sh new file mode 100755 index 0000000000..767e700077 --- /dev/null +++ b/scripts/synthetic-network/set_defaults_synthetic-network.sh @@ -0,0 +1,89 @@ +#!/bin/env bash + +set -euo pipefail + +source ./scripts/common.sh + +function usage() { + cat << EOF +Usage: + $0 + This scripts sets network settings for the synthetic-network to some sane defaults. + + --node Node0 + name of the docker container inside which this script should be executed, default is 'Node0' +EOF + exit 0 +} + +while [[ $# -gt 0 ]]; do + case $1 in + --node) + NODE="$2" + shift;shift + ;; + --help) + usage + shift + ;; + *) + error "Unrecognized argument $1!" + ;; + esac +done + +NODE=${NODE:-Node0} + +docker exec $NODE curl -H "Content-Type: application/json" \ +-d \ +'{ + "default_link": { + "ingress": { + "rate": 27800000, + "loss": 0, + "latency": 0, + "jitter": 0, + "jitter_strength": 0, + "reorder_packets": false + }, + "egress": { + "rate": 1000000, + "loss": 0, + "latency": 0, + "jitter": 0, + "jitter_strength": 0, + "reorder_packets": false + } + }, + "flows": [ + { + "label": "http", + "flow": { + "ip": 0, + "protocol": 6, + "port_min": 80, + "port_max": 80 + }, + "link": { + "ingress": { + "rate": 96500000, + "loss": 0, + "latency": 0, + "jitter": 0, + "jitter_strength": 0, + "reorder_packets": false + }, + "egress": { + "rate": 96500000, + "loss": 0, + "latency": 0, + "jitter": 0, + "jitter_strength": 0, + "reorder_packets": false + } + } + } + ] +}' http://localhost:80/qos + +exit 0 diff --git a/scripts/synthetic-network/synthetic-link/Cargo.lock b/scripts/synthetic-network/synthetic-link/Cargo.lock new file mode 100644 index 0000000000..c7b2372015 --- /dev/null +++ b/scripts/synthetic-network/synthetic-link/Cargo.lock @@ -0,0 +1,1296 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" + +[[package]] +name = "futures-sink" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" + +[[package]] +name = "futures-task" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" + +[[package]] +name = "futures-util" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "ipnet" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + +[[package]] +name = "is-terminal" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys 0.45.0", +] + +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.45.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.45.0", +] + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustix" +version = "0.36.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synthetic-link" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "env_logger", + "log", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "tokio", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicode-bidi" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] diff --git a/scripts/synthetic-network/synthetic-link/Cargo.toml b/scripts/synthetic-network/synthetic-link/Cargo.toml new file mode 100644 index 0000000000..2b0226b48a --- /dev/null +++ b/scripts/synthetic-network/synthetic-link/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "synthetic-link" +version = "0.1.0" +authors = ["Cardinal Cryptography"] +edition = "2021" +license = "Apache 2.0" + +[dependencies] +anyhow = "1.0.66" +clap = { version = "4.0.29", features = ["derive"] } +env_logger = "0.10.0" +log = "0.4.17" +reqwest = { version = "0.11.13", features = ["json"] } +serde = { version = "1.0.149", features = ["derive"] } +serde_json = "1.0.89" +serde_repr = "0.1.9" +tokio = { version = "1.23.0", features = ["full"] } diff --git a/scripts/synthetic-network/synthetic-link/src/lib.rs b/scripts/synthetic-network/synthetic-link/src/lib.rs new file mode 100644 index 0000000000..ba5f5a5c96 --- /dev/null +++ b/scripts/synthetic-network/synthetic-link/src/lib.rs @@ -0,0 +1,266 @@ +use std::ops::RangeInclusive; + +use anyhow::bail; +use reqwest::Client; +use serde::{Deserialize, Serialize}; +use serde_repr::{Deserialize_repr, Serialize_repr}; + +const DEFAULT_SYNTHETIC_NETWORK: SyntheticNetwork = SyntheticNetwork { + default_link: DEFAULT_SYNTHETIC_LINK, + flows: Vec::new(), +}; + +const DEFAULT_SYNTHETIC_LINK: SyntheticLink = SyntheticLink { + ingress: DEFAULT_QOS, + egress: DEFAULT_QOS, +}; + +const DEFAULT_QOS: QualityOfService = QualityOfService { + rate: 1000000000, + loss: StrengthParam::zero(), + latency: 0, + jitter: 0, + jitter_strength: StrengthParam::zero(), + reorder_packets: false, +}; + +const DEFAULT_FLOW: Flow = Flow { + ip: IpPattern::All, + protocol: Protocol::All, + port_range: PortRange::all(), +}; + +#[derive(Serialize, Deserialize, Clone)] +pub struct SyntheticNetwork { + pub default_link: SyntheticLink, + pub flows: Vec, +} + +impl Default for SyntheticNetwork { + fn default() -> Self { + DEFAULT_SYNTHETIC_NETWORK + } +} + +#[derive(Serialize, Deserialize, Clone)] +pub struct SyntheticLink { + pub ingress: QualityOfService, + pub egress: QualityOfService, +} + +impl Default for SyntheticLink { + fn default() -> Self { + DEFAULT_SYNTHETIC_LINK + } +} + +#[derive(Serialize, Deserialize, Clone)] +pub struct QualityOfService { + pub rate: u64, + pub loss: StrengthParam, + pub latency: u64, + pub jitter: u64, + pub jitter_strength: StrengthParam, + pub reorder_packets: bool, +} + +impl Default for QualityOfService { + fn default() -> Self { + DEFAULT_QOS + } +} + +#[derive(Serialize, Deserialize, Clone)] +pub struct SyntheticFlow { + pub label: NonEmptyString, + pub flow: Flow, + pub link: SyntheticLink, +} + +impl SyntheticFlow { + pub fn new(label: NonEmptyString) -> Self { + Self { + label, + flow: DEFAULT_FLOW, + link: DEFAULT_SYNTHETIC_LINK, + } + } +} + +#[derive(Serialize, Deserialize, Clone)] +pub struct Flow { + pub ip: IpPattern, + pub protocol: Protocol, + #[serde(flatten)] + pub port_range: PortRange, +} + +impl Default for Flow { + fn default() -> Self { + DEFAULT_FLOW + } +} + +/// Simple wrapper for the `String` type representing only non-empty strings. +#[derive(Serialize, Deserialize, Clone)] +pub struct NonEmptyString(String); + +impl NonEmptyString { + /// Creates an instance of the NonEmptyString type. Bails if provided value `is_empty`. + pub fn new(value: String) -> anyhow::Result { + if value.is_empty() { + bail!("`value` must be non-empty"); + } + Ok(Self(value)) + } +} + +impl AsRef for NonEmptyString { + fn as_ref(&self) -> &String { + &self.0 + } +} + +/// Simple wrapper for the `f64` type representing number in range 0..=1. +#[derive(Serialize, Deserialize, Clone)] +pub struct StrengthParam(f64); + +impl Default for StrengthParam { + fn default() -> Self { + Self(0.0) + } +} + +impl StrengthParam { + /// Creates an instance of the `StrengthParam` type. Bails if provided value is not withing 0..=1 range. + pub fn new(value: f64) -> anyhow::Result { + if value > 1.0 { + bail!("value shouldn't be larger than 1"); + } + if value < 0.0 { + bail!("value shouldn't be smaller than 0"); + } + Ok(Self(value)) + } + + const fn zero() -> Self { + Self(0.0) + } +} + +impl AsRef for StrengthParam { + fn as_ref(&self) -> &f64 { + &self.0 + } +} + +#[derive(Serialize_repr, Deserialize_repr, Clone)] +#[repr(u8)] +pub enum Protocol { + Icmp = 1, + Tcp = 6, + Udp = 17, + All = 0, +} + +/// Simple wrapper for the `RangeInclusive` type. +#[derive(Serialize, Deserialize, Clone)] +#[serde(try_from = "PortRangeSerde", into = "PortRangeSerde")] +pub struct PortRange(RangeInclusive); + +impl PortRange { + pub const fn all() -> Self { + Self(0..=u16::MAX) + } + + /// Creates an instance of the `PortRange` type. Bails if `port_min > port_max`. + pub fn new(port_min: u16, port_max: u16) -> anyhow::Result { + if port_min > port_max { + bail!("`port_min` is larger than `port_max`"); + } + Ok(Self(port_min..=port_max)) + } +} + +impl AsRef> for PortRange { + fn as_ref(&self) -> &RangeInclusive { + &self.0 + } +} + +#[derive(Serialize, Deserialize, Clone)] +struct PortRangeSerde { + port_min: u16, + port_max: u16, +} + +impl TryFrom for PortRange { + type Error = anyhow::Error; + + fn try_from(value: PortRangeSerde) -> Result { + Self::new(value.port_min, value.port_max) + } +} + +impl From for PortRangeSerde { + fn from(value: PortRange) -> Self { + PortRangeSerde { + port_min: *value.0.start(), + port_max: *value.0.end(), + } + } +} + +/// Custom type for representing IP patterns, namely `all addresses` or any other specific value. +#[derive(Serialize, Deserialize, Clone)] +#[serde(from = "IpPatternSerde", into = "IpPatternSerde")] +pub enum IpPattern { + All, + Ip(u32), +} + +#[derive(Serialize, Deserialize, Clone)] +struct IpPatternSerde(u32); + +impl From for IpPattern { + fn from(value: IpPatternSerde) -> Self { + match value.0 { + 0 => IpPattern::All, + ip => IpPattern::Ip(ip), + } + } +} + +impl From for IpPatternSerde { + fn from(value: IpPattern) -> Self { + let ip = match value { + IpPattern::All => 0, + IpPattern::Ip(ip) => ip, + }; + IpPatternSerde(ip) + } +} + +pub struct SyntheticNetworkClient { + client: Client, + url: String, +} + +impl SyntheticNetworkClient { + pub fn new(url: String) -> Self { + SyntheticNetworkClient { + client: Client::new(), + url, + } + } + + pub async fn commit_config(&mut self, config: &SyntheticNetwork) -> anyhow::Result<()> { + let result = self.client.post(&self.url).json(config).send().await; + Ok(result.map(|_| ())?) + } + + pub async fn load_config(&mut self) -> anyhow::Result { + let result = self.client.get(&self.url).send().await?; + Ok(result.json::().await?) + } +} diff --git a/scripts/synthetic-network/synthetic-link/src/main.rs b/scripts/synthetic-network/synthetic-link/src/main.rs new file mode 100644 index 0000000000..01f7a68924 --- /dev/null +++ b/scripts/synthetic-network/synthetic-link/src/main.rs @@ -0,0 +1,34 @@ +use clap::{arg, Parser}; +use log::info; +use synthetic_link::{SyntheticNetwork, SyntheticNetworkClient}; + +#[derive(Parser, Debug)] +struct Args { + #[arg(short, long, default_value = "http://Node0:80/qos")] + url: String, +} + +#[tokio::main] +async fn main() { + env_logger::init(); + + let args = Args::parse(); + let synth_net_url = args.url; + + info!("reading SyntheticNetwork configuration from stdin"); + let deserializer = serde_json::Deserializer::from_reader(std::io::stdin()); + let synth_net_config: SyntheticNetwork = deserializer + .into_iter() + .next() + .unwrap_or_else(|| panic!("no configuration on stdin")) + .unwrap_or_else(|e| panic!("unable to parse SyntheticNetwork config: {}", e)); + info!("parsed SyntheticNetwork configuration"); + + info!("commiting configuration"); + let mut synth_net_client = SyntheticNetworkClient::new(synth_net_url); + synth_net_client + .commit_config(&synth_net_config) + .await + .unwrap_or_else(|e| panic!("failed to commit SyntheticNetwork configuration: {}", e)); + info!("successfully committed new configuration"); +} diff --git a/scripts/synthetic-network/vendor/synthetic-network b/scripts/synthetic-network/vendor/synthetic-network new file mode 160000 index 0000000000..72bbb4fde9 --- /dev/null +++ b/scripts/synthetic-network/vendor/synthetic-network @@ -0,0 +1 @@ +Subproject commit 72bbb4fde915e4132c19cd7ce3605364abac58a5 diff --git a/shell.nix b/shell.nix index d21ea4d5ee..030d32db42 100644 --- a/shell.nix +++ b/shell.nix @@ -6,7 +6,7 @@ let nixpkgs = versions.nixpkgs; env = versions.stdenv; project = import ./default.nix ( buildOptions // { inherit versions; } ); - rust = nixpkgs.rust.override { + rust = versions.rustToolchain.rust.override { extensions = [ "rust-src" ]; }; nativeBuildInputs = [rust nixpkgs.cacert nixpkgs.openssl] ++ project.nativeBuildInputs; @@ -15,4 +15,6 @@ nixpkgs.mkShell.override { stdenv = env; } { inherit nativeBuildInputs; inherit (project) buildInputs shellHook; + # RUST_SRC_PATH might be needed by the `rust-analyzer` + RUST_SRC_PATH = "${versions.rustToolchain.rust-src}/lib/rustlib/src/rust/library/"; }