Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 41 additions & 142 deletions pallets/dactr/src/extensions/check_batch_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,10 @@ where

pub fn get_scheduler_call(&self) -> Option<&<T as SchedulerConfig>::RuntimeCall> {
match self.0.is_sub_type() {
Some(SchedulerCall::<T>::schedule {
call,
when: _,
maybe_periodic: _,
priority: _,
})
| Some(SchedulerCall::<T>::schedule_after {
after: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named {
id: _,
when: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named_after {
id: _,
after: _,
maybe_periodic: _,
priority: _,
call,
}) => Some(call),
Some(SchedulerCall::<T>::schedule { call, .. })
| Some(SchedulerCall::<T>::schedule_after { call, .. })
| Some(SchedulerCall::<T>::schedule_named { call, .. })
| Some(SchedulerCall::<T>::schedule_named_after { call, .. }) => Some(call),
_ => None,
}
}
Expand All @@ -107,31 +85,16 @@ where

pub fn get_as_multi_call(&self) -> Option<&<T as MultisigConfig>::RuntimeCall> {
match self.0.is_sub_type() {
Some(MultisigCall::<T>::as_multi {
call,
threshold: _,
other_signatories: _,
maybe_timepoint: _,
max_weight: _,
})
| Some(MultisigCall::as_multi_threshold_1 {
other_signatories: _,
call,
}) => {
//
Some(call)
},
Some(MultisigCall::<T>::as_multi { call, .. })
| Some(MultisigCall::as_multi_threshold_1 { call, .. }) => Some(call),
_ => None,
}
}

pub fn get_proxy_call(&self) -> Option<&<T as ProxyConfig>::RuntimeCall> {
match self.0.is_sub_type() {
Some(ProxyCall::<T>::proxy {
call,
real: _,
force_proxy_type: _,
}) => Some(call),
Some(ProxyCall::<T>::proxy { call, .. }) => Some(call),
Some(ProxyCall::<T>::proxy_announced { call, .. }) => Some(call),
_ => None,
}
}
Expand Down Expand Up @@ -272,12 +235,10 @@ where
let call: &<T as SystemConfig>::RuntimeCall = call.into_ref();
let call = WrappedCall::<T>(call);

if iteration > 1 || inside_batch {
ensure!(
!call.is_send_message_call(),
InvalidTransaction::Custom(UnexpectedSendMessageCall as u8)
);
}
ensure!(
!call.is_send_message_call(),
InvalidTransaction::Custom(UnexpectedSendMessageCall as u8)
);

if let Some(call) = call.get_proxy_call() {
return Self::recursive_proxy_call(call, iteration + 1, inside_batch);
Expand Down Expand Up @@ -310,21 +271,20 @@ where
return Err(InvalidTransaction::Custom(MaxRecursionExceeded as u8).into());
}

if iteration > 1 || inside_batch {
match call.is_sub_type() {
Some(VectorCall::<T>::send_message { .. }) => {
return Err(InvalidTransaction::Custom(UnexpectedSendMessageCall as u8).into())
},
_ => (),
}
match call.is_sub_type() {
Some(VectorCall::<T>::send_message { .. }) => {
return Err(InvalidTransaction::Custom(UnexpectedSendMessageCall as u8).into())
},
_ => (),
}

match call.is_sub_type() {
Some(ProxyCall::<T>::proxy {
call,
real: _,
force_proxy_type: _,
}) => return Self::recursive_proxy_call(call, iteration + 1, inside_batch),
Some(ProxyCall::<T>::proxy { call, .. }) => {
return Self::recursive_proxy_call(call, iteration + 1, inside_batch)
},
Some(ProxyCall::<T>::proxy_announced { call, .. }) => {
return Self::recursive_proxy_call(call, iteration + 1, inside_batch)
},
_ => (),
}

Expand All @@ -338,49 +298,18 @@ where
}

match call.is_sub_type() {
Some(MultisigCall::<T>::as_multi {
call,
threshold: _,
other_signatories: _,
maybe_timepoint: _,
max_weight: _,
})
| Some(MultisigCall::as_multi_threshold_1 {
other_signatories: _,
call,
}) => {
Some(MultisigCall::<T>::as_multi { call, .. })
| Some(MultisigCall::as_multi_threshold_1 { call, .. }) => {
return Self::recursive_multisig_call(call, iteration + 1, inside_batch);
},
_ => (),
}

match call.is_sub_type() {
Some(SchedulerCall::<T>::schedule {
call,
when: _,
maybe_periodic: _,
priority: _,
})
| Some(SchedulerCall::<T>::schedule_after {
after: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named {
id: _,
when: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named_after {
id: _,
after: _,
maybe_periodic: _,
priority: _,
call,
}) => {
Some(SchedulerCall::<T>::schedule { call, .. })
| Some(SchedulerCall::<T>::schedule_after { call, .. })
| Some(SchedulerCall::<T>::schedule_named { call, .. })
| Some(SchedulerCall::<T>::schedule_named_after { call, .. }) => {
return Self::recursive_scheduler_call(call, iteration + 1, inside_batch);
},
_ => (),
Expand Down Expand Up @@ -409,11 +338,12 @@ where
}

match call.is_sub_type() {
Some(ProxyCall::<T>::proxy {
call,
real: _,
force_proxy_type: _,
}) => return Self::recursive_proxy_call(call, iteration + 1, inside_batch),
Some(ProxyCall::<T>::proxy { call, .. }) => {
return Self::recursive_proxy_call(call, iteration + 1, inside_batch)
},
Some(ProxyCall::<T>::proxy_announced { call, .. }) => {
return Self::recursive_proxy_call(call, iteration + 1, inside_batch)
},
_ => (),
}

Expand All @@ -427,49 +357,18 @@ where
}

match call.is_sub_type() {
Some(MultisigCall::<T>::as_multi {
call,
threshold: _,
other_signatories: _,
maybe_timepoint: _,
max_weight: _,
})
| Some(MultisigCall::as_multi_threshold_1 {
other_signatories: _,
call,
}) => {
Some(MultisigCall::<T>::as_multi { call, .. })
| Some(MultisigCall::as_multi_threshold_1 { call, .. }) => {
return Self::recursive_multisig_call(call, iteration + 1, inside_batch);
},
_ => (),
}

match call.is_sub_type() {
Some(SchedulerCall::<T>::schedule {
call,
when: _,
maybe_periodic: _,
priority: _,
})
| Some(SchedulerCall::<T>::schedule_after {
after: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named {
id: _,
when: _,
maybe_periodic: _,
priority: _,
call,
})
| Some(SchedulerCall::<T>::schedule_named_after {
id: _,
after: _,
maybe_periodic: _,
priority: _,
call,
}) => {
Some(SchedulerCall::<T>::schedule { call, .. })
| Some(SchedulerCall::<T>::schedule_after { call, .. })
| Some(SchedulerCall::<T>::schedule_named { call, .. })
| Some(SchedulerCall::<T>::schedule_named_after { call, .. }) => {
return Self::recursive_scheduler_call(call, iteration + 1, inside_batch);
},
_ => (),
Expand Down
7 changes: 1 addition & 6 deletions runtime/src/transaction_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ impl HeaderExtensionDataFilter for Runtime {
let (final_call, nb_iterations) = extract_final_call(&unchecked_extrinsic.function);

if nb_iterations > 0 {
match final_call {
Call::Vector(call) => {
filter_vector_call(failed_transactions, maybe_caller, call, block, tx_index)
},
_ => None,
}
None
} else {
match final_call {
Call::Vector(call) => {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// Per convention: if the runtime behavior changes, increment spec_version
// and set impl_version to 0. This paramenter is typically incremented when
// there's an update to the transaction_version.
spec_version: 50,
spec_version: 51,
// The version of the implementation of the specification. Nodes can ignore this. It is only
// used to indicate that the code is different. As long as the authoring_version and the
// spec_version are the same, the code itself might have changed, but the native and Wasm
Expand Down
Loading