BREAKING: Rename Origin (#12258)

* BREAKING: Rename Origin

* more renaming

* a bit more renaming

* fix

* more fixing

* fix in frame_support

* even more fixes

* fix

* small fix

* ...

* update .stderr

* docs

* update docs

* update docs

* docs
This commit is contained in:
Sergej Sakac
2022-09-21 00:13:09 +02:00
committed by GitHub
parent 986d20b352
commit e4b6f4a66d
221 changed files with 5233 additions and 4200 deletions
+1 -1
View File
@@ -655,7 +655,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
// Add public immutables and private mutables.
#[allow(dead_code)]
fn accumulate_foo(origin: T::Origin, increase_by: T::Balance) -> DispatchResult {
fn accumulate_foo(origin: T::RuntimeOrigin, increase_by: T::Balance) -> DispatchResult {
let _sender = ensure_signed(origin)?;
let prev = <Foo<T>>::get();
+5 -5
View File
@@ -60,7 +60,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -128,12 +128,12 @@ fn it_works_for_optional_value() {
assert_eq!(Example::dummy(), Some(val1));
// Check that accumulate works when we have Some value in Dummy already.
assert_ok!(Example::accumulate_dummy(Origin::signed(1), val2));
assert_ok!(Example::accumulate_dummy(RuntimeOrigin::signed(1), val2));
assert_eq!(Example::dummy(), Some(val1 + val2));
// Check that accumulate works when we Dummy has None in it.
<Example as OnInitialize<u64>>::on_initialize(2);
assert_ok!(Example::accumulate_dummy(Origin::signed(1), val1));
assert_ok!(Example::accumulate_dummy(RuntimeOrigin::signed(1), val1));
assert_eq!(Example::dummy(), Some(val1 + val2 + val1));
});
}
@@ -142,7 +142,7 @@ fn it_works_for_optional_value() {
fn it_works_for_default_value() {
new_test_ext().execute_with(|| {
assert_eq!(Example::foo(), 24);
assert_ok!(Example::accumulate_foo(Origin::signed(1), 1));
assert_ok!(Example::accumulate_foo(RuntimeOrigin::signed(1), 1));
assert_eq!(Example::foo(), 25);
});
}
@@ -151,7 +151,7 @@ fn it_works_for_default_value() {
fn set_dummy_works() {
new_test_ext().execute_with(|| {
let test_val = 133;
assert_ok!(Example::set_dummy(Origin::root(), test_val.into()));
assert_ok!(Example::set_dummy(RuntimeOrigin::root(), test_val.into()));
assert_eq!(Example::dummy(), Some(test_val));
});
}
@@ -60,7 +60,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
@@ -134,10 +134,10 @@ fn it_aggregates_the_price() {
sp_io::TestExternalities::default().execute_with(|| {
assert_eq!(Example::average_price(), None);
assert_ok!(Example::submit_price(Origin::signed(test_pub()), 27));
assert_ok!(Example::submit_price(RuntimeOrigin::signed(test_pub()), 27));
assert_eq!(Example::average_price(), Some(27));
assert_ok!(Example::submit_price(Origin::signed(test_pub()), 43));
assert_ok!(Example::submit_price(RuntimeOrigin::signed(test_pub()), 43));
assert_eq!(Example::average_price(), Some(35));
});
}
@@ -45,7 +45,7 @@ parameter_types! {
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type PalletInfo = PalletInfo;
type Index = u64;
@@ -76,8 +76,8 @@ fn test_pub(n: u8) -> sp_core::sr25519::Public {
sp_core::sr25519::Public::from_raw([n; 32])
}
fn test_origin(n: u8) -> Origin {
Origin::signed(test_pub(n))
fn test_origin(n: u8) -> RuntimeOrigin {
RuntimeOrigin::signed(test_pub(n))
}
#[test]
@@ -103,7 +103,7 @@ fn it_can_enlist() {
},
];
Example::enlist_participants(Origin::signed(test_pub(1)), participants)
Example::enlist_participants(RuntimeOrigin::signed(test_pub(1)), participants)
.expect("Failed to enlist");
assert_eq!(Example::participants().len(), 2);