Skip to content

Commit

Permalink
all mortal. tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Nov 6, 2024
1 parent b01e088 commit 7263b95
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app-libs/stf/src/trusted_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ where
shield_funds(who, value)?;

// Send proof of execution on chain.
let mortality =
get_mortality(parentchain_id, 32).unwrap_or_else(GenericMortality::immortal);
calls.push(ParentchainCall::Integritee {
call: OpaqueCall::from_tuple(&(
node_metadata_repo
Expand All @@ -378,7 +380,7 @@ where
Vec::<itp_types::H256>::new(),
b"shielded some funds!".to_vec(),
)),
mortality: GenericMortality::immortal(),
mortality,
});
Ok(())
},
Expand Down
3 changes: 2 additions & 1 deletion core-primitives/stf-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ mod tests {
use itp_sgx_externalities::SgxExternalities;
use itp_test::mock::stf_mock::{GetterMock, TrustedCallSignedMock};
use itp_types::{parentchain::GenericMortality, OpaqueCall};
use sp_runtime::generic::Era;

#[test]
fn is_success_works() {
Expand Down Expand Up @@ -236,7 +237,7 @@ mod tests {
let hash = H256::from([int; 32]);
let opaque_call: Vec<ParentchainCall> = vec![ParentchainCall::Integritee {
call: OpaqueCall(vec![int; 10]),
mortality: GenericMortality::immortal(),
mortality: GenericMortality { era: Era::mortal(0, 0), mortality_checkpoint: None },
}];
let operation =
ExecutedOperation::success(hash, TrustedOperationOrHash::Hash(hash), opaque_call);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
limitations under the License.
*/

use crate::{error::Result, ConfirmBlockImport};
use itp_types::{parentchain::SidechainBlockConfirmation, ShardIdentifier};
use its_primitives::types::header::SidechainHeader;
use sp_runtime::traits::Block;

/// Mock implementation of the `ConfirmBlockImport` trait.
pub struct ConfirmBlockImportMock;

impl ConfirmBlockImport<SidechainHeader> for ConfirmBlockImportMock {
impl<ParentchainBlock: Block> ConfirmBlockImport<SidechainHeader, ParentchainBlock>
for ConfirmBlockImportMock
{
fn confirm_import(
&self,
_header: &SidechainHeader,
_shard: &ShardIdentifier,
_maybe_confirmation: &Option<SidechainBlockConfirmation>,
_latest_parentchain_header: &<ParentchainBlock as Block>::Header,
) -> Result<()> {
Ok(())
}
Expand Down

0 comments on commit 7263b95

Please sign in to comment.