Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnReedV committed Nov 7, 2024
1 parent dc2ca17 commit be1c132
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use sp_core::{
crypto::{ByteArray, KeyTypeId},
OpaqueMetadata, H160, H256, U256,
};
use sp_runtime::generic::Era;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
Expand All @@ -53,6 +52,7 @@ use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use sp_runtime::generic::Era;

// A few exports that help ease life for downstream crates.
pub use frame_support::{
Expand Down Expand Up @@ -90,12 +90,12 @@ use pallet_evm::{Account as EVMAccount, BalanceConverter, FeeCalculator, Runner}

// Drand
impl pallet_drand::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_drand::weights::SubstrateWeight<Runtime>;
type AuthorityId = pallet_drand::crypto::TestAuthId;
type Verifier = pallet_drand::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HttpFetchTimeout = ConstU64<1_000>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_drand::weights::SubstrateWeight<Runtime>;
type AuthorityId = pallet_drand::crypto::TestAuthId;
type Verifier = pallet_drand::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HttpFetchTimeout = ConstU64<1_000>;
}

impl frame_system::offchain::SigningTypes for Runtime {
Expand All @@ -112,8 +112,10 @@ where
}

impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>> for Runtime {
fn create_transaction<S: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: RuntimeCall, // Change parameter type to `RuntimeCall`
fn create_transaction<
S: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>,
>(
call: RuntimeCall,
public: <Signature as Verify>::Signer,
account: AccountId,
index: Index,
Expand All @@ -123,8 +125,6 @@ impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>
)> {
use sp_runtime::traits::StaticLookup;

// No need to convert `call` since it's already `RuntimeCall`

let address = <Runtime as frame_system::Config>::Lookup::unlookup(account.clone());
let extra: SignedExtra = (
frame_system::CheckNonZeroSender::<Runtime>::new(),
Expand All @@ -143,7 +143,11 @@ impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>
let raw_payload = SignedPayload::new(call.clone(), extra.clone()).ok()?;
let signature = raw_payload.using_encoded(|payload| S::sign(payload, public))?;

let signature_payload = (address, signature.into(), extra);
let signature_payload = (
address,
signature.into(),
extra,
);

Some((call, signature_payload))
}
Expand Down

0 comments on commit be1c132

Please sign in to comment.