use complex transactions on RBH/WBH bridge hubs (#1893)

This commit is contained in:
Svyatoslav Nikolsky
2023-02-20 11:27:39 +03:00
committed by Bastian Köcher
parent 976e96608c
commit bb078b8226
9 changed files with 68 additions and 14 deletions
@@ -31,6 +31,15 @@ pub enum SystemCall {
remark(Vec<u8>),
}
/// A minimized version of `pallet-utility::Call` that can be used without a runtime.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)]
pub enum UtilityCall<Call> {
/// `pallet-utility::Call::batch_all`
#[codec(index = 2)]
batch_all(Vec<Call>),
}
/// A minimized version of `pallet-sudo::Call` that can be used without a runtime.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)]
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use crate::calls::UtilityCall;
use bp_messages::MessageNonce;
use bp_runtime::{
Chain as ChainBase, EncodedOrDecodedCall, HashOf, Parachain as ParachainBase, TransactionEra,
@@ -276,6 +278,21 @@ where
}
}
/// Structure that implements `UtilityPalletProvider` based on a call conversion.
pub struct MockedRuntimeUtilityPallet<Call> {
_phantom: std::marker::PhantomData<Call>,
}
impl<C, Call> UtilityPallet<C> for MockedRuntimeUtilityPallet<Call>
where
C: Chain,
C::Call: From<UtilityCall<C::Call>>,
{
fn build_batch_call(calls: Vec<C::Call>) -> C::Call {
UtilityCall::batch_all(calls).into()
}
}
/// Substrate-based chain that uses `pallet-utility`.
pub trait ChainWithUtilityPallet: Chain {
/// The utility pallet provider.
+2 -2
View File
@@ -36,8 +36,8 @@ pub use crate::{
chain::{
AccountKeyPairOf, BlockWithJustification, CallOf, Chain, ChainWithBalances,
ChainWithGrandpa, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
FullRuntimeUtilityPallet, Parachain, RelayChain, SignParam, TransactionStatusOf,
UnsignedTransaction, UtilityPallet,
FullRuntimeUtilityPallet, MockedRuntimeUtilityPallet, Parachain, RelayChain, SignParam,
TransactionStatusOf, UnsignedTransaction, UtilityPallet,
},
client::{
is_ancient_block, ChainRuntimeVersion, Client, OpaqueGrandpaAuthoritiesSet,