From 65cd8fe6dafb3d36a81c5cbbaf6645a605307d65 Mon Sep 17 00:00:00 2001 From: Kasper Ziemianek Date: Wed, 19 Jun 2024 00:28:31 +0200 Subject: [PATCH] fix bitacross indirect-calls-executor tests --- .../indirect-calls-executor/src/executor.rs | 1 - .../indirect-calls-executor/src/mock.rs | 53 +------------------ 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/bitacross-worker/core/parentchain/indirect-calls-executor/src/executor.rs b/bitacross-worker/core/parentchain/indirect-calls-executor/src/executor.rs index 5dd0f06e3f..09b43bd0b1 100644 --- a/bitacross-worker/core/parentchain/indirect-calls-executor/src/executor.rs +++ b/bitacross-worker/core/parentchain/indirect-calls-executor/src/executor.rs @@ -353,7 +353,6 @@ mod test { TestStfEnclaveSigner, TestTopPoolAuthor, TestNodeMetadataRepository, - MockExtrinsicFilter, TestEventCreator, MockParentchainEventHandler, TrustedCallSignedMock, diff --git a/bitacross-worker/core/parentchain/indirect-calls-executor/src/mock.rs b/bitacross-worker/core/parentchain/indirect-calls-executor/src/mock.rs index bedebeae6f..1cfa53fe53 100644 --- a/bitacross-worker/core/parentchain/indirect-calls-executor/src/mock.rs +++ b/bitacross-worker/core/parentchain/indirect-calls-executor/src/mock.rs @@ -1,6 +1,6 @@ use crate::{ error::{Error, Result as ICResult}, - filter_metadata::{EventsFromMetadata, FilterIntoDataFrom}, + filter_metadata::EventsFromMetadata, IndirectDispatch, }; use bc_relayer_registry::RelayerRegistry; @@ -10,10 +10,7 @@ use core::marker::PhantomData; use litentry_primitives::DecryptableRequest; use bc_enclave_registry::EnclaveRegistry; -use itp_node_api::{ - api_client::{CallIndex, PairSignature, UncheckedExtrinsicV4}, - metadata::NodeMetadataTrait, -}; +use itp_node_api::api_client::{CallIndex, PairSignature, UncheckedExtrinsicV4}; use itp_sgx_runtime_primitives::types::{AccountId, Balance}; use itp_stf_primitives::{traits::IndirectExecutor, types::Signature}; use itp_test::mock::stf_mock::{GetterMock, TrustedCallMock, TrustedCallSignedMock}; @@ -27,52 +24,6 @@ use itp_types::{ use log::*; use std::vec::Vec; -/// Default filter we use for the Integritee-Parachain. -pub struct MockExtrinsicFilter { - _phantom: PhantomData, -} - -impl FilterIntoDataFrom - for MockExtrinsicFilter -where - ExtrinsicParser: ParseExtrinsic, -{ - type Output = IndirectCall; - type ParseParentchainMetadata = ExtrinsicParser; - - fn filter_into_from_metadata( - encoded_data: &[u8], - metadata: &NodeMetadata, - ) -> Option { - let call_mut = &mut &encoded_data[..]; - - // Todo: the filter should not need to parse, only filter. This should directly be configured - // in the indirect executor. - let xt = match Self::ParseParentchainMetadata::parse(call_mut) { - Ok(xt) => xt, - Err(e) => { - log::error!( - "[ShieldFundsAndInvokeFilter] Could not parse parentchain extrinsic: {:?}", - e - ); - return None - }, - }; - let index = xt.call_index; - let call_args = &mut &xt.call_args[..]; - log::trace!( - "[ShieldFundsAndInvokeFilter] attempting to execute indirect call with index {:?}", - index - ); - if index == metadata.post_opaque_task_call_indexes().ok()? { - log::debug!("executing invoke call"); - let args = InvokeArgs::decode(call_args).unwrap(); - Some(IndirectCall::Invoke(args)) - } else { - None - } - } -} pub struct ExtrinsicParser { _phantom: PhantomData, }