Skip to content

Commit deca936

Browse files
authored
Merge pull request #2265 from oasisprotocol/kostko/feature/rofl-app-refactor-core
rofl-app-core: Extract ROFL app core to its own crate
2 parents 3a786c6 + ad5e6de commit deca936

31 files changed

Lines changed: 102 additions & 55 deletions

File tree

Cargo.lock

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ members = [
1717
"contract-sdk-macros",
1818

1919
# ROFL.
20+
"rofl-app-core",
2021
"rofl-utils",
2122
"rofl-appd",
2223
"rofl-containers",

rofl-app-core/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "rofl-app-core"
3+
version = "0.0.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
cbor = { version = "0.5.1", package = "oasis-cbor" }
8+
oasis-runtime-sdk = { path = "../runtime-sdk" }
9+
oasis-runtime-sdk-rofl-market = { path = "../runtime-sdk/modules/rofl-market" }
10+
11+
# Third party.
12+
anyhow = "1.0.86"
13+
async-trait = "0.1.77"
14+
base64 = "0.22.1"
15+
rand = "0.8.5"
16+
slog = "2.7.0"
17+
tokio = { version = "1.38", features = [
18+
"rt",
19+
"rt-multi-thread",
20+
"sync",
21+
"time",
22+
"macros",
23+
] }
24+
25+
[features]
26+
# TDX build.
27+
tdx = ["oasis-runtime-sdk/tdx"]
28+
# Enables mock SGX in non-SGX builds.
29+
debug-mock-sgx = ["oasis-runtime-sdk/debug-mock-sgx"]

runtime-sdk/src/modules/rofl/app/client.rs renamed to rofl-app-core/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use anyhow::{anyhow, Context as _, Result};
1111
use rand::{rngs::OsRng, Rng};
1212
use tokio::sync::{mpsc, oneshot};
1313

14-
use crate::{
14+
use oasis_runtime_sdk::{
1515
core::{
1616
common::crypto::{hash::Hash, mrae::deoxysii},
1717
consensus::{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{collections::BTreeMap, sync::Arc};
33
use anyhow::{anyhow, Result};
44
use tokio::sync::mpsc;
55

6-
use crate::{
6+
use oasis_runtime_sdk::{
77
core::{common::namespace::Namespace, host::Host, identity::Identity, protocol::Protocol},
88
crypto::signature::Signer,
99
};
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ use std::{collections::BTreeMap, sync::Arc};
44
use anyhow::Result;
55
use async_trait::async_trait;
66
use base64::prelude::*;
7-
use oasis_core_runtime::Protocol;
87
use tokio::sync::mpsc;
98

10-
use crate::{
9+
use oasis_runtime_sdk::{
1110
core::{
1211
app,
1312
common::version,
1413
config::Config,
1514
consensus::{roothash, verifier::TrustRoot},
1615
dispatcher::{PostInitState, PreInitState},
17-
start_runtime,
16+
start_runtime, Protocol,
1817
},
1918
crypto,
2019
types::transaction,
@@ -29,9 +28,9 @@ mod processor;
2928
mod registration;
3029
mod watchdog;
3130

32-
pub use crate::modules::rofl::app_id::AppId;
3331
pub use client::Client;
3432
pub use env::Environment;
33+
pub use oasis_runtime_sdk::modules::rofl::app_id::AppId;
3534

3635
/// ROFL component application.
3736
#[allow(unused_variables)]

runtime-sdk/src/modules/rofl/app/notifier.rs renamed to rofl-app-core/src/notifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use anyhow::Result;
44
use tokio::sync::mpsc;
55

6-
use crate::core::common::logger::get_logger;
6+
use oasis_runtime_sdk::core::common::logger::get_logger;
77

88
use super::{processor, App, Environment};
99

runtime-sdk/src/modules/rofl/app/prelude.rs renamed to rofl-app-core/src/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ pub use anyhow::Result;
55
pub use async_trait::async_trait;
66
pub use slog;
77

8-
pub use crate::{self as sdk, core::consensus::verifier::TrustRoot, Version};
8+
pub use oasis_runtime_sdk::{self as sdk, core::consensus::verifier::TrustRoot, Version};
99

1010
pub use super::{App, AppId, Environment};

0 commit comments

Comments
 (0)