Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit afbc64e

Browse files
Szegooshawntabrizi
andauthored
Rename Origin (#6020)
* Rename Origin * fmt * fixes * more fixes * fix * more fixing * small fixes * last touches * update lockfile for {"substrate"} Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: parity-processbot <>
1 parent 9581849 commit afbc64e

File tree

46 files changed

+1176
-910
lines changed

Some content is hidden

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

46 files changed

+1176
-910
lines changed

Cargo.lock

+172-172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/common/src/assigned_slots.rs

+55-32
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub mod pallet {
8888
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
8989

9090
/// Origin for assigning slots.
91-
type AssignSlotOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>;
91+
type AssignSlotOrigin: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
9292

9393
/// The type representing the leasing system.
9494
type Leaser: Leaser<
@@ -592,7 +592,7 @@ mod tests {
592592
type BaseCallFilter = frame_support::traits::Everything;
593593
type BlockWeights = ();
594594
type BlockLength = ();
595-
type Origin = Origin;
595+
type RuntimeOrigin = RuntimeOrigin;
596596
type RuntimeCall = RuntimeCall;
597597
type Index = u64;
598598
type BlockNumber = BlockNumber;
@@ -738,7 +738,10 @@ mod tests {
738738
run_to_block(1);
739739

740740
assert_noop!(
741-
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
741+
AssignedSlots::assign_perm_parachain_slot(
742+
RuntimeOrigin::root(),
743+
ParaId::from(1_u32),
744+
),
742745
Error::<Test>::ParaDoesntExist
743746
);
744747
});
@@ -750,7 +753,10 @@ mod tests {
750753
run_to_block(1);
751754

752755
assert_noop!(
753-
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1_u32),),
756+
AssignedSlots::assign_perm_parachain_slot(
757+
RuntimeOrigin::signed(1),
758+
ParaId::from(1_u32),
759+
),
754760
BadOrigin
755761
);
756762
});
@@ -770,7 +776,10 @@ mod tests {
770776
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1_u32)));
771777

772778
assert_noop!(
773-
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
779+
AssignedSlots::assign_perm_parachain_slot(
780+
RuntimeOrigin::root(),
781+
ParaId::from(1_u32),
782+
),
774783
Error::<Test>::NotParathread
775784
);
776785
});
@@ -792,18 +801,24 @@ mod tests {
792801
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 1, 1));
793802
// Try to assign a perm slot in current period fails
794803
assert_noop!(
795-
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
804+
AssignedSlots::assign_perm_parachain_slot(
805+
RuntimeOrigin::root(),
806+
ParaId::from(1_u32),
807+
),
796808
Error::<Test>::OngoingLeaseExists
797809
);
798810

799811
// Cleanup
800-
assert_ok!(Slots::clear_all_leases(Origin::root(), 1.into()));
812+
assert_ok!(Slots::clear_all_leases(RuntimeOrigin::root(), 1.into()));
801813

802814
// Register lease for next lease period
803815
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 2, 1));
804816
// Should be detected and also fail
805817
assert_noop!(
806-
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
818+
AssignedSlots::assign_perm_parachain_slot(
819+
RuntimeOrigin::root(),
820+
ParaId::from(1_u32),
821+
),
807822
Error::<Test>::OngoingLeaseExists
808823
);
809824
});
@@ -836,17 +851,20 @@ mod tests {
836851
));
837852

838853
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
839-
Origin::root(),
854+
RuntimeOrigin::root(),
840855
ParaId::from(1_u32),
841856
));
842857
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
843-
Origin::root(),
858+
RuntimeOrigin::root(),
844859
ParaId::from(2_u32),
845860
));
846861
assert_eq!(AssignedSlots::permanent_slot_count(), 2);
847862

848863
assert_noop!(
849-
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(3_u32),),
864+
AssignedSlots::assign_perm_parachain_slot(
865+
RuntimeOrigin::root(),
866+
ParaId::from(3_u32),
867+
),
850868
Error::<Test>::MaxPermanentSlotsExceeded
851869
);
852870
});
@@ -868,7 +886,7 @@ mod tests {
868886
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1_u32)), None);
869887

870888
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
871-
Origin::root(),
889+
RuntimeOrigin::root(),
872890
ParaId::from(1_u32),
873891
));
874892

@@ -901,7 +919,7 @@ mod tests {
901919

902920
assert_noop!(
903921
AssignedSlots::assign_temp_parachain_slot(
904-
Origin::root(),
922+
RuntimeOrigin::root(),
905923
ParaId::from(1_u32),
906924
SlotLeasePeriodStart::Current
907925
),
@@ -917,7 +935,7 @@ mod tests {
917935

918936
assert_noop!(
919937
AssignedSlots::assign_temp_parachain_slot(
920-
Origin::signed(1),
938+
RuntimeOrigin::signed(1),
921939
ParaId::from(1_u32),
922940
SlotLeasePeriodStart::Current
923941
),
@@ -941,7 +959,7 @@ mod tests {
941959

942960
assert_noop!(
943961
AssignedSlots::assign_temp_parachain_slot(
944-
Origin::root(),
962+
RuntimeOrigin::root(),
945963
ParaId::from(1_u32),
946964
SlotLeasePeriodStart::Current
947965
),
@@ -967,22 +985,22 @@ mod tests {
967985
// Try to assign a perm slot in current period fails
968986
assert_noop!(
969987
AssignedSlots::assign_temp_parachain_slot(
970-
Origin::root(),
988+
RuntimeOrigin::root(),
971989
ParaId::from(1_u32),
972990
SlotLeasePeriodStart::Current
973991
),
974992
Error::<Test>::OngoingLeaseExists
975993
);
976994

977995
// Cleanup
978-
assert_ok!(Slots::clear_all_leases(Origin::root(), 1.into()));
996+
assert_ok!(Slots::clear_all_leases(RuntimeOrigin::root(), 1.into()));
979997

980998
// Register lease for next lease period
981999
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 2, 1));
9821000
// Should be detected and also fail
9831001
assert_noop!(
9841002
AssignedSlots::assign_temp_parachain_slot(
985-
Origin::root(),
1003+
RuntimeOrigin::root(),
9861004
ParaId::from(1_u32),
9871005
SlotLeasePeriodStart::Current
9881006
),
@@ -1006,7 +1024,7 @@ mod tests {
10061024
));
10071025

10081026
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
1009-
Origin::root(),
1027+
RuntimeOrigin::root(),
10101028
ParaId::from(n as u32),
10111029
SlotLeasePeriodStart::Current
10121030
));
@@ -1023,7 +1041,7 @@ mod tests {
10231041
));
10241042
assert_noop!(
10251043
AssignedSlots::assign_temp_parachain_slot(
1026-
Origin::root(),
1044+
RuntimeOrigin::root(),
10271045
ParaId::from(7_u32),
10281046
SlotLeasePeriodStart::Current
10291047
),
@@ -1047,7 +1065,7 @@ mod tests {
10471065
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1_u32)), None);
10481066

10491067
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
1050-
Origin::root(),
1068+
RuntimeOrigin::root(),
10511069
ParaId::from(1_u32),
10521070
SlotLeasePeriodStart::Current
10531071
));
@@ -1122,7 +1140,7 @@ mod tests {
11221140
));
11231141

11241142
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
1125-
Origin::root(),
1143+
RuntimeOrigin::root(),
11261144
ParaId::from(n as u32),
11271145
if (n % 2).is_zero() {
11281146
SlotLeasePeriodStart::Current
@@ -1214,7 +1232,7 @@ mod tests {
12141232
run_to_block(1);
12151233

12161234
assert_noop!(
1217-
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),),
1235+
AssignedSlots::unassign_parachain_slot(RuntimeOrigin::root(), ParaId::from(1_u32),),
12181236
Error::<Test>::SlotNotAssigned
12191237
);
12201238
});
@@ -1226,7 +1244,10 @@ mod tests {
12261244
run_to_block(1);
12271245

12281246
assert_noop!(
1229-
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1_u32),),
1247+
AssignedSlots::assign_perm_parachain_slot(
1248+
RuntimeOrigin::signed(1),
1249+
ParaId::from(1_u32),
1250+
),
12301251
BadOrigin
12311252
);
12321253
});
@@ -1245,15 +1266,16 @@ mod tests {
12451266
));
12461267

12471268
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
1248-
Origin::root(),
1269+
RuntimeOrigin::root(),
12491270
ParaId::from(1_u32),
12501271
));
12511272

12521273
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
12531274

1254-
assert_ok!(
1255-
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),)
1256-
);
1275+
assert_ok!(AssignedSlots::unassign_parachain_slot(
1276+
RuntimeOrigin::root(),
1277+
ParaId::from(1_u32),
1278+
));
12571279

12581280
assert_eq!(AssignedSlots::permanent_slot_count(), 0);
12591281
assert_eq!(AssignedSlots::has_permanent_slot(ParaId::from(1_u32)), false);
@@ -1276,16 +1298,17 @@ mod tests {
12761298
));
12771299

12781300
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
1279-
Origin::root(),
1301+
RuntimeOrigin::root(),
12801302
ParaId::from(1_u32),
12811303
SlotLeasePeriodStart::Current
12821304
));
12831305

12841306
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
12851307

1286-
assert_ok!(
1287-
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),)
1288-
);
1308+
assert_ok!(AssignedSlots::unassign_parachain_slot(
1309+
RuntimeOrigin::root(),
1310+
ParaId::from(1_u32),
1311+
));
12891312

12901313
assert_eq!(AssignedSlots::temporary_slot_count(), 0);
12911314
assert_eq!(AssignedSlots::active_temporary_slot_count(), 0);

0 commit comments

Comments
 (0)