Skip to content

Commit

Permalink
Apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
techraed committed Oct 11, 2024
1 parent cfc3930 commit 819e654
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions pallets/gear-builtin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl<E> BuiltinCollection<E> for Tuple {
#[frame_support::pallet]
pub mod pallet {
use super::*;
use common::Origin;
use frame_support::{
dispatch::{GetDispatchInfo, PostDispatchInfo},
pallet_prelude::*,
Expand Down Expand Up @@ -218,10 +219,13 @@ pub mod pallet {
}

pub(crate) fn dispatch_call(
origin: T::AccountId,
origin: ProgramId,
call: CallOf<T>,
gas_limit: u64,
) -> (Result<(), BuiltinActorError>, u64) {
) -> (Result<(), BuiltinActorError>, u64)
where
T::AccountId: Origin,
{
let call_info = call.get_dispatch_info();

// Necessary upfront gas sufficiency check
Expand All @@ -230,7 +234,7 @@ pub mod pallet {
}

// Execute call
let res = call.dispatch(frame_system::RawOrigin::Signed(origin).into());
let res = call.dispatch(frame_system::RawOrigin::Signed(origin.cast()).into());
let actual_gas = extract_actual_weight(&res, &call_info).ref_time();

match res {
Expand Down
2 changes: 1 addition & 1 deletion pallets/gear-builtin/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
return (Err(BuiltinActorError::DecodingError), 0);
};

let origin = dispatch.source().cast();
let origin = dispatch.source();

match Self::cast(request) {
Ok(call) => {
Expand Down
2 changes: 1 addition & 1 deletion pallets/gear-builtin/src/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ where

fn handle(dispatch: &StoredDispatch, gas_limit: u64) -> (Result<Payload, Self::Error>, u64) {
let message = dispatch.message();
let origin: T::AccountId = dispatch.source().cast();
let origin = dispatch.source();
let mut payload = message.payload_bytes();

// Rule out payloads that exceed the largest reasonable size.
Expand Down

0 comments on commit 819e654

Please sign in to comment.