mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 11:41:04 +00:00
Remove deprecated batch verification (#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.
This commit is contained in:
@@ -163,7 +163,7 @@ mod execution {
|
||||
use sp_core::{
|
||||
hexdisplay::HexDisplay,
|
||||
storage::{ChildInfo, ChildType, PrefixedStorageKey},
|
||||
traits::{CallContext, CodeExecutor, ReadRuntimeVersionExt, RuntimeCode, SpawnNamed},
|
||||
traits::{CallContext, CodeExecutor, ReadRuntimeVersionExt, RuntimeCode},
|
||||
};
|
||||
use sp_externalities::Extensions;
|
||||
use std::{
|
||||
@@ -324,11 +324,9 @@ mod execution {
|
||||
call_data: &'a [u8],
|
||||
mut extensions: Extensions,
|
||||
runtime_code: &'a RuntimeCode,
|
||||
spawn_handle: impl SpawnNamed + Send + 'static,
|
||||
context: CallContext,
|
||||
) -> Self {
|
||||
extensions.register(ReadRuntimeVersionExt::new(exec.clone()));
|
||||
extensions.register(sp_core::traits::TaskExecutorExt::new(spawn_handle));
|
||||
|
||||
Self {
|
||||
backend,
|
||||
@@ -511,11 +509,10 @@ mod execution {
|
||||
}
|
||||
|
||||
/// Prove execution using the given state backend, overlayed changes, and call executor.
|
||||
pub fn prove_execution<B, H, Exec, Spawn>(
|
||||
pub fn prove_execution<B, H, Exec>(
|
||||
backend: &mut B,
|
||||
overlay: &mut OverlayedChanges,
|
||||
exec: &Exec,
|
||||
spawn_handle: Spawn,
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
runtime_code: &RuntimeCode,
|
||||
@@ -525,14 +522,12 @@ mod execution {
|
||||
H: Hasher,
|
||||
H::Out: Ord + 'static + codec::Codec,
|
||||
Exec: CodeExecutor + Clone + 'static,
|
||||
Spawn: SpawnNamed + Send + 'static,
|
||||
{
|
||||
let trie_backend = backend.as_trie_backend();
|
||||
prove_execution_on_trie_backend::<_, _, _, _>(
|
||||
prove_execution_on_trie_backend::<_, _, _>(
|
||||
trie_backend,
|
||||
overlay,
|
||||
exec,
|
||||
spawn_handle,
|
||||
method,
|
||||
call_data,
|
||||
runtime_code,
|
||||
@@ -549,11 +544,10 @@ mod execution {
|
||||
///
|
||||
/// Note: changes to code will be in place if this call is made again. For running partial
|
||||
/// blocks (e.g. a transaction at a time), ensure a different method is used.
|
||||
pub fn prove_execution_on_trie_backend<S, H, Exec, Spawn>(
|
||||
pub fn prove_execution_on_trie_backend<S, H, Exec>(
|
||||
trie_backend: &TrieBackend<S, H>,
|
||||
overlay: &mut OverlayedChanges,
|
||||
exec: &Exec,
|
||||
spawn_handle: Spawn,
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
runtime_code: &RuntimeCode,
|
||||
@@ -564,7 +558,6 @@ mod execution {
|
||||
H: Hasher,
|
||||
H::Out: Ord + 'static + codec::Codec,
|
||||
Exec: CodeExecutor + 'static + Clone,
|
||||
Spawn: SpawnNamed + Send + 'static,
|
||||
{
|
||||
let proving_backend =
|
||||
TrieBackendBuilder::wrap(trie_backend).with_recorder(Default::default()).build();
|
||||
@@ -577,7 +570,6 @@ mod execution {
|
||||
call_data,
|
||||
extensions,
|
||||
runtime_code,
|
||||
spawn_handle,
|
||||
CallContext::Offchain,
|
||||
)
|
||||
.execute_using_consensus_failure_handler::<_>(always_wasm())?;
|
||||
@@ -590,12 +582,11 @@ mod execution {
|
||||
}
|
||||
|
||||
/// Check execution proof, generated by `prove_execution` call.
|
||||
pub fn execution_proof_check<H, Exec, Spawn>(
|
||||
pub fn execution_proof_check<H, Exec>(
|
||||
root: H::Out,
|
||||
proof: StorageProof,
|
||||
overlay: &mut OverlayedChanges,
|
||||
exec: &Exec,
|
||||
spawn_handle: Spawn,
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
runtime_code: &RuntimeCode,
|
||||
@@ -604,14 +595,12 @@ mod execution {
|
||||
H: Hasher + 'static,
|
||||
Exec: CodeExecutor + Clone + 'static,
|
||||
H::Out: Ord + 'static + codec::Codec,
|
||||
Spawn: SpawnNamed + Send + 'static,
|
||||
{
|
||||
let trie_backend = create_proof_check_backend::<H>(root, proof)?;
|
||||
execution_proof_check_on_trie_backend::<_, _, _>(
|
||||
execution_proof_check_on_trie_backend::<_, _>(
|
||||
&trie_backend,
|
||||
overlay,
|
||||
exec,
|
||||
spawn_handle,
|
||||
method,
|
||||
call_data,
|
||||
runtime_code,
|
||||
@@ -619,11 +608,10 @@ mod execution {
|
||||
}
|
||||
|
||||
/// Check execution proof on proving backend, generated by `prove_execution` call.
|
||||
pub fn execution_proof_check_on_trie_backend<H, Exec, Spawn>(
|
||||
pub fn execution_proof_check_on_trie_backend<H, Exec>(
|
||||
trie_backend: &TrieBackend<MemoryDB<H>, H>,
|
||||
overlay: &mut OverlayedChanges,
|
||||
exec: &Exec,
|
||||
spawn_handle: Spawn,
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
runtime_code: &RuntimeCode,
|
||||
@@ -632,7 +620,6 @@ mod execution {
|
||||
H: Hasher,
|
||||
H::Out: Ord + 'static + codec::Codec,
|
||||
Exec: CodeExecutor + Clone + 'static,
|
||||
Spawn: SpawnNamed + Send + 'static,
|
||||
{
|
||||
StateMachine::<_, H, Exec>::new(
|
||||
trie_backend,
|
||||
@@ -642,7 +629,6 @@ mod execution {
|
||||
call_data,
|
||||
Extensions::default(),
|
||||
runtime_code,
|
||||
spawn_handle,
|
||||
CallContext::Offchain,
|
||||
)
|
||||
.execute_using_consensus_failure_handler(always_untrusted_wasm())
|
||||
@@ -1309,7 +1295,6 @@ mod tests {
|
||||
use sp_core::{
|
||||
map,
|
||||
storage::{ChildInfo, StateVersion},
|
||||
testing::TaskExecutor,
|
||||
traits::{CallContext, CodeExecutor, Externalities, RuntimeCode},
|
||||
H256,
|
||||
};
|
||||
@@ -1384,7 +1369,6 @@ mod tests {
|
||||
&[],
|
||||
Default::default(),
|
||||
&wasm_code,
|
||||
TaskExecutor::new(),
|
||||
CallContext::Offchain,
|
||||
);
|
||||
|
||||
@@ -1413,7 +1397,6 @@ mod tests {
|
||||
&[],
|
||||
Default::default(),
|
||||
&wasm_code,
|
||||
TaskExecutor::new(),
|
||||
CallContext::Offchain,
|
||||
);
|
||||
|
||||
@@ -1443,7 +1426,6 @@ mod tests {
|
||||
&[],
|
||||
Default::default(),
|
||||
&wasm_code,
|
||||
TaskExecutor::new(),
|
||||
CallContext::Offchain,
|
||||
);
|
||||
|
||||
@@ -1475,7 +1457,6 @@ mod tests {
|
||||
&mut remote_backend,
|
||||
&mut Default::default(),
|
||||
&executor,
|
||||
TaskExecutor::new(),
|
||||
"test",
|
||||
&[],
|
||||
&RuntimeCode::empty(),
|
||||
@@ -1483,12 +1464,11 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// check proof locally
|
||||
let local_result = execution_proof_check::<BlakeTwo256, _, _>(
|
||||
let local_result = execution_proof_check::<BlakeTwo256, _>(
|
||||
remote_root,
|
||||
remote_proof,
|
||||
&mut Default::default(),
|
||||
&executor,
|
||||
TaskExecutor::new(),
|
||||
"test",
|
||||
&[],
|
||||
&RuntimeCode::empty(),
|
||||
|
||||
Reference in New Issue
Block a user