Skip to content

Commit

Permalink
Import vec to bridges/primitives/header-chain (#6031)
Browse files Browse the repository at this point in the history
# Description

I'm unable to build a bridge library due to the errors below, so I am
adding the explicit import to `sp_std::vec`.

## Integration

Projects using it can update their dependency. We are using the branch
`stable2407` (mixed them up in my branch).

## Errors
```
error: cannot find macro `vec` in this scope
  --> /Users/drew/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/88c3250/bridges/primitives/header-chain/src/justification/verification/mod.rs:99:19
   |
99 |         let mut route = vec![];
   |                         ^^^
   |
help: consider importing one of these items
   |
23 + use scale_info::prelude::vec;
   |
23 + use sp_std::vec;
   |

error: cannot find macro `vec` in this scope
   --> /Users/drew/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/88c3250/bridges/primitives/header-chain/src/justification/verification/optimizer.rs:135:36
    |
135 |         duplicate_votes_ancestries_idxs: vec![],
    |                                          ^^^
    |
help: consider importing one of these items
    |
19  + use scale_info::prelude::vec;
    |
19  + use sp_std::vec;
    |

error: cannot find macro `vec` in this scope
   --> /Users/drew/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/88c3250/bridges/primitives/header-chain/src/justification/verification/optimizer.rs:134:21
    |
134 |         extra_precommits: vec![],
    |                           ^^^
    |
help: consider importing one of these items
    |
19  + use scale_info::prelude::vec;
    |
19  + use sp_std::vec;
    |

error: cannot find macro `vec` in this scope
  --> /Users/drew/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/88c3250/bridges/primitives/header-chain/src/justification/verification/equivocation.rs:89:27
   |
89 |         let mut equivocations = vec![];
   |                                 ^^^
   |
help: consider importing one of these items
   |
19 + use scale_info::prelude::vec;
   |
19 + use sp_std::vec;
```

---------

Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Serban Iorga <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: Adrian Catangiu <[email protected]>
(cherry picked from commit 31dfc9f)
  • Loading branch information
drewstone authored and github-actions[bot] committed Oct 17, 2024
1 parent a50858c commit 855eefa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ use sp_runtime::traits::Header as HeaderT;
use sp_std::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
prelude::*,
vec,
vec::Vec,
};

enum AuthorityVotes<Header: HeaderT> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ use sp_std::{
btree_set::BTreeSet,
},
prelude::*,
vec,
vec::Vec,
};

type SignedPrecommit<Header> = finality_grandpa::SignedPrecommit<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::justification::verification::{
};
use sp_consensus_grandpa::AuthorityId;
use sp_runtime::traits::Header as HeaderT;
use sp_std::{collections::btree_set::BTreeSet, prelude::*};
use sp_std::{collections::btree_set::BTreeSet, prelude::*, vec, vec::Vec};

// Verification callbacks for justification optimization.
struct JustificationOptimizer<Header: HeaderT> {
Expand Down
10 changes: 10 additions & 0 deletions prdoc/pr_6031.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: "Import vec to bridges/primitives/header-chain"

doc:
- audience: Runtime Dev
description: |
Add the `vec` dependency to these files to resolve compiler errors.

crates:
- name: bp-header-chain
bump: patch

0 comments on commit 855eefa

Please sign in to comment.