Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
da550a7
metadata-ir: Add extrinsic type info to decode address, call, sig
lexnv May 11, 2023
a51ea7b
frame-metadata: Point to unreleased branch
lexnv May 11, 2023
888ce4a
metadata-ir: Include addrees, call, signature in V15 conversion
lexnv May 11, 2023
49995b4
metadata-ir: Include extra ty
lexnv May 11, 2023
0babb53
construct_runtime: Extract address,call,sig,extra ty from tx type
lexnv May 11, 2023
768c515
frame/tests: Check metadata populates xt types correctly
lexnv May 11, 2023
ab66814
metadata-ir/tests: Add extra fields on ExtrinsicMetadataIR
lexnv May 11, 2023
52f1480
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv May 11, 2023
6610ac2
primitives/traits: Expand the `Extrinsic::SignaturePayload`
lexnv May 15, 2023
25617e0
primitives: Adjust to new `Extrinsic` associated types
lexnv May 15, 2023
10bbe10
frame/metadata: Simplify metadata generation
lexnv May 15, 2023
b823f5c
frame/example: Adjust to new interface
lexnv May 15, 2023
a94cd09
frame/tests: Adjust `extrinsic_metadata_ir_types`
lexnv May 16, 2023
1f17361
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv May 29, 2023
86e39c1
Revert the additional Extrinsic' associated types
lexnv May 29, 2023
903ebd7
primitives: Add `SignaturePayload` marker trait
lexnv May 29, 2023
37f6a09
primitives: Implement SignaturePayload for empty tuple
lexnv May 29, 2023
16b81b6
Adjust to new SignaturePayload trait
lexnv May 29, 2023
cd5c0a3
tests: Adjust `extrinsic_metadata_ir_types` to new interface
lexnv May 29, 2023
60db7bc
frame/support: Adjust pallet test
lexnv May 29, 2023
6e4f749
frame: Add Extrinsic length prefix to the metadata
lexnv May 30, 2023
0ad90f3
primitives: Populate `ExtrinsicMetadataIR` with `len_ty`
lexnv May 30, 2023
7d55ba1
Update primitives/runtime/src/traits.rs
lexnv Jun 2, 2023
03383be
Apply cargo fmt
lexnv Jun 2, 2023
0e87313
v15: Remove len type of the extrinsic
lexnv Jun 2, 2023
2c307b8
cargo: Update frame-metadata
lexnv Jun 2, 2023
e183783
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv Jun 2, 2023
1747586
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
Jun 5, 2023
9fd69cd
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv Jun 28, 2023
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
Prev Previous commit
Next Next commit
Revert the additional Extrinsic' associated types
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed May 29, 2023
commit 86e39c175bd40cb0515abe8e92a3b9d89b3ded6e
9 changes: 1 addition & 8 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,14 +1267,7 @@ where
public: <Signature as traits::Verify>::Signer,
account: AccountId,
nonce: Index,
) -> Option<(
RuntimeCall,
(
<UncheckedExtrinsic as traits::Extrinsic>::SignatureAddress,
<UncheckedExtrinsic as traits::Extrinsic>::Signature,
<UncheckedExtrinsic as traits::Extrinsic>::SignatureExtra,
),
)> {
) -> Option<(RuntimeCall, <UncheckedExtrinsic as traits::Extrinsic>::SignaturePayload)> {
let tip = 0;
// take the biggest period possible.
let period =
Expand Down
11 changes: 2 additions & 9 deletions frame/examples/offchain-worker/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,8 @@ where
_public: <Signature as Verify>::Signer,
_account: AccountId,
nonce: u64,
) -> Option<(
RuntimeCall,
(
<Extrinsic as ExtrinsicT>::SignatureAddress,
<Extrinsic as ExtrinsicT>::Signature,
<Extrinsic as ExtrinsicT>::SignatureExtra,
),
)> {
Some((call, (nonce, (), ())))
) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
}

Expand Down
4 changes: 2 additions & 2 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ mod tests {
)
}

fn sign_extra(who: u64, nonce: u64, fee: Balance) -> Option<(u64, (), SignedExtra)> {
Some((who, (), extra(nonce, fee)))
fn sign_extra(who: u64, nonce: u64, fee: Balance) -> Option<(u64, SignedExtra)> {
Some((who, extra(nonce, fee)))
}

fn call_transfer(dest: u64, value: u64) -> RuntimeCall {
Expand Down
15 changes: 2 additions & 13 deletions frame/system/src/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ where
/// Submit transaction onchain by providing the call and an optional signature
pub fn submit_transaction(
call: <T as SendTransactionTypes<LocalCall>>::OverarchingCall,
signature: Option<(
<T::Extrinsic as ExtrinsicT>::SignatureAddress,
<T::Extrinsic as ExtrinsicT>::Signature,
<T::Extrinsic as ExtrinsicT>::SignatureExtra,
)>,
signature: Option<<T::Extrinsic as ExtrinsicT>::SignaturePayload>,
) -> Result<(), ()> {
let xt = T::Extrinsic::new(call, signature).ok_or(())?;
sp_io::offchain::submit_transaction(xt.encode())
Expand Down Expand Up @@ -491,14 +487,7 @@ pub trait CreateSignedTransaction<LocalCall>:
public: Self::Public,
account: Self::AccountId,
nonce: Self::Index,
) -> Option<(
Self::OverarchingCall,
(
<Self::Extrinsic as ExtrinsicT>::SignatureAddress,
<Self::Extrinsic as ExtrinsicT>::Signature,
<Self::Extrinsic as ExtrinsicT>::SignatureExtra,
),
)>;
) -> Option<(Self::OverarchingCall, <Self::Extrinsic as ExtrinsicT>::SignaturePayload)>;
}

/// A message signer.
Expand Down
2 changes: 1 addition & 1 deletion frame/transaction-payment/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fn query_info_and_fee_details_works() {
let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 69 });
let origin = 111111;
let extra = ();
let xt = TestXt::new(call.clone(), Some((origin, (), extra)));
let xt = TestXt::new(call.clone(), Some((origin, extra)));
let info = xt.get_dispatch_info();
let ext = xt.encode();
let len = ext.len() as u32;
Expand Down
6 changes: 2 additions & 4 deletions primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,15 +902,13 @@ impl<'a> ::serde::Deserialize<'a> for OpaqueExtrinsic {
{
let r = ::sp_core::bytes::deserialize(de)?;
Decode::decode(&mut &r[..])
.map_err(|e: codec::Error| ::serde::de::Error::custom(format!("Decode error: {}", e)))
.map_err(|e| ::serde::de::Error::custom(format!("Decode error: {}", e)))
}
}

impl traits::Extrinsic for OpaqueExtrinsic {
type Call = ();
type SignatureAddress = ();
type Signature = ();
type SignatureExtra = ();
type SignaturePayload = ();
}

/// Print something that implements `Printable` from the runtime.
Expand Down
21 changes: 7 additions & 14 deletions primitives/runtime/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ pub struct ExtrinsicWrapper<Xt>(Xt);

impl<Xt> traits::Extrinsic for ExtrinsicWrapper<Xt> {
type Call = ();
type SignatureAddress = ();
type Signature = ();
type SignatureExtra = ();
type SignaturePayload = ();

fn is_signed(&self) -> Option<bool> {
None
Expand Down Expand Up @@ -288,14 +286,14 @@ where
#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
pub struct TestXt<Call, Extra> {
/// Signature of the extrinsic.
pub signature: Option<(u64, (), Extra)>,
pub signature: Option<(u64, Extra)>,
/// Call of the extrinsic.
pub call: Call,
}

impl<Call, Extra> TestXt<Call, Extra> {
/// Create a new `TextXt`.
pub fn new(call: Call, signature: Option<(u64, (), Extra)>) -> Self {
pub fn new(call: Call, signature: Option<(u64, Extra)>) -> Self {
Self { call, signature }
}
}
Expand Down Expand Up @@ -335,18 +333,13 @@ impl<Call: Codec + Sync + Send, Context, Extra> Checkable<Context> for TestXt<Ca

impl<Call: Codec + Sync + Send, Extra> traits::Extrinsic for TestXt<Call, Extra> {
type Call = Call;
type SignatureAddress = u64;
type Signature = ();
type SignatureExtra = Extra;
type SignaturePayload = (u64, Extra);

fn is_signed(&self) -> Option<bool> {
Some(self.signature.is_some())
}

fn new(
c: Call,
sig: Option<(Self::SignatureAddress, Self::Signature, Self::SignatureExtra)>,
) -> Option<Self> {
fn new(c: Call, sig: Option<Self::SignaturePayload>) -> Option<Self> {
Some(TestXt { signature: sig, call: c })
}
}
Expand Down Expand Up @@ -383,7 +376,7 @@ where
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> TransactionValidity {
if let Some((ref id, _, ref extra)) = self.signature {
if let Some((ref id, ref extra)) = self.signature {
Extra::validate(extra, id, &self.call, info, len)
} else {
let valid = Extra::validate_unsigned(&self.call, info, len)?;
Expand All @@ -399,7 +392,7 @@ where
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> ApplyExtrinsicResultWithInfo<PostDispatchInfoOf<Self::Call>> {
let maybe_who = if let Some((who, _, extra)) = self.signature {
let maybe_who = if let Some((who, extra)) = self.signature {
Extra::pre_dispatch(extra, &who, &self.call, info, len)?;
Some(who)
} else {
Expand Down