Skip to content

Commit

Permalink
[pallet-revive] Update typeInfo (paritytech#6263)
Browse files Browse the repository at this point in the history
Update typeinfo impl to make it transparent for subxt

see paritytech/subxt#1845

---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
pgherveou and actions-user authored Oct 28, 2024
1 parent 58fd5ae commit 7e87654
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
10 changes: 10 additions & 0 deletions prdoc/pr_6263.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: '[pallet-revive] Update typeInfo'
doc:
- audience: Runtime Dev
description: |-
Update typeinfo impl to make it transparent for subxt

see https://github.com/paritytech/subxt/pull/1845
crates:
- name: pallet-revive
bump: minor
18 changes: 15 additions & 3 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use frame_support::{
traits::{ExtrinsicCall, InherentBuilder, SignedTransactionBuilder},
};
use pallet_transaction_payment::OnChargeTransaction;
use scale_info::TypeInfo;
use scale_info::{StaticTypeInfo, TypeInfo};
use sp_arithmetic::Percent;
use sp_core::{Get, U256};
use sp_runtime::{
Expand All @@ -52,12 +52,24 @@ pub const GAS_PRICE: u32 = 1u32;

/// Wraps [`generic::UncheckedExtrinsic`] to support checking unsigned
/// [`crate::Call::eth_transact`] extrinsic.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
#[scale_info(skip_type_params(E))]
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
pub struct UncheckedExtrinsic<Address, Signature, E: EthExtra>(
pub generic::UncheckedExtrinsic<Address, CallOf<E::Config>, Signature, E::Extension>,
);

impl<Address, Signature, E: EthExtra> TypeInfo for UncheckedExtrinsic<Address, Signature, E>
where
Address: StaticTypeInfo,
Signature: StaticTypeInfo,
E::Extension: StaticTypeInfo,
{
type Identity =
generic::UncheckedExtrinsic<Address, CallOf<E::Config>, Signature, E::Extension>;
fn type_info() -> scale_info::Type {
generic::UncheckedExtrinsic::<Address, CallOf<E::Config>, Signature, E::Extension>::type_info()
}
}

impl<Address, Signature, E: EthExtra>
From<generic::UncheckedExtrinsic<Address, CallOf<E::Config>, Signature, E::Extension>>
for UncheckedExtrinsic<Address, Signature, E>
Expand Down

0 comments on commit 7e87654

Please sign in to comment.