diff --git a/pallets/automation-time/src/benchmarking.rs b/pallets/automation-time/src/benchmarking.rs index ff7a73f5..7ba552ef 100644 --- a/pallets/automation-time/src/benchmarking.rs +++ b/pallets/automation-time/src/benchmarking.rs @@ -217,18 +217,18 @@ benchmarks! { let schedule = ScheduleParam::Fixed { execution_times: times }; let caller: T::AccountId = account("caller", 0, SEED); - let call: ::Call = frame_system::Call::remark { remark: vec![] }.into(); + let call: ::RuntimeCall = frame_system::Call::remark { remark: vec![] }.into(); let account_min = T::Currency::minimum_balance().saturating_mul(ED_MULTIPLIER.into()); T::Currency::deposit_creating(&caller, account_min.saturating_mul(DEPOSIT_MULTIPLIER.into())); let initial_event_count = frame_system::Pallet::::event_count() as u8; - }: schedule_dynamic_dispatch_task(RawOrigin::Signed(caller.clone()), schedule, Box::new(call)) + }: schedule_dynamic_dispatch_task(RawOrigin::Signed(caller.clone()), schedule, Box::new(call.clone())) verify { { //panic!("events count: {:?} final {:?} data:{:?}", initial_event_count, frame_system::Pallet::::event_count(), frame_system::Pallet::::events()); // the task id schedule on first block, first extrinsics, but depend on which path in unitest or in benchmark the initial_event_count might be different therefore we get it from the initial state - assert_last_event::(Event::TaskScheduled { who: caller, schedule_as: None, task_id: format!("1-0-{:?}", initial_event_count).as_bytes().to_vec(), }.into()) + assert_last_event::(Event::TaskScheduled { who: caller, schedule_as: None, task_id: format!("1-0-{:?}", initial_event_count).as_bytes().to_vec(), encoded_call: Some(call.encode()) }.into()) } } @@ -243,7 +243,7 @@ benchmarks! { let schedule = ScheduleParam::Fixed { execution_times: times.clone() }; let caller: T::AccountId = account("caller", 0, SEED); - let call: ::Call = frame_system::Call::remark { remark: vec![] }.into(); + let call: ::RuntimeCall = frame_system::Call::remark { remark: vec![] }.into(); let account_min = T::Currency::minimum_balance().saturating_mul(ED_MULTIPLIER.into()); T::Currency::deposit_creating(&caller, account_min.saturating_mul(DEPOSIT_MULTIPLIER.into())); @@ -251,10 +251,10 @@ benchmarks! { // Almost fill up all time slots schedule_notify_tasks::(caller.clone(), times, T::MaxTasksPerSlot::get() - 1); let initial_event_count = frame_system::Pallet::::event_count() as u8; - }: schedule_dynamic_dispatch_task(RawOrigin::Signed(caller.clone()), schedule, Box::new(call)) + }: schedule_dynamic_dispatch_task(RawOrigin::Signed(caller.clone()), schedule, Box::new(call.clone())) verify { // the task id schedule on first block, first extrinsics, but depend on which path in unitest or in benchmark the initial_event_count might be different therefore we get it from the initial state - assert_last_event::(Event::TaskScheduled { who: caller, schedule_as: None, task_id: format!("1-0-{:?}", initial_event_count).as_bytes().to_vec(), }.into()) + assert_last_event::(Event::TaskScheduled { who: caller, schedule_as: None, task_id: format!("1-0-{:?}", initial_event_count).as_bytes().to_vec(), encoded_call: Some(call.encode()) }.into()) } cancel_scheduled_task_full { @@ -347,7 +347,7 @@ benchmarks! { run_dynamic_dispatch_action { let caller: T::AccountId = account("caller", 0, SEED); let task_id = vec![49, 45, 48, 45, 52]; - let call: ::Call = frame_system::Call::remark { remark: vec![] }.into(); + let call: ::RuntimeCall = frame_system::Call::remark { remark: vec![] }.into(); let encoded_call = call.encode(); }: { let (_, error) = AutomationTime::::run_dynamic_dispatch_action(caller.clone(), encoded_call); diff --git a/pallets/automation-time/src/lib.rs b/pallets/automation-time/src/lib.rs index e4d9a5d1..ba0322a2 100644 --- a/pallets/automation-time/src/lib.rs +++ b/pallets/automation-time/src/lib.rs @@ -173,12 +173,13 @@ pub mod pallet { type DelegatorActions: DelegatorActions>; /// The overarching call type. - type Call: Parameter + type RuntimeCall: Parameter + Dispatchable + GetDispatchInfo + From> + IsSubType> - + IsType<::RuntimeCall>; + + IsType<::RuntimeCall> + + From>; type ScheduleAllowList: Contains<::RuntimeCall>; @@ -287,6 +288,7 @@ pub mod pallet { who: AccountOf, task_id: TaskIdV2, schedule_as: Option>, + encoded_call: Option>, }, /// Cancelled a task. TaskCancelled { @@ -330,7 +332,6 @@ pub mod pallet { who: AccountOf, task_id: TaskIdV2, condition: BTreeMap, Vec>, - encoded_call: Option>, }, TaskExecuted { who: AccountOf, @@ -411,32 +412,55 @@ pub mod pallet { T::EnsureProxy::ensure_ok(schedule_as_account, who.clone())?; } - let destination = - MultiLocation::try_from(*destination).map_err(|()| Error::::BadVersion)?; - let schedule_fee = - MultiLocation::try_from(*schedule_fee).map_err(|()| Error::::BadVersion)?; + let destination_location = MultiLocation::try_from(*destination.clone()) + .map_err(|()| Error::::BadVersion)?; + let schedule_fee_location = MultiLocation::try_from(*schedule_fee.clone()) + .map_err(|()| Error::::BadVersion)?; - let execution_fee: AssetPayment = *execution_fee; + let execution_fee_payment: AssetPayment = *execution_fee.clone(); let execution_fee_location = - MultiLocation::try_from(execution_fee.clone().asset_location) + MultiLocation::try_from(execution_fee_payment.clone().asset_location) .map_err(|()| Error::::BadVersion)?; - Self::ensure_supported_execution_fee_location(&execution_fee_location, &destination)?; + Self::ensure_supported_execution_fee_location( + &execution_fee_location, + &destination_location, + )?; let action = Action::XCMP { + destination: destination_location, + schedule_fee: schedule_fee_location, + execution_fee: execution_fee_payment, + encoded_call: encoded_call.clone(), + encoded_call_weight: encoded_call_weight.clone(), + overall_weight: overall_weight.clone(), + schedule_as: schedule_as.clone(), + instruction_sequence: instruction_sequence.clone(), + }; + + // Convert the call into a runtime call + let call: ::RuntimeCall = Call::schedule_xcmp_task { + schedule: schedule.clone(), destination, schedule_fee, execution_fee, encoded_call, encoded_call_weight, overall_weight, - schedule_as, instruction_sequence, - }; + schedule_as, + } + .into(); - let schedule = schedule.validated_into::()?; + // Schedule the task. + Self::schedule_task_with_event( + action, + who, + schedule.validated_into::()?, + vec![], + Some(call.encode()), + )?; - Self::validate_and_schedule_task(action, who, schedule, vec![])?; Ok(()) } @@ -480,7 +504,8 @@ pub mod pallet { .map(|&error| error.as_bytes().to_vec()) .collect(); - Self::validate_and_schedule_task(action, who, schedule, errors)?; + Self::schedule_task_with_event(action, who, schedule, errors, None)?; + Ok(()) } @@ -502,15 +527,16 @@ pub mod pallet { pub fn schedule_dynamic_dispatch_task( origin: OriginFor, schedule: ScheduleParam, - call: Box<::Call>, + call: Box<::RuntimeCall>, ) -> DispatchResult { let who = ensure_signed(origin)?; let encoded_call = call.encode(); - let action = Action::DynamicDispatch { encoded_call }; + let action = Action::DynamicDispatch { encoded_call: encoded_call.clone() }; let schedule = schedule.validated_into::()?; - Self::validate_and_schedule_task(action, who, schedule, vec![])?; + Self::schedule_task_with_event(action, who, schedule, vec![], Some(encoded_call))?; + Ok(()) } @@ -898,17 +924,10 @@ pub mod pallet { format!("{}", time_slot).into_bytes(), ); - let encoded_call = match task.action.clone() { - Action::XCMP { encoded_call, .. } => Some(encoded_call), - Action::DynamicDispatch { encoded_call } => Some(encoded_call), - _ => None, - }; - Self::deposit_event(Event::TaskTriggered { who: account_id.clone(), task_id: task_id.clone(), condition, - encoded_call, }); let (task_action_weight, dispatch_error) = match task.action.clone() { @@ -1116,7 +1135,7 @@ pub mod pallet { caller: AccountOf, encoded_call: Vec, ) -> (Weight, Option) { - match ::Call::decode(&mut &*encoded_call) { + match ::RuntimeCall::decode(&mut &*encoded_call) { Ok(scheduled_call) => { let mut dispatch_origin: T::RuntimeOrigin = frame_system::RawOrigin::Signed(caller).into(); @@ -1317,12 +1336,12 @@ pub mod pallet { /// Validate and schedule task. /// This will also charge the execution fee. - pub fn validate_and_schedule_task( + fn validate_and_schedule_task( action: ActionOf, owner_id: AccountOf, schedule: Schedule, abort_errors: Vec>, - ) -> DispatchResult { + ) -> Result { match action.clone() { Action::XCMP { execution_fee, .. } => { let asset_location = MultiLocation::try_from(execution_fee.asset_location) @@ -1351,12 +1370,37 @@ pub mod pallet { Ok(task_id) })?; + Ok(task_id) + } + + /// Schedule a task with TaskScheduled event. + pub fn schedule_task_with_event( + action: ActionOf, + owner_id: AccountOf, + schedule: Schedule, + abort_errors: Vec>, + encoded_call: Option>, + ) -> DispatchResult { + // Schedule the task. + let task_id: TaskIdV2 = Self::validate_and_schedule_task( + action.clone(), + owner_id.clone(), + schedule, + abort_errors, + )?; + let schedule_as = match action { Action::XCMP { schedule_as, .. } => schedule_as, _ => None, }; - Self::deposit_event(Event::::TaskScheduled { who: owner_id, task_id, schedule_as }); + // Deposit the event. + Self::deposit_event(Event::::TaskScheduled { + who: owner_id, + task_id, + schedule_as, + encoded_call, + }); Ok(()) } diff --git a/pallets/automation-time/src/mock.rs b/pallets/automation-time/src/mock.rs index 23ee4f77..3ebb3ccd 100644 --- a/pallets/automation-time/src/mock.rs +++ b/pallets/automation-time/src/mock.rs @@ -529,7 +529,7 @@ impl pallet_automation_time::Config for Test { type FeeHandler = FeeHandler; type DelegatorActions = MockDelegatorActions; type XcmpTransactor = MockXcmpTransactor; - type Call = RuntimeCall; + type RuntimeCall = RuntimeCall; type ScheduleAllowList = ScheduleAllowList; type CurrencyIdConvert = MockTokenIdConvert; type FeeConversionRateProvider = MockConversionRateProvider; diff --git a/pallets/automation-time/src/tests.rs b/pallets/automation-time/src/tests.rs index f8c00bbb..6e3e8741 100644 --- a/pallets/automation-time/src/tests.rs +++ b/pallets/automation-time/src/tests.rs @@ -36,7 +36,10 @@ use sp_runtime::{ TokenError::FundsUnavailable, }; use sp_std::collections::btree_map::BTreeMap; -use xcm::latest::{prelude::*, Junction::Parachain, MultiLocation}; +use xcm::{ + latest::{prelude::*, Junction::Parachain, MultiLocation}, + VersionedMultiLocation, +}; use pallet_valve::Shutdown; @@ -381,7 +384,6 @@ fn schedule_transfer_with_dynamic_dispatch() { who: account_id.clone(), task_id: task_id.clone(), condition, - encoded_call: Some(call.encode()), }), RuntimeEvent::Balances(pallet_balances::pallet::Event::Transfer { from: account_id.clone(), @@ -759,7 +761,6 @@ fn will_emit_task_completed_event_when_task_failed() { who: account_id.clone(), task_id: task_id.clone(), condition, - encoded_call: Some(call.encode()), }), RuntimeEvent::AutomationTime(crate::Event::TaskExecutionFailed { who: account_id.clone(), @@ -1034,6 +1035,62 @@ fn schedule_xcmp_works() { }) } +#[test] +fn schedule_xcmp_task_and_check_encoded_call_success() { + new_test_ext(START_BLOCK_TIME).execute_with(|| { + let alice = AccountId32::new(ALICE); + // Funds including XCM fees + get_xcmp_funds(alice.clone()); + + let origin = RuntimeOrigin::signed(alice); + let schedule = ScheduleParam::Fixed { execution_times: vec![SCHEDULED_TIME] }; + let destination: Box = Box::new(MultiLocation::new(1, X1(Parachain(PARA_ID))).into()); + let schedule_fee: Box = Box::new(NATIVE_LOCATION.into()); + let execution_fee = Box::new(AssetPayment { + asset_location: MultiLocation::new(0, Here).into(), + amount: 10, + }); + let remote_encoded_call = vec![2, 4, 5]; + let encoded_call_weight = Weight::from_parts(100_000, 0); + let overall_weight = Weight::from_parts(200_000, 0); + let instruction_sequence = InstructionSequence::PayThroughSovereignAccount; + let schedule_as = None; + + // Call the schedule_xcmp_task function + assert_ok!(AutomationTime::schedule_xcmp_task( + origin.clone(), + schedule.clone(), + destination.clone(), + schedule_fee.clone(), + execution_fee.clone(), + remote_encoded_call.clone(), + encoded_call_weight.clone(), + overall_weight.clone(), + instruction_sequence.clone(), + schedule_as.clone(), + )); + + // Calculate the expected encoded call + let expected_encoded_call = Into::::into(crate::Call::schedule_xcmp_task { + schedule, + destination, + schedule_fee, + execution_fee, + encoded_call: remote_encoded_call, + encoded_call_weight, + overall_weight, + instruction_sequence, + schedule_as, + }).encode(); + + // Find the TaskScheduled event in the event list and verify if the encoded_call within it is correct. + events() + .into_iter() + .find(|e| matches!(e, RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { encoded_call, .. }) if encoded_call.as_ref() == Some(&expected_encoded_call))) + .expect("TaskScheduled event should emit with correct encoded_call."); + }) +} + #[test] fn schedule_xcmp_works_with_multi_currency() { new_test_ext(START_BLOCK_TIME).execute_with(|| { @@ -1559,6 +1616,8 @@ fn taskid_changed_per_block() { fn taskid_adjusted_on_extrinsicid_on_same_block() { new_test_ext(START_BLOCK_TIME).execute_with(|| { let first_caller = AccountId32::new(ALICE); + let message: Vec = vec![2, 4, 5]; + let task_id1 = schedule_task( ALICE, vec![ @@ -1566,7 +1625,7 @@ fn taskid_adjusted_on_extrinsicid_on_same_block() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); // Set to a high and more than one digit extrinsic index to test task_id also match @@ -1580,7 +1639,7 @@ fn taskid_adjusted_on_extrinsicid_on_same_block() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); LastTimeSlot::::put(( SCHEDULED_TIME - SLOT_SIZE_SECONDS * 4, @@ -1590,16 +1649,26 @@ fn taskid_adjusted_on_extrinsicid_on_same_block() { assert_eq!(task_id1, FIRST_TASK_ID.to_vec()); assert_eq!(task_id2, vec![49, 45, 50, 51, 52, 45, 56]); + // Calculate the expected encoded call + let expected_encoded_call = + Into::::into(frame_system::Call::remark_with_event { + remark: message.clone(), + }) + .encode(); + + // Find the TaskScheduled event in the event list and verify if the encoded_call within it is correct. assert_has_event(RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { who: first_caller, task_id: FIRST_TASK_ID.to_vec(), schedule_as: None, + encoded_call: Some(expected_encoded_call.clone()), })); assert_has_event(RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { who: second_caller, task_id: vec![49, 45, 50, 51, 52, 45, 56], schedule_as: None, + encoded_call: Some(expected_encoded_call), })); }) } @@ -1609,6 +1678,7 @@ fn taskid_adjusted_on_extrinsicid_on_same_block() { fn taskid_adjusted_on_eventindex_on_same_block_from_same_caller() { new_test_ext(START_BLOCK_TIME).execute_with(|| { let caller = AccountId32::new(ALICE); + let message: Vec = vec![2, 4, 5]; let task_id1 = schedule_task( ALICE, @@ -1617,7 +1687,7 @@ fn taskid_adjusted_on_eventindex_on_same_block_from_same_caller() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); // Set to a high and more than one digit extrinsic index to test task_id also match @@ -1630,7 +1700,7 @@ fn taskid_adjusted_on_eventindex_on_same_block_from_same_caller() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); // 1-0-3 @@ -1638,16 +1708,26 @@ fn taskid_adjusted_on_eventindex_on_same_block_from_same_caller() { // 1-234-6 assert_eq!(task_id2, "1-234-6".as_bytes().to_vec()); + // Calculate the expected encoded call + let expected_encoded_call = + Into::::into(frame_system::Call::remark_with_event { + remark: message.clone(), + }) + .encode(); + + // Find the TaskScheduled event in the event list and verify if the encoded_call within it is correct. assert_has_event(RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { who: caller.clone(), task_id: "1-0-3".as_bytes().to_vec(), schedule_as: None, + encoded_call: Some(expected_encoded_call.clone()), })); assert_has_event(RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { who: caller, task_id: "1-234-6".as_bytes().to_vec(), schedule_as: None, + encoded_call: Some(expected_encoded_call), })); }) } @@ -1657,6 +1737,8 @@ fn taskid_adjusted_on_eventindex_on_same_block_from_same_caller() { fn taskid_on_same_extrinsid_have_unique_event_index() { new_test_ext(START_BLOCK_TIME).execute_with(|| { let owner = AccountId32::new(ALICE); + let message: Vec = vec![2, 4, 5]; + let task_id1 = schedule_task( ALICE, vec![ @@ -1664,7 +1746,7 @@ fn taskid_on_same_extrinsid_have_unique_event_index() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); let task_id2 = schedule_task( @@ -1674,7 +1756,7 @@ fn taskid_on_same_extrinsid_have_unique_event_index() { SCHEDULED_TIME + SLOT_SIZE_SECONDS, SCHEDULED_TIME + SLOT_SIZE_SECONDS * 2, ], - vec![2, 4, 5], + message.clone(), ); LastTimeSlot::::put(( SCHEDULED_TIME - SLOT_SIZE_SECONDS * 4, @@ -1684,10 +1766,17 @@ fn taskid_on_same_extrinsid_have_unique_event_index() { assert_eq!(task_id1, FIRST_TASK_ID.to_vec()); assert_eq!(task_id2, SECOND_TASK_ID.to_vec()); + // Calculate the expected encoded call + let expected_encoded_call = + Into::::into(frame_system::Call::remark_with_event { remark: message }) + .encode(); + + // Find the TaskScheduled event in the event list and verify if the encoded_call within it is correct. assert_has_event(RuntimeEvent::AutomationTime(crate::Event::TaskScheduled { who: owner, task_id: FIRST_TASK_ID.to_vec(), schedule_as: None, + encoded_call: Some(expected_encoded_call), })); }) } @@ -1885,7 +1974,6 @@ fn cancel_works_for_an_executed_task() { who: owner.clone(), task_id: task_id1.clone(), condition, - encoded_call: Some(call.encode()), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2105,13 +2193,13 @@ mod extrinsics { assert_ok!(fund_account_dynamic_dispatch( &account_id, execution_times.len(), - call.encode() + call.clone().encode() )); assert_ok!(AutomationTime::schedule_dynamic_dispatch_task( RuntimeOrigin::signed(account_id.clone()), ScheduleParam::Fixed { execution_times: vec![SCHEDULED_TIME] }, - Box::new(call) + Box::new(call.clone()) )); assert_eq!( last_event(), @@ -2119,6 +2207,7 @@ mod extrinsics { who: account_id, task_id: FIRST_TASK_ID.to_vec(), schedule_as: None, + encoded_call: Some(call.encode()), }) ); }) @@ -2324,7 +2413,6 @@ fn trigger_tasks_handles_missed_slots() { who: owner.clone(), task_id: task_will_be_run_id.clone(), condition, - encoded_call: Some(call.encode()), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: AccountId32::new(ALICE), @@ -2424,7 +2512,6 @@ fn trigger_tasks_limits_missed_slots() { who: owner.clone(), task_id: task_id.clone(), condition: condition.clone(), - encoded_call: Some(call.encode()), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2541,7 +2628,6 @@ fn trigger_tasks_completes_all_tasks() { who: owner.clone(), task_id: task_id1.clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 12, 2, 4, 5]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2559,7 +2645,6 @@ fn trigger_tasks_completes_all_tasks() { who: owner.clone(), task_id: task_id2.clone(), condition, - encoded_call: Some(vec![0, 7, 8, 2, 4]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2639,7 +2724,6 @@ fn trigger_tasks_completes_some_tasks() { who: owner.clone(), task_id: task_id1.clone(), condition, - encoded_call: Some(vec![0, 7, 12, 2, 4, 5]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2836,7 +2920,6 @@ fn missed_tasks_removes_completed_tasks() { who: owner.clone(), task_id: task_id01.clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 12, 2, 5, 7]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -2903,7 +2986,6 @@ fn trigger_tasks_completes_some_xcmp_tasks() { who: owner.clone(), task_id: task_id.clone(), condition, - encoded_call: Some(encoded_call), }), RuntimeEvent::AutomationTime(crate::Event::TaskExecuted { who: owner.clone(), @@ -2964,7 +3046,6 @@ fn trigger_tasks_completes_auto_compound_delegated_stake_task() { who: delegator.clone(), task_id: task_id.clone(), condition, - encoded_call: None, }), RuntimeEvent::ParachainStaking( pallet_parachain_staking::Event::DelegationIncreased { @@ -3390,8 +3471,7 @@ fn trigger_tasks_updates_executions_left() { RuntimeEvent::AutomationTime(crate::Event::TaskTriggered { who: owner.clone(), task_id: task_id01.clone(), - condition, - encoded_call: (Some(vec![0, 7, 12, 2, 5, 7])), + condition }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3452,7 +3532,6 @@ fn trigger_tasks_removes_completed_tasks() { who: owner.clone(), task_id: task_id01.clone(), condition, - encoded_call: Some(vec![0, 7, 12, 2, 5, 7]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3515,7 +3594,6 @@ fn on_init_runs_tasks() { who: owner.clone(), task_id: task_id1.clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 12, 2, 4, 5]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3534,7 +3612,6 @@ fn on_init_runs_tasks() { who: owner.clone(), task_id: task_id2.clone(), condition, - encoded_call: Some(vec![0, 7, 8, 2, 4]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3613,7 +3690,6 @@ fn on_init_check_task_queue() { who: owner.clone(), task_id: tasks[0].clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 4, 0]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3631,7 +3707,6 @@ fn on_init_check_task_queue() { who: owner.clone(), task_id: tasks[1].clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 4, 1]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3659,7 +3734,6 @@ fn on_init_check_task_queue() { who: owner.clone(), task_id: tasks[2].clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 4, 2]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), @@ -3677,7 +3751,6 @@ fn on_init_check_task_queue() { who: owner.clone(), task_id: tasks[3].clone(), condition: condition.clone(), - encoded_call: Some(vec![0, 7, 4, 3]), }), RuntimeEvent::System(frame_system::pallet::Event::Remarked { sender: owner.clone(), diff --git a/pallets/automation-time/src/types.rs b/pallets/automation-time/src/types.rs index 05f5cbd7..ddc848b7 100644 --- a/pallets/automation-time/src/types.rs +++ b/pallets/automation-time/src/types.rs @@ -49,8 +49,9 @@ impl Action { Action::AutoCompoundDelegatedStake { .. } => ::WeightInfo::run_auto_compound_delegated_stake_task(), Action::DynamicDispatch { encoded_call } => { - let scheduled_call: ::Call = Decode::decode(&mut &**encoded_call) - .map_err(|_| Error::::CallCannotBeDecoded)?; + let scheduled_call: ::RuntimeCall = + Decode::decode(&mut &**encoded_call) + .map_err(|_| Error::::CallCannotBeDecoded)?; ::WeightInfo::run_dynamic_dispatch_action() .saturating_add(scheduled_call.get_dispatch_info().weight) }, diff --git a/runtime/neumann/src/lib.rs b/runtime/neumann/src/lib.rs index 064014fb..ff9ac0b0 100644 --- a/runtime/neumann/src/lib.rs +++ b/runtime/neumann/src/lib.rs @@ -915,7 +915,7 @@ impl pallet_automation_time::Config for Runtime { type DelegatorActions = ParachainStaking; type CurrencyIdConvert = TokenIdConvert; type FeeConversionRateProvider = FeePerSecondProvider; - type Call = RuntimeCall; + type RuntimeCall = RuntimeCall; type ScheduleAllowList = ScheduleAllowList; type EnsureProxy = AutomationEnsureProxy; type UniversalLocation = UniversalLocation; diff --git a/runtime/oak/src/lib.rs b/runtime/oak/src/lib.rs index 53234fd2..5571fc0c 100644 --- a/runtime/oak/src/lib.rs +++ b/runtime/oak/src/lib.rs @@ -943,7 +943,7 @@ impl pallet_automation_time::Config for Runtime { type DelegatorActions = ParachainStaking; type CurrencyIdConvert = TokenIdConvert; type FeeConversionRateProvider = FeePerSecondProvider; - type Call = RuntimeCall; + type RuntimeCall = RuntimeCall; type ScheduleAllowList = ScheduleAllowList; type EnsureProxy = AutomationEnsureProxy; type UniversalLocation = UniversalLocation; diff --git a/runtime/turing/src/lib.rs b/runtime/turing/src/lib.rs index f3013652..c82032cc 100644 --- a/runtime/turing/src/lib.rs +++ b/runtime/turing/src/lib.rs @@ -938,7 +938,7 @@ impl pallet_automation_time::Config for Runtime { type DelegatorActions = ParachainStaking; type CurrencyIdConvert = TokenIdConvert; type FeeConversionRateProvider = FeePerSecondProvider; - type Call = RuntimeCall; + type RuntimeCall = RuntimeCall; type ScheduleAllowList = ScheduleAllowList; type EnsureProxy = AutomationEnsureProxy; type UniversalLocation = UniversalLocation;