Encode and estimate Rococo/Wococo/Kusama/Polkadot messages (#1322)

* encode and estimate Rococo/Wococo/Kusama/Polkadot messages

* allow send-message for non-bundled chains

* weight -> dispatch-weight

* fmt

* fix spelling
This commit is contained in:
Svyatoslav Nikolsky
2022-02-21 11:53:23 +03:00
committed by Bastian Köcher
parent 097a28418b
commit efa3e97210
36 changed files with 518 additions and 241 deletions
+5 -5
View File
@@ -20,8 +20,8 @@ use bp_messages::MessageNonce;
use codec::Encode;
use frame_support::weights::Weight;
use relay_substrate_client::{
Chain, ChainBase, ChainWithBalances, ChainWithGrandpa, ChainWithMessages, SignParam,
TransactionSignScheme, UnsignedTransaction,
Chain, ChainBase, ChainWithBalances, ChainWithGrandpa, ChainWithMessages,
Error as SubstrateError, SignParam, TransactionSignScheme, UnsignedTransaction,
};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
@@ -101,7 +101,7 @@ impl TransactionSignScheme for Kusama {
type AccountKeyPair = sp_core::sr25519::Pair;
type SignedTransaction = crate::runtime::UncheckedExtrinsic;
fn sign_transaction(param: SignParam<Self>) -> Self::SignedTransaction {
fn sign_transaction(param: SignParam<Self>) -> Result<Self::SignedTransaction, SubstrateError> {
let raw_payload = SignedPayload::new(
param.unsigned.call.clone(),
bp_kusama::SignedExtensions::new(
@@ -119,12 +119,12 @@ impl TransactionSignScheme for Kusama {
let signer: sp_runtime::MultiSigner = param.signer.public().into();
let (call, extra, _) = raw_payload.deconstruct();
bp_kusama::UncheckedExtrinsic::new_signed(
Ok(bp_kusama::UncheckedExtrinsic::new_signed(
call,
sp_runtime::MultiAddress::Id(signer.into_account()),
signature.into(),
extra,
)
))
}
fn is_signed(tx: &Self::SignedTransaction) -> bool {