• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oasisprotocol / oasis-core / #6868

12 Feb 2026 01:11PM UTC coverage: 48.237% (-0.1%) from 48.357%
#6868

push

web-flow
Merge pull request #6460 from oasisprotocol/kostko/feature/rust-2026-02-11

5 of 8 new or added lines in 3 files covered. (62.5%)

43 existing lines in 14 files now uncovered.

4650 of 9640 relevant lines covered (48.24%)

1.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/runtime/src/app/application.rs
1
//! Runtime apps.
2
use std::sync::Arc;
3

4
use anyhow::{bail, Result};
5
use async_trait::async_trait;
6

7
use crate::{
8
    common::sgx,
9
    consensus::roothash,
10
    dispatcher::{Initializer, PostInitState, PreInitState},
11
    host::Host,
12
};
13

14
use super::Config;
15

16
/// A runtime application.
17
#[allow(unused_variables)]
18
#[async_trait]
19
pub trait App: Send + Sync {
20
    /// Whether this is a ROFL application.
21
    fn is_rofl(&self) -> bool {
×
22
        true
×
23
    }
24

25
    /// Returns the application's configuration settings.
26
    fn get_config(&self) -> Config {
×
27
        Config::default()
×
28
    }
29

30
    /// Called on application initialization.
31
    fn on_init(&mut self, host: Arc<dyn Host>) -> Result<()> {
×
32
        // Default implementation does nothing.
33
        Ok(())
×
34
    }
35

36
    /// Quote policy to use for verifying our own enclave identity.
37
    async fn quote_policy(&self) -> Result<sgx::QuotePolicy> {
×
38
        // Default implementation uses a sane policy.
39
        Ok(sgx::QuotePolicy {
×
40
            ias: Some(sgx::ias::QuotePolicy {
×
41
                disabled: true, // Disable legacy EPID attestation.
42
                ..Default::default()
×
43
            }),
44
            pcs: Some(sgx::pcs::QuotePolicy {
×
45
                // Allow TDX since that is not part of the default policy.
46
                tdx: Some(sgx::pcs::TdxQuotePolicy {
×
47
                    allowed_tdx_modules: vec![],
×
48
                }),
49
                ..Default::default()
×
50
            }),
51
        })
52
    }
53

54
    /// Called on new runtime block being received.
55
    async fn on_runtime_block(&self, blk: &roothash::AnnotatedBlock) -> Result<()> {
×
56
        // Default implementation does nothing.
57
        Ok(())
×
58
    }
59

60
    /// Called on new runtime event being detected.
UNCOV
61
    async fn on_runtime_event(
×
62
        &self,
63
        blk: &roothash::AnnotatedBlock,
64
        tags: &[Vec<u8>],
65
    ) -> Result<()> {
66
        // Default implementation does nothing.
67
        Ok(())
×
68
    }
69

70
    /// Called for runtime queries.
71
    async fn query(&self, method: &str, args: Vec<u8>) -> Result<Vec<u8>> {
×
72
        // Default implementation rejects all requests.
73
        bail!("method not supported");
×
74
    }
75
}
76

77
/// An application which doesn't do anything.
78
pub struct NoopApp;
79

80
#[async_trait]
81
impl App for NoopApp {
82
    fn is_rofl(&self) -> bool {
×
83
        false
84
    }
85
}
86

87
/// Create a new runtime initializer for an application.
88
pub fn new(app: Box<dyn App>) -> Box<dyn Initializer> {
×
89
    Box::new(|_state: PreInitState<'_>| -> PostInitState {
×
90
        PostInitState {
×
91
            app: Some(app),
×
92
            ..Default::default()
×
93
        }
94
    })
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc