Commit Graph

79 Commits

Author SHA1 Message Date
dependabot[bot] cffc8e3a7b Bump scale-info from 2.5.0 to 2.6.0
Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/scale-info/commits)

---
updated-dependencies:
- dependency-name: scale-info
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 10:28:37 +02:00
dependabot[bot] 1659b4b447 Bump scale-info from 2.4.0 to 2.5.0
Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/scale-info/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: scale-info
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 10:28:37 +02:00
dependabot[bot] cf00c67579 Bump hex-literal from 0.3.4 to 0.4.0
Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.3.4 to 0.4.0.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](https://github.com/RustCrypto/utils/compare/hex-literal-v0.3.4...hex-literal-v0.4.0)

---
updated-dependencies:
- dependency-name: hex-literal
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 10:28:37 +02:00
dependabot[bot] 8e14f3f9af Bump finality-grandpa from 0.16.1 to 0.16.2
Bumps [finality-grandpa](https://github.com/paritytech/finality-grandpa) from 0.16.1 to 0.16.2.
- [Release notes](https://github.com/paritytech/finality-grandpa/releases)
- [Commits](https://github.com/paritytech/finality-grandpa/compare/v0.16.1...v0.16.2)

---
updated-dependencies:
- dependency-name: finality-grandpa
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 10:28:37 +02:00
Branislav Kontur 874ab44e00 Bump substrate/polkadot/cumulus (#1962)
* Bump substrate/polkadot/cumulus

* sp_finality_grandpa - >sp_consensus_grandpa

* sp_beefy -> sp_consensus_beefy

* pallet_randomness_collective_flip -> pallet_insecure_randomness_collective_flip

* fix

* Cumulus parachain stuff

* Cumulus parachain stuff one more

* Millau/Rialto runtimes

* Removed pallet_insecure_randomness_collective_flip

* Millau node

* Removed session historial

* TMP: just try disable all fetches

* Docs in gitlab.yml
2024-04-10 10:28:37 +02:00
Serban Iorga 9b44db0fbe Some error improvements (#1956)
* Use `HeaderChainError` in parachains module

* Use MessageProofError instead of 'static str in some places

* Avoid implementing Into<'static str> for some errors

We avoid deriving `Debug` for the structs that we use in the runtime and
we derive `RuntimeDebug` instead in order to avoid bloating th eruntime
with static strs. But implementing `Into<'static str>` does the same. So
in some places it makes sense to replace `Into<'static str>` with `Debug`.

* Move the messages error definition

Move the messages error definition outside of `mod target`
2024-04-10 10:28:37 +02:00
Serban Iorga e7debc4b09 Fix init-bridge (#1900) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 498a3e83d0 Weight+size limits for bridge GRANDPA pallet calls (#1882)
* weight+size limits for bridge GRANDPA pallet calls

* continue

* fixed all tests

* some changes to refund computations

* post_dispatch_refunds_relayer_in_all_finality_batch_with_extra_weight

* - dup code

* do not return Pays::No if call is above weight/size limits

* relayer_pays_tx_fee_when_submitting_huge_mandatory_header and relayer_pays_tx_fee_when_submitting_justification_with_long_ancestry_votes

* clippy

* fmt

* clippy

* small change in docs

* fixed GRANDPA-limits constants for Polkadot-like chains

* clippy

* clippy + spelling

* Update primitives/polkadot-core/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update bin/runtime-common/src/refund_relayer_extension.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* reverted unnecessary change

* GrandpaJustification::max_reasonable_size

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 1d6e8a9a26 optimize justification before submit (#1887)
* optimize justification before submit

* fmt

* spelling

* clippy

* fmt again

* aaand compilation

* clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky c6c39be967 ChainWithGrandpa in primitives (#1885)
* ChainWithGrandpa in primitives

* clippy ++ spelling

* fix benchmarks comppilation
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 25c17feb23 Reject storage proofs with unused nodes: begin (#1878)
* reject storage proofs with unused nodes: begin

* fix ignores_parachain_head_if_it_is_missing_from_storage_proof

* message_proof_is_rejected_if_it_has_duplicate_trie_nodes && message_proof_is_rejected_if_it_has_unused_trie_nodes

* proof_with_duplicate_items_is_rejected and proof_with_unused_items_is_rejected

* clippy

* fix benchmarks compilation

* impl From<Error> for &'static str

* fix review comments

* added comment
2024-04-10 10:28:37 +02:00
Serban Iorga 5d875d05d3 Use named parameters for indirect calls (#1823) 2024-04-10 10:28:37 +02:00
Serban Iorga 63a538a9bb Deduplicate pallet call structs used for indirect runtime calls (#1744)
* Small changes

* Define generic bridge pallets call structs

* polkadot-core SignedExtension simplifications

- we don't seem to need to pass the Call as a generic param
- we can use codec(skip) instead of implementing Encode and Decode

* Split BridgeHubRococo and BridgeHubWococo calls

* code review fixes
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 7014046485 only store header state root (pallet-bridge-grandpa) (#1699) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 6dcecf4425 Reintroduce header chain trait (#1622)
* reintroduce header chain trait

* renive BridgedChainWithMessages::maximal_extrinsic_size
2024-04-10 10:28:37 +02:00
Serban Iorga 01538bc5fa Finality loop: get block justification and authorities change by consensus engine ID (#1619)
* SignedBlock: get justification by consensus engine id

* Define ConsensusLogReader

Making the check for authority changes more generic

* cod review changes
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f38852f661 Remove pallet::without_storage_info from bridge GRANDPA pallet (#1478)
* remove pallet::without_storage_info from bridge GRANDPA pallet

* StoredBridgedHeader

* spelling

* fix benchmarks

* MAX_BRIDGED_AUTHORITIES: 256 -> 2048

* Update modules/grandpa/src/storage_types.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update modules/grandpa/src/storage_types.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* moved max authorities + header size to chain primitives

* removed unused code

* new -> try_new

* fix benchmarks compilation

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 95c30c780c update Substrate/Polkadot/Cumulus refs (#1562)
* update Substrate/Polkadot/Cumulus refs

* finality-grandpa 0.16

* fix miillau-runtime compilation

* fix rialto runtime compilation

* fixed rialto-parachain runtime compilation

* backport GRANDPA test fixes

* helper instead of removed record_all_keys

* substrate-relay is compiling

* millau-bridge-node at least compiles

* rialto-bridge-node at least compiles

* rialto-parachain-collator compiles

* fixings tests (wip)

* fmt

* fixed BEEFY alert

* clippy

* removed unused dep

* -extra var

* move Leaf to mod mmr

* fix benchmarks
2024-04-10 10:28:37 +02:00
Branislav Kontur 7ad5b0fe56 Bump codec version 3.0.0 -> 3.1.5 + unify parity-scale-codec vs codec (#1552) 2024-04-10 10:28:37 +02:00
Serban Iorga f8ff3c9142 Unify the operating mode for bridge pallets (#1483)
Unify the operating mode for bridge pallets

- define the OperationMode trait and BasicOperatingMode enum
- use the OperationMode trait in all the bridge pallets
- use BasicOperatingMode instead of IsHalted for the Grandpa pallet
- use BasicOperatingMode as part of MessagesOperatingMode

Signed-off-by: Serban Iorga <serban@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky a97dedb50f Store both block number and hash in best finalized storage value (#1475)
* store both block number and hash in BestFinalized

* also fix relay code

* spelling
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 31a2be845c Fix on-different-forks metrics during initialization (#1468)
* fix on-different-forks metrics during initialization

* "initialize" parachain finality pallet in on-demand parachains relay

* decrease converstion rate requests count

* more error logging

* fix compilation

* clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 7a92b40eab Fix clippy warnings + try to enable proper (no-warning) clippy on CI (#1410)
* fix clippy warnings

* try to reenable proper clippy on CI

* fix clippy error

* more Eqs

* ignore clippy::derive-partial-eq-without-eq - clippy seems to be broken now :/
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky c538a39816 Switch to gav-xcm-v3 branch to be able to test bridges + XCMv3 integration (#1378)
* switch to gav-xcm-v3 branch (wip)

* add comment

* play with CI

* keep playing with CI

* play with CI

* trigger CI

* Revert "trigger CI"

This reverts commit fc35ac648fe6a3ea8e710a2e07dfee7d8762c6c4.
2024-04-10 10:28:37 +02:00
Adrian Catangiu d04b018630 Few typos and clippy fixes (#1362)
* fix typos

* clippy fixes
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 65c2c0ccce Update Substrate/Polkadot/Cumulus references (#1353)
* cumulus: 4e95228291
polkadot: 975e780ae0d988dc033f400ba822d14b326ee5b9
substrate: 89fcb3e4f62d221d4e161a437768e77d6265889e

* fix refs

* sync changes from https://github.com/paritytech/polkadot/pull/3828

* sync changes from https://github.com/paritytech/polkadot/pull/4387

* sync changes from https://github.com/paritytech/polkadot/pull/3940

* sync with changes from https://github.com/paritytech/polkadot/pull/4493

* sync with changes from https://github.com/paritytech/polkadot/pull/4958

* sync with changes from https://github.com/paritytech/polkadot/pull/3889

* sync with changes from https://github.com/paritytech/polkadot/pull/5033

* sync with changes from https://github.com/paritytech/polkadot/pull/5065

* compilation fixes

* fixed prometheus endpoint startup (it now requires to be spawned within tokio context)
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 2bf5b23262 edition = "2021" (#1346) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ea2d6f898d Bump Substrate/Polkadot/Cumulus refs (#1295)
Substrate: 31d90c202d6df9ce3837ee55587b604619a912ba
Polkadot: 60df3c55c711c2872872d6220f98b2611340e051
Cumulus: a9630551c2
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0fa8c02e7a when GRANDPA pallet is halted, relay shall not submit finality transactions (#1288) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky bb249eff15 verify that GRANDPA pallet is not initialized before submitting initialization transaction (#1267)
* verify that GRANDPA pallet is not initialized before submitting initialization transaction

* spelling
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky e23266c7e6 Bump dependencies (#1180)
* substrate: d0f6c1c60da22e04dd25c2eca46ebfe6f1571af0
polkadot: dd4b2e6a34a08a01b876d14641e99e7011be3463
cumulus: 9379cd6c18

* fmt

* fixed lost refs

* spelling

* benckhmarks

* fmt
2024-04-10 10:28:37 +02:00
hacpy bd70de8b8b Match substrate's fmt (#1148)
* Alter gitlab.

* Use substrate's rustfmt.toml

* cargo +nightly fmt --all

* Fix spellcheck.

* cargo +nightly fmt --all

* format.

* Fix spellcheck and fmt

* fmt?

* Fix spellcheck

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 084da4343d Box large arguments of GRANDPA pallet (#1154)
* box large arguments

* benchmarks

* fix
2024-04-10 10:28:37 +02:00
Xavier Lau 3d4d66456d Code Cleaning (#1124)
* Remove Trailing Space

* Correct Source Chain Name
2024-04-10 10:28:37 +02:00
Tomasz Waszczyk f86d101d7c Fix full spellcheck (#1076)
* fix(spellcheck): test of fixing

* fix(hunspell): improved many typos etc.

* fix(hunspell): all errors solved

* fix(hunspell): extended scope of files - the build should fail

* Return error code.

* Fix spelling, sort dictionary.

* fix(hunspell): added fix to gitlabs check

* fix(typo): one typo and test of verification on github

* fix(typo): one typo

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f5f73537a8 bump dependencies before start referencing polkadot repo (#1048) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 37d067c0e0 Update submit finality proof weight formula (#981)
* updated weight formula for submit_finality_proof

* remove common prefix traces

* update docs

* single benchmark

* Re-generate weights.

* Update delivery transaction limits

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: Hernando Castano <hernando@hcastano.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 700d63672b Custom justification verification (#979)
* custom justification verification

* is_ancestor -> ensure_descendant

* PrecommitIsNotCommitDescendant

* Update primitives/header-chain/src/justification.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b6efe6f740 Avoid hashing headers twice in verify_justification (#973) 2024-04-10 10:28:37 +02:00
Hernando Castano bca83fd020 Westend<>Rococo Headers Relay (#875)
* Add modules for Rococo<>Westend header sync

* Use mock Westend and Rococo finaltiy tx calls

* Add Westend<>Rococo variants to `init_bridge`

* Add Westend<>Rococo variants to `relay_headers`

* Simplify the Rococo and Westend signing params

* Add `submit_finality_proof` mock Call variant

* Add note to more closely match `initialize` Call variant

* Accidentally committed `cargo-expand`ed code 🤦

* Add `initialize` Call variant to Rococo mock

* Fix call enums.

* Add explainatory comment.

* clippy.

* Add issue number.

* De-duplicate metrics customisation.

* Add comments to Rococo/Westend runtimes.

* Add scale-encoding compatibility test.

* Fix tests.

* Clippy.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano c6ae74725b Bump Substrate (#871)
* Bump Substrate

* Change usage of "Module" to "Pallet"

Related Substrate PR: https://github.com/paritytech/substrate/pull/8372

* Add `OnSetCode` config param

Related Substrate PR: https://github.com/paritytech/substrate/pull/8496

* Update Aura Slot duration time type

Related Substrate PR: https://github.com/paritytech/substrate/pull/8386

* Add `OnSetCode` to mock runtimes

* Add support for multiple justifications

Related Substrate PR: https://github.com/paritytech/substrate/pull/7640

* Use updated justification type in more places

* Make GenesisConfig type non-optional

Related Substrate PR: https://github.com/paritytech/substrate/pull/8275

* Update service to use updated telemetry

Related Substrate PR: https://github.com/paritytech/substrate/pull/8143

* Appease Clippy
2024-04-10 10:28:37 +02:00
Hernando Castano 21baffc832 Update Copyright Date to 2021 (#864)
* Update copyright date to 2021

* Bump date in license header template
2024-04-10 10:28:37 +02:00
Hernando Castano 1928e2b870 Use Vote Ancestries Directly in Weight Calculations (#862)
* Use more accurate weight calculation in declared weight

* Remove session length and validator set size config constants

* Remove config params from mock

* Allow specifying total number of votes-ancestries per justification

* Change limits used during benchmarking

* Regenerate weights

* Use simplified weight annotation

* Remove comment

* Address leftover TODO

* Prevent possible divide by zero errors

* Use correct argument order in weight declaration
2024-04-10 10:28:37 +02:00
Hernando Castano 67cdca8aa4 Use GrandpaJustification instead of Vec<u8> in Pallet API (#847)
* Stop passing raw encoded justifications to pallet API

By having the API accept a struct-ified justification we are able to
better utilize the justifications fields for weight calculations.

* Update relayer code to use decoded justifications

* Add justification to `expect()` statement

* Fix some imports

* Make justification wrapper contain decoded justification

* Rename some fields

* Get rid of warnings

* Appease Clippy

* Only decode justification once at init time

* Remove unnecessary method

* Remove justification wrapper

This became kinda unnecessary since we could implement the FinalityProof
trait on GrandpaJustification directly.
2024-04-10 10:28:37 +02:00
Hernando Castano 78a9cdca66 Larger Test Keyring Support (#842)
* Allow creation of authority lists with any number of authorities

* Move keyring helpers into their own module

* Add helper for generating list of test accounts

* Fix import names in tests

* Rename Keyring trait to Signer

* Get list of accounts in a more functional way

* Clarify meaning of `test_keyring` return type

* Use concrete test account type instead of generics

* Make sure voter set contains all authorities which signed off on pre-commits
2024-04-10 10:28:37 +02:00
Hernando Castano 1c7b5d1b30 Tunable Justification Generator (#835)
* Add way to create tunable GRANDPA justifications

* Use new function in tests

* Allow multiple authorities on a single fork

* Only store pre-commit targets instead of full ancestry chains

* Rename precommit_header to be more generic

* Push new digest item instead of overriding entire digest

* Ensure that we generate chains with non-zero length

* Extract justification creation parameters into struct

* Appease Clippy
2024-04-10 10:28:37 +02:00
Hernando Castano eb7c96ba14 Make Test Helpers no_std Compatible (#823)
* Use `sp-application-crypto` when generating test justifications

* Try to justifications tests compiling

* Try using `ed25519_dalek` for justification creation

* Small cleanup

* Correctly generate a Keypair

The public key didn't correspond to what would be derived
with the given private key.

* Remove enum index hack

* Clean up test account helper functions

* Fix tests in `pallet-finality-verifier`

* Get `pallet-substrate-bridge` tests compiling again

* Use the correct keyring in justification tests

* Clean up Keyring related code a bit

* Appease Clippy

* Remove unused import

* Use keyring variants directly

* Remove unecessary From implementation
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky d749bc3a96 Sync Westend to Millau (#824)
* make finality verifier pallet instantiable

* add second instance of finality verifier pallet to the Millau runtime

* add Westend -> Millau headers relay

* use wss to connect to public westend nodes

* initialize with best_finalized_block

* typo

* Revert "initialize with best_finalized_block"

This reverts commit 954ed2832372d67618abc1a06d47e66faa93f674.

* pass VoterSet by ref

* new bridge initialization code

* loop upper bound

* Polkadot -> Westend

* fixed tests compilation

* default-features

* assert
2024-04-10 10:28:37 +02:00
Hernando Castano d8852fd197 Clean Finality Verifier Pallet (#804)
* Remove unused Config types from `pallet-finality-verifier`

* Remove unused AncestryChecker trait

* Remove ancestry proof parameter from relayer calls

* Update docs to reflect current state of pallet

* Remove mock ancestry checker

* Remove unused error

* Write headers outside of function used for authority set changes

* Move justification verification into helper function

* Add documentation suggestions

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Clean up module level documentation a bit

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 8f11732bb9 Uniform git dependencies (Backport of substrate#2589) (#805)
* Make Substrate deps uniform

* Rest of the deps.

* Fix broken merge.

* Revert substrate.

* Fix tests

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2024-04-10 10:28:37 +02:00