Skip to content

Commit

Permalink
feat: add other code template types (#5242)
Browse files Browse the repository at this point in the history
Description
---
Add flow and manifest code template types 

Motivation and Context
---
Composing templates into a single wasm is not always practical. This
change allows users to wire together multiple templates using a flow or
manifest

How Has This Been Tested?
---
locally


<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
stringhandler committed Apr 12, 2023
1 parent 97f5b2f commit 93e5e85
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions applications/tari_app_grpc/proto/sidechain_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ message ConfidentialOutputData {
message TemplateType {
oneof template_type {
WasmInfo wasm = 1;
FlowInfo flow = 2;
ManifestInfo manifest = 3;
}
}

message WasmInfo {
uint32 abi_version = 1;
}

message FlowInfo {
}

message ManifestInfo {
}

message BuildInfo {
string repo_url = 1;
bytes commit_hash = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ impl TryFrom<grpc::TemplateType> for TemplateType {
grpc::template_type::TemplateType::Wasm(wasm) => Ok(TemplateType::Wasm {
abi_version: wasm.abi_version.try_into().map_err(|_| "abi_version overflowed")?,
}),
grpc::template_type::TemplateType::Flow(_flow) => Ok(TemplateType::Flow {}),
grpc::template_type::TemplateType::Manifest(_manifest) => Ok(TemplateType::Manifest {}),
}
}
}
Expand All @@ -192,6 +194,12 @@ impl From<TemplateType> for grpc::TemplateType {
abi_version: abi_version.into(),
})),
},
TemplateType::Flow => Self {
template_type: Some(grpc::template_type::TemplateType::Flow(grpc::FlowInfo {})),
},
TemplateType::Manifest => Self {
template_type: Some(grpc::template_type::TemplateType::Manifest(grpc::ManifestInfo {})),
},
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions base_layer/core/src/proto/sidechain_feature.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,22 @@ message ConfidentialOutputData {
message TemplateType {
oneof template_type {
WasmInfo wasm = 1;
FlowInfo flow = 2;
ManifestInfo manifest =3;
}
}
message WasmInfo {
uint32 abi_version = 1;
}

message FlowInfo {

}

message ManifestInfo {

}

message BuildInfo {
string repo_url = 1;
bytes commit_hash = 2;
Expand Down
12 changes: 12 additions & 0 deletions base_layer/core/src/proto/sidechain_feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ impl TryFrom<proto::types::TemplateType> for TemplateType {
proto::types::template_type::TemplateType::Wasm(wasm) => Ok(TemplateType::Wasm {
abi_version: wasm.abi_version.try_into().map_err(|_| "abi_version overflowed")?,
}),
proto::types::template_type::TemplateType::Flow(_flow) => Ok(TemplateType::Flow),
proto::types::template_type::TemplateType::Manifest(_manifest) => Ok(TemplateType::Manifest),
}
}
}
Expand All @@ -196,6 +198,16 @@ impl From<TemplateType> for proto::types::TemplateType {
},
)),
},
TemplateType::Flow => Self {
template_type: Some(proto::types::template_type::TemplateType::Flow(
proto::types::FlowInfo {},
)),
},
TemplateType::Manifest => Self {
template_type: Some(proto::types::template_type::TemplateType::Manifest(
proto::types::ManifestInfo {},
)),
},
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub struct CodeTemplateRegistration {
pub enum TemplateType {
/// Indicates that the template is a WASM module
Wasm { abi_version: u16 },
/// A flow template
Flow,
/// A manifest template
Manifest,
}

// -------------------------------- BuildInfo -------------------------------- //
Expand Down

0 comments on commit 93e5e85

Please sign in to comment.