Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber (#2790)

* Fixes

* Removes unused import

* Uses Block and removes BlockNumber/Header from Chain

* Fixes bridges

* Fixes

* Removes unused import

* Fixes build

* Uses correct RelayBlock

* Minor fix

* Fixes glutton-kusama

* Uses correct RelayBlock

* Minor fix

* Fixes benchmark for pallet-bridge-parachains

* Adds appropriate constraints

* Minor fixes

* Removes unused import

* Fixes integrity tests

* Minor fixes

* Updates trait bounds

* Uses custom bound for AsPrimitive

* Fixes trait bounds

* Revert "Fixes trait bounds"

This reverts commit 0b0f42f583f3a616a88afe45fcd06d31e7d9a06f.

* Revert "Uses custom bound for AsPrimitive"

This reverts commit 838e5281adf8b6e9632a2abb9cd550db4ae24126.

* No AsPrimitive trait bound for now

* Removes bounds on Number

* update lockfile for {"substrate", "polkadot"}

* Formatting

* ".git/.scripts/commands/fmt/fmt.sh"

* Minor fix

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
gupnik
2023-07-13 19:00:28 +05:30
committed by GitHub
parent 49145bdd9b
commit 24d6e46ad0
54 changed files with 449 additions and 633 deletions
@@ -75,7 +75,7 @@ impl<H: HeaderT> GrandpaJustification<H> {
/// any precise calculations - that's just an estimation.
pub fn max_reasonable_size<C>(required_precommits: u32) -> u32
where
C: Chain<Header = H> + ChainWithGrandpa,
C: Chain + ChainWithGrandpa,
{
// we don't need precise results here - just estimations, so some details
// are removed from computations (e.g. bytes required to encode vector length)
@@ -159,10 +159,7 @@ pub fn verify_and_optimize_justification<Header: HeaderT>(
authorities_set_id: SetId,
authorities_set: &VoterSet<AuthorityId>,
justification: GrandpaJustification<Header>,
) -> Result<GrandpaJustification<Header>, Error>
where
Header::Number: finality_grandpa::BlockNumberOps,
{
) -> Result<GrandpaJustification<Header>, Error> {
let mut optimizer = OptimizationCallbacks(Vec::new());
verify_justification_with_callbacks(
finalized_target,
@@ -180,10 +177,7 @@ pub fn verify_justification<Header: HeaderT>(
authorities_set_id: SetId,
authorities_set: &VoterSet<AuthorityId>,
justification: &GrandpaJustification<Header>,
) -> Result<(), Error>
where
Header::Number: finality_grandpa::BlockNumberOps,
{
) -> Result<(), Error> {
verify_justification_with_callbacks(
finalized_target,
authorities_set_id,
@@ -259,10 +253,7 @@ fn verify_justification_with_callbacks<Header: HeaderT, C: VerificationCallbacks
authorities_set: &VoterSet<AuthorityId>,
justification: &GrandpaJustification<Header>,
callbacks: &mut C,
) -> Result<(), Error>
where
Header::Number: finality_grandpa::BlockNumberOps,
{
) -> Result<(), Error> {
// ensure that it is justification for the expected header
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
return Err(Error::InvalidJustificationTarget)