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
+10 -8
View File
@@ -282,7 +282,7 @@ pub trait Ext: sealing::Sealed {
fn append_debug_buffer(&mut self, msg: &str) -> bool;
/// Call some dispatchable and return the result.
fn call_runtime(&self, call: <Self::T as Config>::Call) -> DispatchResultWithPostInfo;
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo;
/// Recovers ECDSA compressed public key based on signature and message hash.
fn ecdsa_recover(&self, signature: &[u8; 65], message_hash: &[u8; 32]) -> Result<[u8; 33], ()>;
@@ -1305,7 +1305,7 @@ where
}
}
fn call_runtime(&self, call: <Self::T as Config>::Call) -> DispatchResultWithPostInfo {
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo {
let mut origin: T::Origin = RawOrigin::Signed(self.address().clone()).into();
origin.add_filter(T::CallFilter::contains);
call.dispatch(origin)
@@ -1370,7 +1370,8 @@ mod tests {
storage::Storage,
tests::{
test_utils::{get_balance, hash, place_contract, set_balance},
Call, Event as MetaEvent, ExtBuilder, Test, TestFilter, ALICE, BOB, CHARLIE, GAS_LIMIT,
ExtBuilder, RuntimeCall, RuntimeEvent as MetaEvent, Test, TestFilter, ALICE, BOB,
CHARLIE, GAS_LIMIT,
},
Error,
};
@@ -2575,7 +2576,7 @@ mod tests {
#[test]
fn call_runtime_works() {
let code_hash = MockLoader::insert(Call, |ctx, _| {
let call = Call::System(frame_system::Call::remark_with_event {
let call = RuntimeCall::System(frame_system::Call::remark_with_event {
remark: b"Hello World".to_vec(),
});
ctx.ext.call_runtime(call).unwrap();
@@ -2636,10 +2637,11 @@ mod tests {
// remark should still be allowed
let allowed_call =
Call::System(SysCall::remark_with_event { remark: b"Hello".to_vec() });
RuntimeCall::System(SysCall::remark_with_event { remark: b"Hello".to_vec() });
// transfers are disallowed by the `TestFiler` (see below)
let forbidden_call = Call::Balances(BalanceCall::transfer { dest: CHARLIE, value: 22 });
let forbidden_call =
RuntimeCall::Balances(BalanceCall::transfer { dest: CHARLIE, value: 22 });
// simple cases: direct call
assert_err!(
@@ -2648,7 +2650,7 @@ mod tests {
);
// as part of a patch: return is OK (but it interrupted the batch)
assert_ok!(ctx.ext.call_runtime(Call::Utility(UtilCall::batch {
assert_ok!(ctx.ext.call_runtime(RuntimeCall::Utility(UtilCall::batch {
calls: vec![allowed_call.clone(), forbidden_call, allowed_call]
})),);
@@ -2659,7 +2661,7 @@ mod tests {
});
TestFilter::set_filter(|call| match call {
Call::Balances(pallet_balances::Call::transfer { .. }) => false,
RuntimeCall::Balances(pallet_balances::Call::transfer { .. }) => false,
_ => true,
});