mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
seal: Remove ext_dispatch_call and ext_get_runtime_storage (#6464)
Those are way too hard to audit and make only sense with specific chains. They shouldn't be in the core API.
This commit is contained in:
committed by
GitHub
parent
a3a42f599a
commit
b14b472edf
@@ -29,7 +29,6 @@ use frame_support::{
|
||||
};
|
||||
|
||||
pub type AccountIdOf<T> = <T as frame_system::Trait>::AccountId;
|
||||
pub type CallOf<T> = <T as Trait>::Call;
|
||||
pub type MomentOf<T> = <<T as Trait>::Time as Time>::Moment;
|
||||
pub type SeedOf<T> = <T as frame_system::Trait>::Hash;
|
||||
pub type BlockNumberOf<T> = <T as frame_system::Trait>::BlockNumber;
|
||||
@@ -151,9 +150,6 @@ pub trait Ext {
|
||||
input_data: Vec<u8>,
|
||||
) -> ExecResult;
|
||||
|
||||
/// Notes a call dispatch.
|
||||
fn note_dispatch_call(&mut self, call: CallOf<Self::T>);
|
||||
|
||||
/// Restores the given destination contract sacrificing the current one.
|
||||
///
|
||||
/// Since this function removes the self contract eagerly, if succeeded, no further actions should
|
||||
@@ -274,23 +270,11 @@ impl<T: Trait> Token<T> for ExecFeeToken {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq, Clone))]
|
||||
#[derive(sp_runtime::RuntimeDebug)]
|
||||
pub enum DeferredAction<T: Trait> {
|
||||
DispatchRuntimeCall {
|
||||
/// The account id of the contract who dispatched this call.
|
||||
origin: T::AccountId,
|
||||
/// The call to dispatch.
|
||||
call: <T as Trait>::Call,
|
||||
},
|
||||
}
|
||||
|
||||
pub struct ExecutionContext<'a, T: Trait + 'a, V, L> {
|
||||
pub caller: Option<&'a ExecutionContext<'a, T, V, L>>,
|
||||
pub self_account: T::AccountId,
|
||||
pub self_trie_id: Option<TrieId>,
|
||||
pub depth: usize,
|
||||
pub deferred: Vec<DeferredAction<T>>,
|
||||
pub config: &'a Config<T>,
|
||||
pub vm: &'a V,
|
||||
pub loader: &'a L,
|
||||
@@ -314,7 +298,6 @@ where
|
||||
self_trie_id: None,
|
||||
self_account: origin,
|
||||
depth: 0,
|
||||
deferred: Vec::new(),
|
||||
config: &cfg,
|
||||
vm: &vm,
|
||||
loader: &loader,
|
||||
@@ -331,7 +314,6 @@ where
|
||||
self_trie_id: trie_id,
|
||||
self_account: dest,
|
||||
depth: self.depth + 1,
|
||||
deferred: Vec::new(),
|
||||
config: self.config,
|
||||
vm: self.vm,
|
||||
loader: self.loader,
|
||||
@@ -532,21 +514,14 @@ where
|
||||
where F: FnOnce(&mut ExecutionContext<T, V, L>) -> ExecResult
|
||||
{
|
||||
use frame_support::storage::TransactionOutcome::*;
|
||||
let (output, deferred) = {
|
||||
let mut nested = self.nested(dest, trie_id);
|
||||
let output = frame_support::storage::with_transaction(|| {
|
||||
let output = func(&mut nested);
|
||||
match output {
|
||||
Ok(ref rv) if rv.is_success() => Commit(output),
|
||||
_ => Rollback(output),
|
||||
}
|
||||
})?;
|
||||
(output, nested.deferred)
|
||||
};
|
||||
if output.is_success() {
|
||||
self.deferred.extend(deferred);
|
||||
}
|
||||
Ok(output)
|
||||
let mut nested = self.nested(dest, trie_id);
|
||||
frame_support::storage::with_transaction(|| {
|
||||
let output = func(&mut nested);
|
||||
match output {
|
||||
Ok(ref rv) if rv.is_success() => Commit(output),
|
||||
_ => Rollback(output),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns whether a contract, identified by address, is currently live in the execution
|
||||
@@ -767,13 +742,6 @@ where
|
||||
self.ctx.call(to.clone(), value, gas_meter, input_data)
|
||||
}
|
||||
|
||||
fn note_dispatch_call(&mut self, call: CallOf<Self::T>) {
|
||||
self.ctx.deferred.push(DeferredAction::DispatchRuntimeCall {
|
||||
origin: self.ctx.self_account.clone(),
|
||||
call,
|
||||
});
|
||||
}
|
||||
|
||||
fn restore_to(
|
||||
&mut self,
|
||||
dest: AccountIdOf<Self::T>,
|
||||
|
||||
Reference in New Issue
Block a user