Skip to content

Commit

Permalink
Make kitchensink build
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Oct 4, 2024
1 parent 57432d9 commit 337d27b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions substrate/bin/node/cli/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use node_primitives::{AccountId, Balance};
use sc_cli::Result;
use sp_inherents::{InherentData, InherentDataProvider};
use sp_keyring::Sr25519Keyring;
use sp_runtime::OpaqueExtrinsic;

use sp_runtime::{generic, OpaqueExtrinsic};
use std::{sync::Arc, time::Duration};

/// Generates `System::Remark` extrinsics for the benchmarks.
Expand Down Expand Up @@ -58,15 +58,15 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {

fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_extrinsic(
let extrinsic: generic::UncheckedExtrinsic<_, _, _, _> = create_extrinsic(
self.client.as_ref(),
acc,
SystemCall::remark { remark: vec![] },
Some(nonce),
)
.into();

Ok(extrinsic)
Ok(extrinsic.into())
}
}

Expand Down Expand Up @@ -97,7 +97,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {

fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_extrinsic(
let extrinsic: generic::UncheckedExtrinsic<_, _, _, _> = create_extrinsic(
self.client.as_ref(),
acc,
BalancesCall::transfer_keep_alive {
Expand All @@ -108,7 +108,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
)
.into();

Ok(extrinsic)
Ok(extrinsic.into())
}
}

Expand Down
6 changes: 5 additions & 1 deletion substrate/bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ pub fn create_extrinsic(
>::from(tip, None),
),
frame_metadata_hash_extension::CheckMetadataHash::new(false),
pallet_revive::evm::runtime::CheckEthTransact::<kitchensink_runtime::Runtime>::default(
),
);

let raw_payload = kitchensink_runtime::SignedPayload::from_raw(
Expand All @@ -153,16 +155,18 @@ pub fn create_extrinsic(
(),
(),
None,
(),
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));

kitchensink_runtime::UncheckedExtrinsic::new_signed(
generic::UncheckedExtrinsic::new_signed(
function,
sp_runtime::AccountId32::from(sender.public()).into(),
kitchensink_runtime::Signature::Sr25519(signature),
extra,
)
.into()
}

/// Creates a new partial node.
Expand Down
20 changes: 20 additions & 0 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ pub struct UncheckedExtrinsic<Call, E: EthExtra>(
generic::UncheckedExtrinsic<MultiAddress, Call, MultiSignature, E::Extra>,
);

impl<Call, E: EthExtra>
From<generic::UncheckedExtrinsic<MultiAddress, Call, MultiSignature, E::Extra>>
for UncheckedExtrinsic<Call, E>
{
fn from(
utx: generic::UncheckedExtrinsic<MultiAddress, Call, MultiSignature, E::Extra>,
) -> Self {
Self(utx)
}
}

impl<Call, E: EthExtra>
Into<generic::UncheckedExtrinsic<MultiAddress, Call, MultiSignature, E::Extra>>
for UncheckedExtrinsic<Call, E>
{
fn into(self) -> generic::UncheckedExtrinsic<MultiAddress, Call, MultiSignature, E::Extra> {
self.0
}
}

impl<Call: TypeInfo, E: EthExtra> Extrinsic for UncheckedExtrinsic<Call, E> {
type Call = Call;

Expand Down

0 comments on commit 337d27b

Please sign in to comment.