From 8d32f388e4528274050c4012319a98d82461e423 Mon Sep 17 00:00:00 2001 From: Ignacio Duart Date: Sat, 7 Feb 2026 00:26:35 +0100 Subject: [PATCH] feat: remove legacy secret message types Commit 891415c2 introduced synchronous host functions (DelegateCtx::get_secret(), set_secret(), etc.) that replace the old async message round-trip pattern (GetSecretRequest -> GetSecretResponse). This removes all legacy types: - GetSecretRequest, GetSecretResponse, SetSecretRequest structs - Their variants from InboundDelegateMsg and OutboundDelegateMsg enums - DelegateRequest::GetSecretRequest variant - FlatBuffers schema entries and generated code - All associated serialization/deserialization code SecretsId is kept as it's used by the new host functions. Bumps version to 0.1.34. Closes #1500 --- rust/Cargo.toml | 2 +- rust/src/client_api/client_events.rs | 187 +-------- rust/src/delegate_interface.rs | 86 ---- .../src/generated/client_request_generated.rs | 311 +------------- rust/src/generated/common_generated.rs | 382 ------------------ rust/src/generated/host_response_generated.rs | 255 +----------- schemas/flatbuffers/client_request.fbs | 9 - schemas/flatbuffers/common.fbs | 12 - schemas/flatbuffers/host_response.fbs | 8 - 9 files changed, 35 insertions(+), 1217 deletions(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 6de1d2e..3538977 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "freenet-stdlib" -version = "0.1.33" +version = "0.1.34" edition = "2021" rust-version = "1.71.1" publish = true diff --git a/rust/src/client_api/client_events.rs b/rust/src/client_api/client_events.rs index 2c2cc78..0ea0508 100644 --- a/rust/src/client_api/client_events.rs +++ b/rust/src/client_api/client_events.rs @@ -11,16 +11,13 @@ use crate::generated::client_request::{ ContractRequestType, DelegateRequest as FbsDelegateRequest, DelegateRequestType, }; -use crate::delegate_interface::DelegateContext; use crate::generated::common::{ ApplicationMessage as FbsApplicationMessage, ApplicationMessageArgs, ContractCode, ContractCodeArgs, ContractContainer as FbsContractContainer, ContractContainerArgs, ContractInstanceId as FbsContractInstanceId, ContractInstanceIdArgs, ContractKey as FbsContractKey, ContractKeyArgs, ContractType, DeltaUpdate, DeltaUpdateArgs, - GetSecretRequest as FbsGetSecretRequest, GetSecretRequestArgs, - GetSecretResponse as FbsGetSecretResponse, GetSecretResponseArgs, RelatedDeltaUpdate, - RelatedDeltaUpdateArgs, RelatedStateAndDeltaUpdate, RelatedStateAndDeltaUpdateArgs, - RelatedStateUpdate, RelatedStateUpdateArgs, SecretsId as FbsSecretsId, SecretsIdArgs, + RelatedDeltaUpdate, RelatedDeltaUpdateArgs, RelatedStateAndDeltaUpdate, + RelatedStateAndDeltaUpdateArgs, RelatedStateUpdate, RelatedStateUpdateArgs, StateAndDeltaUpdate, StateAndDeltaUpdateArgs, StateUpdate, StateUpdateArgs, UpdateData as FbsUpdateData, UpdateDataArgs, UpdateDataType, WasmContractV1, WasmContractV1Args, @@ -35,7 +32,6 @@ use crate::generated::host_response::{ NotFoundArgs, Ok as FbsOk, OkArgs, OutboundDelegateMsg as FbsOutboundDelegateMsg, OutboundDelegateMsgArgs, OutboundDelegateMsgType, PutResponse as FbsPutResponse, PutResponseArgs, RequestUserInput as FbsRequestUserInput, RequestUserInputArgs, - SetSecretRequest as FbsSetSecretRequest, SetSecretRequestArgs, UpdateNotification as FbsUpdateNotification, UpdateNotificationArgs, UpdateResponse as FbsUpdateResponse, UpdateResponseArgs, }; @@ -47,8 +43,8 @@ use crate::prelude::UpdateData::{ use crate::{ delegate_interface::{DelegateKey, InboundDelegateMsg, OutboundDelegateMsg}, prelude::{ - ContractInstanceId, ContractKey, DelegateContainer, GetSecretRequest, Parameters, - RelatedContracts, SecretsId, StateSummary, UpdateData, WrappedState, + ContractInstanceId, ContractKey, DelegateContainer, Parameters, RelatedContracts, + SecretsId, StateSummary, UpdateData, WrappedState, }, versioning::ContractContainer, }; @@ -539,12 +535,6 @@ pub enum DelegateRequest<'a> { #[serde(borrow)] inbound: Vec>, }, - GetSecretRequest { - key: DelegateKey, - #[serde(borrow)] - params: Parameters<'a>, - get_request: GetSecretRequest, - }, RegisterDelegate { delegate: DelegateContainer, cipher: [u8; 32], @@ -575,15 +565,6 @@ impl DelegateRequest<'_> { params: params.into_owned(), inbound: inbound.into_iter().map(|e| e.into_owned()).collect(), }, - DelegateRequest::GetSecretRequest { - key, - get_request, - params, - } => DelegateRequest::GetSecretRequest { - key, - get_request, - params: params.into_owned(), - }, DelegateRequest::RegisterDelegate { delegate, cipher, @@ -600,7 +581,6 @@ impl DelegateRequest<'_> { pub fn key(&self) -> &DelegateKey { match self { DelegateRequest::ApplicationMessages { key, .. } => key, - DelegateRequest::GetSecretRequest { key, .. } => key, DelegateRequest::RegisterDelegate { delegate, .. } => delegate.key(), DelegateRequest::UnregisterDelegate(key) => key, } @@ -634,34 +614,25 @@ impl Display for ClientRequest<'_> { write!(f, "ContractRequest::Subscribe for `{key}`") } }, - ClientRequest::DelegateOp(op) => { - match op { - DelegateRequest::ApplicationMessages { key, inbound, .. } => { - write!( - f, - "DelegateRequest::ApplicationMessages for `{key}` with {} messages", - inbound.len() - ) - } - DelegateRequest::GetSecretRequest { - get_request: GetSecretRequest { key: secret_id, .. }, - key, - .. - } => { - write!(f, "DelegateRequest::GetSecretRequest secret_id `{secret_id}` for key `{key}`") - } - DelegateRequest::RegisterDelegate { delegate, .. } => { - write!( - f, - "DelegateRequest::RegisterDelegate for delegate.key()=`{}`", - delegate.key() - ) - } - DelegateRequest::UnregisterDelegate(key) => { - write!(f, "DelegateRequest::UnregisterDelegate for key `{key}`") - } + ClientRequest::DelegateOp(op) => match op { + DelegateRequest::ApplicationMessages { key, inbound, .. } => { + write!( + f, + "DelegateRequest::ApplicationMessages for `{key}` with {} messages", + inbound.len() + ) } - } + DelegateRequest::RegisterDelegate { delegate, .. } => { + write!( + f, + "DelegateRequest::RegisterDelegate for delegate.key()=`{}`", + delegate.key() + ) + } + DelegateRequest::UnregisterDelegate(key) => { + write!(f, "DelegateRequest::UnregisterDelegate for key `{key}`") + } + }, ClientRequest::Disconnect { .. } => write!(f, "client disconnected"), ClientRequest::Authenticate { .. } => write!(f, "authenticate"), ClientRequest::NodeQueries(query) => write!(f, "node queries: {:?}", query), @@ -690,25 +661,6 @@ impl<'a> TryFromFbs<&FbsDelegateRequest<'a>> for DelegateRequest<'a> { inbound, } } - DelegateRequestType::GetSecretRequestType => { - let get_secret = request - .delegate_request_as_get_secret_request_type() - .unwrap(); - let key = DelegateKey::try_decode_fbs(&get_secret.key())?; - let params = Parameters::from(get_secret.params().bytes().to_vec()); - let get_request = GetSecretRequest { - key: SecretsId::try_decode_fbs(&get_secret.get_request().key())?, - context: DelegateContext::new( - get_secret.get_request().delegate_context().bytes().to_vec(), - ), - processed: get_secret.get_request().processed(), - }; - DelegateRequest::GetSecretRequest { - key, - params, - get_request, - } - } DelegateRequestType::RegisterDelegate => { let register = request.delegate_request_as_register_delegate().unwrap(); let delegate = DelegateContainer::try_decode_fbs(®ister.delegate())?; @@ -1493,101 +1445,6 @@ impl HostResponse { ); messages.push(msg); } - OutboundDelegateMsg::GetSecretRequest(request) => { - let secret_key_data = builder.create_vector(request.key.key()); - let secret_hash_data = builder.create_vector(request.key.hash()); - let secret_id_offset = FbsSecretsId::create( - &mut builder, - &SecretsIdArgs { - key: Some(secret_key_data), - hash: Some(secret_hash_data), - }, - ); - - let delegate_context_data = builder.create_vector(request.context.as_ref()); - let request_offset = FbsGetSecretRequest::create( - &mut builder, - &GetSecretRequestArgs { - key: Some(secret_id_offset), - delegate_context: Some(delegate_context_data), - processed: request.processed, - }, - ); - let msg = FbsOutboundDelegateMsg::create( - &mut builder, - &OutboundDelegateMsgArgs { - inbound_type: OutboundDelegateMsgType::common_GetSecretRequest, - inbound: Some(request_offset.as_union_value()), - }, - ); - messages.push(msg); - } - OutboundDelegateMsg::SetSecretRequest(request) => { - let secret_key_data = builder.create_vector(request.key.key()); - let secret_hash_data = builder.create_vector(request.key.hash()); - let secret_id_offset = FbsSecretsId::create( - &mut builder, - &SecretsIdArgs { - key: Some(secret_key_data), - hash: Some(secret_hash_data), - }, - ); - - let value_data = request - .value - .clone() - .map(|value| builder.create_vector(value.as_slice())); - let request_offset = FbsSetSecretRequest::create( - &mut builder, - &SetSecretRequestArgs { - key: Some(secret_id_offset), - value: value_data, - }, - ); - let msg = FbsOutboundDelegateMsg::create( - &mut builder, - &OutboundDelegateMsgArgs { - inbound_type: OutboundDelegateMsgType::SetSecretRequest, - inbound: Some(request_offset.as_union_value()), - }, - ); - messages.push(msg); - } - OutboundDelegateMsg::GetSecretResponse(response) => { - let secret_key_data = builder.create_vector(response.key.key()); - let secret_hash_data = builder.create_vector(response.key.hash()); - let secret_id_offset = FbsSecretsId::create( - &mut builder, - &SecretsIdArgs { - key: Some(secret_key_data), - hash: Some(secret_hash_data), - }, - ); - - let value_data = response - .value - .clone() - .map(|value| builder.create_vector(value.as_slice())); - - let delegate_context_data = - builder.create_vector(response.context.as_ref()); - let response_offset = FbsGetSecretResponse::create( - &mut builder, - &GetSecretResponseArgs { - key: Some(secret_id_offset), - value: value_data, - delegate_context: Some(delegate_context_data), - }, - ); - let msg = FbsOutboundDelegateMsg::create( - &mut builder, - &OutboundDelegateMsgArgs { - inbound_type: OutboundDelegateMsgType::common_GetSecretResponse, - inbound: Some(response_offset.as_union_value()), - }, - ); - messages.push(msg); - } OutboundDelegateMsg::GetContractRequest(_) => { // GetContractRequest should be handled by the executor and never // reach client serialization. If we get here, it's a bug. diff --git a/rust/src/delegate_interface.rs b/rust/src/delegate_interface.rs index 256ffaa..504ff32 100644 --- a/rust/src/delegate_interface.rs +++ b/rust/src/delegate_interface.rs @@ -24,8 +24,6 @@ use crate::{code_hash::CodeHash, prelude::Parameters}; const DELEGATE_HASH_LENGTH: usize = 32; -type Secret = Vec; - #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Delegate<'a> { #[serde(borrow)] @@ -458,9 +456,7 @@ impl AsRef<[u8]> for DelegateContext { #[derive(Serialize, Deserialize, Debug, Clone)] pub enum InboundDelegateMsg<'a> { ApplicationMessage(ApplicationMessage), - GetSecretResponse(GetSecretResponse), UserResponse(#[serde(borrow)] UserInputResponse<'a>), - GetSecretRequest(GetSecretRequest), GetContractResponse(GetContractResponse), } @@ -468,9 +464,7 @@ impl InboundDelegateMsg<'_> { pub fn into_owned(self) -> InboundDelegateMsg<'static> { match self { InboundDelegateMsg::ApplicationMessage(r) => InboundDelegateMsg::ApplicationMessage(r), - InboundDelegateMsg::GetSecretResponse(r) => InboundDelegateMsg::GetSecretResponse(r), InboundDelegateMsg::UserResponse(r) => InboundDelegateMsg::UserResponse(r.into_owned()), - InboundDelegateMsg::GetSecretRequest(r) => InboundDelegateMsg::GetSecretRequest(r), InboundDelegateMsg::GetContractResponse(r) => { InboundDelegateMsg::GetContractResponse(r) } @@ -482,9 +476,6 @@ impl InboundDelegateMsg<'_> { InboundDelegateMsg::ApplicationMessage(ApplicationMessage { context, .. }) => { Some(context) } - InboundDelegateMsg::GetSecretResponse(GetSecretResponse { context, .. }) => { - Some(context) - } InboundDelegateMsg::GetContractResponse(GetContractResponse { context, .. }) => { Some(context) } @@ -497,9 +488,6 @@ impl InboundDelegateMsg<'_> { InboundDelegateMsg::ApplicationMessage(ApplicationMessage { context, .. }) => { Some(context) } - InboundDelegateMsg::GetSecretResponse(GetSecretResponse { context, .. }) => { - Some(context) - } InboundDelegateMsg::GetContractResponse(GetContractResponse { context, .. }) => { Some(context) } @@ -508,12 +496,6 @@ impl InboundDelegateMsg<'_> { } } -impl From for InboundDelegateMsg<'_> { - fn from(value: GetSecretRequest) -> Self { - Self::GetSecretRequest(value) - } -} - impl From for InboundDelegateMsg<'_> { fn from(value: ApplicationMessage) -> Self { Self::ApplicationMessage(value) @@ -536,15 +518,6 @@ impl<'a> TryFromFbs<&FbsInboundDelegateMsg<'a>> for InboundDelegateMsg<'a> { }; Ok(InboundDelegateMsg::ApplicationMessage(app_msg)) } - InboundDelegateMsgType::common_GetSecretResponse => { - let get_secret = msg.inbound_as_common_get_secret_response().unwrap(); - let get_secret = GetSecretResponse { - key: SecretsId::try_decode_fbs(&get_secret.key())?, - value: get_secret.value().map(|value| value.bytes().to_vec()), - context: DelegateContext::new(get_secret.delegate_context().bytes().to_vec()), - }; - Ok(InboundDelegateMsg::GetSecretResponse(get_secret)) - } InboundDelegateMsgType::UserInputResponse => { let user_response = msg.inbound_as_user_input_response().unwrap(); let user_response = UserInputResponse { @@ -556,27 +529,11 @@ impl<'a> TryFromFbs<&FbsInboundDelegateMsg<'a>> for InboundDelegateMsg<'a> { }; Ok(InboundDelegateMsg::UserResponse(user_response)) } - InboundDelegateMsgType::common_GetSecretRequest => { - let get_secret = msg.inbound_as_common_get_secret_request().unwrap(); - let get_secret = GetSecretRequest { - key: SecretsId::try_decode_fbs(&get_secret.key())?, - context: DelegateContext::new(get_secret.delegate_context().bytes().to_vec()), - processed: get_secret.processed(), - }; - Ok(InboundDelegateMsg::GetSecretRequest(get_secret)) - } _ => unreachable!("invalid inbound delegate message type"), } } } -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct GetSecretResponse { - pub key: SecretsId, - pub value: Option, - pub context: DelegateContext, -} - #[non_exhaustive] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct ApplicationMessage { @@ -635,17 +592,7 @@ pub enum OutboundDelegateMsg { ), // todo: remove when context can be accessed from the delegate environment and we pass it as reference ContextUpdated(DelegateContext), - // from the node - GetSecretRequest(GetSecretRequest), - SetSecretRequest(SetSecretRequest), GetContractRequest(GetContractRequest), - GetSecretResponse(GetSecretResponse), -} - -impl From for OutboundDelegateMsg { - fn from(req: GetSecretRequest) -> Self { - Self::GetSecretRequest(req) - } } impl From for OutboundDelegateMsg { @@ -672,12 +619,9 @@ impl OutboundDelegateMsg { pub fn processed(&self) -> bool { match self { OutboundDelegateMsg::ApplicationMessage(msg) => msg.processed, - OutboundDelegateMsg::GetSecretRequest(msg) => msg.processed, OutboundDelegateMsg::GetContractRequest(msg) => msg.processed, - OutboundDelegateMsg::SetSecretRequest(_) => false, OutboundDelegateMsg::RequestUserInput(_) => true, OutboundDelegateMsg::ContextUpdated(_) => true, - OutboundDelegateMsg::GetSecretResponse(_) => true, } } @@ -686,9 +630,6 @@ impl OutboundDelegateMsg { OutboundDelegateMsg::ApplicationMessage(ApplicationMessage { context, .. }) => { Some(context) } - OutboundDelegateMsg::GetSecretRequest(GetSecretRequest { context, .. }) => { - Some(context) - } OutboundDelegateMsg::GetContractRequest(GetContractRequest { context, .. }) => { Some(context) } @@ -701,9 +642,6 @@ impl OutboundDelegateMsg { OutboundDelegateMsg::ApplicationMessage(ApplicationMessage { context, .. }) => { Some(context) } - OutboundDelegateMsg::GetSecretRequest(GetSecretRequest { context, .. }) => { - Some(context) - } OutboundDelegateMsg::GetContractRequest(GetContractRequest { context, .. }) => { Some(context) } @@ -712,30 +650,6 @@ impl OutboundDelegateMsg { } } -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct GetSecretRequest { - pub key: SecretsId, - pub context: DelegateContext, - pub processed: bool, -} - -impl GetSecretRequest { - pub fn new(key: SecretsId) -> Self { - Self { - key, - context: Default::default(), - processed: false, - } - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct SetSecretRequest { - pub key: SecretsId, - /// Sets or unsets (if none) a value associated with the key. - pub value: Option, -} - /// Request to get contract state from within a delegate. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GetContractRequest { diff --git a/rust/src/generated/client_request_generated.rs b/rust/src/generated/client_request_generated.rs index 145e09d..5b0ff26 100644 --- a/rust/src/generated/client_request_generated.rs +++ b/rust/src/generated/client_request_generated.rs @@ -217,18 +217,16 @@ pub mod client_request { since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] - pub const ENUM_MAX_INBOUND_DELEGATE_MSG_TYPE: u8 = 4; + pub const ENUM_MAX_INBOUND_DELEGATE_MSG_TYPE: u8 = 2; #[deprecated( since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] #[allow(non_camel_case_types)] - pub const ENUM_VALUES_INBOUND_DELEGATE_MSG_TYPE: [InboundDelegateMsgType; 5] = [ + pub const ENUM_VALUES_INBOUND_DELEGATE_MSG_TYPE: [InboundDelegateMsgType; 3] = [ InboundDelegateMsgType::NONE, InboundDelegateMsgType::common_ApplicationMessage, - InboundDelegateMsgType::common_GetSecretResponse, InboundDelegateMsgType::UserInputResponse, - InboundDelegateMsgType::common_GetSecretRequest, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -238,27 +236,21 @@ pub mod client_request { impl InboundDelegateMsgType { pub const NONE: Self = Self(0); pub const common_ApplicationMessage: Self = Self(1); - pub const common_GetSecretResponse: Self = Self(2); - pub const UserInputResponse: Self = Self(3); - pub const common_GetSecretRequest: Self = Self(4); + pub const UserInputResponse: Self = Self(2); pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; + pub const ENUM_MAX: u8 = 2; pub const ENUM_VALUES: &'static [Self] = &[ Self::NONE, Self::common_ApplicationMessage, - Self::common_GetSecretResponse, Self::UserInputResponse, - Self::common_GetSecretRequest, ]; /// Returns the variant's name or "" if unknown. pub fn variant_name(self) -> Option<&'static str> { match self { Self::NONE => Some("NONE"), Self::common_ApplicationMessage => Some("common_ApplicationMessage"), - Self::common_GetSecretResponse => Some("common_GetSecretResponse"), Self::UserInputResponse => Some("UserInputResponse"), - Self::common_GetSecretRequest => Some("common_GetSecretRequest"), _ => None, } } @@ -325,16 +317,15 @@ pub mod client_request { since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] - pub const ENUM_MAX_DELEGATE_REQUEST_TYPE: u8 = 4; + pub const ENUM_MAX_DELEGATE_REQUEST_TYPE: u8 = 3; #[deprecated( since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] #[allow(non_camel_case_types)] - pub const ENUM_VALUES_DELEGATE_REQUEST_TYPE: [DelegateRequestType; 5] = [ + pub const ENUM_VALUES_DELEGATE_REQUEST_TYPE: [DelegateRequestType; 4] = [ DelegateRequestType::NONE, DelegateRequestType::ApplicationMessages, - DelegateRequestType::GetSecretRequestType, DelegateRequestType::RegisterDelegate, DelegateRequestType::UnregisterDelegate, ]; @@ -346,16 +337,14 @@ pub mod client_request { impl DelegateRequestType { pub const NONE: Self = Self(0); pub const ApplicationMessages: Self = Self(1); - pub const GetSecretRequestType: Self = Self(2); - pub const RegisterDelegate: Self = Self(3); - pub const UnregisterDelegate: Self = Self(4); + pub const RegisterDelegate: Self = Self(2); + pub const UnregisterDelegate: Self = Self(3); pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; + pub const ENUM_MAX: u8 = 3; pub const ENUM_VALUES: &'static [Self] = &[ Self::NONE, Self::ApplicationMessages, - Self::GetSecretRequestType, Self::RegisterDelegate, Self::UnregisterDelegate, ]; @@ -364,7 +353,6 @@ pub mod client_request { match self { Self::NONE => Some("NONE"), Self::ApplicationMessages => Some("ApplicationMessages"), - Self::GetSecretRequestType => Some("GetSecretRequestType"), Self::RegisterDelegate => Some("RegisterDelegate"), Self::UnregisterDelegate => Some("UnregisterDelegate"), _ => None, @@ -2789,22 +2777,6 @@ pub mod client_request { } } - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_response( - &self, - ) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::common_GetSecretResponse { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) - } else { - None - } - } - #[inline] #[allow(non_snake_case)] pub fn inbound_as_user_input_response(&self) -> Option> { @@ -2818,22 +2790,6 @@ pub mod client_request { None } } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_request( - &self, - ) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::common_GetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) - } else { - None - } - } } impl ::flatbuffers::Verifiable for InboundDelegateMsg<'_> { @@ -2846,9 +2802,7 @@ pub mod client_request { .visit_union::("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| { match key { InboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("InboundDelegateMsgType::common_ApplicationMessage", pos), - InboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("InboundDelegateMsgType::common_GetSecretResponse", pos), InboundDelegateMsgType::UserInputResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("InboundDelegateMsgType::UserInputResponse", pos), - InboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("InboundDelegateMsgType::common_GetSecretRequest", pos), _ => Ok(()), } })? @@ -2927,16 +2881,6 @@ pub mod client_request { ) } } - InboundDelegateMsgType::common_GetSecretResponse => { - if let Some(x) = self.inbound_as_common_get_secret_response() { - ds.field("inbound", &x) - } else { - ds.field( - "inbound", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } InboundDelegateMsgType::UserInputResponse => { if let Some(x) = self.inbound_as_user_input_response() { ds.field("inbound", &x) @@ -2947,16 +2891,6 @@ pub mod client_request { ) } } - InboundDelegateMsgType::common_GetSecretRequest => { - if let Some(x) = self.inbound_as_common_get_secret_request() { - ds.field("inbound", &x) - } else { - ds.field( - "inbound", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } _ => { let x: Option<()> = None; ds.field("inbound", &x) @@ -3173,206 +3107,6 @@ pub mod client_request { ds.finish() } } - pub enum GetSecretRequestTypeOffset {} - #[derive(Copy, Clone, PartialEq)] - - pub struct GetSecretRequestType<'a> { - pub _tab: ::flatbuffers::Table<'a>, - } - - impl<'a> ::flatbuffers::Follow<'a> for GetSecretRequestType<'a> { - type Inner = GetSecretRequestType<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: unsafe { ::flatbuffers::Table::new(buf, loc) }, - } - } - } - - impl<'a> GetSecretRequestType<'a> { - pub const VT_KEY: ::flatbuffers::VOffsetT = 4; - pub const VT_PARAMS: ::flatbuffers::VOffsetT = 6; - pub const VT_GET_REQUEST: ::flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { - GetSecretRequestType { _tab: table } - } - #[allow(unused_mut)] - pub fn create< - 'bldr: 'args, - 'args: 'mut_bldr, - 'mut_bldr, - A: ::flatbuffers::Allocator + 'bldr, - >( - _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args GetSecretRequestTypeArgs<'args>, - ) -> ::flatbuffers::WIPOffset> { - let mut builder = GetSecretRequestTypeBuilder::new(_fbb); - if let Some(x) = args.get_request { - builder.add_get_request(x); - } - if let Some(x) = args.params { - builder.add_params(x); - } - if let Some(x) = args.key { - builder.add_key(x); - } - builder.finish() - } - - #[inline] - pub fn key(&self) -> DelegateKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset>( - GetSecretRequestType::VT_KEY, - None, - ) - .unwrap() - } - } - #[inline] - pub fn params(&self) -> ::flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>( - GetSecretRequestType::VT_PARAMS, - None, - ) - .unwrap() - } - } - #[inline] - pub fn get_request(&self) -> super::common::GetSecretRequest<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset>( - GetSecretRequestType::VT_GET_REQUEST, - None, - ) - .unwrap() - } - } - } - - impl ::flatbuffers::Verifiable for GetSecretRequestType<'_> { - #[inline] - fn run_verifier( - v: &mut ::flatbuffers::Verifier, - pos: usize, - ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { - v.visit_table(pos)? - .visit_field::<::flatbuffers::ForwardsUOffset>( - "key", - Self::VT_KEY, - true, - )? - .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>( - "params", - Self::VT_PARAMS, - true, - )? - .visit_field::<::flatbuffers::ForwardsUOffset>( - "get_request", - Self::VT_GET_REQUEST, - true, - )? - .finish(); - Ok(()) - } - } - pub struct GetSecretRequestTypeArgs<'a> { - pub key: Option<::flatbuffers::WIPOffset>>, - pub params: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>, - pub get_request: Option<::flatbuffers::WIPOffset>>, - } - impl<'a> Default for GetSecretRequestTypeArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretRequestTypeArgs { - key: None, // required field - params: None, // required field - get_request: None, // required field - } - } - } - - pub struct GetSecretRequestTypeBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { - fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, - } - impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GetSecretRequestTypeBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset>( - GetSecretRequestType::VT_KEY, - key, - ); - } - #[inline] - pub fn add_params( - &mut self, - params: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>, - ) { - self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>( - GetSecretRequestType::VT_PARAMS, - params, - ); - } - #[inline] - pub fn add_get_request( - &mut self, - get_request: ::flatbuffers::WIPOffset>, - ) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset>( - GetSecretRequestType::VT_GET_REQUEST, - get_request, - ); - } - #[inline] - pub fn new( - _fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - ) -> GetSecretRequestTypeBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - GetSecretRequestTypeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> ::flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretRequestType::VT_KEY, "key"); - self.fbb_ - .required(o, GetSecretRequestType::VT_PARAMS, "params"); - self.fbb_ - .required(o, GetSecretRequestType::VT_GET_REQUEST, "get_request"); - ::flatbuffers::WIPOffset::new(o.value()) - } - } - - impl ::core::fmt::Debug for GetSecretRequestType<'_> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut ds = f.debug_struct("GetSecretRequestType"); - ds.field("key", &self.key()); - ds.field("params", &self.params()); - ds.field("get_request", &self.get_request()); - ds.finish() - } - } pub enum RegisterDelegateOffset {} #[derive(Copy, Clone, PartialEq)] @@ -4055,22 +3789,6 @@ pub mod client_request { } } - #[inline] - #[allow(non_snake_case)] - pub fn delegate_request_as_get_secret_request_type( - &self, - ) -> Option> { - if self.delegate_request_type() == DelegateRequestType::GetSecretRequestType { - let u = self.delegate_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { GetSecretRequestType::init_from_table(u) }) - } else { - None - } - } - #[inline] #[allow(non_snake_case)] pub fn delegate_request_as_register_delegate(&self) -> Option> { @@ -4110,7 +3828,6 @@ pub mod client_request { .visit_union::("delegate_request_type", Self::VT_DELEGATE_REQUEST_TYPE, "delegate_request", Self::VT_DELEGATE_REQUEST, true, |key, v, pos| { match key { DelegateRequestType::ApplicationMessages => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("DelegateRequestType::ApplicationMessages", pos), - DelegateRequestType::GetSecretRequestType => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("DelegateRequestType::GetSecretRequestType", pos), DelegateRequestType::RegisterDelegate => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("DelegateRequestType::RegisterDelegate", pos), DelegateRequestType::UnregisterDelegate => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("DelegateRequestType::UnregisterDelegate", pos), _ => Ok(()), @@ -4191,16 +3908,6 @@ pub mod client_request { ) } } - DelegateRequestType::GetSecretRequestType => { - if let Some(x) = self.delegate_request_as_get_secret_request_type() { - ds.field("delegate_request", &x) - } else { - ds.field( - "delegate_request", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } DelegateRequestType::RegisterDelegate => { if let Some(x) = self.delegate_request_as_register_delegate() { ds.field("delegate_request", &x) diff --git a/rust/src/generated/common_generated.rs b/rust/src/generated/common_generated.rs index ddcb687..b19b97f 100644 --- a/rust/src/generated/common_generated.rs +++ b/rust/src/generated/common_generated.rs @@ -1016,388 +1016,6 @@ pub mod common { ds.finish() } } - pub enum GetSecretRequestOffset {} - #[derive(Copy, Clone, PartialEq)] - - pub struct GetSecretRequest<'a> { - pub _tab: ::flatbuffers::Table<'a>, - } - - impl<'a> ::flatbuffers::Follow<'a> for GetSecretRequest<'a> { - type Inner = GetSecretRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: unsafe { ::flatbuffers::Table::new(buf, loc) }, - } - } - } - - impl<'a> GetSecretRequest<'a> { - pub const VT_KEY: ::flatbuffers::VOffsetT = 4; - pub const VT_DELEGATE_CONTEXT: ::flatbuffers::VOffsetT = 6; - pub const VT_PROCESSED: ::flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { - GetSecretRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create< - 'bldr: 'args, - 'args: 'mut_bldr, - 'mut_bldr, - A: ::flatbuffers::Allocator + 'bldr, - >( - _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args GetSecretRequestArgs<'args>, - ) -> ::flatbuffers::WIPOffset> { - let mut builder = GetSecretRequestBuilder::new(_fbb); - if let Some(x) = args.delegate_context { - builder.add_delegate_context(x); - } - if let Some(x) = args.key { - builder.add_key(x); - } - builder.add_processed(args.processed); - builder.finish() - } - - #[inline] - pub fn key(&self) -> SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset>( - GetSecretRequest::VT_KEY, - None, - ) - .unwrap() - } - } - #[inline] - pub fn delegate_context(&self) -> ::flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>( - GetSecretRequest::VT_DELEGATE_CONTEXT, - None, - ) - .unwrap() - } - } - #[inline] - pub fn processed(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::(GetSecretRequest::VT_PROCESSED, Some(false)) - .unwrap() - } - } - } - - impl ::flatbuffers::Verifiable for GetSecretRequest<'_> { - #[inline] - fn run_verifier( - v: &mut ::flatbuffers::Verifier, - pos: usize, - ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { - v.visit_table(pos)? - .visit_field::<::flatbuffers::ForwardsUOffset>( - "key", - Self::VT_KEY, - true, - )? - .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>( - "delegate_context", - Self::VT_DELEGATE_CONTEXT, - true, - )? - .visit_field::("processed", Self::VT_PROCESSED, false)? - .finish(); - Ok(()) - } - } - pub struct GetSecretRequestArgs<'a> { - pub key: Option<::flatbuffers::WIPOffset>>, - pub delegate_context: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>, - pub processed: bool, - } - impl<'a> Default for GetSecretRequestArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretRequestArgs { - key: None, // required field - delegate_context: None, // required field - processed: false, - } - } - } - - pub struct GetSecretRequestBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { - fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, - } - impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GetSecretRequestBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset>( - GetSecretRequest::VT_KEY, - key, - ); - } - #[inline] - pub fn add_delegate_context( - &mut self, - delegate_context: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>, - ) { - self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>( - GetSecretRequest::VT_DELEGATE_CONTEXT, - delegate_context, - ); - } - #[inline] - pub fn add_processed(&mut self, processed: bool) { - self.fbb_ - .push_slot::(GetSecretRequest::VT_PROCESSED, processed, false); - } - #[inline] - pub fn new( - _fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - ) -> GetSecretRequestBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - GetSecretRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> ::flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretRequest::VT_KEY, "key"); - self.fbb_ - .required(o, GetSecretRequest::VT_DELEGATE_CONTEXT, "delegate_context"); - ::flatbuffers::WIPOffset::new(o.value()) - } - } - - impl ::core::fmt::Debug for GetSecretRequest<'_> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut ds = f.debug_struct("GetSecretRequest"); - ds.field("key", &self.key()); - ds.field("delegate_context", &self.delegate_context()); - ds.field("processed", &self.processed()); - ds.finish() - } - } - pub enum GetSecretResponseOffset {} - #[derive(Copy, Clone, PartialEq)] - - pub struct GetSecretResponse<'a> { - pub _tab: ::flatbuffers::Table<'a>, - } - - impl<'a> ::flatbuffers::Follow<'a> for GetSecretResponse<'a> { - type Inner = GetSecretResponse<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: unsafe { ::flatbuffers::Table::new(buf, loc) }, - } - } - } - - impl<'a> GetSecretResponse<'a> { - pub const VT_KEY: ::flatbuffers::VOffsetT = 4; - pub const VT_VALUE: ::flatbuffers::VOffsetT = 6; - pub const VT_DELEGATE_CONTEXT: ::flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { - GetSecretResponse { _tab: table } - } - #[allow(unused_mut)] - pub fn create< - 'bldr: 'args, - 'args: 'mut_bldr, - 'mut_bldr, - A: ::flatbuffers::Allocator + 'bldr, - >( - _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args GetSecretResponseArgs<'args>, - ) -> ::flatbuffers::WIPOffset> { - let mut builder = GetSecretResponseBuilder::new(_fbb); - if let Some(x) = args.delegate_context { - builder.add_delegate_context(x); - } - if let Some(x) = args.value { - builder.add_value(x); - } - if let Some(x) = args.key { - builder.add_key(x); - } - builder.finish() - } - - #[inline] - pub fn key(&self) -> SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset>( - GetSecretResponse::VT_KEY, - None, - ) - .unwrap() - } - } - #[inline] - pub fn value(&self) -> Option<::flatbuffers::Vector<'a, u8>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>( - GetSecretResponse::VT_VALUE, - None, - ) - } - } - #[inline] - pub fn delegate_context(&self) -> ::flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>( - GetSecretResponse::VT_DELEGATE_CONTEXT, - None, - ) - .unwrap() - } - } - } - - impl ::flatbuffers::Verifiable for GetSecretResponse<'_> { - #[inline] - fn run_verifier( - v: &mut ::flatbuffers::Verifier, - pos: usize, - ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { - v.visit_table(pos)? - .visit_field::<::flatbuffers::ForwardsUOffset>( - "key", - Self::VT_KEY, - true, - )? - .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>( - "value", - Self::VT_VALUE, - false, - )? - .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>( - "delegate_context", - Self::VT_DELEGATE_CONTEXT, - true, - )? - .finish(); - Ok(()) - } - } - pub struct GetSecretResponseArgs<'a> { - pub key: Option<::flatbuffers::WIPOffset>>, - pub value: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>, - pub delegate_context: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>, - } - impl<'a> Default for GetSecretResponseArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretResponseArgs { - key: None, // required field - value: None, - delegate_context: None, // required field - } - } - } - - pub struct GetSecretResponseBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { - fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, - } - impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> GetSecretResponseBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset>( - GetSecretResponse::VT_KEY, - key, - ); - } - #[inline] - pub fn add_value( - &mut self, - value: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>, - ) { - self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>( - GetSecretResponse::VT_VALUE, - value, - ); - } - #[inline] - pub fn add_delegate_context( - &mut self, - delegate_context: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>, - ) { - self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>( - GetSecretResponse::VT_DELEGATE_CONTEXT, - delegate_context, - ); - } - #[inline] - pub fn new( - _fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - ) -> GetSecretResponseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - GetSecretResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> ::flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretResponse::VT_KEY, "key"); - self.fbb_.required( - o, - GetSecretResponse::VT_DELEGATE_CONTEXT, - "delegate_context", - ); - ::flatbuffers::WIPOffset::new(o.value()) - } - } - - impl ::core::fmt::Debug for GetSecretResponse<'_> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut ds = f.debug_struct("GetSecretResponse"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.field("delegate_context", &self.delegate_context()); - ds.finish() - } - } pub enum WasmContractV1Offset {} #[derive(Copy, Clone, PartialEq)] diff --git a/rust/src/generated/host_response_generated.rs b/rust/src/generated/host_response_generated.rs index 05354e6..115d784 100644 --- a/rust/src/generated/host_response_generated.rs +++ b/rust/src/generated/host_response_generated.rs @@ -130,20 +130,17 @@ pub mod host_response { since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] - pub const ENUM_MAX_OUTBOUND_DELEGATE_MSG_TYPE: u8 = 6; + pub const ENUM_MAX_OUTBOUND_DELEGATE_MSG_TYPE: u8 = 3; #[deprecated( since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021." )] #[allow(non_camel_case_types)] - pub const ENUM_VALUES_OUTBOUND_DELEGATE_MSG_TYPE: [OutboundDelegateMsgType; 7] = [ + pub const ENUM_VALUES_OUTBOUND_DELEGATE_MSG_TYPE: [OutboundDelegateMsgType; 4] = [ OutboundDelegateMsgType::NONE, OutboundDelegateMsgType::common_ApplicationMessage, OutboundDelegateMsgType::RequestUserInput, OutboundDelegateMsgType::ContextUpdated, - OutboundDelegateMsgType::common_GetSecretRequest, - OutboundDelegateMsgType::SetSecretRequest, - OutboundDelegateMsgType::common_GetSecretResponse, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -155,20 +152,14 @@ pub mod host_response { pub const common_ApplicationMessage: Self = Self(1); pub const RequestUserInput: Self = Self(2); pub const ContextUpdated: Self = Self(3); - pub const common_GetSecretRequest: Self = Self(4); - pub const SetSecretRequest: Self = Self(5); - pub const common_GetSecretResponse: Self = Self(6); pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 6; + pub const ENUM_MAX: u8 = 3; pub const ENUM_VALUES: &'static [Self] = &[ Self::NONE, Self::common_ApplicationMessage, Self::RequestUserInput, Self::ContextUpdated, - Self::common_GetSecretRequest, - Self::SetSecretRequest, - Self::common_GetSecretResponse, ]; /// Returns the variant's name or "" if unknown. pub fn variant_name(self) -> Option<&'static str> { @@ -177,9 +168,6 @@ pub mod host_response { Self::common_ApplicationMessage => Some("common_ApplicationMessage"), Self::RequestUserInput => Some("RequestUserInput"), Self::ContextUpdated => Some("ContextUpdated"), - Self::common_GetSecretRequest => Some("common_GetSecretRequest"), - Self::SetSecretRequest => Some("SetSecretRequest"), - Self::common_GetSecretResponse => Some("common_GetSecretResponse"), _ => None, } } @@ -2178,164 +2166,6 @@ pub mod host_response { ds.finish() } } - pub enum SetSecretRequestOffset {} - #[derive(Copy, Clone, PartialEq)] - - pub struct SetSecretRequest<'a> { - pub _tab: ::flatbuffers::Table<'a>, - } - - impl<'a> ::flatbuffers::Follow<'a> for SetSecretRequest<'a> { - type Inner = SetSecretRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: unsafe { ::flatbuffers::Table::new(buf, loc) }, - } - } - } - - impl<'a> SetSecretRequest<'a> { - pub const VT_KEY: ::flatbuffers::VOffsetT = 4; - pub const VT_VALUE: ::flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self { - SetSecretRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create< - 'bldr: 'args, - 'args: 'mut_bldr, - 'mut_bldr, - A: ::flatbuffers::Allocator + 'bldr, - >( - _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SetSecretRequestArgs<'args>, - ) -> ::flatbuffers::WIPOffset> { - let mut builder = SetSecretRequestBuilder::new(_fbb); - if let Some(x) = args.value { - builder.add_value(x); - } - if let Some(x) = args.key { - builder.add_key(x); - } - builder.finish() - } - - #[inline] - pub fn key(&self) -> super::common::SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset>( - SetSecretRequest::VT_KEY, - None, - ) - .unwrap() - } - } - #[inline] - pub fn value(&self) -> ::flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>( - SetSecretRequest::VT_VALUE, - None, - ) - .unwrap() - } - } - } - - impl ::flatbuffers::Verifiable for SetSecretRequest<'_> { - #[inline] - fn run_verifier( - v: &mut ::flatbuffers::Verifier, - pos: usize, - ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> { - v.visit_table(pos)? - .visit_field::<::flatbuffers::ForwardsUOffset>( - "key", - Self::VT_KEY, - true, - )? - .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>( - "value", - Self::VT_VALUE, - true, - )? - .finish(); - Ok(()) - } - } - pub struct SetSecretRequestArgs<'a> { - pub key: Option<::flatbuffers::WIPOffset>>, - pub value: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>, - } - impl<'a> Default for SetSecretRequestArgs<'a> { - #[inline] - fn default() -> Self { - SetSecretRequestArgs { - key: None, // required field - value: None, // required field - } - } - } - - pub struct SetSecretRequestBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> { - fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>, - } - impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> SetSecretRequestBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset>( - SetSecretRequest::VT_KEY, - key, - ); - } - #[inline] - pub fn add_value( - &mut self, - value: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>, - ) { - self.fbb_ - .push_slot_always::<::flatbuffers::WIPOffset<_>>(SetSecretRequest::VT_VALUE, value); - } - #[inline] - pub fn new( - _fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, - ) -> SetSecretRequestBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SetSecretRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> ::flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, SetSecretRequest::VT_KEY, "key"); - self.fbb_.required(o, SetSecretRequest::VT_VALUE, "value"); - ::flatbuffers::WIPOffset::new(o.value()) - } - } - - impl ::core::fmt::Debug for SetSecretRequest<'_> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut ds = f.debug_struct("SetSecretRequest"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } - } pub enum OutboundDelegateMsgOffset {} #[derive(Copy, Clone, PartialEq)] @@ -2450,52 +2280,6 @@ pub mod host_response { None } } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_request( - &self, - ) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_set_secret_request(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::SetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { SetSecretRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_response( - &self, - ) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretResponse { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) - } else { - None - } - } } impl ::flatbuffers::Verifiable for OutboundDelegateMsg<'_> { @@ -2510,9 +2294,6 @@ pub mod host_response { OutboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::common_ApplicationMessage", pos), OutboundDelegateMsgType::RequestUserInput => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::RequestUserInput", pos), OutboundDelegateMsgType::ContextUpdated => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::ContextUpdated", pos), - OutboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::common_GetSecretRequest", pos), - OutboundDelegateMsgType::SetSecretRequest => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::SetSecretRequest", pos), - OutboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset>("OutboundDelegateMsgType::common_GetSecretResponse", pos), _ => Ok(()), } })? @@ -2611,36 +2392,6 @@ pub mod host_response { ) } } - OutboundDelegateMsgType::common_GetSecretRequest => { - if let Some(x) = self.inbound_as_common_get_secret_request() { - ds.field("inbound", &x) - } else { - ds.field( - "inbound", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } - OutboundDelegateMsgType::SetSecretRequest => { - if let Some(x) = self.inbound_as_set_secret_request() { - ds.field("inbound", &x) - } else { - ds.field( - "inbound", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } - OutboundDelegateMsgType::common_GetSecretResponse => { - if let Some(x) = self.inbound_as_common_get_secret_response() { - ds.field("inbound", &x) - } else { - ds.field( - "inbound", - &"InvalidFlatbuffer: Union discriminant does not match value.", - ) - } - } _ => { let x: Option<()> = None; ds.field("inbound", &x) diff --git a/schemas/flatbuffers/client_request.fbs b/schemas/flatbuffers/client_request.fbs index 9c3c848..10112f1 100644 --- a/schemas/flatbuffers/client_request.fbs +++ b/schemas/flatbuffers/client_request.fbs @@ -82,9 +82,7 @@ table UserInputResponse { union InboundDelegateMsgType { common.ApplicationMessage, - common.GetSecretResponse, UserInputResponse, - common.GetSecretRequest, } table InboundDelegateMsg { @@ -97,12 +95,6 @@ table ApplicationMessages { inbound:[InboundDelegateMsg](required); } -table GetSecretRequestType { - key:DelegateKey(required); - params:[ubyte](required); - get_request:common.GetSecretRequest(required); -} - table RegisterDelegate { delegate:DelegateContainer(required); cipher:[ubyte](required); @@ -115,7 +107,6 @@ table UnregisterDelegate { union DelegateRequestType { ApplicationMessages, - GetSecretRequestType, RegisterDelegate, UnregisterDelegate } diff --git a/schemas/flatbuffers/common.fbs b/schemas/flatbuffers/common.fbs index fd90a5e..7d20eaf 100644 --- a/schemas/flatbuffers/common.fbs +++ b/schemas/flatbuffers/common.fbs @@ -26,18 +26,6 @@ table ApplicationMessage { processed: bool; } -table GetSecretRequest { - key: SecretsId(required); - delegate_context: [ubyte](required); - processed: bool; -} - -table GetSecretResponse { - key: SecretsId(required); - value: [ubyte]; - delegate_context: [ubyte](required); -} - table WasmContractV1 { data:ContractCode(required); parameters:[ubyte](required); diff --git a/schemas/flatbuffers/host_response.fbs b/schemas/flatbuffers/host_response.fbs index f0d1951..f11acf7 100644 --- a/schemas/flatbuffers/host_response.fbs +++ b/schemas/flatbuffers/host_response.fbs @@ -66,18 +66,10 @@ table ContextUpdated { context: [ubyte](required); } -table SetSecretRequest { - key: common.SecretsId(required); - value: [ubyte](required); -} - union OutboundDelegateMsgType { common.ApplicationMessage, RequestUserInput, ContextUpdated, - common.GetSecretRequest, - SetSecretRequest, - common.GetSecretResponse, } table OutboundDelegateMsg {