Skip to content

Commit 1d642ba

Browse files
bkchrnathanwhit
authored andcommitted
Remove deprecated batch verification (paritytech#13799)
This removes the deprecated batch verification. This was actually never really activated. Nevertheless, we need to keep the host functions around to support old runtimes which may import these host functions. However, we do not give access to these functions anymore. This means that any new runtime can not call them anymore. The host function implementations we keep will not do batch verification and will instead fall back to the always existing option of directly verifying the passed signature. `finish_batch_verification` will return the combined result of all the batch verify calls. This removes the `TaskExecutorExt` which only existed to support the batch verification. So, any code that used this extension can just remove the registration of them. It also removes `SignatureBatching` that was used by `frame-executive` to control the batch verification. However, there wasn't any `Verify` implementation that called the batch verification functions.
1 parent 5f26e2b commit 1d642ba

15 files changed

Lines changed: 76 additions & 530 deletions

File tree

client/service/src/builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ where
272272
let executor = crate::client::LocalCallExecutor::new(
273273
backend.clone(),
274274
executor,
275-
spawn_handle.clone(),
276275
config.clone(),
277276
execution_extensions,
278277
)?;

client/service/src/client/call_executor.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use sc_client_api::{
2323
use sc_executor::{RuntimeVersion, RuntimeVersionOf};
2424
use sp_api::{ProofRecorder, StorageTransactionCache};
2525
use sp_core::{
26-
traits::{CallContext, CodeExecutor, RuntimeCode, SpawnNamed},
26+
traits::{CallContext, CodeExecutor, RuntimeCode},
2727
ExecutionContext,
2828
};
2929
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
@@ -39,7 +39,6 @@ pub struct LocalCallExecutor<Block: BlockT, B, E> {
3939
executor: E,
4040
wasm_override: Arc<Option<WasmOverride>>,
4141
wasm_substitutes: WasmSubstitutes<Block, E, B>,
42-
spawn_handle: Box<dyn SpawnNamed>,
4342
execution_extensions: Arc<ExecutionExtensions<Block>>,
4443
}
4544

@@ -52,7 +51,6 @@ where
5251
pub fn new(
5352
backend: Arc<B>,
5453
executor: E,
55-
spawn_handle: Box<dyn SpawnNamed>,
5654
client_config: ClientConfig<Block>,
5755
execution_extensions: ExecutionExtensions<Block>,
5856
) -> sp_blockchain::Result<Self> {
@@ -72,7 +70,6 @@ where
7270
backend,
7371
executor,
7472
wasm_override: Arc::new(wasm_override),
75-
spawn_handle,
7673
wasm_substitutes,
7774
execution_extensions: Arc::new(execution_extensions),
7875
})
@@ -142,7 +139,6 @@ where
142139
backend: self.backend.clone(),
143140
executor: self.executor.clone(),
144141
wasm_override: self.wasm_override.clone(),
145-
spawn_handle: self.spawn_handle.clone(),
146142
wasm_substitutes: self.wasm_substitutes.clone(),
147143
execution_extensions: self.execution_extensions.clone(),
148144
}
@@ -196,7 +192,6 @@ where
196192
call_data,
197193
extensions,
198194
&runtime_code,
199-
self.spawn_handle.clone(),
200195
context,
201196
)
202197
.set_parent_hash(at_hash);
@@ -256,7 +251,6 @@ where
256251
call_data,
257252
extensions,
258253
&runtime_code,
259-
self.spawn_handle.clone(),
260254
call_context,
261255
)
262256
.with_storage_transaction_cache(storage_transaction_cache.as_deref_mut())
@@ -272,7 +266,6 @@ where
272266
call_data,
273267
extensions,
274268
&runtime_code,
275-
self.spawn_handle.clone(),
276269
call_context,
277270
)
278271
.with_storage_transaction_cache(storage_transaction_cache.as_deref_mut())
@@ -313,7 +306,6 @@ where
313306
trie_backend,
314307
&mut Default::default(),
315308
&self.executor,
316-
self.spawn_handle.clone(),
317309
method,
318310
call_data,
319311
&runtime_code,
@@ -425,7 +417,6 @@ mod tests {
425417
backend: backend.clone(),
426418
executor: executor.clone(),
427419
wasm_override: Arc::new(Some(overrides)),
428-
spawn_handle: Box::new(TaskExecutor::new()),
429420
wasm_substitutes: WasmSubstitutes::new(
430421
Default::default(),
431422
executor.clone(),

client/service/src/client/client.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,8 @@ where
245245
sc_offchain::OffchainDb::factory_from_backend(&*backend),
246246
);
247247

248-
let call_executor = LocalCallExecutor::new(
249-
backend.clone(),
250-
executor,
251-
spawn_handle.clone(),
252-
config.clone(),
253-
extensions,
254-
)?;
248+
let call_executor =
249+
LocalCallExecutor::new(backend.clone(), executor, config.clone(), extensions)?;
255250

256251
Client::new(
257252
backend,

client/service/test/src/client/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ fn construct_block(
104104
let mut overlay = OverlayedChanges::default();
105105
let backend_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(backend);
106106
let runtime_code = backend_runtime_code.runtime_code().expect("Code is part of the backend");
107-
let task_executor = Box::new(TaskExecutor::new());
108107

109108
StateMachine::new(
110109
backend,
@@ -114,7 +113,6 @@ fn construct_block(
114113
&header.encode(),
115114
Default::default(),
116115
&runtime_code,
117-
task_executor.clone() as Box<_>,
118116
CallContext::Onchain,
119117
)
120118
.execute(ExecutionStrategy::NativeElseWasm)
@@ -129,7 +127,6 @@ fn construct_block(
129127
&tx.encode(),
130128
Default::default(),
131129
&runtime_code,
132-
task_executor.clone() as Box<_>,
133130
CallContext::Onchain,
134131
)
135132
.execute(ExecutionStrategy::NativeElseWasm)
@@ -144,7 +141,6 @@ fn construct_block(
144141
&[],
145142
Default::default(),
146143
&runtime_code,
147-
task_executor.clone() as Box<_>,
148144
CallContext::Onchain,
149145
)
150146
.execute(ExecutionStrategy::NativeElseWasm)
@@ -217,7 +213,6 @@ fn construct_genesis_should_work_with_native() {
217213
&b1data,
218214
Default::default(),
219215
&runtime_code,
220-
TaskExecutor::new(),
221216
CallContext::Onchain,
222217
)
223218
.execute(ExecutionStrategy::NativeElseWasm)
@@ -251,7 +246,6 @@ fn construct_genesis_should_work_with_wasm() {
251246
&b1data,
252247
Default::default(),
253248
&runtime_code,
254-
TaskExecutor::new(),
255249
CallContext::Onchain,
256250
)
257251
.execute(ExecutionStrategy::AlwaysWasm)
@@ -285,7 +279,6 @@ fn construct_genesis_with_bad_transaction_should_panic() {
285279
&b1data,
286280
Default::default(),
287281
&runtime_code,
288-
TaskExecutor::new(),
289282
CallContext::Onchain,
290283
)
291284
.execute(ExecutionStrategy::NativeElseWasm);

frame/executive/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,10 @@ where
480480
// any initial checks
481481
Self::initial_checks(&block);
482482

483-
let signature_batching = sp_runtime::SignatureBatching::start();
484-
485483
// execute extrinsics
486484
let (header, extrinsics) = block.deconstruct();
487485
Self::execute_extrinsics_with_book_keeping(extrinsics, *header.number());
488486

489-
if !signature_batching.verify() {
490-
panic!("Signature verification failed.");
491-
}
492-
493487
// any final checks
494488
Self::final_checks(&header);
495489
}

primitives/api/test/tests/runtime_calls.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ fn record_proof_works() {
188188
&backend,
189189
&mut overlay,
190190
&executor,
191-
sp_core::testing::TaskExecutor::new(),
192191
"Core_execute_block",
193192
&block.encode(),
194193
&runtime_code,

primitives/core/src/traits.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,6 @@ impl ReadRuntimeVersionExt {
169169
}
170170
}
171171

172-
sp_externalities::decl_extension! {
173-
/// Task executor extension.
174-
pub struct TaskExecutorExt(Box<dyn SpawnNamed>);
175-
}
176-
177-
impl TaskExecutorExt {
178-
/// New instance of task executor extension.
179-
pub fn new(spawn_handle: impl SpawnNamed + Send + 'static) -> Self {
180-
Self(Box::new(spawn_handle))
181-
}
182-
}
183-
184172
/// Something that can spawn tasks (blocking and non-blocking) with an assigned name
185173
/// and optional group.
186174
#[dyn_clonable::clonable]

0 commit comments

Comments
 (0)