BREAKING: Rename Call & Event (#11981)

* rename Event to RuntimeEvent

* rename Call

* rename in runtimes

* small fix

* rename Event

* small fix & rename RuntimeCall back to Call for now

* small fixes

* more renaming

* a bit more renaming

* fmt

* small fix

* commit

* prep for renaming associated types

* fix

* rename associated Event type

* rename to RuntimeEvent

* commit

* merge conflict fixes & fmt

* additional renaming

* fix.

* fix decl_event

* rename in tests

* remove warnings

* remove accidental rename

* .

* commit

* update .stderr

* fix in test

* update .stderr

* TRYBUILD=overwrite

* docs

* fmt

* small change in docs

* rename PalletEvent to Event

* rename Call to RuntimeCall

* renamed at wrong places :P

* rename Call

* rename

* rename associated type

* fix

* fix & fmt

* commit

* frame-support-test

* passing tests

* update docs

* rustdoc fix

* update .stderr

* wrong code in docs

* merge fix

* fix in error message

* update .stderr

* docs & error message

* .

* merge fix

* merge fix

* fmt

* fmt

* merge fix

* more fixing

* fmt

* remove unused

* fmt

* fix

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergej Sakac
2022-09-13 00:03:31 +02:00
committed by GitHub
parent 472b5746e5
commit 6e8795afe6
228 changed files with 1791 additions and 1672 deletions
@@ -61,7 +61,7 @@ impl frame_system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -69,7 +69,7 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -82,7 +82,7 @@ impl frame_system::Config for Test {
type MaxConsumers = ConstU32<16>;
}
type Extrinsic = TestXt<Call, ()>;
type Extrinsic = TestXt<RuntimeCall, ()>;
type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
impl frame_system::offchain::SigningTypes for Test {
@@ -92,22 +92,22 @@ impl frame_system::offchain::SigningTypes for Test {
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Test
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
type Extrinsic = Extrinsic;
}
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Test
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
call: RuntimeCall,
_public: <Signature as Verify>::Signer,
_account: AccountId,
nonce: u64,
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
}
@@ -117,9 +117,8 @@ parameter_types! {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type AuthorityId = crypto::TestAuthId;
type Call = Call;
type GracePeriod = ConstU64<5>;
type UnsignedInterval = ConstU64<128>;
type UnsignedPriority = UnsignedPriority;
@@ -233,7 +232,7 @@ fn should_submit_signed_transaction_on_chain() {
assert!(pool_state.read().transactions.is_empty());
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature.unwrap().0, 0);
assert_eq!(tx.call, Call::Example(crate::Call::submit_price { price: 15523 }));
assert_eq!(tx.call, RuntimeCall::Example(crate::Call::submit_price { price: 15523 }));
});
}
@@ -278,7 +277,7 @@ fn should_submit_unsigned_transaction_on_chain_for_any_account() {
let tx = pool_state.write().transactions.pop().unwrap();
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature, None);
if let Call::Example(crate::Call::submit_price_unsigned_with_signed_payload {
if let RuntimeCall::Example(crate::Call::submit_price_unsigned_with_signed_payload {
price_payload: body,
signature,
}) = tx.call
@@ -337,7 +336,7 @@ fn should_submit_unsigned_transaction_on_chain_for_all_accounts() {
let tx = pool_state.write().transactions.pop().unwrap();
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature, None);
if let Call::Example(crate::Call::submit_price_unsigned_with_signed_payload {
if let RuntimeCall::Example(crate::Call::submit_price_unsigned_with_signed_payload {
price_payload: body,
signature,
}) = tx.call
@@ -379,7 +378,10 @@ fn should_submit_raw_unsigned_transaction_on_chain() {
assert_eq!(tx.signature, None);
assert_eq!(
tx.call,
Call::Example(crate::Call::submit_price_unsigned { block_number: 1, price: 15523 })
RuntimeCall::Example(crate::Call::submit_price_unsigned {
block_number: 1,
price: 15523
})
);
});
}