diff --git a/.github/actions/run-e2e-test/action.yml b/.github/actions/run-e2e-test/action.yml index d0139b4646..7eb9a95ea3 100644 --- a/.github/actions/run-e2e-test/action.yml +++ b/.github/actions/run-e2e-test/action.yml @@ -91,7 +91,7 @@ runs: RESERVED_SEATS="${{ inputs.reserved-seats }}" NON_RESERVED_SEATS="${{ inputs.non-reserved-seats }}" - + if [[ -n "${RANDOMIZED}" ]]; then ARGS+=(-r "${RANDOMIZED}") fi diff --git a/.github/scripts/run_consensus.sh b/.github/scripts/run_consensus.sh index f5f82cbbfc..d1e8092645 100755 --- a/.github/scripts/run_consensus.sh +++ b/.github/scripts/run_consensus.sh @@ -3,8 +3,10 @@ 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:-""} @@ -51,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" 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/nightly-pipeline.yaml b/.github/workflows/nightly-pipeline.yaml index a426f97ffc..5933a1c8c9 100644 --- a/.github/workflows/nightly-pipeline.yaml +++ b/.github/workflows/nightly-pipeline.yaml @@ -170,7 +170,8 @@ jobs: uses: ./.github/actions/run-e2e-test with: test-case: authorities_are_staking - randomized: true + node-count: 6 + follow-up-finalization-check: true timeout-minutes: 60 run-e2e-high-out-latency: diff --git a/aleph-client/Cargo.lock b/aleph-client/Cargo.lock index 4ecf994c0a..16f592794f 100644 --- a/aleph-client/Cargo.lock +++ b/aleph-client/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "aleph_client" -version = "2.7.0" +version = "2.8.0" dependencies = [ "anyhow", "async-trait", diff --git a/aleph-client/Cargo.toml b/aleph-client/Cargo.toml index 95961566c2..41268b2787 100644 --- a/aleph-client/Cargo.toml +++ b/aleph-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "aleph_client" # TODO bump major version when API stablize -version = "2.7.0" +version = "2.8.0" edition = "2021" license = "Apache 2.0" diff --git a/aleph-client/src/connections.rs b/aleph-client/src/connections.rs index b21c1b54f8..78f7d49db8 100644 --- a/aleph-client/src/connections.rs +++ b/aleph-client/src/connections.rs @@ -3,7 +3,9 @@ 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, @@ -13,7 +15,8 @@ use subxt::{ }; use crate::{ - api, sp_weights::weight_v2::Weight, AccountId, BlockHash, Call, KeyPair, SubxtClient, TxStatus, + api, sp_weights::weight_v2::Weight, AccountId, AlephConfig, BlockHash, Call, KeyPair, + SubxtClient, TxHash, TxStatus, }; /// Capable of communicating with a live Aleph chain. @@ -36,11 +39,13 @@ pub struct RootConnection { /// 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; } @@ -105,6 +110,22 @@ pub trait ConnectionApi: Sync { 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 { + pub block_hash: BlockHash, + 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 { @@ -112,32 +133,32 @@ pub trait SignedConnectionApi: ConnectionApi { /// * `tx` - encoded transaction payload /// * `status` - a [`TxStatus`] for a tx to wait for /// # Returns - /// Block hash of block where transaction was put or error + /// 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 + /// 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; + ) -> 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 or error + /// Block hash of block where transaction was put together with transaction hash, or error. async fn send_tx_with_params( &self, tx: Call, params: BaseExtrinsicParamsBuilder, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; /// Returns account id which signs this connection fn account_id(&self) -> &AccountId; @@ -153,14 +174,14 @@ pub trait SignedConnectionApi: ConnectionApi { #[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; + 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 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 { + 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, @@ -173,7 +194,7 @@ impl SudoCall for RootConnection { self.as_signed().send_tx(sudo, status).await } - async fn sudo(&self, call: Call, status: TxStatus) -> anyhow::Result { + 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); @@ -263,7 +284,7 @@ impl SignedConnectionApi for S { &self, tx: Call, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { self.send_tx_with_params(tx, Default::default(), status) .await } @@ -273,7 +294,7 @@ impl SignedConnectionApi for S { tx: Call, params: BaseExtrinsicParamsBuilder, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { if let Some(details) = tx.validation_details() { info!(target:"aleph-client", "Sending extrinsic {}.{} with params: {:?}", details.pallet_name, details.call_name, params); } @@ -286,15 +307,25 @@ impl SignedConnectionApi for S { .await .map_err(|e| anyhow!("Failed to submit transaction: {:?}", e))?; - // In case of Submitted hash does not mean anything - let hash = match status { - TxStatus::InBlock => progress.wait_for_in_block().await?.block_hash(), - TxStatus::Finalized => progress.wait_for_finalized_success().await?.block_hash(), - TxStatus::Submitted => return Ok(BlockHash::from_low_u64_be(0)), + 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 included in block {:?}", hash); + info!(target: "aleph-client", "tx with hash {:?} included in block {:?}", info.tx_hash, info.block_hash); - Ok(hash) + Ok(info) } fn account_id(&self) -> &AccountId { diff --git a/aleph-client/src/lib.rs b/aleph-client/src/lib.rs index 74d232850f..2f0e79dbe3 100644 --- a/aleph-client/src/lib.rs +++ b/aleph-client/src/lib.rs @@ -13,7 +13,7 @@ extern crate core; pub use contract_transcode; -pub use subxt::ext::sp_core::Pair; +pub use subxt::{blocks::ExtrinsicEvents, ext::sp_core::Pair}; use subxt::{ ext::sp_core::{ed25519, sr25519, H256}, tx::PairSigner, @@ -49,14 +49,17 @@ pub type KeyPair = PairSigner; pub type AccountId = subxt::ext::sp_core::crypto::AccountId32; /// An alias for a client type. pub type Client = OnlineClient; -/// An alias for a hash type. +/// 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::{ - Connection, ConnectionApi, RootConnection, SignedConnection, SignedConnectionApi, SudoCall, + AsConnection, AsSigned, Connection, ConnectionApi, RootConnection, SignedConnection, + SignedConnectionApi, SudoCall, }; /// When submitting a transaction, wait for given status before proceeding. diff --git a/aleph-client/src/pallets/aleph.rs b/aleph-client/src/pallets/aleph.rs index 5e06267322..b68a00f30b 100644 --- a/aleph-client/src/pallets/aleph.rs +++ b/aleph-client/src/pallets/aleph.rs @@ -7,6 +7,7 @@ use crate::{ 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, @@ -26,7 +27,7 @@ pub trait AlephSudoApi { &self, finalizer: AccountId, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; /// Schedules a finality version change for a future session. /// * `version` - next version of the finalizer @@ -39,7 +40,7 @@ pub trait AlephSudoApi { version: u32, session: SessionIndex, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } /// Pallet aleph RPC api. @@ -62,7 +63,7 @@ impl AlephSudoApi for RootConnection { &self, finalizer: AccountId, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Aleph(set_emergency_finalizer { emergency_finalizer: Public(EdPublic(finalizer.into())), }); @@ -74,7 +75,7 @@ impl AlephSudoApi for RootConnection { version: u32, session: SessionIndex, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Aleph(schedule_finality_version_change { version_incoming: version, session, diff --git a/aleph-client/src/pallets/balances.rs b/aleph-client/src/pallets/balances.rs index b4e4be0aae..cf757be5af 100644 --- a/aleph-client/src/pallets/balances.rs +++ b/aleph-client/src/pallets/balances.rs @@ -3,6 +3,7 @@ use subxt::{ext::sp_runtime::MultiAddress, tx::PolkadotExtrinsicParamsBuilder}; use crate::{ aleph_zero::{self, api, api::runtime_types::pallet_balances::BalanceLock}, + connections::TxInfo, pallet_balances::pallet::Call::transfer, pallets::utility::UtilityApi, AccountId, BlockHash, @@ -44,7 +45,7 @@ pub trait BalanceUserApi { dest: AccountId, amount: Balance, status: TxStatus, - ) -> anyhow::Result; + ) -> 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. @@ -54,7 +55,7 @@ pub trait BalanceUserApi { amount: Balance, tip: Balance, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } /// Pallet balances logic not directly related to any pallet call. @@ -79,7 +80,7 @@ pub trait BalanceUserBatchExtApi { dest: &[AccountId], amount: Balance, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } #[async_trait::async_trait] @@ -122,7 +123,7 @@ impl BalanceUserApi for S { dest: AccountId, amount: Balance, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .balances() .transfer(MultiAddress::Id(dest), amount); @@ -135,7 +136,7 @@ impl BalanceUserApi for S { amount: Balance, tip: Balance, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .balances() .transfer(MultiAddress::Id(dest), amount); @@ -152,7 +153,7 @@ impl BalanceUserBatchExtApi for S { dests: &[AccountId], amount: Balance, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let calls = dests .iter() .map(|dest| { diff --git a/aleph-client/src/pallets/contract.rs b/aleph-client/src/pallets/contract.rs index eeebce4a3e..cf24c640f5 100644 --- a/aleph-client/src/pallets/contract.rs +++ b/aleph-client/src/pallets/contract.rs @@ -4,8 +4,8 @@ use primitives::Balance; use subxt::{ext::sp_core::Bytes, rpc_params}; use crate::{ - api, pallet_contracts::wasm::OwnerInfo, sp_weights::weight_v2::Weight, AccountId, BlockHash, - ConnectionApi, SignedConnectionApi, TxStatus, + api, connections::TxInfo, pallet_contracts::wasm::OwnerInfo, sp_weights::weight_v2::Weight, + AccountId, BlockHash, ConnectionApi, SignedConnectionApi, TxStatus, }; /// Arguments to [`ContractRpc::call_and_get`]. @@ -47,7 +47,7 @@ pub trait ContractsUserApi { code: Vec, storage_limit: Option>, status: TxStatus, - ) -> anyhow::Result; + ) -> 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)] @@ -60,7 +60,7 @@ pub trait ContractsUserApi { data: Vec, salt: Vec, status: TxStatus, - ) -> anyhow::Result; + ) -> 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)] @@ -73,7 +73,7 @@ pub trait ContractsUserApi { data: Vec, salt: Vec, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; /// API for [`call`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/struct.Pallet.html#method.call) call. async fn call( @@ -84,14 +84,10 @@ pub trait ContractsUserApi { storage_limit: Option>, data: Vec, status: TxStatus, - ) -> anyhow::Result; + ) -> 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; + async fn remove_code(&self, code_hash: BlockHash, status: TxStatus) -> anyhow::Result; } /// RPC for runtime ContractsApi @@ -124,7 +120,7 @@ impl ContractsUserApi for S { code: Vec, storage_limit: Option>, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().contracts().upload_code(code, storage_limit); self.send_tx(tx, status).await @@ -139,7 +135,7 @@ impl ContractsUserApi for S { data: Vec, salt: Vec, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().contracts().instantiate( balance, gas_limit, @@ -161,7 +157,7 @@ impl ContractsUserApi for S { data: Vec, salt: Vec, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().contracts().instantiate_with_code( balance, gas_limit, @@ -182,7 +178,7 @@ impl ContractsUserApi for S { storage_limit: Option>, data: Vec, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .contracts() @@ -190,11 +186,7 @@ impl ContractsUserApi for S { self.send_tx(tx, status).await } - async fn remove_code( - &self, - code_hash: BlockHash, - status: TxStatus, - ) -> anyhow::Result { + 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 diff --git a/aleph-client/src/pallets/elections.rs b/aleph-client/src/pallets/elections.rs index 4ed650412a..1e7a9083cb 100644 --- a/aleph-client/src/pallets/elections.rs +++ b/aleph-client/src/pallets/elections.rs @@ -6,7 +6,7 @@ use crate::{ pallet_elections::pallet::Call::set_ban_config, primitives::{BanReason, CommitteeSeats, EraValidators}, }, - connections::AsConnection, + connections::{AsConnection, TxInfo}, pallet_elections::pallet::Call::{ ban_from_committee, change_validators, set_elections_openness, }, @@ -99,7 +99,7 @@ pub trait ElectionsSudoApi { clean_session_counter_delay: Option, ban_period: Option, status: TxStatus, - ) -> anyhow::Result; + ) -> 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 @@ -112,7 +112,7 @@ pub trait ElectionsSudoApi { new_non_reserved_validators: Option>, committee_size: Option, status: TxStatus, - ) -> anyhow::Result; + ) -> 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, @@ -123,7 +123,7 @@ pub trait ElectionsSudoApi { account: AccountId, ban_reason: Vec, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; /// Set openness of the elections. /// * `mode` - new elections openness mode @@ -132,7 +132,7 @@ pub trait ElectionsSudoApi { &self, mode: ElectionOpenness, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } #[async_trait::async_trait] @@ -241,7 +241,7 @@ impl ElectionsSudoApi for RootConnection { clean_session_counter_delay: Option, ban_period: Option, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Elections(set_ban_config { minimal_expected_performance, underperformed_session_count_threshold, @@ -258,7 +258,7 @@ impl ElectionsSudoApi for RootConnection { new_non_reserved_validators: Option>, committee_size: Option, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Elections(change_validators { reserved_validators: new_reserved_validators, non_reserved_validators: new_non_reserved_validators, @@ -273,7 +273,7 @@ impl ElectionsSudoApi for RootConnection { account: AccountId, ban_reason: Vec, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Elections(ban_from_committee { banned: account, ban_reason, @@ -285,7 +285,7 @@ impl ElectionsSudoApi for RootConnection { &self, mode: ElectionOpenness, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = Elections(set_elections_openness { openness: mode }); self.sudo_unchecked(call, status).await diff --git a/aleph-client/src/pallets/multisig.rs b/aleph-client/src/pallets/multisig.rs index 7fce899459..2032029e49 100644 --- a/aleph-client/src/pallets/multisig.rs +++ b/aleph-client/src/pallets/multisig.rs @@ -7,7 +7,7 @@ use sp_core::blake2_256; use sp_runtime::traits::TrailingZeroInput; use crate::{ - account_from_keypair, aleph_runtime::RuntimeCall, api, api::runtime_types, + account_from_keypair, aleph_runtime::RuntimeCall, api, api::runtime_types, connections::TxInfo, sp_weights::weight_v2::Weight, AccountId, BlockHash, ConnectionApi, SignedConnectionApi, TxStatus, }; @@ -42,7 +42,7 @@ pub trait MultisigUserApi { other_signatories: Vec, call: Call, status: TxStatus, - ) -> anyhow::Result; + ) -> 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, @@ -52,7 +52,7 @@ pub trait MultisigUserApi { max_weight: Weight, call: Call, status: TxStatus, - ) -> anyhow::Result; + ) -> 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, @@ -62,7 +62,7 @@ pub trait MultisigUserApi { max_weight: Weight, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result; + ) -> 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, @@ -71,7 +71,7 @@ pub trait MultisigUserApi { timepoint: Timepoint, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } #[async_trait::async_trait] @@ -81,7 +81,7 @@ impl MultisigUserApi for S { other_signatories: Vec, call: Call, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .multisig() .as_multi_threshold_1(other_signatories, call); @@ -97,7 +97,7 @@ impl MultisigUserApi for S { max_weight: Weight, call: Call, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().multisig().as_multi( threshold, other_signatories, @@ -117,7 +117,7 @@ impl MultisigUserApi for S { max_weight: Weight, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().multisig().approve_as_multi( threshold, other_signatories, @@ -136,7 +136,7 @@ impl MultisigUserApi for S { timepoint: Timepoint, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().multisig().cancel_as_multi( threshold, other_signatories, @@ -385,7 +385,7 @@ impl Context { #[async_trait::async_trait] pub trait MultisigContextualApi { /// Start signature aggregation for `party` and `call_hash`. Get `Context` object as a result - /// (together with standard block hash). + /// (together with standard tx coordinates). /// /// This is the recommended way of initialization. async fn initiate( @@ -394,9 +394,9 @@ pub trait MultisigContextualApi { max_weight: &Weight, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)>; + ) -> anyhow::Result<(TxInfo, Context)>; /// Start signature aggregation for `party` and `call`. Get `Context` object as a result - /// (together with standard block hash). + /// (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). @@ -406,7 +406,7 @@ pub trait MultisigContextualApi { max_weight: &Weight, call: Call, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)>; + ) -> anyhow::Result<(TxInfo, Context)>; /// Express contextual approval for the call hash. /// /// This is the recommended way for every intermediate approval. @@ -414,7 +414,7 @@ pub trait MultisigContextualApi { &self, context: Context, status: TxStatus, - ) -> anyhow::Result<(BlockHash, ContextAfterUse)>; + ) -> anyhow::Result<(TxInfo, ContextAfterUse)>; /// Express contextual approval for the `call`. /// /// This is the recommended way only for the final approval. @@ -423,13 +423,13 @@ pub trait MultisigContextualApi { context: Context, call: Option, status: TxStatus, - ) -> anyhow::Result<(BlockHash, ContextAfterUse)>; + ) -> anyhow::Result<(TxInfo, ContextAfterUse)>; /// Cancel signature aggregation. async fn cancel( &self, context: Context, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)>; + ) -> anyhow::Result<(TxInfo, Context)>; } #[async_trait::async_trait] @@ -440,10 +440,10 @@ impl MultisigContextualApi for S { max_weight: &Weight, call_hash: CallHash, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)> { + ) -> anyhow::Result<(TxInfo, Context)> { let other_signatories = ensure_signer_in_party(self, party)?; - let block_hash = self + let tx_info = self .approve_as_multi( party.threshold, other_signatories, @@ -461,11 +461,11 @@ impl MultisigContextualApi for S { // `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(block_hash)) + .get_timepoint(&party.account(), &call_hash, Some(tx_info.block_hash)) .await; Ok(( - block_hash, + tx_info, Context::new( party.clone(), self.account_id().clone(), @@ -483,10 +483,10 @@ impl MultisigContextualApi for S { max_weight: &Weight, call: Call, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)> { + ) -> anyhow::Result<(TxInfo, Context)> { let other_signatories = ensure_signer_in_party(self, party)?; - let block_hash = self + let tx_info = self .as_multi( party.threshold, other_signatories, @@ -499,11 +499,11 @@ impl MultisigContextualApi for S { let call_hash = compute_call_hash(&call); let timepoint = self - .get_timepoint(&party.account(), &call_hash, Some(block_hash)) + .get_timepoint(&party.account(), &call_hash, Some(tx_info.block_hash)) .await; Ok(( - block_hash, + tx_info, Context::new( party.clone(), self.account_id().clone(), @@ -519,7 +519,7 @@ impl MultisigContextualApi for S { &self, context: Context, status: TxStatus, - ) -> anyhow::Result<(BlockHash, ContextAfterUse)> { + ) -> anyhow::Result<(TxInfo, ContextAfterUse)> { let other_signatories = ensure_signer_in_party(self, &context.party)?; self.approve_as_multi( @@ -531,7 +531,7 @@ impl MultisigContextualApi for S { status, ) .await - .map(|block_hash| (block_hash, context.add_approval(self.account_id().clone()))) + .map(|tx_info| (tx_info, context.add_approval(self.account_id().clone()))) } async fn approve_with_call( @@ -539,7 +539,7 @@ impl MultisigContextualApi for S { mut context: Context, call: Option, status: TxStatus, - ) -> anyhow::Result<(BlockHash, ContextAfterUse)> { + ) -> anyhow::Result<(TxInfo, ContextAfterUse)> { let other_signatories = ensure_signer_in_party(self, &context.party)?; let call = match (call.as_ref(), context.call.as_ref()) { @@ -569,14 +569,14 @@ impl MultisigContextualApi for S { status, ) .await - .map(|block_hash| (block_hash, context.add_approval(self.account_id().clone()))) + .map(|tx_info| (tx_info, context.add_approval(self.account_id().clone()))) } async fn cancel( &self, context: Context, status: TxStatus, - ) -> anyhow::Result<(BlockHash, Context)> { + ) -> anyhow::Result<(TxInfo, Context)> { let other_signatories = ensure_signer_in_party(self, &context.party)?; ensure!( @@ -584,7 +584,7 @@ impl MultisigContextualApi for S { "Only the author can cancel multisig aggregation" ); - let block_hash = self + let tx_info = self .cancel_as_multi( context.party.threshold, other_signatories, @@ -594,7 +594,7 @@ impl MultisigContextualApi for S { ) .await?; - Ok((block_hash, context.close())) + Ok((tx_info, context.close())) } } diff --git a/aleph-client/src/pallets/session.rs b/aleph-client/src/pallets/session.rs index 4f2f2351e1..eaeda5937c 100644 --- a/aleph-client/src/pallets/session.rs +++ b/aleph-client/src/pallets/session.rs @@ -1,8 +1,8 @@ use primitives::SessionIndex; use crate::{ - api, api::runtime_types::aleph_runtime::SessionKeys, AccountId, BlockHash, ConnectionApi, - SignedConnectionApi, TxStatus, + api, api::runtime_types::aleph_runtime::SessionKeys, connections::TxInfo, AccountId, BlockHash, + ConnectionApi, SignedConnectionApi, TxStatus, }; /// Pallet session read-only api. @@ -26,7 +26,7 @@ pub trait SessionApi { #[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 fn set_keys(&self, new_keys: SessionKeys, status: TxStatus) -> anyhow::Result; } #[async_trait::async_trait] @@ -58,7 +58,7 @@ impl SessionApi for C { #[async_trait::async_trait] impl SessionUserApi for S { - async fn set_keys(&self, new_keys: SessionKeys, status: TxStatus) -> anyhow::Result { + 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 index 6008a19636..0ba312e626 100644 --- a/aleph-client/src/pallets/staking.rs +++ b/aleph-client/src/pallets/staking.rs @@ -9,7 +9,7 @@ use subxt::{ use crate::{ api, - connections::AsConnection, + connections::{AsConnection, TxInfo}, pallet_staking::{ pallet::pallet::{ Call::{bond, force_new_era, nominate, set_staking_configs}, @@ -88,14 +88,14 @@ pub trait StakingUserApi { initial_stake: Balance, controller_id: AccountId, status: TxStatus, - ) -> anyhow::Result; + ) -> 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; + ) -> 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( @@ -103,24 +103,24 @@ pub trait StakingUserApi { stash_account: AccountId, era: EraIndex, status: TxStatus, - ) -> anyhow::Result; + ) -> 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; + ) -> 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; + 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; + ) -> anyhow::Result; } /// Pallet staking logic, not directly related to any particular pallet call. @@ -174,7 +174,7 @@ pub trait StakingApiExt { accounts: &[(AccountId, AccountId)], stake: Balance, status: TxStatus, - ) -> anyhow::Result; + ) -> 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) @@ -186,14 +186,14 @@ pub trait StakingApiExt { &self, nominator_nominee_pairs: &[(AccountId, AccountId)], status: TxStatus, - ) -> anyhow::Result; + ) -> 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; + 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( @@ -203,7 +203,7 @@ pub trait StakingSudoApi { max_nominators_count: Option, max_validators_count: Option, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } /// Logic for retrieving raw storage keys or values from a pallet staking. @@ -317,7 +317,7 @@ impl StakingUserApi for S { initial_stake: Balance, controller_id: AccountId, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().staking().bond( MultiAddress::::Id(controller_id), initial_stake, @@ -331,7 +331,7 @@ impl StakingUserApi for S { &self, validator_commission_percentage: u8, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().staking().validate(ValidatorPrefs { commission: Perbill( SPerbill::from_percent(validator_commission_percentage as u32).deconstruct(), @@ -347,7 +347,7 @@ impl StakingUserApi for S { stash_account: AccountId, era: EraIndex, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().staking().payout_stakers(stash_account, era); self.send_tx(tx, status).await @@ -357,7 +357,7 @@ impl StakingUserApi for S { &self, nominee_account_id: AccountId, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .staking() .nominate(vec![MultiAddress::Id(nominee_account_id)]); @@ -365,7 +365,7 @@ impl StakingUserApi for S { self.send_tx(tx, status).await } - async fn chill(&self, status: TxStatus) -> anyhow::Result { + async fn chill(&self, status: TxStatus) -> anyhow::Result { let tx = api::tx().staking().chill(); self.send_tx(tx, status).await @@ -375,7 +375,7 @@ impl StakingUserApi for S { &self, extra_stake: Balance, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().staking().bond_extra(extra_stake); self.send_tx(tx, status).await @@ -384,7 +384,7 @@ impl StakingUserApi for S { #[async_trait::async_trait] impl StakingSudoApi for RootConnection { - async fn force_new_era(&self, status: TxStatus) -> anyhow::Result { + async fn force_new_era(&self, status: TxStatus) -> anyhow::Result { let call = Staking(force_new_era); self.sudo_unchecked(call, status).await @@ -397,7 +397,7 @@ impl StakingSudoApi for RootConnection { max_nominator_count: Option, max_validator_count: Option, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { fn convert(arg: Option) -> ConfigOp { match arg { Some(v) => Set(v), @@ -462,7 +462,7 @@ impl StakingApiExt for RootConnection { accounts: &[(AccountId, AccountId)], stake: Balance, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let calls = accounts .iter() .map(|(s, c)| { @@ -486,7 +486,7 @@ impl StakingApiExt for RootConnection { &self, nominator_nominee_pairs: &[(AccountId, AccountId)], status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let calls = nominator_nominee_pairs .iter() .map(|(nominator, nominee)| { diff --git a/aleph-client/src/pallets/system.rs b/aleph-client/src/pallets/system.rs index 10a9e792f8..6166759b8c 100644 --- a/aleph-client/src/pallets/system.rs +++ b/aleph-client/src/pallets/system.rs @@ -3,6 +3,7 @@ use subxt::ext::sp_runtime::Perbill as SPerbill; use crate::{ api, + connections::TxInfo, frame_system::pallet::Call::{fill_block, set_code}, sp_arithmetic::per_things::Perbill, AccountId, BlockHash, @@ -25,7 +26,7 @@ pub trait SystemApi { #[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 fn set_code(&self, code: Vec, status: TxStatus) -> anyhow::Result; /// A dispatch that will fill the block weight up to the given ratio. /// * `target_ratio_percent` - ratio to fill block @@ -34,12 +35,12 @@ pub trait SystemSudoApi { &self, target_ratio_percent: u8, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } #[async_trait::async_trait] impl SystemSudoApi for RootConnection { - async fn set_code(&self, code: Vec, status: TxStatus) -> anyhow::Result { + async fn set_code(&self, code: Vec, status: TxStatus) -> anyhow::Result { let call = System(set_code { code }); self.sudo_unchecked(call, status).await @@ -49,7 +50,7 @@ impl SystemSudoApi for RootConnection { &self, target_ratio_percent: u8, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let call = System(fill_block { ratio: Perbill(SPerbill::from_percent(target_ratio_percent as u32).deconstruct()), }); diff --git a/aleph-client/src/pallets/treasury.rs b/aleph-client/src/pallets/treasury.rs index ef4b4c4251..157ed4e9fd 100644 --- a/aleph-client/src/pallets/treasury.rs +++ b/aleph-client/src/pallets/treasury.rs @@ -5,7 +5,7 @@ use subxt::ext::sp_runtime::MultiAddress; use crate::{ api, - connections::AsConnection, + connections::{AsConnection, TxInfo}, pallet_treasury::pallet::Call::{approve_proposal, reject_proposal}, pallets::{elections::ElectionsApi, staking::StakingApi}, AccountId, BlockHash, @@ -37,13 +37,13 @@ pub trait TreasuryUserApi { amount: Balance, beneficiary: AccountId, status: TxStatus, - ) -> anyhow::Result; + ) -> 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; + 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; + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; } /// Pallet treasury funcionality that is not directly related to any pallet call. @@ -59,11 +59,11 @@ pub trait TreasureApiExt { 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; + 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 fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result; } #[async_trait::async_trait] @@ -92,7 +92,7 @@ impl TreasuryUserApi for S { amount: Balance, beneficiary: AccountId, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .treasury() .propose_spend(amount, MultiAddress::Id(beneficiary)); @@ -100,13 +100,13 @@ impl TreasuryUserApi for S { self.send_tx(tx, status).await } - async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + 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 { + 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 @@ -115,13 +115,13 @@ impl TreasuryUserApi for S { #[async_trait::async_trait] impl TreasurySudoApi for RootConnection { - async fn approve(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { + 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 { + async fn reject(&self, proposal_id: u32, status: TxStatus) -> anyhow::Result { let call = Treasury(reject_proposal { proposal_id }); self.sudo_unchecked(call, status).await diff --git a/aleph-client/src/pallets/utility.rs b/aleph-client/src/pallets/utility.rs index 974ca4bedd..77ac93999c 100644 --- a/aleph-client/src/pallets/utility.rs +++ b/aleph-client/src/pallets/utility.rs @@ -1,15 +1,15 @@ -use crate::{api, BlockHash, Call, SignedConnectionApi, TxStatus}; +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 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 { + 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 index 287ce17164..6b3171ac55 100644 --- a/aleph-client/src/pallets/vesting.rs +++ b/aleph-client/src/pallets/vesting.rs @@ -1,8 +1,8 @@ use subxt::ext::sp_runtime::MultiAddress; use crate::{ - api, pallet_vesting::vesting_info::VestingInfo, AccountId, BlockHash, ConnectionApi, - SignedConnectionApi, TxStatus, + api, connections::TxInfo, pallet_vesting::vesting_info::VestingInfo, AccountId, BlockHash, + ConnectionApi, SignedConnectionApi, TxStatus, }; /// Read only pallet vesting API. @@ -22,10 +22,10 @@ pub trait VestingApi { #[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; + 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; + 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( @@ -33,7 +33,7 @@ pub trait VestingUserApi { receiver: AccountId, schedule: VestingInfo, status: TxStatus, - ) -> anyhow::Result; + ) -> 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( @@ -41,7 +41,7 @@ pub trait VestingUserApi { idx1: u32, idx2: u32, status: TxStatus, - ) -> anyhow::Result; + ) -> anyhow::Result; } #[async_trait::async_trait] @@ -59,13 +59,13 @@ impl VestingApi for C { #[async_trait::async_trait] impl VestingUserApi for S { - async fn vest(&self, status: TxStatus) -> anyhow::Result { + 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 { + 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 @@ -76,7 +76,7 @@ impl VestingUserApi for S { receiver: AccountId, schedule: VestingInfo, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx() .vesting() .vested_transfer(MultiAddress::Id(receiver), schedule); @@ -89,7 +89,7 @@ impl VestingUserApi for S { idx1: u32, idx2: u32, status: TxStatus, - ) -> anyhow::Result { + ) -> anyhow::Result { let tx = api::tx().vesting().merge_schedules(idx1, idx2); self.send_tx(tx, status).await diff --git a/aleph-client/src/utility.rs b/aleph-client/src/utility.rs index 15821dbe9d..b68236fed5 100644 --- a/aleph-client/src/utility.rs +++ b/aleph-client/src/utility.rs @@ -1,10 +1,12 @@ +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, + connections::{AsConnection, TxInfo}, pallets::{elections::ElectionsApi, staking::StakingApi}, - BlockHash, + AlephConfig, BlockHash, }; /// Block info API. @@ -38,6 +40,9 @@ pub trait BlocksApi { &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. @@ -99,6 +104,27 @@ impl BlocksApi for C { 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(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] diff --git a/benches/payout-stakers/Cargo.lock b/benches/payout-stakers/Cargo.lock index 9b1dad9c35..0c42c14b3d 100644 --- a/benches/payout-stakers/Cargo.lock +++ b/benches/payout-stakers/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "aleph_client" -version = "2.6.0" +version = "2.8.0" dependencies = [ "anyhow", "async-trait", diff --git a/bin/cliain/Cargo.lock b/bin/cliain/Cargo.lock index 0bf160d3fc..959eb48e46 100644 --- a/bin/cliain/Cargo.lock +++ b/bin/cliain/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "aleph_client" -version = "2.7.0" +version = "2.8.0" dependencies = [ "anyhow", "async-trait", diff --git a/bin/cliain/src/contracts.rs b/bin/cliain/src/contracts.rs index 301968a502..cb6b939dad 100644 --- a/bin/cliain/src/contracts.rs +++ b/bin/cliain/src/contracts.rs @@ -58,7 +58,7 @@ pub async fn upload_code( .await }); - let _block_hash = signed_connection + let _tx_info = signed_connection .upload_code( wasm, storage_deposit(storage_deposit_limit), @@ -109,7 +109,7 @@ pub async fn instantiate( .await }); - let _block_hash = signed_connection + let _tx_info = signed_connection .instantiate( code_hash, balance, @@ -182,7 +182,7 @@ pub async fn instantiate_with_code( .await }); - let _block_hash = signed_connection + let _tx_info = signed_connection .instantiate_with_code( wasm, balance, @@ -227,7 +227,7 @@ pub async fn call( debug!("Encoded call data {:?}", data); - let _block_hash = signed_connection + let _tx_info = signed_connection .call( destination, balance, @@ -267,7 +267,7 @@ pub async fn remove_code( .await }); - let _block_hash = signed_connection + let _tx_info = signed_connection .remove_code(code_hash, TxStatus::InBlock) .await?; diff --git a/docker/docker-compose.base.yml b/docker/docker-compose.base.yml index 6a159a6f19..ca33551779 100644 --- a/docker/docker-compose.base.yml +++ b/docker/docker-compose.base.yml @@ -77,3 +77,19 @@ services: # 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 index b1303e4ca4..0f81315058 100644 --- a/docker/docker-compose.bridged.yml +++ b/docker/docker-compose.bridged.yml @@ -53,6 +53,17 @@ services: - 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 @@ -66,3 +77,5 @@ networks: name: Node3-network Node4: name: Node4-network + Node5: + name: Node5-network diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 154031e825..e07f6dfb98 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -30,3 +30,9 @@ services: 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/e2e-tests/Cargo.lock b/e2e-tests/Cargo.lock index 69fa1e40ed..2f89f24521 100644 --- a/e2e-tests/Cargo.lock +++ b/e2e-tests/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[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", ] @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "aleph-e2e-client" -version = "0.10.0" +version = "0.10.1" dependencies = [ "aleph_client", "anyhow", @@ -78,11 +78,11 @@ dependencies = [ [[package]] name = "aleph_client" -version = "2.6.0" +version = "2.8.0" dependencies = [ "anyhow", "async-trait", - "contract-metadata 2.0.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "contract-metadata 2.0.0-rc", "contract-transcode", "frame-support", "futures", @@ -159,9 +159,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "assert2" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1b167af16149cd41ff2b784bf511bb4208b21c3b05f3f61e30823ce3986361" +checksum = "01456b66bf7c5c8e9e86af730e50f313ba9458fcdd622b11571e3f8fd727ca5d" dependencies = [ "assert2-macros", "atty", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "assert2-macros" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ac27dd1c8f16b282d1c22a8a5ae17119acc757101dec79054458fef62c447e" +checksum = "45c77509bbd2708f7b3f02350c5481bf167f235aeba95e86fd12a2c6dfe6f61c" dependencies = [ "proc-macro2", "quote", @@ -192,9 +192,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.59" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" dependencies = [ "proc-macro2", "quote", @@ -220,9 +220,9 @@ 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", "cc", @@ -251,6 +251,12 @@ 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" @@ -286,9 +292,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest 0.10.6", ] @@ -373,9 +379,9 @@ checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-expr" @@ -460,8 +466,7 @@ checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "contract-metadata" version = "2.0.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bff7703529b16e9d8ba0d54e842b2051691772a822eb9bc130a91183ff9f6a6" +source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" dependencies = [ "anyhow", "impl-serde", @@ -473,8 +478,9 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "2.0.0-beta.1" -source = "git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899#7ca8c365fc1e157cd52901c54949b2faf1cd8899" +version = "2.0.0-rc" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180f2389a624fc4d0e70b207542a508d668e1261b73391bc228775e3f4c84535" dependencies = [ "anyhow", "impl-serde", @@ -490,7 +496,7 @@ 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 (git+https://github.com/paritytech/cargo-contract?rev=7ca8c365fc1e157cd52901c54949b2faf1cd8899)", + "contract-metadata 2.0.0-beta.1", "escape8259", "hex", "indexmap", @@ -652,9 +658,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" dependencies = [ "cc", "cxxbridge-flags", @@ -664,9 +670,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" dependencies = [ "cc", "codespan-reporting", @@ -679,15 +685,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" dependencies = [ "proc-macro2", "quote", @@ -818,9 +824,9 @@ 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" @@ -1328,9 +1334,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" [[package]] name = "group" @@ -1513,9 +1519,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", @@ -1746,30 +1752,30 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" dependencies = [ "libc", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "ipnet" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ "hermit-abi 0.2.6", "io-lifetimes", "rustix", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1783,9 +1789,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" @@ -1920,9 +1926,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[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" @@ -1937,7 +1943,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", @@ -1980,9 +1986,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", ] @@ -2116,9 +2122,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", ] @@ -2132,7 +2138,7 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -2233,9 +2239,9 @@ dependencies = [ [[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", @@ -2275,28 +2281,28 @@ 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 0.1.19", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "object" -version = "0.29.0" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "2b8c786513eb403643f2a88c244c2aaa270ef2153f55094587d0c48a3cf22a83" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "opaque-debug" @@ -2312,9 +2318,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.44" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if", @@ -2344,9 +2350,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.79" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5454462c0eced1e97f2ec09036abc8da362e66802f66fd20f86854d9d8cbcbc4" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -2571,22 +2577,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys", ] [[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" @@ -2732,18 +2738,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] [[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", ] @@ -2853,11 +2859,10 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "crossbeam-deque", "either", "rayon-core", ] @@ -2885,18 +2890,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", @@ -2905,9 +2910,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", @@ -2944,7 +2949,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ - "base64", + "base64 0.13.1", "bytes", "encoding_rs", "futures-core", @@ -3045,14 +3050,14 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.42.0", + "windows-sys", ] [[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", @@ -3074,24 +3079,24 @@ 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" +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 = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "scale-bits" @@ -3161,12 +3166,11 @@ 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", ] [[package]] @@ -3195,9 +3199,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "sct" @@ -3224,9 +3228,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" dependencies = [ "secp256k1-sys", ] @@ -3465,7 +3469,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.1", "bytes", "futures", "httparse", @@ -4294,9 +4298,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.35.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0813c10b9dbdc842c2305f949f724c64866e4ef4d09c9151e96f6a2106773c" +checksum = "d44528162f980c0e03c71e005d334332c8da0aec9f2b0b4bdc557ed4a9f24776" dependencies = [ "Inflector", "num-format", @@ -4426,9 +4430,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -4493,18 +4497,18 @@ dependencies = [ [[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", @@ -4556,9 +4560,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.23.0" +version = "1.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" +checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" dependencies = [ "autocfg", "bytes", @@ -4571,7 +4575,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -4623,9 +4627,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] @@ -4736,15 +4740,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" @@ -4760,9 +4764,9 @@ dependencies = [ [[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" @@ -4784,9 +4788,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[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" @@ -4994,9 +4998,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ "webpki", ] @@ -5032,19 +5036,6 @@ 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" @@ -5052,85 +5043,55 @@ 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", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc", ] [[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.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[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" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -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" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -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.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -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" diff --git a/e2e-tests/Cargo.toml b/e2e-tests/Cargo.toml index 2f78045ad2..7f027d28a5 100644 --- a/e2e-tests/Cargo.toml +++ b/e2e-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-e2e-client" -version = "0.10.0" +version = "0.10.1" edition = "2021" license = "Apache 2.0" diff --git a/e2e-tests/src/config.rs b/e2e-tests/src/config.rs index 10d781bd4f..b79b27de74 100644 --- a/e2e-tests/src/config.rs +++ b/e2e-tests/src/config.rs @@ -86,7 +86,7 @@ impl Config { RootConnection::new(&self.node, sudo_keypair).await.unwrap() } - pub fn validator_names<'a>(&'a self) -> Vec { + pub fn validator_names(&self) -> Vec { (0..self.validator_count) .map(|id| format!("Node{}", id)) .collect() diff --git a/e2e-tests/src/test/electing_validators.rs b/e2e-tests/src/test/electing_validators.rs index 59bdfc65b7..d5767ad998 100644 --- a/e2e-tests/src/test/electing_validators.rs +++ b/e2e-tests/src/test/electing_validators.rs @@ -15,7 +15,7 @@ use primitives::EraIndex; use crate::{ config::setup_test, - validators::{prepare_validators, setup_accounts}, + validators::{get_controller_connections_to_nodes, prepare_validators, setup_accounts}, }; /// Verify that `pallet_staking::ErasStakers` contains all target validators. @@ -179,7 +179,10 @@ pub async fn authorities_are_staking() -> anyhow::Result<()> { let desired_validator_count = reserved_seats + non_reserved_seats; let accounts = setup_accounts(desired_validator_count); - prepare_validators(&root_connection, node, &accounts).await?; + 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(); diff --git a/e2e-tests/src/test/fee.rs b/e2e-tests/src/test/fee.rs index 8bafab4b93..5f32204251 100644 --- a/e2e-tests/src/test/fee.rs +++ b/e2e-tests/src/test/fee.rs @@ -1,8 +1,8 @@ use aleph_client::{ api::transaction_payment::events::TransactionFeePaid, pallets::{balances::BalanceUserApi, fee::TransactionPaymentApi, system::SystemSudoApi}, - waiting::{AlephWaiting, BlockStatus}, - AccountId, RootConnection, SignedConnection, SignedConnectionApi, TxStatus, + utility::BlocksApi, + AccountId, RootConnection, SignedConnection, TxStatus, }; use log::info; use primitives::Balance; @@ -107,31 +107,16 @@ pub async fn current_fees( ) -> (Balance, u128) { let actual_multiplier = connection.get_next_fee_multiplier(None).await; - let waiting_connection = connection.clone(); - let signer = connection.account_id().clone(); - let event_handle = tokio::spawn(async move { - waiting_connection - .wait_for_event( - |e: &TransactionFeePaid| e.who == signer, - BlockStatus::Finalized, - ) - .await - }); - match tip { - None => { - connection - .transfer(to, transfer_value, TxStatus::Finalized) - .await - .unwrap(); - } - Some(tip) => { - connection - .transfer_with_tip(to, transfer_value, tip, TxStatus::Finalized) - .await - .unwrap(); - } + 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), } - let event = event_handle.await.unwrap(); + .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); diff --git a/e2e-tests/src/validators.rs b/e2e-tests/src/validators.rs index 850dbad40f..3a6c6dab54 100644 --- a/e2e-tests/src/validators.rs +++ b/e2e-tests/src/validators.rs @@ -108,6 +108,7 @@ pub async fn prepare_validators( connection: &S, node: &str, accounts: &Accounts, + controller_connections: Vec, ) -> anyhow::Result<()> { connection .batch_transfer( @@ -138,9 +139,8 @@ pub async fn prepare_validators( })); } - for controller in accounts.controller_raw_keys.iter() { + for connection in controller_connections { let keys = connection.author_rotate_keys().await?; - let connection = SignedConnection::new(node, KeyPair::new(controller.clone())).await; handles.push(tokio::spawn(async move { connection .set_keys(keys, TxStatus::Finalized) @@ -153,3 +153,28 @@ pub async fn prepare_validators( 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/src/justification/requester.rs b/finality-aleph/src/justification/requester.rs index 1bc4595df9..f9eb221a79 100644 --- a/finality-aleph/src/justification/requester.rs +++ b/finality-aleph/src/justification/requester.rs @@ -60,6 +60,14 @@ impl JustificationRequestStatus { } } + 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.block_tries >= self.report_threshold || self.children_tries >= self.report_threshold } @@ -166,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); diff --git a/flooder/Cargo.lock b/flooder/Cargo.lock index 7abb059b74..531c491c17 100644 --- a/flooder/Cargo.lock +++ b/flooder/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "aleph_client" -version = "2.6.0" +version = "2.8.0" dependencies = [ "anyhow", "async-trait", 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"))