Skip to content

Commit

Permalink
Revert "Add option to enable native execution in LocalCallExecutor"
Browse files Browse the repository at this point in the history
This reverts commit c03b0d6.
  • Loading branch information
ark0f committed Jul 11, 2024
1 parent 7a41c56 commit 652e809
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 37 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions substrate/client/api/src/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ pub trait CallExecutor<B: BlockT>: RuntimeVersionOf {
/// The backend used by the node.
type Backend: crate::backend::Backend<B>;

fn gear_use_native(&mut self) {}

/// Returns the [`ExecutionExtensions`].
fn execution_extensions(&self) -> &ExecutionExtensions<B>;

Expand Down
17 changes: 0 additions & 17 deletions substrate/client/service/src/client/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub struct LocalCallExecutor<Block: BlockT, B, E> {
wasm_override: Arc<Option<WasmOverride>>,
wasm_substitutes: WasmSubstitutes<Block, E, B>,
execution_extensions: Arc<ExecutionExtensions<Block>>,
gear_use_native: bool,
}

impl<Block: BlockT, B, E> LocalCallExecutor<Block, B, E>
Expand Down Expand Up @@ -72,7 +71,6 @@ where
wasm_override: Arc::new(wasm_override),
wasm_substitutes,
execution_extensions: Arc::new(execution_extensions),
gear_use_native: false,
})
}

Expand Down Expand Up @@ -143,7 +141,6 @@ where
wasm_override: self.wasm_override.clone(),
wasm_substitutes: self.wasm_substitutes.clone(),
execution_extensions: self.execution_extensions.clone(),
gear_use_native: self.gear_use_native,
}
}
}
Expand All @@ -158,10 +155,6 @@ where

type Backend = B;

fn gear_use_native(&mut self) {
self.gear_use_native = true;
}

fn execution_extensions(&self) -> &ExecutionExtensions<Block> {
&self.execution_extensions
}
Expand Down Expand Up @@ -244,11 +237,6 @@ where
call_context,
)
.set_parent_hash(at_hash);

if self.gear_use_native {
state_machine.gear_use_native();
}

state_machine.execute()
},
None => {
Expand All @@ -263,11 +251,6 @@ where
call_context,
)
.set_parent_hash(at_hash);

if self.gear_use_native {
state_machine.gear_use_native();
}

state_machine.execute()
},
}
Expand Down
4 changes: 0 additions & 4 deletions substrate/client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ where
})
}

pub fn gear_use_native(&mut self) {
self.executor.gear_use_native();
}

/// returns a reference to the block import notification sinks
/// useful for test environments.
pub fn import_notification_sinks(&self) -> &NotificationSinks<BlockImportNotification<Block>> {
Expand Down
15 changes: 1 addition & 14 deletions substrate/primitives/state-machine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ mod execution {
/// Used for logging.
parent_hash: Option<H::Out>,
context: CallContext,
gear_use_native: bool,
}

impl<'a, B, H, Exec> Drop for StateMachine<'a, B, H, Exec>
Expand Down Expand Up @@ -251,7 +250,6 @@ mod execution {
stats: StateMachineStats::default(),
parent_hash: None,
context,
gear_use_native: false,
}
}

Expand Down Expand Up @@ -291,14 +289,7 @@ mod execution {

let result = self
.exec
.call(
&mut ext,
self.runtime_code,
self.method,
self.call_data,
self.gear_use_native,
self.context,
)
.call(&mut ext, self.runtime_code, self.method, self.call_data, false, self.context)
.0;

self.overlay
Expand All @@ -314,10 +305,6 @@ mod execution {

result.map_err(|e| Box::new(e) as Box<_>)
}

pub fn gear_use_native(&mut self) {
self.gear_use_native = true;
}
}

/// Prove execution using the given state backend, overlayed changes, and call executor.
Expand Down

0 comments on commit 652e809

Please sign in to comment.