diff --git a/core-primitives/registry-storage/Cargo.toml b/core-primitives/registry-storage/Cargo.toml index 4e9b45f1b9..be6cde1505 100644 --- a/core-primitives/registry-storage/Cargo.toml +++ b/core-primitives/registry-storage/Cargo.toml @@ -10,6 +10,7 @@ sp-std = { version = "4.0.0-dev", default-features = false, git = "https://githu #local deps itp-storage = { path = "../storage", default-features = false } +itp-types = { path = "../types", default-features = false } # node deps pallet-ajuna-gameregistry = { default-features = false, git = "https://github.com/ajuna-network/ajuna-node.git", branch = "update-substrate-5" } diff --git a/core/parentchain/indirect-calls-executor/src/indirect_calls_executor.rs b/core/parentchain/indirect-calls-executor/src/indirect_calls_executor.rs index 0ee6e4867e..b88bf7b301 100644 --- a/core/parentchain/indirect-calls-executor/src/indirect_calls_executor.rs +++ b/core/parentchain/indirect-calls-executor/src/indirect_calls_executor.rs @@ -20,10 +20,12 @@ use crate::error::Result; use codec::{Decode, Encode}; use ita_stf::{AccountId, TrustedCallSigned}; -use itp_settings::node::{CALL_WORKER, SHIELD_FUNDS, TEEREX_MODULE}; +use itp_settings::node::{ + ACK_GAME, CALL_WORKER, GAME_REGISTRY_MODULE, SHIELD_FUNDS, TEEREX_MODULE, +}; use itp_sgx_crypto::ShieldingCrypto; use itp_stf_executor::traits::{StatePostProcessing, StfExecuteShieldFunds, StfExecuteTrustedCall}; -use itp_types::{CallWorkerFn, OpaqueCall, ShardIdentifier, ShieldFundsFn, H256}; +use itp_types::{AckGameFn, CallWorkerFn, OpaqueCall, ShardIdentifier, ShieldFundsFn, H256}; use log::*; use sp_core::blake2_256; use sp_runtime::traits::{Block as ParentchainBlockTrait, Header}; @@ -72,6 +74,11 @@ where Ok(()) } + fn handle_ack_game_xt(&self, xt: &UncheckedExtrinsicV4) -> Result<()> { + error!("JUHUUUUUUUUUUUUUUU"); + Ok(()) + } + fn decrypt_unchecked_extrinsic( &self, xt: UncheckedExtrinsicV4, @@ -104,7 +111,7 @@ where { debug!("Scanning block {:?} for relevant xt", block.header().number()); let mut opaque_calls = Vec::::new(); - let mut executed_shielding_calls = Vec::::new(); + let mut executed_extrinsics = Vec::::new(); for xt_opaque in block.extrinsics().iter() { // Found ShieldFunds extrinsic in block. if let Ok(xt) = @@ -115,7 +122,21 @@ where error!("Error performing shield funds. Error: {:?}", e); } else { // Cache successfully executed shielding call. - executed_shielding_calls.push(hash_of(xt)) + executed_extrinsics.push(hash_of(xt)) + } + } + }; + + // Found Ack_Game extrinsic in block. + if let Ok(xt) = + UncheckedExtrinsicV4::::decode(&mut xt_opaque.encode().as_slice()) + { + if xt.function.0 == [GAME_REGISTRY_MODULE, ACK_GAME] { + if let Err(e) = self.handle_ack_game_xt(&xt) { + error!("Error performing acknowledge game. Error: {:?}", e); + } else { + // Cache successfully executed shielding call. + executed_extrinsics.push(hash_of(xt)) } } }; @@ -141,7 +162,7 @@ where } } } - Ok((opaque_calls, executed_shielding_calls)) + Ok((opaque_calls, executed_extrinsics)) } }