From 3078ccd0e5491650ce65788f2cdd76be137a3959 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Wed, 17 Mar 2021 22:09:58 +0100 Subject: [PATCH 01/15] feat: added initial configuration of cargo-spellcheck --- .config/lingua.dic | 88 +++++++++++++++++++++++++++++++++++++++++ .config/spellcheck.toml | 12 ++++++ 2 files changed, 100 insertions(+) create mode 100644 .config/lingua.dic create mode 100644 .config/spellcheck.toml diff --git a/.config/lingua.dic b/.config/lingua.dic new file mode 100644 index 00000000000..aac002dc86d --- /dev/null +++ b/.config/lingua.dic @@ -0,0 +1,88 @@ +90 +annualised/MS +Apache-2.0/M +api/SM +API/SM +APIs +async +BFT/M +bitfield/MS +blake2/MS +blockchain/MS +borked +BTC/S +CLI/MS +config/MS +crypto/MS +customizable/B +debian/M +decodable/MS +DOT/S +ed25519 +enum/MS +ERC-20 +ethereum/MS +externality/MS +extrinsic/MS +extrinsics +fedora/M +GiB/S +GPL/M +GPLv3/M +Handler/MS +https +inherent/MS +initialize/RG +instantiate/B +intrinsic/MS +intrinsics +io +js +keccak256/M +KSM/S +kusama/S +KYC/M +merkle/MS +misbehavior/SM +misbehaviors +MIT/M +multivalidator/SM +oneshot/MS +others' +parablock/MS +parachain/MS +parameterize/D +polkadot/MS +pov-block/MS +PoV/MS +promethius +promethius' +provisioner/MS +redhat/M +repo/MS +RPC/MS +runtime/MS +rustc/MS +sr25519 +struct/MS +subsystem/MS +subsystems' +taskmanager/MS +teleport/RG +teleportation/SM +teleporter/SM +teleporters +testnet/MS +trie/MS +trustless/Y +ubuntu/M +union/MSG +unservable/B +validator/SM +w3f/MS +wasm/M +WND/S +XCM/S +XCMP/M +include/BG +isolate/BG diff --git a/.config/spellcheck.toml b/.config/spellcheck.toml new file mode 100644 index 00000000000..0e7d6b1309b --- /dev/null +++ b/.config/spellcheck.toml @@ -0,0 +1,12 @@ +[hunspell] +lang = "en_US" +search_dirs = ["."] +extra_dictionaries = ["lingua.dic"] + +[hunspell.quirks] +# `Type`'s +# 5x +# He tagged it as 'TheGreatestOfAllTimes' +transform_regex = ["^'([^\\s])'$", "^[0-9]+(?:\\.[0-9]*)?x$", "^'s$", "^\\+$"] +allow_concatenation = true +allow_dashes = true From 93fea8c28a7ce83706accf568f8fa75dca28ca30 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Wed, 17 Mar 2021 22:25:40 +0100 Subject: [PATCH 02/15] feat: added initial configuration of cargo-spellcheck --- .config/spellcheck.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/.config/spellcheck.toml b/.config/spellcheck.toml index 0e7d6b1309b..31dc5495e51 100644 --- a/.config/spellcheck.toml +++ b/.config/spellcheck.toml @@ -6,7 +6,6 @@ extra_dictionaries = ["lingua.dic"] [hunspell.quirks] # `Type`'s # 5x -# He tagged it as 'TheGreatestOfAllTimes' transform_regex = ["^'([^\\s])'$", "^[0-9]+(?:\\.[0-9]*)?x$", "^'s$", "^\\+$"] allow_concatenation = true allow_dashes = true From 8f65bf9e642c8aeb81caf8b068de3f47dc1c9196 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Wed, 7 Apr 2021 20:05:26 +0200 Subject: [PATCH 03/15] feat: added specific words for a bridge --- .config/lingua.dic | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.config/lingua.dic b/.config/lingua.dic index aac002dc86d..6987b957f89 100644 --- a/.config/lingua.dic +++ b/.config/lingua.dic @@ -86,3 +86,5 @@ XCM/S XCMP/M include/BG isolate/BG +Rialto +Millau From 159663817bca52565689b98ee78479c710a731cb Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 15 Apr 2021 13:13:08 +0200 Subject: [PATCH 04/15] feat(configuration): added cargo-spellcheck to CI as a new job --- .github/workflows/lint.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4ebd12e0d6f..000ae758de7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -41,3 +41,14 @@ jobs: with: command: fmt args: --all -- --check + check-spellcheck: + name: Check For Spelling and/or Grammar Mistakes + runs-on: ubuntu-latest + env: + RUST_BACKTRACE: full + steps: + - name: Add cargo-spellcheck + run: rustup component add cargo-spellcheck + + - name: Run cargo-spellcheck + run: cargo spellcheck check From 56d71876290cd5a22eeea3b4a198c6a41d2b70ee Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 15 Apr 2021 13:23:17 +0200 Subject: [PATCH 05/15] Update .github/workflows/lint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomasz Drwięga --- .github/workflows/lint.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 000ae758de7..3540b3cb451 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -47,8 +47,22 @@ jobs: env: RUST_BACKTRACE: full steps: - - name: Add cargo-spellcheck + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.4.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources & submodules + uses: actions/checkout@master + with: + fetch-depth: 5 + submodules: recursive + + - name: Add rustfmt run: rustup component add cargo-spellcheck - - - name: Run cargo-spellcheck - run: cargo spellcheck check + + - name: rust-fmt check + uses: actions-rs/cargo@master + with: + command: spellcheck + args: check From 57419c250a1e6558ff4985f1da967d1199d87b28 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 15 Apr 2021 13:27:13 +0200 Subject: [PATCH 06/15] feat(config): change a way to install cargo-spellcheck on CI --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3540b3cb451..8624cb97f11 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -58,8 +58,8 @@ jobs: fetch-depth: 5 submodules: recursive - - name: Add rustfmt - run: rustup component add cargo-spellcheck + - name: Add cargo-spellcheck + run: cargo install cargo-spellcheck - name: rust-fmt check uses: actions-rs/cargo@master From 486a96ff1a438b698281f0ce3fed4187fc8bc3bf Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 15 Apr 2021 13:33:37 +0200 Subject: [PATCH 07/15] feat(configuration): better naming for the job: "Run spellcheck" --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8624cb97f11..e646b035349 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -61,7 +61,7 @@ jobs: - name: Add cargo-spellcheck run: cargo install cargo-spellcheck - - name: rust-fmt check + - name: Run spellcheck uses: actions-rs/cargo@master with: command: spellcheck From 53cc84b3918c4d9665415fb392277eb818b3a49d Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 15 Apr 2021 19:23:41 +0200 Subject: [PATCH 08/15] Update .github/workflows/lint.yml Co-authored-by: Hernando Castano --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e646b035349..869c845a4e7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -65,4 +65,4 @@ jobs: uses: actions-rs/cargo@master with: command: spellcheck - args: check + args: check -m 1 From 214824643cad49c531d169d68cff945288ffea90 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 14:18:32 +0200 Subject: [PATCH 09/15] feat(config): added: to increase verbosity add -v (multiple) to increase verbosity. --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 869c845a4e7..bc6bbe3f8fd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -65,4 +65,4 @@ jobs: uses: actions-rs/cargo@master with: command: spellcheck - args: check -m 1 + args: check -m 1 -v From 1e3947aebc83dbe49af67a103d916afe33bfafef Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 15:21:02 +0200 Subject: [PATCH 10/15] feat(config): added: to increase verbosity add -vv (multiple) to increase verbosity. - enable debug mode --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bc6bbe3f8fd..0f858e24f6f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -65,4 +65,4 @@ jobs: uses: actions-rs/cargo@master with: command: spellcheck - args: check -m 1 -v + args: check -m 1 -vv From 2c9748ee630b9b105f16767f73deb2c083ec6c7c Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 17:56:15 +0200 Subject: [PATCH 11/15] feat(config): first batch of real changes --- .config/lingua.dic | 19 +++++++++++++++++++ bin/millau/node/src/chain_spec.rs | 2 +- bin/millau/node/src/cli.rs | 2 +- bin/millau/runtime/src/lib.rs | 2 +- bin/rialto/runtime/src/exchange.rs | 2 +- modules/currency-exchange/src/lib.rs | 2 +- primitives/currency-exchange/src/lib.rs | 2 +- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.config/lingua.dic b/.config/lingua.dic index 6987b957f89..66652476e3d 100644 --- a/.config/lingua.dic +++ b/.config/lingua.dic @@ -1,10 +1,14 @@ 90 annualised/MS Apache-2.0/M +AccountId/MS api/SM +auth +auths/SM API/SM APIs async +BlockId BFT/M bitfield/MS blake2/MS @@ -12,6 +16,8 @@ blockchain/MS borked BTC/S CLI/MS +ChainSpec +ChainTime config/MS crypto/MS customizable/B @@ -36,17 +42,23 @@ initialize/RG instantiate/B intrinsic/MS intrinsics +isn't io js keccak256/M KSM/S +LaneId kusama/S KYC/M +Kovan merkle/MS +MessageNonce misbehavior/SM misbehaviors +MIN_SIZE MIT/M multivalidator/SM +natively oneshot/MS others' parablock/MS @@ -54,6 +66,7 @@ parachain/MS parameterize/D polkadot/MS pov-block/MS +PoA PoV/MS promethius promethius' @@ -63,7 +76,11 @@ repo/MS RPC/MS runtime/MS rustc/MS +ServiceFactory/MS +SignedExtension +SIZE_FACTOR sr25519 +SS58 struct/MS subsystem/MS subsystems' @@ -77,8 +94,10 @@ trie/MS trustless/Y ubuntu/M union/MSG +unfinalized unservable/B validator/SM +verifier w3f/MS wasm/M WND/S diff --git a/bin/millau/node/src/chain_spec.rs b/bin/millau/node/src/chain_spec.rs index 8e9aded9f11..f8840abb5e5 100644 --- a/bin/millau/node/src/chain_spec.rs +++ b/bin/millau/node/src/chain_spec.rs @@ -24,7 +24,7 @@ use sp_core::{sr25519, Pair, Public}; use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; -/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. +/// Specialized `ChainSpec`. This is a specialization of the general Substrate Chain-specChain-spec type. pub type ChainSpec = sc_service::GenericChainSpec; /// The chain specification option. This is expected to come in from the CLI and diff --git a/bin/millau/node/src/cli.rs b/bin/millau/node/src/cli.rs index c1d42a1f21b..6bda08c64dd 100644 --- a/bin/millau/node/src/cli.rs +++ b/bin/millau/node/src/cli.rs @@ -29,7 +29,7 @@ pub struct Cli { /// Possible subcommands of the main binary. #[derive(Debug, StructOpt)] pub enum Subcommand { - /// Key management cli utilities + /// Key management CLI utilities Key(sc_cli::KeySubcommand), /// Verify a signature for a message, provided on STDIN, with a given (public or secret) key. diff --git a/bin/millau/runtime/src/lib.rs b/bin/millau/runtime/src/lib.rs index 87d5ab87143..8b86cfe9066 100644 --- a/bin/millau/runtime/src/lib.rs +++ b/bin/millau/runtime/src/lib.rs @@ -236,7 +236,7 @@ parameter_types! { } impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. + /// A timestamp: milliseconds since the UNIX epoch. type Moment = u64; type OnTimestampSet = Aura; type MinimumPeriod = MinimumPeriod; diff --git a/bin/rialto/runtime/src/exchange.rs b/bin/rialto/runtime/src/exchange.rs index ac67a6c446b..5e2500ebd3d 100644 --- a/bin/rialto/runtime/src/exchange.rs +++ b/bin/rialto/runtime/src/exchange.rs @@ -65,7 +65,7 @@ pub struct EthereumTransactionTag { pub nonce: sp_core::U256, } -/// Eth transaction from runtime perspective. +/// Ethereum transaction from runtime perspective. pub struct EthTransaction; impl MaybeLockFundsTransaction for EthTransaction { diff --git a/modules/currency-exchange/src/lib.rs b/modules/currency-exchange/src/lib.rs index bd48e6c8a20..f6f7346fbbc 100644 --- a/modules/currency-exchange/src/lib.rs +++ b/modules/currency-exchange/src/lib.rs @@ -70,7 +70,7 @@ decl_error! { InvalidRecipient, /// Cannot map from peer recipient to this blockchain recipient. FailedToMapRecipients, - /// Failed to convert from peer blockchain currency to this blockhain currency. + /// Failed to convert from peer blockchain currency to this blockchain currency. FailedToConvertCurrency, /// Deposit has failed. DepositFailed, diff --git a/primitives/currency-exchange/src/lib.rs b/primitives/currency-exchange/src/lib.rs index 131daf66eda..0f7d1cf3ba0 100644 --- a/primitives/currency-exchange/src/lib.rs +++ b/primitives/currency-exchange/src/lib.rs @@ -36,7 +36,7 @@ pub enum Error { InvalidRecipient, /// Cannot map from peer recipient to this blockchain recipient. FailedToMapRecipients, - /// Failed to convert from peer blockchain currency to this blockhain currency. + /// Failed to convert from peer blockchain currency to this blockchain currency. FailedToConvertCurrency, /// Deposit has failed. DepositFailed, From 13e6331506a57d18a0ca8156ca156cb24539b0de Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 21:12:46 +0200 Subject: [PATCH 12/15] feat(config): second batch of real changes --- .config/lingua.dic | 69 ++++++++++++++++++- bin/rialto/node/src/cli.rs | 2 +- bin/rialto/runtime/src/exchange.rs | 2 +- bin/rialto/runtime/src/lib.rs | 2 +- bin/runtime-common/src/messages.rs | 2 +- docs/high-level-overview.md | 2 +- docs/testing-scenarios.md | 2 +- modules/call-dispatch/src/lib.rs | 4 +- modules/ethereum-contract-builtin/src/lib.rs | 4 +- modules/ethereum/src/finality.rs | 4 +- modules/ethereum/src/import.rs | 2 +- modules/ethereum/src/lib.rs | 2 +- modules/ethereum/src/test_utils.rs | 2 +- modules/ethereum/src/verification.rs | 2 +- modules/finality-verifier/src/lib.rs | 6 +- modules/message-lane/src/benchmarking.rs | 2 +- modules/message-lane/src/instant_payments.rs | 6 +- modules/message-lane/src/lib.rs | 10 +-- modules/message-lane/src/weights_ext.rs | 10 +-- modules/substrate/src/fork_tests.rs | 8 +-- modules/substrate/src/lib.rs | 6 +- modules/substrate/src/verifier.rs | 2 +- primitives/chains/kusama/src/lib.rs | 4 +- primitives/chains/millau/src/lib.rs | 6 +- primitives/chains/polkadot/src/lib.rs | 4 +- primitives/chains/rialto/src/lib.rs | 6 +- primitives/chains/rococo/src/lib.rs | 4 +- primitives/chains/westend/src/lib.rs | 4 +- primitives/ethereum-poa/src/lib.rs | 4 +- primitives/header-chain/src/justification.rs | 2 +- primitives/message-lane/src/lib.rs | 10 +-- primitives/message-lane/src/source_chain.rs | 6 +- primitives/message-lane/src/target_chain.rs | 2 +- primitives/polkadot-core/src/lib.rs | 6 +- primitives/runtime/src/lib.rs | 6 +- relays/clients/ethereum/src/sign.rs | 2 +- relays/clients/substrate/src/client.rs | 2 +- relays/clients/substrate/src/guard.rs | 2 +- relays/ethereum/src/ethereum_client.rs | 2 +- relays/ethereum/src/rialto_client.rs | 8 +-- relays/generic/exchange/src/exchange.rs | 2 +- relays/generic/headers/src/headers.rs | 10 +-- relays/generic/headers/src/sync.rs | 12 ++-- relays/generic/headers/src/sync_loop.rs | 2 +- relays/generic/messages/src/lib.rs | 2 +- .../generic/messages/src/message_lane_loop.rs | 8 +-- .../messages/src/message_race_delivery.rs | 6 +- .../generic/messages/src/message_race_loop.rs | 14 ++-- .../messages/src/message_race_receiving.rs | 2 +- .../messages/src/message_race_strategy.rs | 2 +- relays/generic/messages/src/metrics.rs | 8 +-- relays/generic/utils/src/relay_loop.rs | 2 +- relays/substrate/src/cli.rs | 2 +- relays/substrate/src/messages_lane.rs | 10 +-- 54 files changed, 190 insertions(+), 123 deletions(-) diff --git a/.config/lingua.dic b/.config/lingua.dic index 66652476e3d..a31ecf2c7bd 100644 --- a/.config/lingua.dic +++ b/.config/lingua.dic @@ -7,23 +7,35 @@ auth auths/SM API/SM APIs +arg +args +aren async +Best/MS BlockId BFT/M bitfield/MS blake2/MS blockchain/MS borked +BridgeStorage +BlockNumber BTC/S CLI/MS +Chain1 +Chain2 ChainSpec ChainTime +chain_getBlock +choosen config/MS crypto/MS customizable/B debian/M decodable/MS DOT/S +doesn +dispatchables ed25519 enum/MS ERC-20 @@ -32,58 +44,98 @@ externality/MS extrinsic/MS extrinsics fedora/M +FN +FinalizationError GiB/S GPL/M GPLv3/M Handler/MS +HeaderA +HeaderId https +implementers inherent/MS initialize/RG instantiate/B intrinsic/MS intrinsics -isn't +InitiateChange +isn io js keccak256/M KSM/S +Lane1 +Lane2 +Lane3 LaneId kusama/S KYC/M +keccak Kovan merkle/MS MessageNonce +MessageNonces +Merklized +MaybeOrphan +MaybeExtra +MetricsParams +MessagePayload misbehavior/SM misbehaviors MIN_SIZE MIT/M +max_value multivalidator/SM natively +OldHeader +nonces +number +no_std +ok oneshot/MS others' +OutboundMessages parablock/MS parachain/MS parameterize/D +pallet_message_lane polkadot/MS pov-block/MS PoA PoV/MS +precommit promethius promethius' +prune_end +prune_depth provisioner/MS redhat/M repo/MS +receival RPC/MS +RLP runtime/MS +Runtime1 +Runtime2 rustc/MS ServiceFactory/MS SignedExtension SIZE_FACTOR sr25519 SS58 +SS58Prefix +src +S|N +SURI +source struct/MS +Submitter1 +submitters/MS subsystem/MS subsystems' +shouldn +synchronizer taskmanager/MS teleport/RG teleportation/SM @@ -92,10 +144,18 @@ teleporters testnet/MS trie/MS trustless/Y +ThisChain +TCP ubuntu/M union/MSG +undeliverable unfinalized +unpruned unservable/B +unsynced +ve +vec +Vec validator/SM verifier w3f/MS @@ -105,5 +165,12 @@ XCM/S XCMP/M include/BG isolate/BG +Instance1 +Instance2 +Instance42 +Pre Rialto +stringified +Stringified +millau Millau diff --git a/bin/rialto/node/src/cli.rs b/bin/rialto/node/src/cli.rs index c1d42a1f21b..6bda08c64dd 100644 --- a/bin/rialto/node/src/cli.rs +++ b/bin/rialto/node/src/cli.rs @@ -29,7 +29,7 @@ pub struct Cli { /// Possible subcommands of the main binary. #[derive(Debug, StructOpt)] pub enum Subcommand { - /// Key management cli utilities + /// Key management CLI utilities Key(sc_cli::KeySubcommand), /// Verify a signature for a message, provided on STDIN, with a given (public or secret) key. diff --git a/bin/rialto/runtime/src/exchange.rs b/bin/rialto/runtime/src/exchange.rs index 5e2500ebd3d..52015bae67f 100644 --- a/bin/rialto/runtime/src/exchange.rs +++ b/bin/rialto/runtime/src/exchange.rs @@ -55,7 +55,7 @@ pub struct EthereumTransactionInclusionProof { /// /// The assumption is that this pair will never appear more than once in /// transactions included into finalized blocks. This is obviously true -/// for any existing eth-like chain (that keep current tx format), because +/// for any existing eth-like chain (that keep current TX format), because /// otherwise transaction can be replayed over and over. #[derive(Encode, Decode, PartialEq, RuntimeDebug)] pub struct EthereumTransactionTag { diff --git a/bin/rialto/runtime/src/lib.rs b/bin/rialto/runtime/src/lib.rs index 0674965da50..43c48125e5c 100644 --- a/bin/rialto/runtime/src/lib.rs +++ b/bin/rialto/runtime/src/lib.rs @@ -343,7 +343,7 @@ parameter_types! { } impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. + /// A timestamp: milliseconds since the UNIX epoch. type Moment = u64; type OnTimestampSet = Aura; type MinimumPeriod = MinimumPeriod; diff --git a/bin/runtime-common/src/messages.rs b/bin/runtime-common/src/messages.rs index c69b2073d7d..1c630cf02d9 100644 --- a/bin/runtime-common/src/messages.rs +++ b/bin/runtime-common/src/messages.rs @@ -503,7 +503,7 @@ pub mod target { /// Verify proof of Bridged -> This chain messages. /// /// The `messages_count` argument verification (sane limits) is supposed to be made - /// outside of this function. This function only verifies that the proof declares exactly + /// outside this function. This function only verifies that the proof declares exactly /// `messages_count` messages. pub fn verify_messages_proof( proof: FromBridgedChainMessagesProof>>, diff --git a/docs/high-level-overview.md b/docs/high-level-overview.md index 763371bbf19..9f741deaa4c 100644 --- a/docs/high-level-overview.md +++ b/docs/high-level-overview.md @@ -110,7 +110,7 @@ Users of the pallet add their messages to an "outbound lane" on the source chain finalized message relayers are responsible for reading the current queue of messages and submitting some (or all) of them to the "inbound lane" of the target chain. Each message has a `nonce` associated with it, which serves as the ordering of messages. The inbound lane stores the last -delivered nonce to prevent replaying messages. To succesfuly deliver the message to the inbound lane +delivered nonce to prevent replaying messages. To successfully deliver the message to the inbound lane on target chain the relayer has to present present a storage proof which shows that the message was part of the outbound lane on the source chain. diff --git a/docs/testing-scenarios.md b/docs/testing-scenarios.md index da2e9c0b432..1a6a2a4a912 100644 --- a/docs/testing-scenarios.md +++ b/docs/testing-scenarios.md @@ -91,7 +91,7 @@ kCharlie. 1. Relayer prepares transaction which delivers `B1` and with all of the missing ancestors to the target chain (one header per transaction). -1. After the transaction is succesfully dispatched the Polkadot on-chain light client of the Kusama +1. After the transaction is successfully dispatched the Polkadot on-chain light client of the Kusama chain learns about block `B1` - it is stored in the on-chain storage. ### Syncing finality loop diff --git a/modules/call-dispatch/src/lib.rs b/modules/call-dispatch/src/lib.rs index 3f6bf632a2b..444301fd34b 100644 --- a/modules/call-dispatch/src/lib.rs +++ b/modules/call-dispatch/src/lib.rs @@ -19,7 +19,7 @@ //! The messages are interpreted directly as runtime `Call`. We attempt to decode //! them and then dispatch as usual. To prevent compatibility issues, the Calls have //! to include a `spec_version`. This will be checked before dispatch. In the case of -//! a succesful dispatch an event is emitted. +//! a successful dispatch an event is emitted. #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] @@ -56,7 +56,7 @@ pub enum CallOrigin { /// best finalized. pub stopped_at_finalized_sibling: bool, /// Header ancestors that were read while we have been searching for - /// cached votes entry. Newest header has index 0. + /// cached votes entry. The newest header has index 0. pub unaccounted_ancestry: VecDeque<(HeaderId, Option, AuraHeader)>, /// Cached finality votes, if they have been found. The associated /// header is not included into `unaccounted_ancestry`. @@ -59,7 +59,7 @@ pub struct FinalityEffects { pub struct FinalityVotes { /// Number of votes per each validator. pub votes: BTreeMap, - /// Ancestry blocks with oldest ancestors at the beginning and newest at the + /// Ancestry blocks with the oldest ancestors at the beginning and newest at the /// end of the queue. pub ancestry: VecDeque>, } diff --git a/modules/ethereum/src/import.rs b/modules/ethereum/src/import.rs index 1b41c3a8b20..0d249332e7b 100644 --- a/modules/ethereum/src/import.rs +++ b/modules/ethereum/src/import.rs @@ -22,7 +22,7 @@ use crate::{AuraConfiguration, ChainTime, ChangeToEnact, PruningStrategy, Storag use bp_eth_poa::{AuraHeader, HeaderId, Receipt}; use sp_std::{collections::btree_map::BTreeMap, prelude::*}; -/// Imports bunch of headers and updates blocks finality. +/// Imports a bunch of headers and updates blocks finality. /// /// Transactions receipts must be provided if `header_import_requires_receipts()` /// has returned true. diff --git a/modules/ethereum/src/lib.rs b/modules/ethereum/src/lib.rs index fd08ba0da6f..674bd38d73b 100644 --- a/modules/ethereum/src/lib.rs +++ b/modules/ethereum/src/lib.rs @@ -169,7 +169,7 @@ struct PruningRange { /// were unable to prune for whatever reason (i.e. if it isn't finalized yet and has /// scheduled validators set change). pub oldest_unpruned_block: u64, - /// Number of oldest block(s) that we want to keep. We want to prune blocks in range + /// Number of the oldest block(s) that we want to keep. We want to prune blocks in range /// [`oldest_unpruned_block`; `oldest_block_to_keep`). pub oldest_block_to_keep: u64, } diff --git a/modules/ethereum/src/test_utils.rs b/modules/ethereum/src/test_utils.rs index ad401941289..98305a2e637 100644 --- a/modules/ethereum/src/test_utils.rs +++ b/modules/ethereum/src/test_utils.rs @@ -19,7 +19,7 @@ //! Although the name implies that it is used by tests, it shouldn't be be used _directly_ by tests. //! Instead these utilities should be used by the Mock runtime, which in turn is used by tests. //! -//! On the other hand, they may be used directly by the bechmarking module. +//! On the other hand, they may be used directly by the benchmarking module. // Since this is test code it's fine that not everything is used #![allow(dead_code)] diff --git a/modules/ethereum/src/verification.rs b/modules/ethereum/src/verification.rs index 7b1f175f542..6b1aaeb7e67 100644 --- a/modules/ethereum/src/verification.rs +++ b/modules/ethereum/src/verification.rs @@ -43,7 +43,7 @@ pub fn is_importable_header(storage: &S, header: &AuraHeader) -> Res Ok((id, finalized_id)) } -/// Try accept unsigned aura header into transaction pool. +/// Try to accept unsigned aura header into transaction pool. /// /// Returns required and provided tags. pub fn accept_aura_header_into_pool( diff --git a/modules/finality-verifier/src/lib.rs b/modules/finality-verifier/src/lib.rs index 0f450273a11..0e38b948ec3 100644 --- a/modules/finality-verifier/src/lib.rs +++ b/modules/finality-verifier/src/lib.rs @@ -28,7 +28,7 @@ //! //! Since this pallet only tracks finalized headers it does not deal with forks. Forks can only //! occur if the GRANDPA validator set on the bridged chain is either colluding or there is a severe -//! bug causing resulting in an equivocation. Such events are outside of the scope of this pallet. +//! bug causing resulting in an equivocation. Such events are outside the scope of this pallet. //! Shall the fork occur on the bridged chain governance intervention will be required to //! re-initialize the bridge and track the right fork. @@ -149,7 +149,7 @@ pub mod pallet { /// Bootstrap the bridge pallet with an initial header and authority set from which to sync. /// /// The initial configuration provided does not need to be the genesis header of the bridged - /// chain, it can be any arbirary header. You can also provide the next scheduled set change + /// chain, it can be any arbitrary header. You can also provide the next scheduled set change /// if it is already know. /// /// This function is only allowed to be called from a trusted origin and writes to storage @@ -315,7 +315,7 @@ pub mod pallet { /// is found it will be enacted immediately. /// /// This function does not support forced changes, or scheduled changes with delays - /// since these types of changes are indicitive of abnormal behaviour from GRANDPA. + /// since these types of changes are indicative of abnormal behavior from GRANDPA. pub(crate) fn try_enact_authority_change, I: 'static>( header: &BridgedHeader, ) -> Result<(), sp_runtime::DispatchError> { diff --git a/modules/message-lane/src/benchmarking.rs b/modules/message-lane/src/benchmarking.rs index cd59d1347f2..291e8cce8f8 100644 --- a/modules/message-lane/src/benchmarking.rs +++ b/modules/message-lane/src/benchmarking.rs @@ -151,7 +151,7 @@ benchmarks_instance! { // * outbound lane already has state, so it needs to be read and decoded; // * relayers fund account does not exists (in practice it needs to exist in production environment); // * maximal number of messages is being pruned during the call; - // * message size is 1KB. + // * message size is 1 KB. // // With single KB of message size, the weight of the call is increased (roughly) by // `(send_16_kb_message_worst_case - send_1_kb_message_worst_case) / 15`. diff --git a/modules/message-lane/src/instant_payments.rs b/modules/message-lane/src/instant_payments.rs index 4dffc359352..2631e557d43 100644 --- a/modules/message-lane/src/instant_payments.rs +++ b/modules/message-lane/src/instant_payments.rs @@ -31,14 +31,14 @@ use sp_std::fmt::Debug; /// Instant message payments made in given currency. /// -/// The balance is initally reserved in a special `relayers-fund` account, and transferred +/// The balance is initially reserved in a special `relayers-fund` account, and transferred /// to the relayer when message delivery is confirmed. /// -/// Additionaly, confirmation transaction submitter (`confirmation_relayer`) is reimbursed +/// Additionally, confirmation transaction submitter (`confirmation_relayer`) is reimbursed /// with the confirmation rewards (part of message fee, reserved to pay for delivery confirmation). /// /// NOTE The `relayers-fund` account must always exist i.e. be over Existential Deposit (ED; the -/// pallet enforces that) to make sure that even if the message cost is below ED it is still payed +/// pallet enforces that) to make sure that even if the message cost is below ED it is still paid /// to the relayer account. /// NOTE It's within relayer's interest to keep their balance above ED as well, to make sure they /// can receive the payment. diff --git a/modules/message-lane/src/lib.rs b/modules/message-lane/src/lib.rs index 3132773eadd..78e12c3eacb 100644 --- a/modules/message-lane/src/lib.rs +++ b/modules/message-lane/src/lib.rs @@ -80,7 +80,7 @@ mod mock; pub trait Config: frame_system::Config { // General types - /// They overarching event type. + /// They're overarching event type. type Event: From> + Into<::Event>; /// Benchmarks results from runtime we're plugged into. type WeightInfo: WeightInfoExt; @@ -597,22 +597,22 @@ impl, I: Instance> Module { OutboundMessages::::get(MessageKey { lane_id: lane, nonce }).map(|message_data| message_data.payload) } - /// Get nonce of latest generated message at given outbound lane. + /// Get nonce of the latest generated message at given outbound lane. pub fn outbound_latest_generated_nonce(lane: LaneId) -> MessageNonce { OutboundLanes::::get(&lane).latest_generated_nonce } - /// Get nonce of latest confirmed message at given outbound lane. + /// Get nonce of the latest confirmed message at given outbound lane. pub fn outbound_latest_received_nonce(lane: LaneId) -> MessageNonce { OutboundLanes::::get(&lane).latest_received_nonce } - /// Get nonce of latest received message at given inbound lane. + /// Get nonce of the latest received message at given inbound lane. pub fn inbound_latest_received_nonce(lane: LaneId) -> MessageNonce { InboundLanes::::get(&lane).last_delivered_nonce() } - /// Get nonce of latest confirmed message at given inbound lane. + /// Get nonce of the latest confirmed message at given inbound lane. pub fn inbound_latest_confirmed_nonce(lane: LaneId) -> MessageNonce { InboundLanes::::get(&lane).last_confirmed_nonce } diff --git a/modules/message-lane/src/weights_ext.rs b/modules/message-lane/src/weights_ext.rs index bc75cd5ba0a..310d7ffa769 100644 --- a/modules/message-lane/src/weights_ext.rs +++ b/modules/message-lane/src/weights_ext.rs @@ -26,7 +26,7 @@ use frame_support::weights::Weight; pub const EXPECTED_DEFAULT_MESSAGE_LENGTH: u32 = 128; /// We assume that size of signed extensions on all our chains and size of all 'small' arguments of calls -/// we're checking here would fit 1KB. +/// we're checking here would fit 1 KB. const SIGNED_EXTENSIONS_SIZE: u32 = 1024; /// Ensure that weights from `WeightInfoExt` implementation are looking correct. @@ -242,7 +242,7 @@ pub trait WeightInfoExt: WeightInfo { weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead) } - /// Returns weight that needs to be accounted when receiving given number of messages with message + /// Returns weight that needs to be accounted when receiving a given number of messages with message /// delivery transaction (`receive_messages_proof`). fn receive_messages_proof_messages_overhead(messages: MessageNonce) -> Weight { let weight_of_two_messages_and_single_tx_overhead = Self::receive_two_messages_proof(); @@ -269,7 +269,7 @@ pub trait WeightInfoExt: WeightInfo { weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead) } - /// Returns weight that needs to be accounted when receiving confirmations for given number of + /// Returns weight that needs to be accounted when receiving confirmations for a given number of /// messages with delivery confirmation transaction (`receive_messages_delivery_proof`). fn receive_messages_delivery_proof_messages_overhead(messages: MessageNonce) -> Weight { let weight_of_two_messages = Self::receive_delivery_proof_for_two_messages_by_single_relayer(); @@ -279,7 +279,7 @@ pub trait WeightInfoExt: WeightInfo { .saturating_mul(messages as Weight) } - /// Returns weight that needs to be accounted when receiving confirmations for given number of + /// Returns weight that needs to be accounted when receiving confirmations for a given number of /// relayers entries with delivery confirmation transaction (`receive_messages_delivery_proof`). fn receive_messages_delivery_proof_relayers_overhead(relayers: MessageNonce) -> Weight { let weight_of_two_messages_by_two_relayers = Self::receive_delivery_proof_for_two_messages_by_two_relayers(); @@ -290,7 +290,7 @@ pub trait WeightInfoExt: WeightInfo { .saturating_mul(relayers as Weight) } - /// Returns weight that needs to be accounted when storage proof of given size is recieved (either in + /// Returns weight that needs to be accounted when storage proof of given size is received (either in /// `receive_messages_proof` or `receive_messages_delivery_proof`). /// /// **IMPORTANT**: this overhead is already included in the 'base' transaction cost - e.g. proof diff --git a/modules/substrate/src/fork_tests.rs b/modules/substrate/src/fork_tests.rs index 445ffd8ce50..6dc7846dadb 100644 --- a/modules/substrate/src/fork_tests.rs +++ b/modules/substrate/src/fork_tests.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -//! Tests for checking that behaviour of importing headers and finality proofs works correctly. +//! Tests for checking that behavior of importing headers and finality proofs works correctly. //! //! The tests are built around the idea that we will be importing headers on different forks and we //! should be able to check that we're correctly importing headers, scheduling changes, and @@ -38,20 +38,20 @@ //! (Type::Header(2, 1, None, None), Ok(())) //! //! Import header 2 on fork 1. This does not create a fork, or schedule an authority set change. We -//! expect this header import to be succesful. +//! expect this header import to be successful. //! //! ## Example Import 2 //! //! (Type::Header(4, 2, Some((3, 1)), Some(0)), Ok(())) //! //! Import header 4 on fork 2. This header starts a new fork from header 3 on fork 1. It also -//! schedules a change with a delay of 0 blocks. It should be succesfully imported. +//! schedules a change with a delay of 0 blocks. It should be successfully imported. //! //! ## Example Import 3 //! //! (Type::Finality(2, 1), Err(FinalizationError::OldHeader.into())) //! -//! Import a finality proof for header 2 on fork 1. This finalty proof should fail to be imported +//! Import a finality proof for header 2 on fork 1. This finality proof should fail to be imported //! because the header is an old header. use crate::mock::*; diff --git a/modules/substrate/src/lib.rs b/modules/substrate/src/lib.rs index 86925d52cf2..b97f1d4aa88 100644 --- a/modules/substrate/src/lib.rs +++ b/modules/substrate/src/lib.rs @@ -101,7 +101,7 @@ decl_storage! { /// The next scheduled authority set change for a given fork. /// /// The fork is indicated by the header which _signals_ the change (key in the mapping). - /// Note that this is different than a header which _enacts_ a change. + /// Note that this is different from a header which _enacts_ a change. // GRANDPA doesn't require there to always be a pending change. In fact, most of the time // there will be no pending change available. NextScheduledChange: map hasher(identity) BridgedBlockHash => Option>>; @@ -196,7 +196,7 @@ decl_module! { Ok(()) } - /// Import a finalty proof for a particular header. + /// Import a finality proof for a particular header. /// /// This will take care of finalizing any already imported headers /// which get finalized when importing this particular proof, as well @@ -231,7 +231,7 @@ decl_module! { /// Bootstrap the bridge pallet with an initial header and authority set from which to sync. /// /// The initial configuration provided does not need to be the genesis header of the bridged - /// chain, it can be any arbirary header. You can also provide the next scheduled set change + /// chain, it can be any arbitrary header. You can also provide the next scheduled set change /// if it is already know. /// /// This function is only allowed to be called from a trusted origin and writes to storage diff --git a/modules/substrate/src/verifier.rs b/modules/substrate/src/verifier.rs index 5ae3ed366b5..a3207f07aff 100644 --- a/modules/substrate/src/verifier.rs +++ b/modules/substrate/src/verifier.rs @@ -307,7 +307,7 @@ where } } -/// Returns the lineage of headers between [child, ancestor) +/// Returns the lineage of headers between [ child, ancestor ) fn headers_between( storage: &S, ancestor: ImportedHeader, diff --git a/primitives/chains/kusama/src/lib.rs b/primitives/chains/kusama/src/lib.rs index 4e1134f162d..06d14ae442a 100644 --- a/primitives/chains/kusama/src/lib.rs +++ b/primitives/chains/kusama/src/lib.rs @@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Kusama from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -109,7 +109,7 @@ sp_api::decl_runtime_apis! { pub trait FromKusamaInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/chains/millau/src/lib.rs b/primitives/chains/millau/src/lib.rs index 7397fcf4745..1a159244c26 100644 --- a/primitives/chains/millau/src/lib.rs +++ b/primitives/chains/millau/src/lib.rs @@ -119,7 +119,7 @@ pub type BlockNumber = u64; /// Hash type used in Millau. pub type Hash = ::Out; -/// The type of an object that can produce hashes on Millau. +/// Type of object that can produce hashes on Millau. pub type Hasher = BlakeTwoAndKeccak256; /// The header type used by Millau. @@ -301,7 +301,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Millau from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -331,7 +331,7 @@ sp_api::decl_runtime_apis! { pub trait FromMillauInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/chains/polkadot/src/lib.rs b/primitives/chains/polkadot/src/lib.rs index 53fe1917ea7..11c3a5990f4 100644 --- a/primitives/chains/polkadot/src/lib.rs +++ b/primitives/chains/polkadot/src/lib.rs @@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Polkadot from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -109,7 +109,7 @@ sp_api::decl_runtime_apis! { pub trait FromPolkadotInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/chains/rialto/src/lib.rs b/primitives/chains/rialto/src/lib.rs index ccb2154ee4f..eee8104f0f6 100644 --- a/primitives/chains/rialto/src/lib.rs +++ b/primitives/chains/rialto/src/lib.rs @@ -110,7 +110,7 @@ pub type BlockNumber = u32; /// Hash type used in Rialto. pub type Hash = ::Out; -/// The type of an object that can produce hashes on Rialto. +/// Type of object that can produce hashes on Rialto. pub type Hasher = BlakeTwo256; /// The header type used by Rialto. @@ -262,7 +262,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Rialto from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -292,7 +292,7 @@ sp_api::decl_runtime_apis! { pub trait FromRialtoInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/chains/rococo/src/lib.rs b/primitives/chains/rococo/src/lib.rs index ef372540a34..219f2d7c2d8 100644 --- a/primitives/chains/rococo/src/lib.rs +++ b/primitives/chains/rococo/src/lib.rs @@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Rococo from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -109,7 +109,7 @@ sp_api::decl_runtime_apis! { pub trait FromRococoInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/chains/westend/src/lib.rs b/primitives/chains/westend/src/lib.rs index 5b43eeeae52..cd04db40812 100644 --- a/primitives/chains/westend/src/lib.rs +++ b/primitives/chains/westend/src/lib.rs @@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! { /// /// Returns `None` if message is too expensive to be sent to Westend from this chain. /// - /// Please keep in mind that this method returns lowest message fee required for message + /// Please keep in mind that this method returns the lowest message fee required for message /// to be accepted to the lane. It may be good idea to pay a bit over this price to account /// future exchange rate changes and guarantee that relayer would deliver your message /// to the target chain. @@ -109,7 +109,7 @@ sp_api::decl_runtime_apis! { pub trait FromWestendInboundLaneApi { /// Returns nonce of the latest message, received by given lane. fn latest_received_nonce(lane: LaneId) -> MessageNonce; - /// Nonce of latest message that has been confirmed to the bridged chain. + /// Nonce of the latest message that has been confirmed to the bridged chain. fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce; /// State of the unrewarded relayers set at given lane. fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState; diff --git a/primitives/ethereum-poa/src/lib.rs b/primitives/ethereum-poa/src/lib.rs index dc65ac432b1..00029348f9c 100644 --- a/primitives/ethereum-poa/src/lib.rs +++ b/primitives/ethereum-poa/src/lib.rs @@ -323,7 +323,7 @@ impl UnsignedTransaction { stream.out().to_vec() } - /// Encode to given rlp stream. + /// Encode to given RLP stream. pub fn rlp_to(&self, chain_id: Option, stream: &mut RlpStream) { stream.append(&self.nonce); stream.append(&self.gas_price); @@ -405,7 +405,7 @@ impl SealedEmptyStep { keccak_256(&message.out()).into() } - /// Returns rlp for the vector of empty steps (we only do encoding in tests). + /// Returns RLP for the vector of empty steps (we only do encoding in tests). pub fn rlp_of(empty_steps: &[SealedEmptyStep]) -> Bytes { let mut s = RlpStream::new(); s.begin_list(empty_steps.len()); diff --git a/primitives/header-chain/src/justification.rs b/primitives/header-chain/src/justification.rs index 67968258a5c..e8ac91ac1af 100644 --- a/primitives/header-chain/src/justification.rs +++ b/primitives/header-chain/src/justification.rs @@ -36,7 +36,7 @@ pub enum Error { InvalidJustificationTarget, /// Invalid commit in justification. InvalidJustificationCommit, - /// Justification has invalid authority singature. + /// Justification has invalid authority signature. InvalidAuthoritySignature, /// The justification has precommit for the header that has no route from the target header. InvalidPrecommitAncestryProof, diff --git a/primitives/message-lane/src/lib.rs b/primitives/message-lane/src/lib.rs index de2dbd9ae63..1b0059db123 100644 --- a/primitives/message-lane/src/lib.rs +++ b/primitives/message-lane/src/lib.rs @@ -83,7 +83,7 @@ pub struct InboundLaneData { /// Identifiers of relayers and messages that they have delivered to this lane (ordered by message nonce). /// /// This serves as a helper storage item, to allow the source chain to easily pay rewards - /// to the relayers who succesfuly delivered messages to the target chain (inbound lane). + /// to the relayers who successfully delivered messages to the target chain (inbound lane). /// /// It is guaranteed to have at most N entries, where N is configured at the module level. /// If there are N entries in this vec, then: @@ -119,7 +119,7 @@ impl Default for InboundLaneData { } impl InboundLaneData { - /// Returns approximate size of the struct, given number of entries in the `relayers` set and + /// Returns approximate size of the struct, a given number of entries in the `relayers` set and /// size of each entry. /// /// Returns `None` if size overflows `u32` limits. @@ -154,12 +154,12 @@ pub struct UnrewardedRelayersState { /// Outbound lane data. #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] pub struct OutboundLaneData { - /// Nonce of oldest message that we haven't yet pruned. May point to not-yet-generated message if + /// Nonce of the oldest message that we haven't yet pruned. May point to not-yet-generated message if /// all sent messages are already pruned. pub oldest_unpruned_nonce: MessageNonce, - /// Nonce of latest message, received by bridged chain. + /// Nonce of the latest message, received by bridged chain. pub latest_received_nonce: MessageNonce, - /// Nonce of latest message, generated by us. + /// Nonce of the latest message, generated by us. pub latest_generated_nonce: MessageNonce, } diff --git a/primitives/message-lane/src/source_chain.rs b/primitives/message-lane/src/source_chain.rs index d0dc36bb693..c8cbd74aaaf 100644 --- a/primitives/message-lane/src/source_chain.rs +++ b/primitives/message-lane/src/source_chain.rs @@ -58,12 +58,12 @@ pub trait TargetHeaderChain { /// payload would (at least) be accepted into target chain transaction pool AND /// eventually will be successfully 'mined'. The most obvious incorrect implementation /// example would be implementation for BTC chain that accepts payloads larger than - /// 1MB. BTC nodes aren't accepting transactions that are larger than 1MB, so relayer + /// 1 MB. BTC nodes aren't accepting transactions that are larger than 1 MB, so relayer /// will be unable to craft valid transaction => this (and all subsequent) messages will /// never be delivered. fn verify_message(payload: &Payload) -> Result<(), Self::Error>; - /// Verify messages delivery proof and return lane && nonce of the latest recevied message. + /// Verify messages delivery proof and return lane && nonce of the latest received message. fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, ) -> Result<(LaneId, InboundLaneData), Self::Error>; @@ -102,7 +102,7 @@ pub trait LaneMessageVerifier { /// by relayer. /// /// So to be sure that any non-altruist relayer would agree to deliver message, submitter -/// should set `delivery_and_dispatch_fee` to at least (equialent of): sum of fees from (2) +/// should set `delivery_and_dispatch_fee` to at least (equivalent of): sum of fees from (2) /// to (4) above, plus some interest for the relayer. pub trait MessageDeliveryAndDispatchPayment { /// Error type. diff --git a/primitives/message-lane/src/target_chain.rs b/primitives/message-lane/src/target_chain.rs index 765ce64f63b..caa9e0b39a1 100644 --- a/primitives/message-lane/src/target_chain.rs +++ b/primitives/message-lane/src/target_chain.rs @@ -75,7 +75,7 @@ pub trait SourceHeaderChain { /// messages will be rejected. /// /// The `messages_count` argument verification (sane limits) is supposed to be made - /// outside of this function. This function only verifies that the proof declares exactly + /// outside this function. This function only verifies that the proof declares exactly /// `messages_count` messages. fn verify_messages_proof( proof: Self::MessagesProof, diff --git a/primitives/polkadot-core/src/lib.rs b/primitives/polkadot-core/src/lib.rs index f56d4c52aa7..fa1aaea1110 100644 --- a/primitives/polkadot-core/src/lib.rs +++ b/primitives/polkadot-core/src/lib.rs @@ -68,7 +68,7 @@ pub const MAXIMAL_ENCODED_ACCOUNT_ID_SIZE: u32 = 32; /// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// All Polkadot-like chains allow 2 seconds of compute with a 6 second average block time. +/// All Polkadot-like chains allow 2 seconds of compute with a 6-second average block time. /// /// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate. pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND; @@ -80,7 +80,7 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND; pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1); parameter_types! { - /// All Polkadot-like chains have maximal block size set to 5MB. + /// All Polkadot-like chains have maximal block size set to 5 MB. /// /// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate. pub BlockLength: limits::BlockLength = limits::BlockLength::max_with_normal_ratio( @@ -141,7 +141,7 @@ pub type BlockNumber = u32; /// Hash type used in Polkadot-like chains. pub type Hash = ::Out; -/// The type of an object that can produce hashes on Polkadot-like chains. +/// Type of object that can produce hashes on Polkadot-like chains. pub type Hasher = BlakeTwo256; /// The header type used by Polkadot-like chains. diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 862edf7b972..5a014f99012 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -73,9 +73,9 @@ pub type InstanceId = [u8; 4]; /// Type of accounts on the source chain. pub enum SourceAccount { - /// An account that belongs to Root (priviledged origin). + /// An account that belongs to Root (privileged origin). Root, - /// A non-priviledged account. + /// A non-privileged account. /// /// The embedded account ID may or may not have a private key depending on the "owner" of the /// account (private key, pallet, proxy, etc.). @@ -85,7 +85,7 @@ pub enum SourceAccount { /// Derive an account ID from a foreign account ID. /// /// This function returns an encoded Blake2 hash. It is the responsibility of the caller to ensure -/// this can be succesfully decoded into an AccountId. +/// this can be successfully decoded into an AccountId. /// /// The `bridge_id` is used to provide extra entropy when producing account IDs. This helps prevent /// AccountId collisions between different bridges on a single target chain. diff --git a/relays/clients/ethereum/src/sign.rs b/relays/clients/ethereum/src/sign.rs index 462cb5dbd7d..be8ecf3fb34 100644 --- a/relays/clients/ethereum/src/sign.rs +++ b/relays/clients/ethereum/src/sign.rs @@ -47,7 +47,7 @@ impl Default for SigningParams { } } -/// Sign and submit tranaction using given Ethereum client. +/// Sign and submit transaction using given Ethereum client. pub async fn sign_and_submit_transaction( client: &Client, params: &SigningParams, diff --git a/relays/clients/substrate/src/client.rs b/relays/clients/substrate/src/client.rs index 83328130428..40beca418ed 100644 --- a/relays/clients/substrate/src/client.rs +++ b/relays/clients/substrate/src/client.rs @@ -187,7 +187,7 @@ impl Client { /// Get the nonce of the given Substrate account. /// - /// Note: It's the caller's responsibility to make sure `account` is a valid ss58 address. + /// Note: It's the caller's responsibility to make sure `account` is a valid SS58 address. pub async fn next_account_index(&self, account: C::AccountId) -> Result { Ok(Substrate::::system_account_next_index(&self.client, account).await?) } diff --git a/relays/clients/substrate/src/guard.rs b/relays/clients/substrate/src/guard.rs index e924b94b6f7..d566aeb220e 100644 --- a/relays/clients/substrate/src/guard.rs +++ b/relays/clients/substrate/src/guard.rs @@ -80,7 +80,7 @@ pub fn abort_on_spec_version_change(mut env: impl Environm }); } -/// Abort if, during a 24 hours, free balance of given account is decreased at least by given value. +/// Abort if, during 24 hours, free balance of given account is decreased at least by given value. /// Other components may increase (or decrease) balance of account and it WILL affect logic of the guard. pub fn abort_when_account_balance_decreased( mut env: impl Environment, diff --git a/relays/ethereum/src/ethereum_client.rs b/relays/ethereum/src/ethereum_client.rs index 46c2c76feee..39a98cdbcc9 100644 --- a/relays/ethereum/src/ethereum_client.rs +++ b/relays/ethereum/src/ethereum_client.rs @@ -41,7 +41,7 @@ type RpcResult = std::result::Result; /// interactions involving, for example, an Ethereum contract. #[async_trait] pub trait EthereumHighLevelRpc { - /// Returns best Substrate block that PoA chain knows of. + /// Returns the best Substrate block that PoA chain knows of. async fn best_substrate_block(&self, contract_address: Address) -> RpcResult; /// Returns true if Substrate header is known to Ethereum node. diff --git a/relays/ethereum/src/rialto_client.rs b/relays/ethereum/src/rialto_client.rs index 11eb200a1c3..8dd164b6b30 100644 --- a/relays/ethereum/src/rialto_client.rs +++ b/relays/ethereum/src/rialto_client.rs @@ -41,13 +41,13 @@ type RpcResult = std::result::Result; /// interactions involving, for example, an Ethereum bridge module. #[async_trait] pub trait SubstrateHighLevelRpc { - /// Returns best Ethereum block that Substrate runtime knows of. + /// Returns the best Ethereum block that Substrate runtime knows of. async fn best_ethereum_block(&self) -> RpcResult; - /// Returns best finalized Ethereum block that Substrate runtime knows of. + /// Returns the best finalized Ethereum block that Substrate runtime knows of. async fn best_ethereum_finalized_block(&self) -> RpcResult; - /// Returns whether or not transactions receipts are required for Ethereum header submission. + /// Returns or not transactions receipts are required for Ethereum header submission. async fn ethereum_receipts_required(&self, header: SubstrateEthereumHeader) -> RpcResult; - /// Returns whether or not the given Ethereum header is known to the Substrate runtime. + /// Returns or not the given Ethereum header is known to the Substrate runtime. async fn ethereum_header_known(&self, header_id: EthereumHeaderId) -> RpcResult; } diff --git a/relays/generic/exchange/src/exchange.rs b/relays/generic/exchange/src/exchange.rs index cdf9c1a9f35..ff0a988a64e 100644 --- a/relays/generic/exchange/src/exchange.rs +++ b/relays/generic/exchange/src/exchange.rs @@ -110,7 +110,7 @@ pub trait TargetClient: RelayClient { async fn is_header_known(&self, id: &HeaderId

) -> Result; /// Returns `Ok(true)` if header is finalized by the target node. async fn is_header_finalized(&self, id: &HeaderId

) -> Result; - /// Returns best finalized header id. + /// Returns the best finalized header id. async fn best_finalized_header_id(&self) -> Result, Self::Error>; /// Returns `Ok(true)` if transaction proof is need to be relayed. async fn filter_transaction_proof(&self, proof: &P::TransactionProof) -> Result; diff --git a/relays/generic/headers/src/headers.rs b/relays/generic/headers/src/headers.rs index 99ccc197afc..1060a0b8d8a 100644 --- a/relays/generic/headers/src/headers.rs +++ b/relays/generic/headers/src/headers.rs @@ -65,7 +65,7 @@ pub struct QueuedHeaders { /// Headers that are (we believe) currently submitted to target node by our, /// not-yet mined transactions. submitted: HeadersQueue

, - /// Synced headers childrens. We need it to support case when header is synced, but some of + /// Synced headers children. We need it to support case when header is synced, but some of /// its parents are incomplete. synced_children: SyncedChildren

, /// Pointers to all headers that we ever seen and we believe we can touch in the future. @@ -191,7 +191,7 @@ impl QueuedHeaders

{ .unwrap_or(HeaderStatus::Unknown) } - /// Get oldest header from given queue. + /// Get the oldest header from given queue. pub fn header(&self, status: HeaderStatus) -> Option<&QueuedHeader

> { match status { HeaderStatus::Unknown | HeaderStatus::Synced => None, @@ -205,7 +205,7 @@ impl QueuedHeaders

{ } } - /// Get oldest headers from given queue until functor will return false. + /// Get the oldest headers from given queue until functor will return false. pub fn headers( &self, status: HeaderStatus, @@ -282,7 +282,7 @@ impl QueuedHeaders

{ ); } - /// Receive best header from the target node. + /// Receive the best header from the target node. pub fn target_best_header_response(&mut self, id: &HeaderIdOf

) { self.header_synced(id) } @@ -453,7 +453,7 @@ impl QueuedHeaders

{ } } - /// When incomplete headers ids are receved from target node. + /// When incomplete headers ids are received from target node. pub fn incomplete_headers_response(&mut self, ids: HashSet>) { // all new incomplete headers are marked Synced and all their descendants // are moved from Ready/Submitted to Incomplete queue diff --git a/relays/generic/headers/src/sync.rs b/relays/generic/headers/src/sync.rs index 8e4c671dbaa..6deca23450e 100644 --- a/relays/generic/headers/src/sync.rs +++ b/relays/generic/headers/src/sync.rs @@ -35,7 +35,7 @@ pub struct HeadersSyncParams { /// Maximal total headers size in single submit request. pub max_headers_size_in_single_submit: usize, /// We only may store and accept (from Ethereum node) headers that have - /// number >= than best_substrate_header.number - prune_depth. + /// number >= than best_substrate_header. Number - prune_depth. pub prune_depth: u32, /// Target transactions mode. pub target_tx_mode: TargetTransactionMode, @@ -58,9 +58,9 @@ pub enum TargetTransactionMode { pub struct HeadersSync { /// Synchronization parameters. params: HeadersSyncParams, - /// Best header number known to source node. + /// The best header number known to source node. source_best_number: Option, - /// Best header known to target node. + /// The best header known to target node. target_best_header: Option>, /// Headers queue. headers: QueuedHeaders

, @@ -80,12 +80,12 @@ impl HeadersSync

{ } } - /// Return best header number known to source node. + /// Return the best header number known to source node. pub fn source_best_number(&self) -> Option { self.source_best_number } - /// Best header known to target node. + /// The best header known to target node. pub fn target_best_header(&self) -> Option> { self.target_best_header } @@ -150,7 +150,7 @@ impl HeadersSync

{ Some(best_downloaded_number + One::one()) } - /// Selech orphan header to downoload. + /// Selech orphan header to download. pub fn select_orphan_header_to_download(&self) -> Option<&QueuedHeader

> { let orphan_header = self.headers.header(HeaderStatus::Orphan)?; diff --git a/relays/generic/headers/src/sync_loop.rs b/relays/generic/headers/src/sync_loop.rs index 7da8fd4f42f..e91bd7fbdb0 100644 --- a/relays/generic/headers/src/sync_loop.rs +++ b/relays/generic/headers/src/sync_loop.rs @@ -80,7 +80,7 @@ pub trait SourceClient: RelayClient { /// Target client trait. #[async_trait] pub trait TargetClient: RelayClient { - /// Returns ID of best header known to the target node. + /// Returns ID of the best header known to the target node. async fn best_header_id(&self) -> Result, Self::Error>; /// Returns true if header is known to the target node. diff --git a/relays/generic/messages/src/lib.rs b/relays/generic/messages/src/lib.rs index 99222f0e02f..c5afd98cca0 100644 --- a/relays/generic/messages/src/lib.rs +++ b/relays/generic/messages/src/lib.rs @@ -18,7 +18,7 @@ //! data. Message lane allows sending arbitrary messages between bridged chains. This //! module provides entrypoint that starts reading messages from given message lane //! of source chain and submits proof-of-message-at-source-chain transactions to the -//! target chain. Additionaly, proofs-of-messages-delivery are sent back from the +//! target chain. Additionally, proofs-of-messages-delivery are sent back from the //! target chain to the source chain. // required for futures::select! diff --git a/relays/generic/messages/src/message_lane_loop.rs b/relays/generic/messages/src/message_lane_loop.rs index afbaf7a015a..76bc198a418 100644 --- a/relays/generic/messages/src/message_lane_loop.rs +++ b/relays/generic/messages/src/message_lane_loop.rs @@ -104,7 +104,7 @@ pub trait SourceClient: RelayClient { /// Returns state of the client. async fn state(&self) -> Result, Self::Error>; - /// Get nonce of instance of latest generated message. + /// Get nonce of instance of the latest generated message. async fn latest_generated_nonce( &self, id: SourceHeaderIdOf

, @@ -147,13 +147,13 @@ pub trait TargetClient: RelayClient { /// Returns state of the client. async fn state(&self) -> Result, Self::Error>; - /// Get nonce of latest received message. + /// Get nonce of the latest received message. async fn latest_received_nonce( &self, id: TargetHeaderIdOf

, ) -> Result<(TargetHeaderIdOf

, MessageNonce), Self::Error>; - /// Get nonce of latest confirmed message. + /// Get nonce of the latest confirmed message. async fn latest_confirmed_received_nonce( &self, id: TargetHeaderIdOf

, @@ -182,7 +182,7 @@ pub trait TargetClient: RelayClient { /// State of the client. #[derive(Clone, Debug, Default, PartialEq)] pub struct ClientState { - /// Best header id of this chain. + /// The best header id of this chain. pub best_self: SelfHeaderId, /// Best finalized header id of this chain. pub best_finalized_self: SelfHeaderId, diff --git a/relays/generic/messages/src/message_race_delivery.rs b/relays/generic/messages/src/message_race_delivery.rs index c7e308fee1e..996b3b71ea8 100644 --- a/relays/generic/messages/src/message_race_delivery.rs +++ b/relays/generic/messages/src/message_race_delivery.rs @@ -11,7 +11,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -//! Message delivery race delivers proof-of-messages from lane.source to lane.target. +//! Message delivery race delivers proof-of-messages from lane. Source to lane.target. use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf}; use crate::message_lane_loop::{ @@ -209,7 +209,7 @@ where /// Additional nonces data from the target client used by message delivery race. #[derive(Debug, Clone)] struct DeliveryRaceTargetNoncesData { - /// Latest nonce that we know: (1) has been delivered to us (2) has been confirmed + /// The latest nonce that we know: (1) has been delivered to us (2) has been confirmed /// back to the source node (by confirmations race) and (3) relayer has received /// reward for (and this has been confirmed by the message delivery race). confirmed_nonce: MessageNonce, @@ -229,7 +229,7 @@ struct MessageDeliveryStrategy { max_messages_weight_in_single_batch: Weight, /// Maximal messages size in the single delivery transaction. max_messages_size_in_single_batch: usize, - /// Latest confirmed nonces at the source client + the header id where we have first met this nonce. + /// The latest confirmed nonces at the source client + the header id where we have first met this nonce. latest_confirmed_nonces_at_source: VecDeque<(SourceHeaderIdOf

, MessageNonce)>, /// Target nonces from the source client. target_nonces: Option>, diff --git a/relays/generic/messages/src/message_race_loop.rs b/relays/generic/messages/src/message_race_loop.rs index a11a1d7ff5d..b5a87e42495 100644 --- a/relays/generic/messages/src/message_race_loop.rs +++ b/relays/generic/messages/src/message_race_loop.rs @@ -76,7 +76,7 @@ pub struct SourceClientNonces { /// New nonces range known to the client. `New` here means all nonces generated after /// `prev_latest_nonce` passed to the `SourceClient::nonces` method. pub new_nonces: NoncesRange, - /// Latest nonce that is confirmed to the bridged client. This nonce only makes + /// The latest nonce that is confirmed to the bridged client. This nonce only makes /// sense in some races. In other races it is `None`. pub confirmed_nonce: Option, } @@ -84,7 +84,7 @@ pub struct SourceClientNonces { /// Nonces on the race target client. #[derive(Debug, Clone)] pub struct TargetClientNonces { - /// Latest nonce that is known to the target client. + /// The latest nonce that is known to the target client. pub latest_nonce: MessageNonce, /// Additional data from target node that may be used by the race. pub nonces_data: TargetNoncesData, @@ -93,7 +93,7 @@ pub struct TargetClientNonces { /// One of message lane clients, which is source client for the race. #[async_trait] pub trait SourceClient { - /// Type of error this clients returns. + /// Type of error these clients returns. type Error: std::fmt::Debug + MaybeConnectionError; /// Type of nonces range returned by the source client. type NoncesRange: NoncesRange; @@ -118,7 +118,7 @@ pub trait SourceClient { /// One of message lane clients, which is target client for the race. #[async_trait] pub trait TargetClient { - /// Type of error this clients returns. + /// Type of error these clients returns. type Error: std::fmt::Debug + MaybeConnectionError; /// Type of the additional data from the target client, used by the race. type TargetNoncesData: std::fmt::Debug; @@ -149,12 +149,12 @@ pub trait RaceStrategy: Debug { /// Should return true if nothing has to be synced. fn is_empty(&self) -> bool; - /// Return best nonce at source node. + /// Return the best nonce at source node. /// /// `Some` is returned only if we are sure that the value is greater or equal /// than the result of `best_at_target`. fn best_at_source(&self) -> Option; - /// Return best nonce at target node. + /// Return the best nonce at target node. /// /// May return `None` if value is yet unknown. fn best_at_target(&self) -> Option; @@ -190,7 +190,7 @@ pub struct RaceState { /// Best finalized source header id at the best block on the target /// client (at the `best_finalized_source_header_id_at_best_target`). pub best_finalized_source_header_id_at_best_target: Option, - /// Best header id at the target client. + /// The best header id at the target client. pub best_target_header_id: Option, /// Best finalized header id at the target client. pub best_finalized_target_header_id: Option, diff --git a/relays/generic/messages/src/message_race_receiving.rs b/relays/generic/messages/src/message_race_receiving.rs index cba6ee38589..5da7bf681ad 100644 --- a/relays/generic/messages/src/message_race_receiving.rs +++ b/relays/generic/messages/src/message_race_receiving.rs @@ -11,7 +11,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -//! Message receiving race delivers proof-of-messages-delivery from lane.target to lane.source. +//! Message receiving race delivers proof-of-messages-delivery from lane. Target to lane.source. use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf}; use crate::message_lane_loop::{ diff --git a/relays/generic/messages/src/message_race_strategy.rs b/relays/generic/messages/src/message_race_strategy.rs index dcbcbc4d377..79c51fb4bdf 100644 --- a/relays/generic/messages/src/message_race_strategy.rs +++ b/relays/generic/messages/src/message_race_strategy.rs @@ -35,7 +35,7 @@ pub struct BasicStrategy< > { /// All queued nonces. source_queue: VecDeque<(HeaderId, SourceNoncesRange)>, - /// Best nonce known to target node (at its best block). `None` if it has not been received yet. + /// The best nonce known to target node (at its best block). `None` if it has not been received yet. best_target_nonce: Option, /// Unused generic types dump. _phantom: PhantomData<(TargetHeaderNumber, TargetHeaderHash, Proof)>, diff --git a/relays/generic/messages/src/metrics.rs b/relays/generic/messages/src/metrics.rs index b001d32926d..4061dc42a5e 100644 --- a/relays/generic/messages/src/metrics.rs +++ b/relays/generic/messages/src/metrics.rs @@ -77,28 +77,28 @@ impl MessageLaneLoopMetrics { .set(target_client_state.best_finalized_peer_at_best_self.0.into()); } - /// Update latest generated nonce at source. + /// Update the latest generated nonce at source. pub fn update_source_latest_generated_nonce(&self, source_latest_generated_nonce: MessageNonce) { self.lane_state_nonces .with_label_values(&["source_latest_generated"]) .set(source_latest_generated_nonce); } - /// Update latest confirmed nonce at source. + /// Update the latest confirmed nonce at source. pub fn update_source_latest_confirmed_nonce(&self, source_latest_confirmed_nonce: MessageNonce) { self.lane_state_nonces .with_label_values(&["source_latest_confirmed"]) .set(source_latest_confirmed_nonce); } - /// Update latest received nonce at target. + /// Update the latest received nonce at target. pub fn update_target_latest_received_nonce(&self, target_latest_generated_nonce: MessageNonce) { self.lane_state_nonces .with_label_values(&["target_latest_received"]) .set(target_latest_generated_nonce); } - /// Update latest confirmed nonce at target. + /// Update the latest confirmed nonce at target. pub fn update_target_latest_confirmed_nonce(&self, target_latest_confirmed_nonce: MessageNonce) { self.lane_state_nonces .with_label_values(&["target_latest_confirmed"]) diff --git a/relays/generic/utils/src/relay_loop.rs b/relays/generic/utils/src/relay_loop.rs index 6a61ecd2893..a5252fdc042 100644 --- a/relays/generic/utils/src/relay_loop.rs +++ b/relays/generic/utils/src/relay_loop.rs @@ -25,7 +25,7 @@ pub const RECONNECT_DELAY: Duration = Duration::from_secs(10); /// Basic blockchain client from relay perspective. #[async_trait] pub trait Client: Clone + Send + Sync { - /// Type of error this clients returns. + /// Type of error these clients returns. type Error: Debug + MaybeConnectionError; /// Try to reconnect to source node. diff --git a/relays/substrate/src/cli.rs b/relays/substrate/src/cli.rs index a4296226e25..7fb95d74675 100644 --- a/relays/substrate/src/cli.rs +++ b/relays/substrate/src/cli.rs @@ -382,7 +382,7 @@ where } /// Create chain-specific set of configuration objects: connection parameters, -/// signing parameters and bridge initialisation parameters. +/// signing parameters and bridge initialization parameters. #[macro_export] macro_rules! declare_chain_options { ($chain:ident, $chain_prefix:ident) => { diff --git a/relays/substrate/src/messages_lane.rs b/relays/substrate/src/messages_lane.rs index 78b5f5c0248..b43d0666bcf 100644 --- a/relays/substrate/src/messages_lane.rs +++ b/relays/substrate/src/messages_lane.rs @@ -31,16 +31,16 @@ use std::ops::RangeInclusive; pub trait SubstrateMessageLane: MessageLane { /// Name of the runtime method that returns dispatch weight of outbound messages at the source chain. const OUTBOUND_LANE_MESSAGES_DISPATCH_WEIGHT_METHOD: &'static str; - /// Name of the runtime method that returns latest generated nonce at the source chain. + /// Name of the runtime method that returns the latest generated nonce at the source chain. const OUTBOUND_LANE_LATEST_GENERATED_NONCE_METHOD: &'static str; - /// Name of the runtime method that returns latest received (confirmed) nonce at the the source chain. + /// Name of the runtime method that returns the latest received (confirmed) nonce at the the source chain. const OUTBOUND_LANE_LATEST_RECEIVED_NONCE_METHOD: &'static str; - /// Name of the runtime method that returns latest received nonce at the target chain. + /// Name of the runtime method that returns the latest received nonce at the target chain. const INBOUND_LANE_LATEST_RECEIVED_NONCE_METHOD: &'static str; - /// Name of the runtime method that returns latest confirmed (reward-paid) nonce at the target chain. + /// Name of the runtime method that returns the latest confirmed (reward-paid) nonce at the target chain. const INBOUND_LANE_LATEST_CONFIRMED_NONCE_METHOD: &'static str; - /// Numebr of the runtime method that returns state of "unrewarded relayers" set at the target chain. + /// Number of the runtime method that returns state of "unrewarded relayers" set at the target chain. const INBOUND_LANE_UNREWARDED_RELAYERS_STATE: &'static str; /// Name of the runtime method that returns id of best finalized source header at target chain. From 91d06ebae5a065e7ba29ee95466e2ff269715bc9 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 21:48:15 +0200 Subject: [PATCH 13/15] feat(config): try to solve single hunspell quirk --- .config/spellcheck.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/spellcheck.toml b/.config/spellcheck.toml index 31dc5495e51..956077a81cc 100644 --- a/.config/spellcheck.toml +++ b/.config/spellcheck.toml @@ -6,6 +6,6 @@ extra_dictionaries = ["lingua.dic"] [hunspell.quirks] # `Type`'s # 5x -transform_regex = ["^'([^\\s])'$", "^[0-9]+(?:\\.[0-9]*)?x$", "^'s$", "^\\+$"] +transform_regex = ["^'([^\\s])'$", "^[0-9]+(?:\\.[0-9]*)?x$", "^'s$", "^\\+$", "."] allow_concatenation = true allow_dashes = true From 6d4f9497bdb4f18f55ce8bd01e8a72225d97bf16 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Mon, 19 Apr 2021 23:21:40 +0200 Subject: [PATCH 14/15] feat(sparta): this is sparta --- primitives/polkadot-core/src/lib.rs | 2 +- primitives/test-utils/src/lib.rs | 2 +- relays/messages/src/message_race_loop.rs | 2 +- relays/utils/src/relay_loop.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/primitives/polkadot-core/src/lib.rs b/primitives/polkadot-core/src/lib.rs index 03c2d1d1a90..74252ea7f74 100644 --- a/primitives/polkadot-core/src/lib.rs +++ b/primitives/polkadot-core/src/lib.rs @@ -165,7 +165,7 @@ pub type Index = u32; /// Hashing type. pub type Hashing = BlakeTwo256; -/// The type of an object that can produce hashes on Polkadot-like chains. +/// The type of object that can produce hashes on Polkadot-like chains. pub type Hasher = BlakeTwo256; /// The header type used by Polkadot-like chains. diff --git a/primitives/test-utils/src/lib.rs b/primitives/test-utils/src/lib.rs index 0fcc263763c..ce84f212469 100644 --- a/primitives/test-utils/src/lib.rs +++ b/primitives/test-utils/src/lib.rs @@ -48,7 +48,7 @@ pub struct JustificationGeneratorParams { pub authorities: Vec<(Account, AuthorityWeight)>, /// The total number of vote ancestries in our justification. /// - /// These may be distributed among many different forks. + /// These may be distributed among many forks. pub votes: u32, /// The number of forks. /// diff --git a/relays/messages/src/message_race_loop.rs b/relays/messages/src/message_race_loop.rs index 30851c12340..5a0a5dd8bd3 100644 --- a/relays/messages/src/message_race_loop.rs +++ b/relays/messages/src/message_race_loop.rs @@ -155,7 +155,7 @@ pub trait RaceStrategy: Debug { fn is_empty(&self) -> bool; /// Return id of source header that is required to be on target to continue synchronization. fn required_source_header_at_target(&self, current_best: &SourceHeaderId) -> Option; - /// Return best nonce at source node. + /// Return the best nonce at source node. /// /// `Some` is returned only if we are sure that the value is greater or equal /// than the result of `best_at_target`. diff --git a/relays/utils/src/relay_loop.rs b/relays/utils/src/relay_loop.rs index 8790b0913e1..d26047f6810 100644 --- a/relays/utils/src/relay_loop.rs +++ b/relays/utils/src/relay_loop.rs @@ -27,7 +27,7 @@ pub const RECONNECT_DELAY: Duration = Duration::from_secs(10); /// Basic blockchain client from relay perspective. #[async_trait] pub trait Client: Clone + Send + Sync { - /// Type of error this clients returns. + /// Type of error these clients returns. type Error: Debug + MaybeConnectionError; /// Try to reconnect to source node. From 992d00b713f529b1ae0f26d80dca33c801cab5cf Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Thu, 22 Apr 2021 22:08:06 +0200 Subject: [PATCH 15/15] Revert "Add pruning to bechmarks & update weights. (#918)" This reverts commit c2d56b2e9355d2ef106bf45ceedbf53839b26e0b. --- bin/rialto/runtime/src/lib.rs | 30 ++------ modules/grandpa/src/benchmarking.rs | 29 +++---- modules/grandpa/src/lib.rs | 60 ++++----------- modules/grandpa/src/weights.rs | 50 ++++++------ modules/messages/src/weights.rs | 94 +++++++++++------------ relays/bin-substrate/src/messages_lane.rs | 2 +- 6 files changed, 106 insertions(+), 159 deletions(-) diff --git a/bin/rialto/runtime/src/lib.rs b/bin/rialto/runtime/src/lib.rs index e6cc1d82957..49a931199d6 100644 --- a/bin/rialto/runtime/src/lib.rs +++ b/bin/rialto/runtime/src/lib.rs @@ -409,30 +409,16 @@ impl pallet_session::Config for Runtime { } parameter_types! { - /// This is a pretty unscientific cap. - /// - /// Note that once this is hit the pallet will essentially throttle incoming requests down to one - /// call per block. + // This is a pretty unscientific cap. + // + // Note that once this is hit the pallet will essentially throttle incoming requests down to one + // call per block. pub const MaxRequests: u32 = 50; -} - -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - /// Number of headers to keep in benchmarks. - /// - /// In benchmarks we always populate with full number of `HeadersToKeep` to make sure that - /// pruning is taken into account. - /// - /// Note: This is lower than regular value, to speed up benchmarking setup. - pub const HeadersToKeep: u32 = 1024; -} -#[cfg(not(feature = "runtime-benchmarks"))] -parameter_types! { - /// Number of headers to keep. - /// - /// Assuming the worst case of every header being finalized, we will keep headers at least for a - /// week. + // Number of headers to keep. + // + // Assuming the worst case of every header being finalized, we will keep headers at least for a + // week. pub const HeadersToKeep: u32 = 7 * bp_rialto::DAYS as u32; } diff --git a/modules/grandpa/src/benchmarking.rs b/modules/grandpa/src/benchmarking.rs index b7294e91800..cb170fdc8b1 100644 --- a/modules/grandpa/src/benchmarking.rs +++ b/modules/grandpa/src/benchmarking.rs @@ -51,10 +51,9 @@ use bp_test_utils::{ TEST_GRANDPA_ROUND, TEST_GRANDPA_SET_ID, }; use frame_benchmarking::{benchmarks_instance_pallet, whitelisted_caller}; -use frame_support::traits::Get; use frame_system::RawOrigin; use sp_finality_grandpa::AuthorityId; -use sp_runtime::traits::Zero; +use sp_runtime::traits::{One, Zero}; use sp_std::{vec, vec::Vec}; // The maximum number of vote ancestries to include in a justification. @@ -67,14 +66,6 @@ const MAX_VOTE_ANCESTRIES: u32 = 1000; // number of validators. const MAX_VALIDATOR_SET_SIZE: u32 = 1024; -/// Returns number of first header to be imported. -/// -/// Since we boostrap the pallet with `HeadersToKeep` already imported headers, -/// this function computes the next expected header number to import. -fn header_number, I: 'static, N: From>() -> N { - (T::HeadersToKeep::get() + 1).into() -} - benchmarks_instance_pallet! { // This is the "gold standard" benchmark for this extrinsic, and it's what should be used to // annotate the weight in the pallet. @@ -99,9 +90,9 @@ benchmarks_instance_pallet! { is_halted: false, }; - bootstrap_bridge::(init_data); + initialize_bridge::(init_data); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); let params = JustificationGeneratorParams { header: header.clone(), round: TEST_GRANDPA_ROUND, @@ -115,7 +106,7 @@ benchmarks_instance_pallet! { }: _(RawOrigin::Signed(caller), header, justification) verify { - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); let expected_hash = header.hash(); assert_eq!(>::get(), expected_hash); @@ -136,8 +127,8 @@ benchmarks_instance_pallet! { is_halted: false, }; - bootstrap_bridge::(init_data); - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); + initialize_bridge::(init_data); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); let params = JustificationGeneratorParams { header: header.clone(), @@ -152,7 +143,7 @@ benchmarks_instance_pallet! { }: submit_finality_proof(RawOrigin::Signed(caller), header, justification) verify { - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); let expected_hash = header.hash(); assert_eq!(>::get(), expected_hash); @@ -179,8 +170,8 @@ benchmarks_instance_pallet! { is_halted: false, }; - bootstrap_bridge::(init_data); - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); + initialize_bridge::(init_data); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); let params = JustificationGeneratorParams { header: header.clone(), @@ -195,7 +186,7 @@ benchmarks_instance_pallet! { }: submit_finality_proof(RawOrigin::Signed(caller), header, justification) verify { - let header: BridgedHeader = bp_test_utils::test_header(header_number::()); + let header: BridgedHeader = bp_test_utils::test_header(One::one()); let expected_hash = header.hash(); assert_eq!(>::get(), expected_hash); diff --git a/modules/grandpa/src/lib.rs b/modules/grandpa/src/lib.rs index c263c194875..358e99ef2d6 100644 --- a/modules/grandpa/src/lib.rs +++ b/modules/grandpa/src/lib.rs @@ -158,8 +158,20 @@ pub mod pallet { verify_justification::(&justification, hash, *number, authority_set)?; let _enacted = try_enact_authority_change::(&finality_target, set_id)?; + let index = >::get(); + let pruning = >::try_get(index); + >::put(hash); + >::insert(hash, finality_target); + >::insert(index, hash); >::mutate(|count| *count += 1); - insert_header::(finality_target, hash); + + // Update ring buffer pointer and remove old header. + >::put((index + 1) % T::HeadersToKeep::get()); + if let Ok(hash) = pruning { + log::debug!(target: "runtime::bridge-grandpa", "Pruning old header: {:?}.", hash); + >::remove(hash); + } + log::info!(target: "runtime::bridge-grandpa", "Succesfully imported finalized header with hash {:?}!", hash); Ok(().into()) @@ -415,25 +427,6 @@ pub mod pallet { ) } - /// Import a previously verified header to the storage. - /// - /// Note this function solely takes care of updating the storage and pruning old entries, - /// but does not verify the validaty of such import. - pub(crate) fn insert_header, I: 'static>(header: BridgedHeader, hash: BridgedBlockHash) { - let index = >::get(); - let pruning = >::try_get(index); - >::put(hash); - >::insert(hash, header); - >::insert(index, hash); - - // Update ring buffer pointer and remove old header. - >::put((index + 1) % T::HeadersToKeep::get()); - if let Ok(hash) = pruning { - log::debug!(target: "runtime::bridge-grandpa", "Pruning old header: {:?}.", hash); - >::remove(hash); - } - } - /// Since this writes to storage with no real checks this should only be used in functions that /// were called by a trusted origin. pub(crate) fn initialize_bridge, I: 'static>( @@ -448,8 +441,8 @@ pub mod pallet { let initial_hash = header.hash(); >::put(initial_hash); - >::put(0); - insert_header::(header, initial_hash); + >::put(initial_hash); + >::insert(initial_hash, header); let authority_set = bp_header_chain::AuthoritySet::new(authority_list, set_id); >::put(authority_set); @@ -457,29 +450,6 @@ pub mod pallet { >::put(is_halted); } - #[cfg(feature = "runtime-benchmarks")] - pub(crate) fn bootstrap_bridge, I: 'static>( - init_params: super::InitializationData>, - ) { - let start_number = *init_params.header.number(); - let end_number = start_number + T::HeadersToKeep::get().into(); - initialize_bridge::(init_params); - - let mut number = start_number; - while number < end_number { - number = number + sp_runtime::traits::One::one(); - let header = >::new( - number, - Default::default(), - Default::default(), - Default::default(), - Default::default(), - ); - let hash = header.hash(); - insert_header::(header, hash); - } - } - /// Ensure that the origin is either root, or `PalletOwner`. fn ensure_owner_or_root, I: 'static>(origin: T::Origin) -> Result<(), BadOrigin> { match origin.into() { diff --git a/modules/grandpa/src/weights.rs b/modules/grandpa/src/weights.rs index 9e7c2ebc087..a548534a20b 100644 --- a/modules/grandpa/src/weights.rs +++ b/modules/grandpa/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_grandpa //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-04-21, STEPS: [50, ], REPEAT: 20 +//! DATE: 2021-04-14, STEPS: [50, ], REPEAT: 20 //! LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled //! CHAIN: Some("dev"), DB CACHE: 128 @@ -60,29 +60,29 @@ pub struct RialtoWeight(PhantomData); impl WeightInfo for RialtoWeight { fn submit_finality_proof(v: u32, p: u32) -> Weight { (0 as Weight) - .saturating_add((756_462_000 as Weight).saturating_mul(v as Weight)) - .saturating_add((791_236_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((837_084_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((874_929_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } fn submit_finality_proof_on_single_fork(v: u32) -> Weight { - (280_121_000 as Weight) - .saturating_add((14_098_000 as Weight).saturating_mul(v as Weight)) + (276_463_000 as Weight) + .saturating_add((14_149_000 as Weight).saturating_mul(v as Weight)) .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } fn submit_finality_proof_on_many_forks(p: u32) -> Weight { - (10_370_940_000 as Weight) - .saturating_add((96_902_000 as Weight).saturating_mul(p as Weight)) + (10_676_019_000 as Weight) + .saturating_add((97_598_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } fn find_scheduled_change(n: u32) -> Weight { - (479_000 as Weight).saturating_add((11_000 as Weight).saturating_mul(n as Weight)) + (618_000 as Weight).saturating_add((8_000 as Weight).saturating_mul(n as Weight)) } fn read_write_authority_sets(n: u32) -> Weight { - (8_030_000 as Weight) - .saturating_add((232_000 as Weight).saturating_mul(n as Weight)) + (8_582_000 as Weight) + .saturating_add((234_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -92,29 +92,29 @@ impl WeightInfo for RialtoWeight { impl WeightInfo for () { fn submit_finality_proof(v: u32, p: u32) -> Weight { (0 as Weight) - .saturating_add((756_462_000 as Weight).saturating_mul(v as Weight)) - .saturating_add((791_236_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((837_084_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((874_929_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } fn submit_finality_proof_on_single_fork(v: u32) -> Weight { - (280_121_000 as Weight) - .saturating_add((14_098_000 as Weight).saturating_mul(v as Weight)) + (276_463_000 as Weight) + .saturating_add((14_149_000 as Weight).saturating_mul(v as Weight)) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } fn submit_finality_proof_on_many_forks(p: u32) -> Weight { - (10_370_940_000 as Weight) - .saturating_add((96_902_000 as Weight).saturating_mul(p as Weight)) + (10_676_019_000 as Weight) + .saturating_add((97_598_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } fn find_scheduled_change(n: u32) -> Weight { - (479_000 as Weight).saturating_add((11_000 as Weight).saturating_mul(n as Weight)) + (618_000 as Weight).saturating_add((8_000 as Weight).saturating_mul(n as Weight)) } fn read_write_authority_sets(n: u32) -> Weight { - (8_030_000 as Weight) - .saturating_add((232_000 as Weight).saturating_mul(n as Weight)) + (8_582_000 as Weight) + .saturating_add((234_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } diff --git a/modules/messages/src/weights.rs b/modules/messages/src/weights.rs index f86a21e3ed9..0eecd0d8462 100644 --- a/modules/messages/src/weights.rs +++ b/modules/messages/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_messages //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-04-21, STEPS: [50, ], REPEAT: 20 +//! DATE: 2021-04-14, STEPS: [50, ], REPEAT: 20 //! LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled //! CHAIN: Some("dev"), DB CACHE: 128 @@ -73,105 +73,105 @@ pub trait WeightInfo { pub struct RialtoWeight(PhantomData); impl WeightInfo for RialtoWeight { fn send_minimal_message_worst_case() -> Weight { - (149_643_000 as Weight) + (149_497_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn send_1_kb_message_worst_case() -> Weight { - (153_329_000 as Weight) + (154_339_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn send_16_kb_message_worst_case() -> Weight { - (200_113_000 as Weight) + (200_066_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn increase_message_fee() -> Weight { - (6_407_252_000 as Weight) + (6_432_637_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_single_message_proof() -> Weight { - (141_256_000 as Weight) + (141_671_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_two_messages_proof() -> Weight { - (247_723_000 as Weight) + (247_393_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_with_outbound_lane_state() -> Weight { - (159_731_000 as Weight) + (159_312_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_1_kb() -> Weight { - (168_546_000 as Weight) + (167_935_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_16_kb() -> Weight { - (450_087_000 as Weight) + (449_846_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_single_message() -> Weight { - (164_519_000 as Weight) + (127_322_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { - (173_300_000 as Weight) + (134_120_000 as Weight) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { - (246_205_000 as Weight) + (191_193_000 as Weight) .saturating_add(T::DbWeight::get().reads(8 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn send_messages_of_various_lengths(i: u32) -> Weight { - (149_551_000 as Weight) + (115_699_000 as Weight) .saturating_add((3_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn receive_multiple_messages_proof(i: u32) -> Weight { (0 as Weight) - .saturating_add((114_817_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((113_551_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_message_proofs_with_extra_nodes(i: u32) -> Weight { - (437_797_000 as Weight) - .saturating_add((10_000 as Weight).saturating_mul(i as Weight)) + (458_731_000 as Weight) + .saturating_add((9_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_message_proofs_with_large_leaf(i: u32) -> Weight { - (137_633_000 as Weight) + (82_314_000 as Weight) .saturating_add((7_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight { - (0 as Weight) - .saturating_add((118_482_000 as Weight).saturating_mul(i as Weight)) + (16_766_000 as Weight) + .saturating_add((115_533_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight { - (116_036_000 as Weight) - .saturating_add((7_118_000 as Weight).saturating_mul(i as Weight)) + (122_146_000 as Weight) + .saturating_add((6_789_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight { - (172_780_000 as Weight) - .saturating_add((63_718_000 as Weight).saturating_mul(i as Weight)) + (155_671_000 as Weight) + .saturating_add((63_020_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -182,105 +182,105 @@ impl WeightInfo for RialtoWeight { // For backwards compatibility and tests impl WeightInfo for () { fn send_minimal_message_worst_case() -> Weight { - (149_643_000 as Weight) + (149_497_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn send_1_kb_message_worst_case() -> Weight { - (153_329_000 as Weight) + (154_339_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn send_16_kb_message_worst_case() -> Weight { - (200_113_000 as Weight) + (200_066_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn increase_message_fee() -> Weight { - (6_407_252_000 as Weight) + (6_432_637_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_single_message_proof() -> Weight { - (141_256_000 as Weight) + (141_671_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_two_messages_proof() -> Weight { - (247_723_000 as Weight) + (247_393_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_with_outbound_lane_state() -> Weight { - (159_731_000 as Weight) + (159_312_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_1_kb() -> Weight { - (168_546_000 as Weight) + (167_935_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_16_kb() -> Weight { - (450_087_000 as Weight) + (449_846_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_single_message() -> Weight { - (164_519_000 as Weight) + (127_322_000 as Weight) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { - (173_300_000 as Weight) + (134_120_000 as Weight) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { - (246_205_000 as Weight) + (191_193_000 as Weight) .saturating_add(RocksDbWeight::get().reads(8 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn send_messages_of_various_lengths(i: u32) -> Weight { - (149_551_000 as Weight) + (115_699_000 as Weight) .saturating_add((3_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn receive_multiple_messages_proof(i: u32) -> Weight { (0 as Weight) - .saturating_add((114_817_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((113_551_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_message_proofs_with_extra_nodes(i: u32) -> Weight { - (437_797_000 as Weight) - .saturating_add((10_000 as Weight).saturating_mul(i as Weight)) + (458_731_000 as Weight) + .saturating_add((9_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_message_proofs_with_large_leaf(i: u32) -> Weight { - (137_633_000 as Weight) + (82_314_000 as Weight) .saturating_add((7_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight { - (0 as Weight) - .saturating_add((118_482_000 as Weight).saturating_mul(i as Weight)) + (16_766_000 as Weight) + .saturating_add((115_533_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight { - (116_036_000 as Weight) - .saturating_add((7_118_000 as Weight).saturating_mul(i as Weight)) + (122_146_000 as Weight) + .saturating_add((6_789_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight { - (172_780_000 as Weight) - .saturating_add((63_718_000 as Weight).saturating_mul(i as Weight)) + (155_671_000 as Weight) + .saturating_add((63_020_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) diff --git a/relays/bin-substrate/src/messages_lane.rs b/relays/bin-substrate/src/messages_lane.rs index 8b4f2435fba..bc353340696 100644 --- a/relays/bin-substrate/src/messages_lane.rs +++ b/relays/bin-substrate/src/messages_lane.rs @@ -203,7 +203,7 @@ mod tests { // reserved for messages dispatch allows dispatch of non-trivial messages. // // Any significant change in this values should attract additional attention. - (1013, 216_583_333_334), + (1020, 216_583_333_334), ); } }