diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index c1dd2f3166..98d4f2edf4 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -1234,7 +1234,7 @@ impl Pallet { operator_id: OperatorId, operator: Operator, T::Share>, bundle_slot_probability: (u64, u64), - proof_of_election: &ProofOfElection, + proof_of_election: &ProofOfElection, ) -> Result<(), BundleError> { proof_of_election .verify_vrf_signature(&operator.signing_key) diff --git a/crates/pallet-domains/src/tests.rs b/crates/pallet-domains/src/tests.rs index 95575ef067..11db4f6736 100644 --- a/crates/pallet-domains/src/tests.rs +++ b/crates/pallet-domains/src/tests.rs @@ -223,6 +223,7 @@ pub(crate) fn create_dummy_receipt( parent_domain_block_receipt_hash, consensus_block_number: block_number, consensus_block_hash, + invalid_bundles: Vec::new(), block_extrinsics_roots, final_state_root: Default::default(), execution_trace, diff --git a/crates/sp-domains/src/lib.rs b/crates/sp-domains/src/lib.rs index bc2f3efa2f..7c7290d743 100644 --- a/crates/sp-domains/src/lib.rs +++ b/crates/sp-domains/src/lib.rs @@ -159,14 +159,17 @@ impl DomainId { #[derive(Debug, Decode, Encode, TypeInfo, PartialEq, Eq, Clone)] pub struct BundleHeader { /// Proof of bundle producer election. - pub proof_of_election: ProofOfElection, + pub proof_of_election: ProofOfElection, /// Execution receipt that should extend the receipt chain or add confirmations /// to the head receipt. pub receipt: ExecutionReceipt, - /// The size of the bundle body in bytes. Used to calculate the storage cost. + /// The size of the bundle body in bytes. + /// + /// Used to calculate the storage cost. pub bundle_size: u32, - /// The total (estimated) weight of all extrinsics in the bundle. Used to prevent overloading - /// the bundle with compute. + /// The total (estimated) weight of all extrinsics in the bundle. + /// + /// Used to prevent overloading the bundle with compute. pub estimated_bundle_weight: Weight, /// The Merkle root of all new extrinsics included in this bundle. pub bundle_extrinsics_root: ExtrinsicsRoot, @@ -244,12 +247,12 @@ impl< self.sealed_header.header.proof_of_election.domain_id } - // Return the `bundle_extrinsics_root` + /// Return the `bundle_extrinsics_root` pub fn extrinsics_root(&self) -> ExtrinsicsRoot { self.sealed_header.header.bundle_extrinsics_root } - // Return the `operator_id` + /// Return the `operator_id` pub fn operator_id(&self) -> OperatorId { self.sealed_header.header.proof_of_election.operator_id } @@ -310,28 +313,34 @@ pub struct BundleDigest { /// Receipt of a domain block execution. #[derive(Debug, Decode, Encode, TypeInfo, PartialEq, Eq, Clone)] pub struct ExecutionReceipt { - // The index of the current domain block that forms the basis of this ER. + /// The index of the current domain block that forms the basis of this ER. pub domain_block_number: DomainNumber, - // The block hash correspond to `domain_block_number`. + /// The block hash corresponding to `domain_block_number`. pub domain_block_hash: DomainHash, - // A pointer to the hash of the ER for the last domain block. + /// The hash of the ER for the last domain block. pub parent_domain_block_receipt_hash: ReceiptHash, - // A pointer to the consensus block index which contains all of the bundles that were used to derive and - // order all extrinsics executed by the current domain block for this ER. + /// A pointer to the consensus block index which contains all of the bundles that were used to derive and + /// order all extrinsics executed by the current domain block for this ER. pub consensus_block_number: Number, - // The block hash correspond to `consensus_block_number`. + /// The block hash corresponding to `consensus_block_number`. pub consensus_block_hash: Hash, - // All `extrinsics_roots` for all bundles being executed by this block. Used to ensure these are contained - // within the state of the `execution_inbox`. + /// Potential bundles that are excluded from the domain block building. + pub invalid_bundles: Vec, + /// All `extrinsics_roots` for all bundles being executed by this block. + /// + /// Used to ensure these are contained within the state of the `execution_inbox`. pub block_extrinsics_roots: Vec, - // The final state root for the current domain block reflected by this ER. Used for verifying storage proofs - // for domains. + /// The final state root for the current domain block reflected by this ER. + /// + /// Used for verifying storage proofs for domains. pub final_state_root: DomainHash, /// List of storage roots collected during the domain block execution. pub execution_trace: Vec, - // The Merkle root of the execution trace for the current domain block. Used for verifying fraud proofs. + /// The Merkle root of the execution trace for the current domain block. + /// + /// Used for verifying fraud proofs. pub execution_trace_root: H256, - // All SSC rewards for this ER to be shared across operators. + /// All SSC rewards for this ER to be shared across operators. pub total_rewards: Balance, } @@ -355,6 +364,7 @@ impl< parent_domain_block_receipt_hash: Default::default(), consensus_block_hash: consensus_genesis_hash, consensus_block_number: Zero::zero(), + invalid_bundles: Vec::new(), block_extrinsics_roots: sp_std::vec![], final_state_root: genesis_state_root.clone(), execution_trace: sp_std::vec![genesis_state_root], @@ -365,7 +375,7 @@ impl< } #[derive(Debug, Decode, Encode, TypeInfo, PartialEq, Eq, Clone)] -pub struct ProofOfElection { +pub struct ProofOfElection { /// Domain id. pub domain_id: DomainId, /// The slot number. @@ -376,11 +386,9 @@ pub struct ProofOfElection { pub vrf_signature: VrfSignature, /// Operator index in the OperatorRegistry. pub operator_id: OperatorId, - // TODO: added temporarily in order to not change a lot of code to make it compile, remove later. - pub _phantom: DomainHash, } -impl ProofOfElection { +impl ProofOfElection { pub fn verify_vrf_signature( &self, operator_signing_key: &OperatorPublicKey, @@ -404,7 +412,7 @@ impl ProofOfElection { } } -impl ProofOfElection { +impl ProofOfElection { #[cfg(any(feature = "std", feature = "runtime-benchmarks"))] pub fn dummy(domain_id: DomainId, operator_id: OperatorId) -> Self { let output_bytes = vec![0u8; VrfOutput::max_encoded_len()]; @@ -419,7 +427,6 @@ impl ProofOfElection { global_randomness: Randomness::default(), vrf_signature, operator_id, - _phantom: Default::default(), } } } @@ -602,6 +609,49 @@ pub fn signer_in_tx_range(bundle_vrf_hash: &U256, signer_id_hash: &U256, tx_rang distance_from_vrf_hash <= (*tx_range / 2) } +/// Receipt invalidity type. +#[derive(Debug, Decode, Encode, TypeInfo, Clone, PartialEq, Eq)] +pub enum InvalidReceipt { + /// The field `invalid_bundles` in [`ExecutionReceipt`] is invalid. + InvalidBundles, +} + +#[derive(Debug, Decode, Encode, TypeInfo, Clone, PartialEq, Eq)] +pub enum ReceiptValidity { + Valid, + Invalid(InvalidReceipt), +} + +/// Bundle invalidity type. +#[derive(Debug, Decode, Encode, TypeInfo, Clone, PartialEq, Eq)] +pub enum InvalidBundleType { + /// Failed to decode the opaque extrinsic. + UndecodableTx, + /// Transaction is out of the tx range. + OutOfRangeTx, + /// Transaction is illegal (unable to pay the fee, etc). + IllegalTx, + /// Receipt is invalid. + InvalidReceipt(InvalidReceipt), +} + +/// [`InvalidBundle`] represents a bundle that was originally included in the consensus +/// block but subsequently excluded from the corresponding domain block by operator due +/// to being flagged as invalid. +#[derive(Debug, Decode, Encode, TypeInfo, Clone, PartialEq, Eq)] +pub struct InvalidBundle { + /// Index of this bundle in the original list of bundles in the consensus block. + pub bundle_index: u32, + /// Specific type of invalidity. + pub invalid_bundle_type: InvalidBundleType, +} + +#[derive(Debug, Decode, Encode, TypeInfo, Clone, PartialEq, Eq)] +pub enum BundleValidity { + Valid(Vec), + Invalid(InvalidBundleType), +} + sp_api::decl_runtime_apis! { /// API necessary for domains pallet. pub trait DomainsApi { diff --git a/crates/subspace-fraud-proof/src/invalid_transaction_proof.rs b/crates/subspace-fraud-proof/src/invalid_transaction_proof.rs index 06f47978af..eabb542249 100644 --- a/crates/subspace-fraud-proof/src/invalid_transaction_proof.rs +++ b/crates/subspace-fraud-proof/src/invalid_transaction_proof.rs @@ -193,7 +193,7 @@ where as DomainCoreApi>::check_transaction_validity( &runtime_api_light, Default::default(), // Unused for stateless runtime api. - extrinsic, + &extrinsic, *domain_block_hash, )?; diff --git a/domains/client/block-preprocessor/src/lib.rs b/domains/client/block-preprocessor/src/lib.rs index 9ac17ad604..80ef802a5b 100644 --- a/domains/client/block-preprocessor/src/lib.rs +++ b/domains/client/block-preprocessor/src/lib.rs @@ -30,7 +30,8 @@ use sc_client_api::BlockBackend; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_domains::{ - DomainId, DomainsApi, DomainsDigestItem, ExtrinsicsRoot, OpaqueBundle, OpaqueBundles, + BundleValidity, DomainId, DomainsApi, DomainsDigestItem, ExecutionReceipt, ExtrinsicsRoot, + InvalidBundle, InvalidBundleType, OpaqueBundle, OpaqueBundles, ReceiptValidity, }; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor}; use std::borrow::Cow; @@ -195,18 +196,20 @@ fn shuffle_extrinsics( pub struct PreprocessResult { pub extrinsics: Vec, pub extrinsics_roots: Vec, + pub invalid_bundles: Vec, } -pub struct DomainBlockPreprocessor { +pub struct DomainBlockPreprocessor { domain_id: DomainId, client: Arc, consensus_client: Arc, runtime_api: RuntimeApi, + receipt_validator: ReceiptValidator, _phantom_data: PhantomData<(Block, CBlock)>, } -impl Clone - for DomainBlockPreprocessor +impl Clone + for DomainBlockPreprocessor { fn clone(&self) -> Self { Self { @@ -214,13 +217,31 @@ impl Clone client: self.client.clone(), consensus_client: self.consensus_client.clone(), runtime_api: self.runtime_api.clone(), + receipt_validator: self.receipt_validator.clone(), _phantom_data: self._phantom_data, } } } -impl - DomainBlockPreprocessor +pub trait ValidateReceipt +where + Block: BlockT, + CBlock: BlockT, +{ + fn validate_receipt( + &self, + receipt: &ExecutionReceipt< + NumberFor, + CBlock::Hash, + NumberFor, + Block::Hash, + Balance, + >, + ) -> sp_blockchain::Result; +} + +impl + DomainBlockPreprocessor where Block: BlockT, CBlock: BlockT, @@ -239,18 +260,21 @@ where + Sync + 'static, CClient::Api: DomainsApi, Block::Hash>, + ReceiptValidator: ValidateReceipt, { pub fn new( domain_id: DomainId, client: Arc, consensus_client: Arc, runtime_api: RuntimeApi, + receipt_validator: ReceiptValidator, ) -> Self { Self { domain_id, client, consensus_client, runtime_api, + receipt_validator, _phantom_data: Default::default(), } } @@ -286,7 +310,8 @@ where .runtime_api() .domain_tx_range(consensus_block_hash, self.domain_id)?; - let extrinsics = self.compile_bundles_to_extrinsics(bundles, tx_range, domain_hash); + let (invalid_bundles, extrinsics) = + self.compile_bundles_to_extrinsics(bundles, tx_range, domain_hash)?; let extrinsics_in_bundle = deduplicate_and_shuffle_extrinsics( domain_hash, @@ -321,6 +346,7 @@ where Ok(Some(PreprocessResult { extrinsics, extrinsics_roots, + invalid_bundles, })) } @@ -331,28 +357,26 @@ where bundles: OpaqueBundles, Block::Hash, Balance>, tx_range: U256, at: Block::Hash, - ) -> Vec { - bundles - .into_iter() - .filter(|bundle| { - self.is_valid_bundle(bundle, &tx_range, at) - .map_err(|err| { - tracing::error!(?err, "Error occurred in checking bundle validity"); - }) - .unwrap_or(false) - }) - .flat_map(|valid_bundle| { - valid_bundle.extrinsics.into_iter().map(|opaque_extrinsic| { - <::Extrinsic>::decode( - &mut opaque_extrinsic.encode().as_slice(), - ) - .expect("Must succeed as it was decoded successfully before; qed") - }) - }) - .collect::>() + ) -> sp_blockchain::Result<(Vec, Vec)> { + let mut invalid_bundles = Vec::with_capacity(bundles.len()); + let mut valid_extrinsics = Vec::new(); + + for (index, bundle) in bundles.into_iter().enumerate() { + match self.check_bundle_validity(&bundle, &tx_range, at)? { + BundleValidity::Valid(extrinsics) => valid_extrinsics.extend(extrinsics), + BundleValidity::Invalid(invalid_bundle_type) => { + invalid_bundles.push(InvalidBundle { + bundle_index: index as u32, + invalid_bundle_type, + }); + } + } + } + + Ok((invalid_bundles, valid_extrinsics)) } - fn is_valid_bundle( + fn check_bundle_validity( &self, bundle: &OpaqueBundle< NumberFor, @@ -363,10 +387,21 @@ where >, tx_range: &U256, at: Block::Hash, - ) -> Result { + ) -> sp_blockchain::Result> { + // Bundles with incorrect ER are considered invalid. + if let ReceiptValidity::Invalid(invalid_receipt) = + self.receipt_validator.validate_receipt(bundle.receipt())? + { + return Ok(BundleValidity::Invalid(InvalidBundleType::InvalidReceipt( + invalid_receipt, + ))); + } + let bundle_vrf_hash = U256::from_be_bytes(bundle.sealed_header.header.proof_of_election.vrf_hash()); + let mut extrinsics = Vec::with_capacity(bundle.extrinsics.len()); + for opaque_extrinsic in &bundle.extrinsics { let Ok(extrinsic) = <::Extrinsic>::decode(&mut opaque_extrinsic.encode().as_slice()) @@ -376,7 +411,7 @@ where "Undecodable extrinsic in bundle({})", bundle.hash() ); - return Ok(false); + return Ok(BundleValidity::Invalid(InvalidBundleType::UndecodableTx)); }; let is_within_tx_range = self.client.runtime_api().is_within_tx_range( @@ -388,23 +423,25 @@ where if !is_within_tx_range { // TODO: Generate a fraud proof for this invalid bundle - return Ok(false); + return Ok(BundleValidity::Invalid(InvalidBundleType::OutOfRangeTx)); } // TODO: the `check_transaction_validity` is unimplemented let is_legal_tx = self .client .runtime_api() - .check_transaction_validity(at, extrinsic, at)? + .check_transaction_validity(at, &extrinsic, at)? .is_ok(); if !is_legal_tx { // TODO: Generate a fraud proof for this invalid bundle - return Ok(false); + return Ok(BundleValidity::Invalid(InvalidBundleType::IllegalTx)); } + + extrinsics.push(extrinsic); } - Ok(true) + Ok(BundleValidity::Valid(extrinsics)) } fn filter_invalid_xdm_extrinsics( diff --git a/domains/client/domain-operator/src/aux_schema.rs b/domains/client/domain-operator/src/aux_schema.rs index 17006d618c..dd57d8f1f0 100644 --- a/domains/client/domain-operator/src/aux_schema.rs +++ b/domains/client/domain-operator/src/aux_schema.rs @@ -503,6 +503,7 @@ mod tests { parent_domain_block_receipt_hash: H256::random(), consensus_block_number, consensus_block_hash: H256::random(), + invalid_bundles: Vec::new(), block_extrinsics_roots: Default::default(), final_state_root: Default::default(), execution_trace: Default::default(), diff --git a/domains/client/domain-operator/src/bundle_processor.rs b/domains/client/domain-operator/src/bundle_processor.rs index 72bbf2eb76..fd2501841d 100644 --- a/domains/client/domain-operator/src/bundle_processor.rs +++ b/domains/client/domain-operator/src/bundle_processor.rs @@ -1,7 +1,7 @@ use crate::domain_block_processor::{ DomainBlockProcessor, PendingConsensusBlocks, ReceiptsChecker, }; -use crate::{DomainParentChain, TransactionFor}; +use crate::{DomainParentChain, ExecutionReceiptFor, TransactionFor}; use domain_block_preprocessor::runtime_api_full::RuntimeApiFull; use domain_block_preprocessor::{DomainBlockPreprocessor, PreprocessResult}; use domain_runtime_primitives::{DomainCoreApi, InherentExtrinsicApi}; @@ -11,10 +11,10 @@ use sp_api::{NumberFor, ProvideRuntimeApi}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; use sp_consensus::BlockOrigin; use sp_core::traits::CodeExecutor; -use sp_domains::{DomainId, DomainsApi}; +use sp_domains::{DomainId, DomainsApi, InvalidReceipt, ReceiptValidity}; use sp_keystore::KeystorePtr; use sp_messenger::MessengerApi; -use sp_runtime::traits::{Block as BlockT, HashFor}; +use sp_runtime::traits::{Block as BlockT, HashFor, Zero}; use sp_runtime::Digest; use std::sync::Arc; @@ -40,8 +40,14 @@ where backend: Arc, keystore: KeystorePtr, domain_receipts_checker: DomainReceiptsChecker, - domain_block_preprocessor: - DomainBlockPreprocessor>, + domain_block_preprocessor: DomainBlockPreprocessor< + Block, + CBlock, + Client, + CClient, + RuntimeApiFull, + ReceiptValidator, + >, domain_block_processor: DomainBlockProcessor, } @@ -65,6 +71,60 @@ where } } +struct ReceiptValidator { + client: Arc, +} + +impl Clone for ReceiptValidator { + fn clone(&self) -> Self { + Self { + client: self.client.clone(), + } + } +} + +impl ReceiptValidator { + pub fn new(client: Arc) -> Self { + Self { client } + } +} + +impl domain_block_preprocessor::ValidateReceipt + for ReceiptValidator +where + Block: BlockT, + CBlock: BlockT, + Client: AuxStore, +{ + fn validate_receipt( + &self, + receipt: &ExecutionReceiptFor, + ) -> sp_blockchain::Result { + // Skip genesis receipt as it has been already verified by the consensus chain. + if receipt.domain_block_number.is_zero() { + return Ok(ReceiptValidity::Valid); + } + + let consensus_block_hash = receipt.consensus_block_hash; + let local_receipt = crate::aux_schema::load_execution_receipt::<_, Block, CBlock>( + &*self.client, + consensus_block_hash, + )? + .ok_or_else(|| { + sp_blockchain::Error::Backend(format!( + "Receipt for consensus block {consensus_block_hash} not found" + )) + })?; + + if local_receipt.invalid_bundles != receipt.invalid_bundles { + // TODO: Generate fraud proof + return Ok(ReceiptValidity::Invalid(InvalidReceipt::InvalidBundles)); + } + + Ok(ReceiptValidity::Valid) + } +} + impl BundleProcessor where @@ -112,6 +172,7 @@ where client.clone(), consensus_client.clone(), RuntimeApiFull::new(client.clone()), + ReceiptValidator::new(client.clone()), ); Self { domain_id, @@ -209,26 +270,25 @@ where .head_receipt_number(consensus_block_hash, self.domain_id)? .into(); - let PreprocessResult { + let Some(PreprocessResult { extrinsics, extrinsics_roots, - } = match self + invalid_bundles, + }) = self .domain_block_preprocessor .preprocess_consensus_block(consensus_block_hash, parent_hash)? - { - Some(exts) => exts, - None => { - tracing::debug!( - "Skip building new domain block, no bundles and runtime upgrade for this domain \ + else { + tracing::debug!( + "Skip building new domain block, no bundles and runtime upgrade for this domain \ in consensus block #{consensus_block_number:?},{consensus_block_hash}" - ); - self.domain_block_processor.on_consensus_block_processed( - consensus_block_hash, - None, - head_receipt_number, - )?; - return Ok(None); - } + ); + self.domain_block_processor.on_consensus_block_processed( + consensus_block_hash, + None, + head_receipt_number, + )?; + + return Ok(None); }; let domain_block_result = self @@ -237,6 +297,7 @@ where (consensus_block_hash, consensus_block_number), (parent_hash, parent_number), extrinsics, + invalid_bundles, extrinsics_roots, Digest::default(), ) @@ -259,6 +320,7 @@ where head_receipt_number, )?; + // TODO: Remove as ReceiptsChecker has been superseded by ReceiptValidator in block-preprocessor. self.domain_receipts_checker .check_state_transition(consensus_block_hash)?; diff --git a/domains/client/domain-operator/src/bundle_producer_election_solver.rs b/domains/client/domain-operator/src/bundle_producer_election_solver.rs index ab5735daff..9973fee423 100644 --- a/domains/client/domain-operator/src/bundle_producer_election_solver.rs +++ b/domains/client/domain-operator/src/bundle_producer_election_solver.rs @@ -49,7 +49,7 @@ where consensus_block_hash: CBlock::Hash, domain_id: DomainId, global_randomness: Randomness, - ) -> sp_blockchain::Result, OperatorPublicKey)>> { + ) -> sp_blockchain::Result> { let BundleProducerElectionParams { current_operators, total_domain_stake, @@ -94,7 +94,6 @@ where global_randomness, vrf_signature, operator_id, - _phantom: Default::default(), }; return Ok(Some((proof_of_election, operator_signing_key))); } diff --git a/domains/client/domain-operator/src/domain_block_processor.rs b/domains/client/domain-operator/src/domain_block_processor.rs index 68a70f5ce9..abb5947da2 100644 --- a/domains/client/domain-operator/src/domain_block_processor.rs +++ b/domains/client/domain-operator/src/domain_block_processor.rs @@ -15,7 +15,7 @@ use sp_consensus::{BlockOrigin, SyncOracle}; use sp_core::traits::CodeExecutor; use sp_domains::fraud_proof::FraudProof; use sp_domains::merkle_tree::MerkleTree; -use sp_domains::{DomainId, DomainsApi, ExecutionReceipt, ExtrinsicsRoot}; +use sp_domains::{DomainId, DomainsApi, ExecutionReceipt, ExtrinsicsRoot, InvalidBundle}; use sp_runtime::traits::{Block as BlockT, CheckedSub, HashFor, Header as HeaderT, One, Zero}; use sp_runtime::Digest; use std::cmp::Ordering; @@ -252,6 +252,7 @@ where (consensus_block_hash, consensus_block_number): (CBlock::Hash, NumberFor), (parent_hash, parent_number): (Block::Hash, NumberFor), extrinsics: Vec, + invalid_bundles: Vec, bundle_extrinsics_roots: Vec, digests: Digest, ) -> Result, sp_blockchain::Error> { @@ -347,6 +348,7 @@ where parent_domain_block_receipt_hash: parent_receipt.hash(), consensus_block_number, consensus_block_hash, + invalid_bundles, block_extrinsics_roots: bundle_extrinsics_roots, final_state_root: state_root, execution_trace: trace, diff --git a/domains/client/domain-operator/src/domain_bundle_producer.rs b/domains/client/domain-operator/src/domain_bundle_producer.rs index a57b9772c5..51d4a5270d 100644 --- a/domains/client/domain-operator/src/domain_bundle_producer.rs +++ b/domains/client/domain-operator/src/domain_bundle_producer.rs @@ -172,7 +172,7 @@ where .parent_chain .head_receipt_number(self.parent_chain.best_hash())?; - // Executor is lagging behind the receipt chain on its parent chain as another executor + // Operator is lagging behind the receipt chain on its parent chain as another operator // already processed a block higher than the local best and submitted the receipt to // the parent chain, we ought to catch up with the consensus block processing before // producing new bundle. diff --git a/domains/client/domain-operator/src/domain_bundle_proposer.rs b/domains/client/domain-operator/src/domain_bundle_proposer.rs index 33d0b0e185..fe3ab649ac 100644 --- a/domains/client/domain-operator/src/domain_bundle_proposer.rs +++ b/domains/client/domain-operator/src/domain_bundle_proposer.rs @@ -74,7 +74,7 @@ where pub(crate) async fn propose_bundle_at( &self, - proof_of_election: ProofOfElection, + proof_of_election: ProofOfElection, parent_chain: ParentChain, tx_range: U256, ) -> sp_blockchain::Result> diff --git a/domains/client/domain-operator/src/fraud_proof.rs b/domains/client/domain-operator/src/fraud_proof.rs index 4f00f267a1..8bcbb93e99 100644 --- a/domains/client/domain-operator/src/fraud_proof.rs +++ b/domains/client/domain-operator/src/fraud_proof.rs @@ -134,15 +134,11 @@ where let digest = Digest::default(); - // TODO: abstract the execution proof impl to be reusable in the test. let invalid_state_transition_proof = if local_trace_index == 0 { // `initialize_block` execution proof. let pre_state_root = as_h256(parent_header.state_root())?; let post_state_root = as_h256(local_root)?; - // TODO: add a test to cover the entire flow of creation and verification in the production - // environment, i.e., the generate_proof function on the executor side and the verify function - // on the verifier side. let new_header = Block::Header::new( block_number.into(), Default::default(), diff --git a/domains/primitives/runtime/src/lib.rs b/domains/primitives/runtime/src/lib.rs index 9a1dea2399..7e9b205a5b 100644 --- a/domains/primitives/runtime/src/lib.rs +++ b/domains/primitives/runtime/src/lib.rs @@ -184,7 +184,7 @@ sp_api::decl_runtime_apis! { /// Checks the validity of extrinsic in a bundle. fn check_transaction_validity( - uxt: ::Extrinsic, + uxt: &::Extrinsic, block_hash: ::Hash, ) -> Result<(), CheckTxValidityError>; diff --git a/domains/runtime/evm/src/lib.rs b/domains/runtime/evm/src/lib.rs index 9ecafd9ee0..66979c6d35 100644 --- a/domains/runtime/evm/src/lib.rs +++ b/domains/runtime/evm/src/lib.rs @@ -792,7 +792,7 @@ impl_runtime_apis! { } fn check_transaction_validity( - _uxt: ::Extrinsic, + _uxt: &::Extrinsic, _block_hash: ::Hash, ) -> Result<(), domain_runtime_primitives::CheckTxValidityError> { // TODO: check transaction fee to core-evm diff --git a/domains/test/runtime/evm/src/lib.rs b/domains/test/runtime/evm/src/lib.rs index 684ce1a12d..5d73af5136 100644 --- a/domains/test/runtime/evm/src/lib.rs +++ b/domains/test/runtime/evm/src/lib.rs @@ -792,7 +792,7 @@ impl_runtime_apis! { } fn check_transaction_validity( - _uxt: ::Extrinsic, + _uxt: &::Extrinsic, _block_hash: ::Hash, ) -> Result<(), domain_runtime_primitives::CheckTxValidityError> { // TODO: check transaction fee to core-evm