Skip to content

Commit cdbac35

Browse files
authored
Merge pull request #821 from opentensor/sam-pallet-index
require explicit pallet indexes
2 parents 2069a48 + c428641 commit cdbac35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+21037
-41
lines changed

.github/workflows/check-rust.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ jobs:
157157

158158
- name: check lints
159159
run: |
160-
set -o pipefail # Ensure the pipeline fails if any command in the pipeline fails
161-
cargo check 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g" | tee /dev/tty | grep -q "^warning:" && \
162-
(echo "Build emitted the following warnings:" >&2 && exit 1) || echo "No warnings found."
160+
set -o pipefail
161+
cargo check 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g" | grep "warning:" && exit 1
162+
echo "No warnings found."
163163
164164
cargo-clippy-all-features:
165165
name: cargo clippy --all-features

Cargo.lock

Lines changed: 69 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ members = [
3333
"support/tools",
3434
"support/macros",
3535
"support/linting",
36+
"support/procedural-fork",
3637
]
38+
exclude = ["support/procedural-fork"]
3739
resolver = "2"
3840

3941
[workspace.lints.clippy]

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fn main() {
6060
};
6161

6262
track_lint(RequireFreezeStruct::lint(&parsed_file));
63+
track_lint(RequireExplicitPalletIndex::lint(&parsed_file));
6364
});
6465

6566
// Collect and print all errors after the parallel processing is done

pallets/admin-utils/tests/mock.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ type Block = frame_system::mocking::MockBlock<Test>;
2323
frame_support::construct_runtime!(
2424
pub enum Test
2525
{
26-
System: frame_system,
27-
Balances: pallet_balances,
28-
AdminUtils: pallet_admin_utils,
29-
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>, Error<T>},
30-
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
26+
System: frame_system = 1,
27+
Balances: pallet_balances = 2,
28+
AdminUtils: pallet_admin_utils = 3,
29+
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>, Error<T>} = 4,
30+
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 5,
3131
}
3232
);
3333

pallets/collective/src/tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64,
3636
frame_support::construct_runtime!(
3737
pub enum Test
3838
{
39-
System: frame_system::{Pallet, Call, Event<T>},
40-
Collective: pallet_collective::<Instance1>::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
41-
CollectiveMajority: pallet_collective::<Instance2>::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
42-
DefaultCollective: pallet_collective::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
43-
Democracy: mock_democracy::{Pallet, Call, Event<T>},
39+
System: frame_system::{Pallet, Call, Event<T>} = 1,
40+
Collective: pallet_collective::<Instance1>::{Pallet, Call, Event<T>, Origin<T>, Config<T>} = 2,
41+
CollectiveMajority: pallet_collective::<Instance2>::{Pallet, Call, Event<T>, Origin<T>, Config<T>} = 3,
42+
DefaultCollective: pallet_collective::{Pallet, Call, Event<T>, Origin<T>, Config<T>} = 4,
43+
Democracy: mock_democracy::{Pallet, Call, Event<T>} = 5,
4444
}
4545
);
4646
mod mock_democracy {

pallets/commitments/src/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ type Block = frame_system::mocking::MockBlock<Test>;
1212
frame_support::construct_runtime!(
1313
pub enum Test
1414
{
15-
System: frame_system,
16-
Commitments: pallet_commitments,
15+
System: frame_system = 1,
16+
Commitments: pallet_commitments = 2,
1717
}
1818
);
1919

pallets/commitments/src/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64,
1616
frame_support::construct_runtime!(
1717
pub enum Test
1818
{
19-
System: frame_system,
20-
Balances: pallet_balances,
21-
Commitments: pallet_commitments
19+
System: frame_system = 1,
20+
Balances: pallet_balances = 2,
21+
Commitments: pallet_commitments = 3,
2222
}
2323
);
2424

pallets/registry/src/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ type Block = frame_system::mocking::MockBlock<Test>;
1212
frame_support::construct_runtime!(
1313
pub enum Test
1414
{
15-
System: frame_system,
16-
TemplateModule: pallet_template,
15+
System: frame_system = 1,
16+
TemplateModule: pallet_template = 2,
1717
}
1818
);
1919

pallets/subtensor/tests/mock.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ type Block = frame_system::mocking::MockBlock<Test>;
2424
frame_support::construct_runtime!(
2525
pub enum Test
2626
{
27-
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
28-
Balances: pallet_balances::{Pallet, Call, Config<T>, Storage, Event<T>},
29-
Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
30-
TriumvirateMembers: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>},
31-
Senate: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
32-
SenateMembers: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>},
33-
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>},
34-
Utility: pallet_utility::{Pallet, Call, Storage, Event},
35-
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
36-
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>},
27+
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 1,
28+
Balances: pallet_balances::{Pallet, Call, Config<T>, Storage, Event<T>} = 2,
29+
Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 3,
30+
TriumvirateMembers: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 4,
31+
Senate: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 5,
32+
SenateMembers: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 6,
33+
SubtensorModule: pallet_subtensor::{Pallet, Call, Storage, Event<T>} = 7,
34+
Utility: pallet_utility::{Pallet, Call, Storage, Event} = 8,
35+
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 9,
36+
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 10,
3737
}
3838
);
3939

0 commit comments

Comments
 (0)