Add CheckNonZeroSender to runtime configs (#4493)

* Add CheckNonZeroSender to runtime configs

* cargo fmt

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes
This commit is contained in:
Keith Yeung
2021-12-12 02:22:08 -08:00
committed by GitHub
parent 0755ad39d3
commit 54423f8b8a
13 changed files with 27 additions and 4 deletions
@@ -248,11 +248,12 @@ pub type UncheckedExtrinsic<Call> =
pub type Address = MultiAddress<AccountId, ()>;
/// A type of the data encoded as part of the transaction.
pub type SignedExtra = ((), (), (), sp_runtime::generic::Era, Compact<Nonce>, (), Compact<Balance>);
pub type SignedExtra =
((), (), (), (), sp_runtime::generic::Era, Compact<Nonce>, (), Compact<Balance>);
/// Parameters which are part of the payload used to produce transaction signature,
/// but don't end up in the transaction itself (i.e. inherent part of the runtime).
pub type AdditionalSigned = (u32, u32, Hash, Hash, (), (), ());
pub type AdditionalSigned = ((), u32, u32, Hash, Hash, (), (), ());
/// A simplified version of signed extensions meant for producing signed transactions
/// and signed payload in the client code.
@@ -287,6 +288,7 @@ impl<Call> SignedExtensions<Call> {
) -> Self {
Self {
encode_payload: (
(), // non-zero sender
(), // spec version
(), // tx version
(), // genesis
@@ -296,6 +298,7 @@ impl<Call> SignedExtensions<Call> {
tip.into(), // transaction payment / tip (compact encoding)
),
additional_signed: (
(),
version.spec_version,
version.transaction_version,
genesis_hash,
@@ -312,12 +315,12 @@ impl<Call> SignedExtensions<Call> {
impl<Call> SignedExtensions<Call> {
/// Return signer nonce, used to craft transaction.
pub fn nonce(&self) -> Nonce {
self.encode_payload.4.into()
self.encode_payload.5.into()
}
/// Return transaction tip.
pub fn tip(&self) -> Balance {
self.encode_payload.6.into()
self.encode_payload.7.into()
}
}