From 953ad1c6103146121871a3e2fa5aaca3d6256891 Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Thu, 15 Aug 2024 15:28:33 -0700 Subject: [PATCH] Bump XDR for archival proofs (#385) --- src/curr/generated.rs | 3810 ++++++++++++++++++++++++----------- src/next/generated.rs | 4374 ++++++++++++++++++++++++++++------------- xdr/curr | 2 +- xdr/curr-version | 2 +- xdr/next | 2 +- xdr/next-version | 2 +- 6 files changed, 5618 insertions(+), 2574 deletions(-) diff --git a/src/curr/generated.rs b/src/curr/generated.rs index a2b875c7..82e8c001 100644 --- a/src/curr/generated.rs +++ b/src/curr/generated.rs @@ -46,11 +46,11 @@ pub const XDR_FILES_SHA256: [(&str, &str); 12] = [ ), ( "xdr/curr/Stellar-ledger-entries.x", - "77dc7062ae6d0812136333e12e35b2294d7c2896a536be9c811eb0ed2abbbccb", + "03e8be938bace784410b0e837ed6496ff66dc0d1e70fc6e4f0d006566a344879", ), ( "xdr/curr/Stellar-ledger.x", - "88b6fac00398f1f943533efb3be8fb60ae3a1076661799c581c214d7db0f25a5", + "c2ac5bde5da28d4d02e2ea455f3bc5d5133adf271d374010cebe4e314c8504e8", ), ( "xdr/curr/Stellar-overlay.x", @@ -58,7 +58,7 @@ pub const XDR_FILES_SHA256: [(&str, &str); 12] = [ ), ( "xdr/curr/Stellar-transaction.x", - "747639c267aa298c01e5c026a776679454171d717207ef60aed158c5dedae957", + "a938e583ab5d25237c51f355a47446215575b720150db89a1cecf13773249df1", ), ( "xdr/curr/Stellar-types.x", @@ -17461,119 +17461,131 @@ impl WriteXdr for EnvelopeType { } } -/// UpgradeType is an XDR Typedef defines as: +/// BucketListType is an XDR Enum defines as: /// /// ```text -/// typedef opaque UpgradeType<128>; +/// enum BucketListType +/// { +/// LIVE = 0, +/// HOT_ARCHIVE = 1, +/// COLD_ARCHIVE = 2 +/// }; /// ``` /// -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[derive(Default)] #[cfg_attr( all(feature = "serde", feature = "alloc"), derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[derive(Debug)] -pub struct UpgradeType(pub BytesM<128>); - -impl From for BytesM<128> { - #[must_use] - fn from(x: UpgradeType) -> Self { - x.0 - } +#[repr(i32)] +pub enum BucketListType { + Live = 0, + HotArchive = 1, + ColdArchive = 2, } -impl From> for UpgradeType { +impl BucketListType { + pub const VARIANTS: [BucketListType; 3] = [ + BucketListType::Live, + BucketListType::HotArchive, + BucketListType::ColdArchive, + ]; + pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"]; + #[must_use] - fn from(x: BytesM<128>) -> Self { - UpgradeType(x) + pub const fn name(&self) -> &'static str { + match self { + Self::Live => "Live", + Self::HotArchive => "HotArchive", + Self::ColdArchive => "ColdArchive", + } } -} -impl AsRef> for UpgradeType { #[must_use] - fn as_ref(&self) -> &BytesM<128> { - &self.0 + pub const fn variants() -> [BucketListType; 3] { + Self::VARIANTS } } -impl ReadXdr for UpgradeType { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - let i = BytesM::<128>::read_xdr(r)?; - let v = UpgradeType(i); - Ok(v) - }) +impl Name for BucketListType { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) } } -impl WriteXdr for UpgradeType { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| self.0.write_xdr(w)) +impl Variants for BucketListType { + fn variants() -> slice::Iter<'static, BucketListType> { + Self::VARIANTS.iter() } } -impl Deref for UpgradeType { - type Target = BytesM<128>; - fn deref(&self) -> &Self::Target { - &self.0 - } -} +impl Enum for BucketListType {} -impl From for Vec { - #[must_use] - fn from(x: UpgradeType) -> Self { - x.0 .0 +impl fmt::Display for BucketListType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl TryFrom> for UpgradeType { +impl TryFrom for BucketListType { type Error = Error; - fn try_from(x: Vec) -> Result { - Ok(UpgradeType(x.try_into()?)) - } -} -#[cfg(feature = "alloc")] -impl TryFrom<&Vec> for UpgradeType { - type Error = Error; - fn try_from(x: &Vec) -> Result { - Ok(UpgradeType(x.try_into()?)) + fn try_from(i: i32) -> Result { + let e = match i { + 0 => BucketListType::Live, + 1 => BucketListType::HotArchive, + 2 => BucketListType::ColdArchive, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) } } -impl AsRef> for UpgradeType { +impl From for i32 { #[must_use] - fn as_ref(&self) -> &Vec { - &self.0 .0 + fn from(e: BucketListType) -> Self { + e as Self } } -impl AsRef<[u8]> for UpgradeType { - #[cfg(feature = "alloc")] - #[must_use] - fn as_ref(&self) -> &[u8] { - &self.0 .0 +impl ReadXdr for BucketListType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) + }) } - #[cfg(not(feature = "alloc"))] - #[must_use] - fn as_ref(&self) -> &[u8] { - self.0 .0 +} + +impl WriteXdr for BucketListType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + let i: i32 = (*self).into(); + i.write_xdr(w) + }) } } -/// StellarValueType is an XDR Enum defines as: +/// BucketEntryType is an XDR Enum defines as: /// /// ```text -/// enum StellarValueType +/// enum BucketEntryType /// { -/// STELLAR_VALUE_BASIC = 0, -/// STELLAR_VALUE_SIGNED = 1 +/// METAENTRY = +/// -1, // At-and-after protocol 11: bucket metadata, should come first. +/// LIVEENTRY = 0, // Before protocol 11: created-or-updated; +/// // At-and-after protocol 11: only updated. +/// DEADENTRY = 1, +/// INITENTRY = 2 // At-and-after protocol 11: only created. /// }; /// ``` /// @@ -17587,57 +17599,69 @@ impl AsRef<[u8]> for UpgradeType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum StellarValueType { - Basic = 0, - Signed = 1, +pub enum BucketEntryType { + Metaentry = -1, + Liveentry = 0, + Deadentry = 1, + Initentry = 2, } -impl StellarValueType { - pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; - pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; +impl BucketEntryType { + pub const VARIANTS: [BucketEntryType; 4] = [ + BucketEntryType::Metaentry, + BucketEntryType::Liveentry, + BucketEntryType::Deadentry, + BucketEntryType::Initentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = + ["Metaentry", "Liveentry", "Deadentry", "Initentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Basic => "Basic", - Self::Signed => "Signed", + Self::Metaentry => "Metaentry", + Self::Liveentry => "Liveentry", + Self::Deadentry => "Deadentry", + Self::Initentry => "Initentry", } } #[must_use] - pub const fn variants() -> [StellarValueType; 2] { + pub const fn variants() -> [BucketEntryType; 4] { Self::VARIANTS } } -impl Name for StellarValueType { +impl Name for BucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for StellarValueType { - fn variants() -> slice::Iter<'static, StellarValueType> { +impl Variants for BucketEntryType { + fn variants() -> slice::Iter<'static, BucketEntryType> { Self::VARIANTS.iter() } } -impl Enum for StellarValueType {} +impl Enum for BucketEntryType {} -impl fmt::Display for StellarValueType { +impl fmt::Display for BucketEntryType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for StellarValueType { +impl TryFrom for BucketEntryType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 0 => StellarValueType::Basic, - 1 => StellarValueType::Signed, + -1 => BucketEntryType::Metaentry, + 0 => BucketEntryType::Liveentry, + 1 => BucketEntryType::Deadentry, + 2 => BucketEntryType::Initentry, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -17645,14 +17669,14 @@ impl TryFrom for StellarValueType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: StellarValueType) -> Self { + fn from(e: BucketEntryType) -> Self { e as Self } } -impl ReadXdr for StellarValueType { +impl ReadXdr for BucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -17663,7 +17687,7 @@ impl ReadXdr for StellarValueType { } } -impl WriteXdr for StellarValueType { +impl WriteXdr for BucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -17673,66 +17697,22 @@ impl WriteXdr for StellarValueType { } } -/// LedgerCloseValueSignature is an XDR Struct defines as: +/// HotArchiveBucketEntryType is an XDR Enum defines as: /// /// ```text -/// struct LedgerCloseValueSignature +/// enum HotArchiveBucketEntryType /// { -/// NodeID nodeID; // which node introduced the value -/// Signature signature; // nodeID's signature +/// HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +/// HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived +/// HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but +/// // has been added back to the live BucketList. +/// // Does not need to be persisted. +/// HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) /// }; /// ``` /// -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerCloseValueSignature { - pub node_id: NodeId, - pub signature: Signature, -} - -impl ReadXdr for LedgerCloseValueSignature { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - Ok(Self { - node_id: NodeId::read_xdr(r)?, - signature: Signature::read_xdr(r)?, - }) - }) - } -} - -impl WriteXdr for LedgerCloseValueSignature { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| { - self.node_id.write_xdr(w)?; - self.signature.write_xdr(w)?; - Ok(()) - }) - } -} - -/// StellarValueExt is an XDR NestedUnion defines as: -/// -/// ```text -/// union switch (StellarValueType v) -/// { -/// case STELLAR_VALUE_BASIC: -/// void; -/// case STELLAR_VALUE_SIGNED: -/// LedgerCloseValueSignature lcValueSignature; -/// } -/// ``` -/// -// union with discriminant StellarValueType -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -17740,178 +17720,114 @@ impl WriteXdr for LedgerCloseValueSignature { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[allow(clippy::large_enum_variant)] -pub enum StellarValueExt { - Basic, - Signed(LedgerCloseValueSignature), +#[repr(i32)] +pub enum HotArchiveBucketEntryType { + Metaentry = -1, + Archived = 0, + Live = 1, + Deleted = 2, } -impl StellarValueExt { - pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; - pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; +impl HotArchiveBucketEntryType { + pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ + HotArchiveBucketEntryType::Metaentry, + HotArchiveBucketEntryType::Archived, + HotArchiveBucketEntryType::Live, + HotArchiveBucketEntryType::Deleted, + ]; + pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Basic => "Basic", - Self::Signed(_) => "Signed", - } - } - - #[must_use] - pub const fn discriminant(&self) -> StellarValueType { - #[allow(clippy::match_same_arms)] - match self { - Self::Basic => StellarValueType::Basic, - Self::Signed(_) => StellarValueType::Signed, + Self::Metaentry => "Metaentry", + Self::Archived => "Archived", + Self::Live => "Live", + Self::Deleted => "Deleted", } } #[must_use] - pub const fn variants() -> [StellarValueType; 2] { + pub const fn variants() -> [HotArchiveBucketEntryType; 4] { Self::VARIANTS } } -impl Name for StellarValueExt { +impl Name for HotArchiveBucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for StellarValueExt { - #[must_use] - fn discriminant(&self) -> StellarValueType { - Self::discriminant(self) - } -} - -impl Variants for StellarValueExt { - fn variants() -> slice::Iter<'static, StellarValueType> { +impl Variants for HotArchiveBucketEntryType { + fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { Self::VARIANTS.iter() } } -impl Union for StellarValueExt {} +impl Enum for HotArchiveBucketEntryType {} -impl ReadXdr for StellarValueExt { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - let dv: StellarValueType = ::read_xdr(r)?; - #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] - let v = match dv { - StellarValueType::Basic => Self::Basic, - StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?), - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(v) - }) +impl fmt::Display for HotArchiveBucketEntryType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl WriteXdr for StellarValueExt { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| { - self.discriminant().write_xdr(w)?; - #[allow(clippy::match_same_arms)] - match self { - Self::Basic => ().write_xdr(w)?, - Self::Signed(v) => v.write_xdr(w)?, - }; - Ok(()) - }) +impl TryFrom for HotArchiveBucketEntryType { + type Error = Error; + + fn try_from(i: i32) -> Result { + let e = match i { + -1 => HotArchiveBucketEntryType::Metaentry, + 0 => HotArchiveBucketEntryType::Archived, + 1 => HotArchiveBucketEntryType::Live, + 2 => HotArchiveBucketEntryType::Deleted, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) } } -/// StellarValue is an XDR Struct defines as: -/// -/// ```text -/// struct StellarValue -/// { -/// Hash txSetHash; // transaction set to apply to previous ledger -/// TimePoint closeTime; // network close time -/// -/// // upgrades to apply to the previous ledger (usually empty) -/// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop -/// // unknown steps during consensus if needed. -/// // see notes below on 'LedgerUpgrade' for more detail -/// // max size is dictated by number of upgrade types (+ room for future) -/// UpgradeType upgrades<6>; -/// -/// // reserved for future use -/// union switch (StellarValueType v) -/// { -/// case STELLAR_VALUE_BASIC: -/// void; -/// case STELLAR_VALUE_SIGNED: -/// LedgerCloseValueSignature lcValueSignature; -/// } -/// ext; -/// }; -/// ``` -/// -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct StellarValue { - pub tx_set_hash: Hash, - pub close_time: TimePoint, - pub upgrades: VecM, - pub ext: StellarValueExt, +impl From for i32 { + #[must_use] + fn from(e: HotArchiveBucketEntryType) -> Self { + e as Self + } } -impl ReadXdr for StellarValue { +impl ReadXdr for HotArchiveBucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - Ok(Self { - tx_set_hash: Hash::read_xdr(r)?, - close_time: TimePoint::read_xdr(r)?, - upgrades: VecM::::read_xdr(r)?, - ext: StellarValueExt::read_xdr(r)?, - }) + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) }) } } -impl WriteXdr for StellarValue { +impl WriteXdr for HotArchiveBucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.tx_set_hash.write_xdr(w)?; - self.close_time.write_xdr(w)?; - self.upgrades.write_xdr(w)?; - self.ext.write_xdr(w)?; - Ok(()) + let i: i32 = (*self).into(); + i.write_xdr(w) }) } } -/// MaskLedgerHeaderFlags is an XDR Const defines as: -/// -/// ```text -/// const MASK_LEDGER_HEADER_FLAGS = 0x7; -/// ``` -/// -pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; - -/// LedgerHeaderFlags is an XDR Enum defines as: +/// ColdArchiveBucketEntryType is an XDR Enum defines as: /// /// ```text -/// enum LedgerHeaderFlags +/// enum ColdArchiveBucketEntryType /// { -/// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, -/// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, -/// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 +/// COLD_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +/// COLD_ARCHIVE_ARCHIVED_LEAF = 0, // Full LedgerEntry that was archived during the epoch +/// COLD_ARCHIVE_DELETED_LEAF = 1, // LedgerKey that was deleted during the epoch +/// COLD_ARCHIVE_BOUNDARY_LEAF = 2, // Dummy leaf representing low/high bound +/// COLD_ARCHIVE_HASH = 3 // Intermediary Merkle hash entry /// }; /// ``` /// @@ -17925,64 +17841,78 @@ pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum LedgerHeaderFlags { - TradingFlag = 1, - DepositFlag = 2, - WithdrawalFlag = 4, +pub enum ColdArchiveBucketEntryType { + Metaentry = -1, + ArchivedLeaf = 0, + DeletedLeaf = 1, + BoundaryLeaf = 2, + Hash = 3, } -impl LedgerHeaderFlags { - pub const VARIANTS: [LedgerHeaderFlags; 3] = [ - LedgerHeaderFlags::TradingFlag, - LedgerHeaderFlags::DepositFlag, - LedgerHeaderFlags::WithdrawalFlag, +impl ColdArchiveBucketEntryType { + pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [ + ColdArchiveBucketEntryType::Metaentry, + ColdArchiveBucketEntryType::ArchivedLeaf, + ColdArchiveBucketEntryType::DeletedLeaf, + ColdArchiveBucketEntryType::BoundaryLeaf, + ColdArchiveBucketEntryType::Hash, + ]; + pub const VARIANTS_STR: [&'static str; 5] = [ + "Metaentry", + "ArchivedLeaf", + "DeletedLeaf", + "BoundaryLeaf", + "Hash", ]; - pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::TradingFlag => "TradingFlag", - Self::DepositFlag => "DepositFlag", - Self::WithdrawalFlag => "WithdrawalFlag", + Self::Metaentry => "Metaentry", + Self::ArchivedLeaf => "ArchivedLeaf", + Self::DeletedLeaf => "DeletedLeaf", + Self::BoundaryLeaf => "BoundaryLeaf", + Self::Hash => "Hash", } } #[must_use] - pub const fn variants() -> [LedgerHeaderFlags; 3] { + pub const fn variants() -> [ColdArchiveBucketEntryType; 5] { Self::VARIANTS } } -impl Name for LedgerHeaderFlags { +impl Name for ColdArchiveBucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for LedgerHeaderFlags { - fn variants() -> slice::Iter<'static, LedgerHeaderFlags> { +impl Variants for ColdArchiveBucketEntryType { + fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> { Self::VARIANTS.iter() } } -impl Enum for LedgerHeaderFlags {} +impl Enum for ColdArchiveBucketEntryType {} -impl fmt::Display for LedgerHeaderFlags { +impl fmt::Display for ColdArchiveBucketEntryType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for LedgerHeaderFlags { +impl TryFrom for ColdArchiveBucketEntryType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 1 => LedgerHeaderFlags::TradingFlag, - 2 => LedgerHeaderFlags::DepositFlag, - 4 => LedgerHeaderFlags::WithdrawalFlag, + -1 => ColdArchiveBucketEntryType::Metaentry, + 0 => ColdArchiveBucketEntryType::ArchivedLeaf, + 1 => ColdArchiveBucketEntryType::DeletedLeaf, + 2 => ColdArchiveBucketEntryType::BoundaryLeaf, + 3 => ColdArchiveBucketEntryType::Hash, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -17990,14 +17920,14 @@ impl TryFrom for LedgerHeaderFlags { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: LedgerHeaderFlags) -> Self { + fn from(e: ColdArchiveBucketEntryType) -> Self { e as Self } } -impl ReadXdr for LedgerHeaderFlags { +impl ReadXdr for ColdArchiveBucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18008,7 +17938,7 @@ impl ReadXdr for LedgerHeaderFlags { } } -impl WriteXdr for LedgerHeaderFlags { +impl WriteXdr for ColdArchiveBucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18018,13 +17948,15 @@ impl WriteXdr for LedgerHeaderFlags { } } -/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: +/// BucketMetadataExt is an XDR NestedUnion defines as: /// /// ```text /// union switch (int v) /// { /// case 0: /// void; +/// case 1: +/// BucketListType bucketListType; /// } /// ``` /// @@ -18038,18 +17970,20 @@ impl WriteXdr for LedgerHeaderFlags { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerHeaderExtensionV1Ext { +pub enum BucketMetadataExt { V0, + V1(BucketListType), } -impl LedgerHeaderExtensionV1Ext { - pub const VARIANTS: [i32; 1] = [0]; - pub const VARIANTS_STR: [&'static str; 1] = ["V0"]; +impl BucketMetadataExt { + pub const VARIANTS: [i32; 2] = [0, 1]; + pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; #[must_use] pub const fn name(&self) -> &'static str { match self { Self::V0 => "V0", + Self::V1(_) => "V1", } } @@ -18058,38 +17992,39 @@ impl LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms)] match self { Self::V0 => 0, + Self::V1(_) => 1, } } #[must_use] - pub const fn variants() -> [i32; 1] { + pub const fn variants() -> [i32; 2] { Self::VARIANTS } } -impl Name for LedgerHeaderExtensionV1Ext { +impl Name for BucketMetadataExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerHeaderExtensionV1Ext { +impl Discriminant for BucketMetadataExt { #[must_use] fn discriminant(&self) -> i32 { Self::discriminant(self) } } -impl Variants for LedgerHeaderExtensionV1Ext { +impl Variants for BucketMetadataExt { fn variants() -> slice::Iter<'static, i32> { Self::VARIANTS.iter() } } -impl Union for LedgerHeaderExtensionV1Ext {} +impl Union for BucketMetadataExt {} -impl ReadXdr for LedgerHeaderExtensionV1Ext { +impl ReadXdr for BucketMetadataExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18097,6 +18032,7 @@ impl ReadXdr for LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { 0 => Self::V0, + 1 => Self::V1(BucketListType::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18105,7 +18041,7 @@ impl ReadXdr for LedgerHeaderExtensionV1Ext { } } -impl WriteXdr for LedgerHeaderExtensionV1Ext { +impl WriteXdr for BucketMetadataExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18113,23 +18049,28 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms)] match self { Self::V0 => ().write_xdr(w)?, + Self::V1(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// LedgerHeaderExtensionV1 is an XDR Struct defines as: +/// BucketMetadata is an XDR Struct defines as: /// /// ```text -/// struct LedgerHeaderExtensionV1 +/// struct BucketMetadata /// { -/// uint32 flags; // LedgerHeaderFlags +/// // Indicates the protocol version used to create / merge this bucket. +/// uint32 ledgerVersion; /// +/// // reserved for future use /// union switch (int v) /// { /// case 0: /// void; +/// case 1: +/// BucketListType bucketListType; /// } /// ext; /// }; @@ -18143,47 +18084,51 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerHeaderExtensionV1 { - pub flags: u32, - pub ext: LedgerHeaderExtensionV1Ext, +pub struct BucketMetadata { + pub ledger_version: u32, + pub ext: BucketMetadataExt, } -impl ReadXdr for LedgerHeaderExtensionV1 { +impl ReadXdr for BucketMetadata { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - flags: u32::read_xdr(r)?, - ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?, + ledger_version: u32::read_xdr(r)?, + ext: BucketMetadataExt::read_xdr(r)?, }) }) } } -impl WriteXdr for LedgerHeaderExtensionV1 { +impl WriteXdr for BucketMetadata { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.flags.write_xdr(w)?; + self.ledger_version.write_xdr(w)?; self.ext.write_xdr(w)?; Ok(()) }) } } -/// LedgerHeaderExt is an XDR NestedUnion defines as: +/// BucketEntry is an XDR Union defines as: /// /// ```text -/// union switch (int v) -/// { -/// case 0: -/// void; -/// case 1: -/// LedgerHeaderExtensionV1 v1; -/// } +/// union BucketEntry switch (BucketEntryType type) +/// { +/// case LIVEENTRY: +/// case INITENTRY: +/// LedgerEntry liveEntry; +/// +/// case DEADENTRY: +/// LedgerKey deadEntry; +/// case METAENTRY: +/// BucketMetadata metaEntry; +/// }; /// ``` /// -// union with discriminant i32 +// union with discriminant BucketEntryType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -18193,69 +18138,83 @@ impl WriteXdr for LedgerHeaderExtensionV1 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerHeaderExt { - V0, - V1(LedgerHeaderExtensionV1), +pub enum BucketEntry { + Liveentry(LedgerEntry), + Initentry(LedgerEntry), + Deadentry(LedgerKey), + Metaentry(BucketMetadata), } -impl LedgerHeaderExt { - pub const VARIANTS: [i32; 2] = [0, 1]; - pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; +impl BucketEntry { + pub const VARIANTS: [BucketEntryType; 4] = [ + BucketEntryType::Liveentry, + BucketEntryType::Initentry, + BucketEntryType::Deadentry, + BucketEntryType::Metaentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = + ["Liveentry", "Initentry", "Deadentry", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::V0 => "V0", - Self::V1(_) => "V1", + Self::Liveentry(_) => "Liveentry", + Self::Initentry(_) => "Initentry", + Self::Deadentry(_) => "Deadentry", + Self::Metaentry(_) => "Metaentry", } } #[must_use] - pub const fn discriminant(&self) -> i32 { + pub const fn discriminant(&self) -> BucketEntryType { #[allow(clippy::match_same_arms)] match self { - Self::V0 => 0, - Self::V1(_) => 1, + Self::Liveentry(_) => BucketEntryType::Liveentry, + Self::Initentry(_) => BucketEntryType::Initentry, + Self::Deadentry(_) => BucketEntryType::Deadentry, + Self::Metaentry(_) => BucketEntryType::Metaentry, } } #[must_use] - pub const fn variants() -> [i32; 2] { + pub const fn variants() -> [BucketEntryType; 4] { Self::VARIANTS } } -impl Name for LedgerHeaderExt { +impl Name for BucketEntry { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerHeaderExt { +impl Discriminant for BucketEntry { #[must_use] - fn discriminant(&self) -> i32 { + fn discriminant(&self) -> BucketEntryType { Self::discriminant(self) } } -impl Variants for LedgerHeaderExt { - fn variants() -> slice::Iter<'static, i32> { +impl Variants for BucketEntry { + fn variants() -> slice::Iter<'static, BucketEntryType> { Self::VARIANTS.iter() } } -impl Union for LedgerHeaderExt {} +impl Union for BucketEntry {} -impl ReadXdr for LedgerHeaderExt { +impl ReadXdr for BucketEntry { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: i32 = ::read_xdr(r)?; + let dv: BucketEntryType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - 0 => Self::V0, - 1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?), + BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?), + BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?), + BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?), + BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18264,62 +18223,299 @@ impl ReadXdr for LedgerHeaderExt { } } -impl WriteXdr for LedgerHeaderExt { +impl WriteXdr for BucketEntry { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::V0 => ().write_xdr(w)?, - Self::V1(v) => v.write_xdr(w)?, + Self::Liveentry(v) => v.write_xdr(w)?, + Self::Initentry(v) => v.write_xdr(w)?, + Self::Deadentry(v) => v.write_xdr(w)?, + Self::Metaentry(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// LedgerHeader is an XDR Struct defines as: +/// HotArchiveBucketEntry is an XDR Union defines as: /// /// ```text -/// struct LedgerHeader +/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) /// { -/// uint32 ledgerVersion; // the protocol version of the ledger -/// Hash previousLedgerHash; // hash of the previous ledger header -/// StellarValue scpValue; // what consensus agreed to -/// Hash txSetResultHash; // the TransactionResultSet that led to this ledger -/// Hash bucketListHash; // hash of the ledger state +/// case HOT_ARCHIVE_ARCHIVED: +/// LedgerEntry archivedEntry; /// -/// uint32 ledgerSeq; // sequence number of this ledger +/// case HOT_ARCHIVE_LIVE: +/// case HOT_ARCHIVE_DELETED: +/// LedgerKey key; +/// case HOT_ARCHIVE_METAENTRY: +/// BucketMetadata metaEntry; +/// }; +/// ``` /// -/// int64 totalCoins; // total number of stroops in existence. -/// // 10,000,000 stroops in 1 XLM +// union with discriminant HotArchiveBucketEntryType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum HotArchiveBucketEntry { + Archived(LedgerEntry), + Live(LedgerKey), + Deleted(LedgerKey), + Metaentry(BucketMetadata), +} + +impl HotArchiveBucketEntry { + pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ + HotArchiveBucketEntryType::Archived, + HotArchiveBucketEntryType::Live, + HotArchiveBucketEntryType::Deleted, + HotArchiveBucketEntryType::Metaentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Archived(_) => "Archived", + Self::Live(_) => "Live", + Self::Deleted(_) => "Deleted", + Self::Metaentry(_) => "Metaentry", + } + } + + #[must_use] + pub const fn discriminant(&self) -> HotArchiveBucketEntryType { + #[allow(clippy::match_same_arms)] + match self { + Self::Archived(_) => HotArchiveBucketEntryType::Archived, + Self::Live(_) => HotArchiveBucketEntryType::Live, + Self::Deleted(_) => HotArchiveBucketEntryType::Deleted, + Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry, + } + } + + #[must_use] + pub const fn variants() -> [HotArchiveBucketEntryType; 4] { + Self::VARIANTS + } +} + +impl Name for HotArchiveBucketEntry { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for HotArchiveBucketEntry { + #[must_use] + fn discriminant(&self) -> HotArchiveBucketEntryType { + Self::discriminant(self) + } +} + +impl Variants for HotArchiveBucketEntry { + fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { + Self::VARIANTS.iter() + } +} + +impl Union for HotArchiveBucketEntry {} + +impl ReadXdr for HotArchiveBucketEntry { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: HotArchiveBucketEntryType = + ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?), + HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?), + HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?), + HotArchiveBucketEntryType::Metaentry => { + Self::Metaentry(BucketMetadata::read_xdr(r)?) + } + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for HotArchiveBucketEntry { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::Archived(v) => v.write_xdr(w)?, + Self::Live(v) => v.write_xdr(w)?, + Self::Deleted(v) => v.write_xdr(w)?, + Self::Metaentry(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// ColdArchiveArchivedLeaf is an XDR Struct defines as: /// -/// int64 feePool; // fees burned since last inflation run -/// uint32 inflationSeq; // inflation sequence number +/// ```text +/// struct ColdArchiveArchivedLeaf +/// { +/// uint32 index; +/// LedgerEntry archivedEntry; +/// }; +/// ``` /// -/// uint64 idPool; // last used global ID, used for generating objects +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveArchivedLeaf { + pub index: u32, + pub archived_entry: LedgerEntry, +} + +impl ReadXdr for ColdArchiveArchivedLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + archived_entry: LedgerEntry::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveArchivedLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.archived_entry.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveDeletedLeaf is an XDR Struct defines as: /// -/// uint32 baseFee; // base fee per operation in stroops -/// uint32 baseReserve; // account base reserve in stroops +/// ```text +/// struct ColdArchiveDeletedLeaf +/// { +/// uint32 index; +/// LedgerKey deletedKey; +/// }; +/// ``` /// -/// uint32 maxTxSetSize; // maximum size a transaction set can be +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveDeletedLeaf { + pub index: u32, + pub deleted_key: LedgerKey, +} + +impl ReadXdr for ColdArchiveDeletedLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + deleted_key: LedgerKey::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveDeletedLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.deleted_key.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveBoundaryLeaf is an XDR Struct defines as: /// -/// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back -/// // in time without walking the chain back ledger by ledger -/// // each slot contains the oldest ledger that is mod of -/// // either 50 5000 50000 or 500000 depending on index -/// // skipList[0] mod(50), skipList[1] mod(5000), etc +/// ```text +/// struct ColdArchiveBoundaryLeaf +/// { +/// uint32 index; +/// bool isLowerBound; +/// }; +/// ``` /// -/// // reserved for future use -/// union switch (int v) -/// { -/// case 0: -/// void; -/// case 1: -/// LedgerHeaderExtensionV1 v1; -/// } -/// ext; +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveBoundaryLeaf { + pub index: u32, + pub is_lower_bound: bool, +} + +impl ReadXdr for ColdArchiveBoundaryLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + is_lower_bound: bool::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveBoundaryLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.is_lower_bound.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveHashEntry is an XDR Struct defines as: +/// +/// ```text +/// struct ColdArchiveHashEntry +/// { +/// uint32 index; +/// uint32 level; +/// Hash hash; /// }; /// ``` /// @@ -18331,85 +18527,300 @@ impl WriteXdr for LedgerHeaderExt { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerHeader { - pub ledger_version: u32, - pub previous_ledger_hash: Hash, - pub scp_value: StellarValue, - pub tx_set_result_hash: Hash, - pub bucket_list_hash: Hash, - pub ledger_seq: u32, - pub total_coins: i64, - pub fee_pool: i64, - pub inflation_seq: u32, - pub id_pool: u64, - pub base_fee: u32, - pub base_reserve: u32, - pub max_tx_set_size: u32, - pub skip_list: [Hash; 4], - pub ext: LedgerHeaderExt, +pub struct ColdArchiveHashEntry { + pub index: u32, + pub level: u32, + pub hash: Hash, } -impl ReadXdr for LedgerHeader { +impl ReadXdr for ColdArchiveHashEntry { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - ledger_version: u32::read_xdr(r)?, - previous_ledger_hash: Hash::read_xdr(r)?, - scp_value: StellarValue::read_xdr(r)?, - tx_set_result_hash: Hash::read_xdr(r)?, - bucket_list_hash: Hash::read_xdr(r)?, - ledger_seq: u32::read_xdr(r)?, - total_coins: i64::read_xdr(r)?, - fee_pool: i64::read_xdr(r)?, - inflation_seq: u32::read_xdr(r)?, - id_pool: u64::read_xdr(r)?, - base_fee: u32::read_xdr(r)?, - base_reserve: u32::read_xdr(r)?, - max_tx_set_size: u32::read_xdr(r)?, - skip_list: <[Hash; 4]>::read_xdr(r)?, - ext: LedgerHeaderExt::read_xdr(r)?, + index: u32::read_xdr(r)?, + level: u32::read_xdr(r)?, + hash: Hash::read_xdr(r)?, }) }) } } -impl WriteXdr for LedgerHeader { +impl WriteXdr for ColdArchiveHashEntry { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.ledger_version.write_xdr(w)?; - self.previous_ledger_hash.write_xdr(w)?; - self.scp_value.write_xdr(w)?; - self.tx_set_result_hash.write_xdr(w)?; - self.bucket_list_hash.write_xdr(w)?; - self.ledger_seq.write_xdr(w)?; - self.total_coins.write_xdr(w)?; - self.fee_pool.write_xdr(w)?; - self.inflation_seq.write_xdr(w)?; - self.id_pool.write_xdr(w)?; - self.base_fee.write_xdr(w)?; - self.base_reserve.write_xdr(w)?; - self.max_tx_set_size.write_xdr(w)?; - self.skip_list.write_xdr(w)?; - self.ext.write_xdr(w)?; + self.index.write_xdr(w)?; + self.level.write_xdr(w)?; + self.hash.write_xdr(w)?; Ok(()) }) } } -/// LedgerUpgradeType is an XDR Enum defines as: +/// ColdArchiveBucketEntry is an XDR Union defines as: /// /// ```text -/// enum LedgerUpgradeType +/// union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type) /// { -/// LEDGER_UPGRADE_VERSION = 1, -/// LEDGER_UPGRADE_BASE_FEE = 2, -/// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, -/// LEDGER_UPGRADE_BASE_RESERVE = 4, -/// LEDGER_UPGRADE_FLAGS = 5, -/// LEDGER_UPGRADE_CONFIG = 6, -/// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 +/// case COLD_ARCHIVE_METAENTRY: +/// BucketMetadata metaEntry; +/// case COLD_ARCHIVE_ARCHIVED_LEAF: +/// ColdArchiveArchivedLeaf archivedLeaf; +/// case COLD_ARCHIVE_DELETED_LEAF: +/// ColdArchiveDeletedLeaf deletedLeaf; +/// case COLD_ARCHIVE_BOUNDARY_LEAF: +/// ColdArchiveBoundaryLeaf boundaryLeaf; +/// case COLD_ARCHIVE_HASH: +/// ColdArchiveHashEntry hashEntry; +/// }; +/// ``` +/// +// union with discriminant ColdArchiveBucketEntryType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum ColdArchiveBucketEntry { + Metaentry(BucketMetadata), + ArchivedLeaf(ColdArchiveArchivedLeaf), + DeletedLeaf(ColdArchiveDeletedLeaf), + BoundaryLeaf(ColdArchiveBoundaryLeaf), + Hash(ColdArchiveHashEntry), +} + +impl ColdArchiveBucketEntry { + pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [ + ColdArchiveBucketEntryType::Metaentry, + ColdArchiveBucketEntryType::ArchivedLeaf, + ColdArchiveBucketEntryType::DeletedLeaf, + ColdArchiveBucketEntryType::BoundaryLeaf, + ColdArchiveBucketEntryType::Hash, + ]; + pub const VARIANTS_STR: [&'static str; 5] = [ + "Metaentry", + "ArchivedLeaf", + "DeletedLeaf", + "BoundaryLeaf", + "Hash", + ]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Metaentry(_) => "Metaentry", + Self::ArchivedLeaf(_) => "ArchivedLeaf", + Self::DeletedLeaf(_) => "DeletedLeaf", + Self::BoundaryLeaf(_) => "BoundaryLeaf", + Self::Hash(_) => "Hash", + } + } + + #[must_use] + pub const fn discriminant(&self) -> ColdArchiveBucketEntryType { + #[allow(clippy::match_same_arms)] + match self { + Self::Metaentry(_) => ColdArchiveBucketEntryType::Metaentry, + Self::ArchivedLeaf(_) => ColdArchiveBucketEntryType::ArchivedLeaf, + Self::DeletedLeaf(_) => ColdArchiveBucketEntryType::DeletedLeaf, + Self::BoundaryLeaf(_) => ColdArchiveBucketEntryType::BoundaryLeaf, + Self::Hash(_) => ColdArchiveBucketEntryType::Hash, + } + } + + #[must_use] + pub const fn variants() -> [ColdArchiveBucketEntryType; 5] { + Self::VARIANTS + } +} + +impl Name for ColdArchiveBucketEntry { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for ColdArchiveBucketEntry { + #[must_use] + fn discriminant(&self) -> ColdArchiveBucketEntryType { + Self::discriminant(self) + } +} + +impl Variants for ColdArchiveBucketEntry { + fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> { + Self::VARIANTS.iter() + } +} + +impl Union for ColdArchiveBucketEntry {} + +impl ReadXdr for ColdArchiveBucketEntry { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: ColdArchiveBucketEntryType = + ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + ColdArchiveBucketEntryType::Metaentry => { + Self::Metaentry(BucketMetadata::read_xdr(r)?) + } + ColdArchiveBucketEntryType::ArchivedLeaf => { + Self::ArchivedLeaf(ColdArchiveArchivedLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::DeletedLeaf => { + Self::DeletedLeaf(ColdArchiveDeletedLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::BoundaryLeaf => { + Self::BoundaryLeaf(ColdArchiveBoundaryLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::Hash => Self::Hash(ColdArchiveHashEntry::read_xdr(r)?), + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for ColdArchiveBucketEntry { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::Metaentry(v) => v.write_xdr(w)?, + Self::ArchivedLeaf(v) => v.write_xdr(w)?, + Self::DeletedLeaf(v) => v.write_xdr(w)?, + Self::BoundaryLeaf(v) => v.write_xdr(w)?, + Self::Hash(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// UpgradeType is an XDR Typedef defines as: +/// +/// ```text +/// typedef opaque UpgradeType<128>; +/// ``` +/// +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[derive(Default)] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[derive(Debug)] +pub struct UpgradeType(pub BytesM<128>); + +impl From for BytesM<128> { + #[must_use] + fn from(x: UpgradeType) -> Self { + x.0 + } +} + +impl From> for UpgradeType { + #[must_use] + fn from(x: BytesM<128>) -> Self { + UpgradeType(x) + } +} + +impl AsRef> for UpgradeType { + #[must_use] + fn as_ref(&self) -> &BytesM<128> { + &self.0 + } +} + +impl ReadXdr for UpgradeType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let i = BytesM::<128>::read_xdr(r)?; + let v = UpgradeType(i); + Ok(v) + }) + } +} + +impl WriteXdr for UpgradeType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| self.0.write_xdr(w)) + } +} + +impl Deref for UpgradeType { + type Target = BytesM<128>; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl From for Vec { + #[must_use] + fn from(x: UpgradeType) -> Self { + x.0 .0 + } +} + +impl TryFrom> for UpgradeType { + type Error = Error; + fn try_from(x: Vec) -> Result { + Ok(UpgradeType(x.try_into()?)) + } +} + +#[cfg(feature = "alloc")] +impl TryFrom<&Vec> for UpgradeType { + type Error = Error; + fn try_from(x: &Vec) -> Result { + Ok(UpgradeType(x.try_into()?)) + } +} + +impl AsRef> for UpgradeType { + #[must_use] + fn as_ref(&self) -> &Vec { + &self.0 .0 + } +} + +impl AsRef<[u8]> for UpgradeType { + #[cfg(feature = "alloc")] + #[must_use] + fn as_ref(&self) -> &[u8] { + &self.0 .0 + } + #[cfg(not(feature = "alloc"))] + #[must_use] + fn as_ref(&self) -> &[u8] { + self.0 .0 + } +} + +/// StellarValueType is an XDR Enum defines as: +/// +/// ```text +/// enum StellarValueType +/// { +/// STELLAR_VALUE_BASIC = 0, +/// STELLAR_VALUE_SIGNED = 1 /// }; /// ``` /// @@ -18423,88 +18834,57 @@ impl WriteXdr for LedgerHeader { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum LedgerUpgradeType { - Version = 1, - BaseFee = 2, - MaxTxSetSize = 3, - BaseReserve = 4, - Flags = 5, - Config = 6, - MaxSorobanTxSetSize = 7, +pub enum StellarValueType { + Basic = 0, + Signed = 1, } -impl LedgerUpgradeType { - pub const VARIANTS: [LedgerUpgradeType; 7] = [ - LedgerUpgradeType::Version, - LedgerUpgradeType::BaseFee, - LedgerUpgradeType::MaxTxSetSize, - LedgerUpgradeType::BaseReserve, - LedgerUpgradeType::Flags, - LedgerUpgradeType::Config, - LedgerUpgradeType::MaxSorobanTxSetSize, - ]; - pub const VARIANTS_STR: [&'static str; 7] = [ - "Version", - "BaseFee", - "MaxTxSetSize", - "BaseReserve", - "Flags", - "Config", - "MaxSorobanTxSetSize", - ]; +impl StellarValueType { + pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; + pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Version => "Version", - Self::BaseFee => "BaseFee", - Self::MaxTxSetSize => "MaxTxSetSize", - Self::BaseReserve => "BaseReserve", - Self::Flags => "Flags", - Self::Config => "Config", - Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize", + Self::Basic => "Basic", + Self::Signed => "Signed", } } #[must_use] - pub const fn variants() -> [LedgerUpgradeType; 7] { + pub const fn variants() -> [StellarValueType; 2] { Self::VARIANTS } } -impl Name for LedgerUpgradeType { +impl Name for StellarValueType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for LedgerUpgradeType { - fn variants() -> slice::Iter<'static, LedgerUpgradeType> { +impl Variants for StellarValueType { + fn variants() -> slice::Iter<'static, StellarValueType> { Self::VARIANTS.iter() } } -impl Enum for LedgerUpgradeType {} +impl Enum for StellarValueType {} -impl fmt::Display for LedgerUpgradeType { +impl fmt::Display for StellarValueType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for LedgerUpgradeType { +impl TryFrom for StellarValueType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 1 => LedgerUpgradeType::Version, - 2 => LedgerUpgradeType::BaseFee, - 3 => LedgerUpgradeType::MaxTxSetSize, - 4 => LedgerUpgradeType::BaseReserve, - 5 => LedgerUpgradeType::Flags, - 6 => LedgerUpgradeType::Config, - 7 => LedgerUpgradeType::MaxSorobanTxSetSize, + 0 => StellarValueType::Basic, + 1 => StellarValueType::Signed, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18512,14 +18892,14 @@ impl TryFrom for LedgerUpgradeType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: LedgerUpgradeType) -> Self { + fn from(e: StellarValueType) -> Self { e as Self } } -impl ReadXdr for LedgerUpgradeType { +impl ReadXdr for StellarValueType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18530,7 +18910,7 @@ impl ReadXdr for LedgerUpgradeType { } } -impl WriteXdr for LedgerUpgradeType { +impl WriteXdr for StellarValueType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18540,12 +18920,13 @@ impl WriteXdr for LedgerUpgradeType { } } -/// ConfigUpgradeSetKey is an XDR Struct defines as: +/// LedgerCloseValueSignature is an XDR Struct defines as: /// /// ```text -/// struct ConfigUpgradeSetKey { -/// Hash contractID; -/// Hash contentHash; +/// struct LedgerCloseValueSignature +/// { +/// NodeID nodeID; // which node introduced the value +/// Signature signature; // nodeID's signature /// }; /// ``` /// @@ -18557,60 +18938,47 @@ impl WriteXdr for LedgerUpgradeType { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct ConfigUpgradeSetKey { - pub contract_id: Hash, - pub content_hash: Hash, +pub struct LedgerCloseValueSignature { + pub node_id: NodeId, + pub signature: Signature, } -impl ReadXdr for ConfigUpgradeSetKey { +impl ReadXdr for LedgerCloseValueSignature { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - contract_id: Hash::read_xdr(r)?, - content_hash: Hash::read_xdr(r)?, + node_id: NodeId::read_xdr(r)?, + signature: Signature::read_xdr(r)?, }) }) } } -impl WriteXdr for ConfigUpgradeSetKey { +impl WriteXdr for LedgerCloseValueSignature { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.contract_id.write_xdr(w)?; - self.content_hash.write_xdr(w)?; + self.node_id.write_xdr(w)?; + self.signature.write_xdr(w)?; Ok(()) }) } } -/// LedgerUpgrade is an XDR Union defines as: +/// StellarValueExt is an XDR NestedUnion defines as: /// /// ```text -/// union LedgerUpgrade switch (LedgerUpgradeType type) -/// { -/// case LEDGER_UPGRADE_VERSION: -/// uint32 newLedgerVersion; // update ledgerVersion -/// case LEDGER_UPGRADE_BASE_FEE: -/// uint32 newBaseFee; // update baseFee -/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: -/// uint32 newMaxTxSetSize; // update maxTxSetSize -/// case LEDGER_UPGRADE_BASE_RESERVE: -/// uint32 newBaseReserve; // update baseReserve -/// case LEDGER_UPGRADE_FLAGS: -/// uint32 newFlags; // update flags -/// case LEDGER_UPGRADE_CONFIG: -/// // Update arbitrary `ConfigSetting` entries identified by the key. -/// ConfigUpgradeSetKey newConfig; -/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: -/// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without -/// // using `LEDGER_UPGRADE_CONFIG`. -/// uint32 newMaxSorobanTxSetSize; -/// }; +/// union switch (StellarValueType v) +/// { +/// case STELLAR_VALUE_BASIC: +/// void; +/// case STELLAR_VALUE_SIGNED: +/// LedgerCloseValueSignature lcValueSignature; +/// } /// ``` /// -// union with discriminant LedgerUpgradeType +// union with discriminant StellarValueType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -18620,107 +18988,69 @@ impl WriteXdr for ConfigUpgradeSetKey { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerUpgrade { - Version(u32), - BaseFee(u32), - MaxTxSetSize(u32), - BaseReserve(u32), - Flags(u32), - Config(ConfigUpgradeSetKey), - MaxSorobanTxSetSize(u32), +pub enum StellarValueExt { + Basic, + Signed(LedgerCloseValueSignature), } -impl LedgerUpgrade { - pub const VARIANTS: [LedgerUpgradeType; 7] = [ - LedgerUpgradeType::Version, - LedgerUpgradeType::BaseFee, - LedgerUpgradeType::MaxTxSetSize, - LedgerUpgradeType::BaseReserve, - LedgerUpgradeType::Flags, - LedgerUpgradeType::Config, - LedgerUpgradeType::MaxSorobanTxSetSize, - ]; - pub const VARIANTS_STR: [&'static str; 7] = [ - "Version", - "BaseFee", - "MaxTxSetSize", - "BaseReserve", - "Flags", - "Config", - "MaxSorobanTxSetSize", - ]; +impl StellarValueExt { + pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; + pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Version(_) => "Version", - Self::BaseFee(_) => "BaseFee", - Self::MaxTxSetSize(_) => "MaxTxSetSize", - Self::BaseReserve(_) => "BaseReserve", - Self::Flags(_) => "Flags", - Self::Config(_) => "Config", - Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize", + Self::Basic => "Basic", + Self::Signed(_) => "Signed", } } #[must_use] - pub const fn discriminant(&self) -> LedgerUpgradeType { + pub const fn discriminant(&self) -> StellarValueType { #[allow(clippy::match_same_arms)] match self { - Self::Version(_) => LedgerUpgradeType::Version, - Self::BaseFee(_) => LedgerUpgradeType::BaseFee, - Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize, - Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve, - Self::Flags(_) => LedgerUpgradeType::Flags, - Self::Config(_) => LedgerUpgradeType::Config, - Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize, + Self::Basic => StellarValueType::Basic, + Self::Signed(_) => StellarValueType::Signed, } } #[must_use] - pub const fn variants() -> [LedgerUpgradeType; 7] { + pub const fn variants() -> [StellarValueType; 2] { Self::VARIANTS } } -impl Name for LedgerUpgrade { +impl Name for StellarValueExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerUpgrade { +impl Discriminant for StellarValueExt { #[must_use] - fn discriminant(&self) -> LedgerUpgradeType { + fn discriminant(&self) -> StellarValueType { Self::discriminant(self) } } -impl Variants for LedgerUpgrade { - fn variants() -> slice::Iter<'static, LedgerUpgradeType> { +impl Variants for StellarValueExt { + fn variants() -> slice::Iter<'static, StellarValueType> { Self::VARIANTS.iter() } } -impl Union for LedgerUpgrade {} +impl Union for StellarValueExt {} -impl ReadXdr for LedgerUpgrade { +impl ReadXdr for StellarValueExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: LedgerUpgradeType = ::read_xdr(r)?; + let dv: StellarValueType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?), - LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?), - LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?), - LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?), - LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?), - LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?), - LedgerUpgradeType::MaxSorobanTxSetSize => { - Self::MaxSorobanTxSetSize(u32::read_xdr(r)?) - } + StellarValueType::Basic => Self::Basic, + StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18729,31 +19059,45 @@ impl ReadXdr for LedgerUpgrade { } } -impl WriteXdr for LedgerUpgrade { +impl WriteXdr for StellarValueExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::Version(v) => v.write_xdr(w)?, - Self::BaseFee(v) => v.write_xdr(w)?, - Self::MaxTxSetSize(v) => v.write_xdr(w)?, - Self::BaseReserve(v) => v.write_xdr(w)?, - Self::Flags(v) => v.write_xdr(w)?, - Self::Config(v) => v.write_xdr(w)?, - Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?, + Self::Basic => ().write_xdr(w)?, + Self::Signed(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// ConfigUpgradeSet is an XDR Struct defines as: +/// StellarValue is an XDR Struct defines as: /// /// ```text -/// struct ConfigUpgradeSet { -/// ConfigSettingEntry updatedEntry<>; +/// struct StellarValue +/// { +/// Hash txSetHash; // transaction set to apply to previous ledger +/// TimePoint closeTime; // network close time +/// +/// // upgrades to apply to the previous ledger (usually empty) +/// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop +/// // unknown steps during consensus if needed. +/// // see notes below on 'LedgerUpgrade' for more detail +/// // max size is dictated by number of upgrade types (+ room for future) +/// UpgradeType upgrades<6>; +/// +/// // reserved for future use +/// union switch (StellarValueType v) +/// { +/// case STELLAR_VALUE_BASIC: +/// void; +/// case STELLAR_VALUE_SIGNED: +/// LedgerCloseValueSignature lcValueSignature; +/// } +/// ext; /// }; /// ``` /// @@ -18765,39 +19109,56 @@ impl WriteXdr for LedgerUpgrade { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct ConfigUpgradeSet { - pub updated_entry: VecM, +pub struct StellarValue { + pub tx_set_hash: Hash, + pub close_time: TimePoint, + pub upgrades: VecM, + pub ext: StellarValueExt, } -impl ReadXdr for ConfigUpgradeSet { +impl ReadXdr for StellarValue { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - updated_entry: VecM::::read_xdr(r)?, + tx_set_hash: Hash::read_xdr(r)?, + close_time: TimePoint::read_xdr(r)?, + upgrades: VecM::::read_xdr(r)?, + ext: StellarValueExt::read_xdr(r)?, }) }) } } -impl WriteXdr for ConfigUpgradeSet { +impl WriteXdr for StellarValue { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.updated_entry.write_xdr(w)?; + self.tx_set_hash.write_xdr(w)?; + self.close_time.write_xdr(w)?; + self.upgrades.write_xdr(w)?; + self.ext.write_xdr(w)?; Ok(()) }) } } -/// BucketListType is an XDR Enum defines as: +/// MaskLedgerHeaderFlags is an XDR Const defines as: /// /// ```text -/// enum BucketListType +/// const MASK_LEDGER_HEADER_FLAGS = 0x7; +/// ``` +/// +pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; + +/// LedgerHeaderFlags is an XDR Enum defines as: +/// +/// ```text +/// enum LedgerHeaderFlags /// { -/// LIVE = 0, -/// HOT_ARCHIVE = 1, -/// COLD_ARCHIVE = 2 +/// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, +/// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, +/// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 /// }; /// ``` /// @@ -18811,64 +19172,64 @@ impl WriteXdr for ConfigUpgradeSet { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum BucketListType { - Live = 0, - HotArchive = 1, - ColdArchive = 2, +pub enum LedgerHeaderFlags { + TradingFlag = 1, + DepositFlag = 2, + WithdrawalFlag = 4, } -impl BucketListType { - pub const VARIANTS: [BucketListType; 3] = [ - BucketListType::Live, - BucketListType::HotArchive, - BucketListType::ColdArchive, +impl LedgerHeaderFlags { + pub const VARIANTS: [LedgerHeaderFlags; 3] = [ + LedgerHeaderFlags::TradingFlag, + LedgerHeaderFlags::DepositFlag, + LedgerHeaderFlags::WithdrawalFlag, ]; - pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"]; + pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Live => "Live", - Self::HotArchive => "HotArchive", - Self::ColdArchive => "ColdArchive", + Self::TradingFlag => "TradingFlag", + Self::DepositFlag => "DepositFlag", + Self::WithdrawalFlag => "WithdrawalFlag", } } #[must_use] - pub const fn variants() -> [BucketListType; 3] { + pub const fn variants() -> [LedgerHeaderFlags; 3] { Self::VARIANTS } } -impl Name for BucketListType { +impl Name for LedgerHeaderFlags { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for BucketListType { - fn variants() -> slice::Iter<'static, BucketListType> { +impl Variants for LedgerHeaderFlags { + fn variants() -> slice::Iter<'static, LedgerHeaderFlags> { Self::VARIANTS.iter() } } -impl Enum for BucketListType {} +impl Enum for LedgerHeaderFlags {} -impl fmt::Display for BucketListType { +impl fmt::Display for LedgerHeaderFlags { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for BucketListType { +impl TryFrom for LedgerHeaderFlags { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 0 => BucketListType::Live, - 1 => BucketListType::HotArchive, - 2 => BucketListType::ColdArchive, + 1 => LedgerHeaderFlags::TradingFlag, + 2 => LedgerHeaderFlags::DepositFlag, + 4 => LedgerHeaderFlags::WithdrawalFlag, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18876,14 +19237,14 @@ impl TryFrom for BucketListType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: BucketListType) -> Self { + fn from(e: LedgerHeaderFlags) -> Self { e as Self } } -impl ReadXdr for BucketListType { +impl ReadXdr for LedgerHeaderFlags { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18894,7 +19255,7 @@ impl ReadXdr for BucketListType { } } -impl WriteXdr for BucketListType { +impl WriteXdr for LedgerHeaderFlags { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18904,22 +19265,18 @@ impl WriteXdr for BucketListType { } } -/// BucketEntryType is an XDR Enum defines as: +/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: /// /// ```text -/// enum BucketEntryType -/// { -/// METAENTRY = -/// -1, // At-and-after protocol 11: bucket metadata, should come first. -/// LIVEENTRY = 0, // Before protocol 11: created-or-updated; -/// // At-and-after protocol 11: only updated. -/// DEADENTRY = 1, -/// INITENTRY = 2 // At-and-after protocol 11: only created. -/// }; +/// union switch (int v) +/// { +/// case 0: +/// void; +/// } /// ``` /// -// enum -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// union with discriminant i32 +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -18927,227 +19284,141 @@ impl WriteXdr for BucketListType { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[repr(i32)] -pub enum BucketEntryType { - Metaentry = -1, - Liveentry = 0, - Deadentry = 1, - Initentry = 2, +#[allow(clippy::large_enum_variant)] +pub enum LedgerHeaderExtensionV1Ext { + V0, } -impl BucketEntryType { - pub const VARIANTS: [BucketEntryType; 4] = [ - BucketEntryType::Metaentry, - BucketEntryType::Liveentry, - BucketEntryType::Deadentry, - BucketEntryType::Initentry, - ]; - pub const VARIANTS_STR: [&'static str; 4] = - ["Metaentry", "Liveentry", "Deadentry", "Initentry"]; +impl LedgerHeaderExtensionV1Ext { + pub const VARIANTS: [i32; 1] = [0]; + pub const VARIANTS_STR: [&'static str; 1] = ["V0"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Metaentry => "Metaentry", - Self::Liveentry => "Liveentry", - Self::Deadentry => "Deadentry", - Self::Initentry => "Initentry", + Self::V0 => "V0", } } #[must_use] - pub const fn variants() -> [BucketEntryType; 4] { + pub const fn discriminant(&self) -> i32 { + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => 0, + } + } + + #[must_use] + pub const fn variants() -> [i32; 1] { Self::VARIANTS } } -impl Name for BucketEntryType { +impl Name for LedgerHeaderExtensionV1Ext { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for BucketEntryType { - fn variants() -> slice::Iter<'static, BucketEntryType> { - Self::VARIANTS.iter() - } -} - -impl Enum for BucketEntryType {} - -impl fmt::Display for BucketEntryType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.name()) +impl Discriminant for LedgerHeaderExtensionV1Ext { + #[must_use] + fn discriminant(&self) -> i32 { + Self::discriminant(self) } } -impl TryFrom for BucketEntryType { - type Error = Error; - - fn try_from(i: i32) -> Result { - let e = match i { - -1 => BucketEntryType::Metaentry, - 0 => BucketEntryType::Liveentry, - 1 => BucketEntryType::Deadentry, - 2 => BucketEntryType::Initentry, - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(e) +impl Variants for LedgerHeaderExtensionV1Ext { + fn variants() -> slice::Iter<'static, i32> { + Self::VARIANTS.iter() } } -impl From for i32 { - #[must_use] - fn from(e: BucketEntryType) -> Self { - e as Self - } -} +impl Union for LedgerHeaderExtensionV1Ext {} -impl ReadXdr for BucketEntryType { +impl ReadXdr for LedgerHeaderExtensionV1Ext { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let e = i32::read_xdr(r)?; - let v: Self = e.try_into()?; + let dv: i32 = ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + 0 => Self::V0, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; Ok(v) }) } } -impl WriteXdr for BucketEntryType { +impl WriteXdr for LedgerHeaderExtensionV1Ext { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - let i: i32 = (*self).into(); - i.write_xdr(w) + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => ().write_xdr(w)?, + }; + Ok(()) }) } } -/// HotArchiveBucketEntryType is an XDR Enum defines as: +/// LedgerHeaderExtensionV1 is an XDR Struct defines as: /// /// ```text -/// enum HotArchiveBucketEntryType +/// struct LedgerHeaderExtensionV1 /// { -/// HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. -/// HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived -/// HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but -/// // has been added back to the live BucketList. -/// // Does not need to be persisted. -/// HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) +/// uint32 flags; // LedgerHeaderFlags +/// +/// union switch (int v) +/// { +/// case 0: +/// void; +/// } +/// ext; /// }; /// ``` /// -// enum -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[repr(i32)] -pub enum HotArchiveBucketEntryType { - Metaentry = -1, - Archived = 0, - Live = 1, - Deleted = 2, -} - -impl HotArchiveBucketEntryType { - pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ - HotArchiveBucketEntryType::Metaentry, - HotArchiveBucketEntryType::Archived, - HotArchiveBucketEntryType::Live, - HotArchiveBucketEntryType::Deleted, - ]; - pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"]; - - #[must_use] - pub const fn name(&self) -> &'static str { - match self { - Self::Metaentry => "Metaentry", - Self::Archived => "Archived", - Self::Live => "Live", - Self::Deleted => "Deleted", - } - } - - #[must_use] - pub const fn variants() -> [HotArchiveBucketEntryType; 4] { - Self::VARIANTS - } -} - -impl Name for HotArchiveBucketEntryType { - #[must_use] - fn name(&self) -> &'static str { - Self::name(self) - } -} - -impl Variants for HotArchiveBucketEntryType { - fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { - Self::VARIANTS.iter() - } -} - -impl Enum for HotArchiveBucketEntryType {} - -impl fmt::Display for HotArchiveBucketEntryType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.name()) - } -} - -impl TryFrom for HotArchiveBucketEntryType { - type Error = Error; - - fn try_from(i: i32) -> Result { - let e = match i { - -1 => HotArchiveBucketEntryType::Metaentry, - 0 => HotArchiveBucketEntryType::Archived, - 1 => HotArchiveBucketEntryType::Live, - 2 => HotArchiveBucketEntryType::Deleted, - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(e) - } -} - -impl From for i32 { - #[must_use] - fn from(e: HotArchiveBucketEntryType) -> Self { - e as Self - } +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct LedgerHeaderExtensionV1 { + pub flags: u32, + pub ext: LedgerHeaderExtensionV1Ext, } -impl ReadXdr for HotArchiveBucketEntryType { +impl ReadXdr for LedgerHeaderExtensionV1 { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let e = i32::read_xdr(r)?; - let v: Self = e.try_into()?; - Ok(v) + Ok(Self { + flags: u32::read_xdr(r)?, + ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?, + }) }) } } -impl WriteXdr for HotArchiveBucketEntryType { +impl WriteXdr for LedgerHeaderExtensionV1 { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - let i: i32 = (*self).into(); - i.write_xdr(w) + self.flags.write_xdr(w)?; + self.ext.write_xdr(w)?; + Ok(()) }) } } -/// BucketMetadataExt is an XDR NestedUnion defines as: +/// LedgerHeaderExt is an XDR NestedUnion defines as: /// /// ```text /// union switch (int v) @@ -19155,7 +19426,7 @@ impl WriteXdr for HotArchiveBucketEntryType { /// case 0: /// void; /// case 1: -/// BucketListType bucketListType; +/// LedgerHeaderExtensionV1 v1; /// } /// ``` /// @@ -19169,12 +19440,12 @@ impl WriteXdr for HotArchiveBucketEntryType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum BucketMetadataExt { +pub enum LedgerHeaderExt { V0, - V1(BucketListType), + V1(LedgerHeaderExtensionV1), } -impl BucketMetadataExt { +impl LedgerHeaderExt { pub const VARIANTS: [i32; 2] = [0, 1]; pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; @@ -19201,29 +19472,29 @@ impl BucketMetadataExt { } } -impl Name for BucketMetadataExt { +impl Name for LedgerHeaderExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for BucketMetadataExt { +impl Discriminant for LedgerHeaderExt { #[must_use] fn discriminant(&self) -> i32 { Self::discriminant(self) } } -impl Variants for BucketMetadataExt { +impl Variants for LedgerHeaderExt { fn variants() -> slice::Iter<'static, i32> { Self::VARIANTS.iter() } } -impl Union for BucketMetadataExt {} +impl Union for LedgerHeaderExt {} -impl ReadXdr for BucketMetadataExt { +impl ReadXdr for LedgerHeaderExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -19231,7 +19502,7 @@ impl ReadXdr for BucketMetadataExt { #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { 0 => Self::V0, - 1 => Self::V1(BucketListType::read_xdr(r)?), + 1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -19240,7 +19511,7 @@ impl ReadXdr for BucketMetadataExt { } } -impl WriteXdr for BucketMetadataExt { +impl WriteXdr for LedgerHeaderExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -19255,13 +19526,37 @@ impl WriteXdr for BucketMetadataExt { } } -/// BucketMetadata is an XDR Struct defines as: +/// LedgerHeader is an XDR Struct defines as: /// /// ```text -/// struct BucketMetadata +/// struct LedgerHeader /// { -/// // Indicates the protocol version used to create / merge this bucket. -/// uint32 ledgerVersion; +/// uint32 ledgerVersion; // the protocol version of the ledger +/// Hash previousLedgerHash; // hash of the previous ledger header +/// StellarValue scpValue; // what consensus agreed to +/// Hash txSetResultHash; // the TransactionResultSet that led to this ledger +/// Hash bucketListHash; // hash of the ledger state +/// +/// uint32 ledgerSeq; // sequence number of this ledger +/// +/// int64 totalCoins; // total number of stroops in existence. +/// // 10,000,000 stroops in 1 XLM +/// +/// int64 feePool; // fees burned since last inflation run +/// uint32 inflationSeq; // inflation sequence number +/// +/// uint64 idPool; // last used global ID, used for generating objects +/// +/// uint32 baseFee; // base fee per operation in stroops +/// uint32 baseReserve; // account base reserve in stroops +/// +/// uint32 maxTxSetSize; // maximum size a transaction set can be +/// +/// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back +/// // in time without walking the chain back ledger by ledger +/// // each slot contains the oldest ledger that is mod of +/// // either 50 5000 50000 or 500000 depending on index +/// // skipList[0] mod(50), skipList[1] mod(5000), etc /// /// // reserved for future use /// union switch (int v) @@ -19269,7 +19564,7 @@ impl WriteXdr for BucketMetadataExt { /// case 0: /// void; /// case 1: -/// BucketListType bucketListType; +/// LedgerHeaderExtensionV1 v1; /// } /// ext; /// }; @@ -19283,52 +19578,90 @@ impl WriteXdr for BucketMetadataExt { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct BucketMetadata { +pub struct LedgerHeader { pub ledger_version: u32, - pub ext: BucketMetadataExt, + pub previous_ledger_hash: Hash, + pub scp_value: StellarValue, + pub tx_set_result_hash: Hash, + pub bucket_list_hash: Hash, + pub ledger_seq: u32, + pub total_coins: i64, + pub fee_pool: i64, + pub inflation_seq: u32, + pub id_pool: u64, + pub base_fee: u32, + pub base_reserve: u32, + pub max_tx_set_size: u32, + pub skip_list: [Hash; 4], + pub ext: LedgerHeaderExt, } -impl ReadXdr for BucketMetadata { +impl ReadXdr for LedgerHeader { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { ledger_version: u32::read_xdr(r)?, - ext: BucketMetadataExt::read_xdr(r)?, + previous_ledger_hash: Hash::read_xdr(r)?, + scp_value: StellarValue::read_xdr(r)?, + tx_set_result_hash: Hash::read_xdr(r)?, + bucket_list_hash: Hash::read_xdr(r)?, + ledger_seq: u32::read_xdr(r)?, + total_coins: i64::read_xdr(r)?, + fee_pool: i64::read_xdr(r)?, + inflation_seq: u32::read_xdr(r)?, + id_pool: u64::read_xdr(r)?, + base_fee: u32::read_xdr(r)?, + base_reserve: u32::read_xdr(r)?, + max_tx_set_size: u32::read_xdr(r)?, + skip_list: <[Hash; 4]>::read_xdr(r)?, + ext: LedgerHeaderExt::read_xdr(r)?, }) }) } } -impl WriteXdr for BucketMetadata { +impl WriteXdr for LedgerHeader { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.ledger_version.write_xdr(w)?; + self.previous_ledger_hash.write_xdr(w)?; + self.scp_value.write_xdr(w)?; + self.tx_set_result_hash.write_xdr(w)?; + self.bucket_list_hash.write_xdr(w)?; + self.ledger_seq.write_xdr(w)?; + self.total_coins.write_xdr(w)?; + self.fee_pool.write_xdr(w)?; + self.inflation_seq.write_xdr(w)?; + self.id_pool.write_xdr(w)?; + self.base_fee.write_xdr(w)?; + self.base_reserve.write_xdr(w)?; + self.max_tx_set_size.write_xdr(w)?; + self.skip_list.write_xdr(w)?; self.ext.write_xdr(w)?; Ok(()) }) } } -/// BucketEntry is an XDR Union defines as: +/// LedgerUpgradeType is an XDR Enum defines as: /// /// ```text -/// union BucketEntry switch (BucketEntryType type) +/// enum LedgerUpgradeType /// { -/// case LIVEENTRY: -/// case INITENTRY: -/// LedgerEntry liveEntry; -/// -/// case DEADENTRY: -/// LedgerKey deadEntry; -/// case METAENTRY: -/// BucketMetadata metaEntry; +/// LEDGER_UPGRADE_VERSION = 1, +/// LEDGER_UPGRADE_BASE_FEE = 2, +/// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, +/// LEDGER_UPGRADE_BASE_RESERVE = 4, +/// LEDGER_UPGRADE_FLAGS = 5, +/// LEDGER_UPGRADE_CONFIG = 6, +/// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 /// }; /// ``` /// -// union with discriminant BucketEntryType -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -19336,126 +19669,195 @@ impl WriteXdr for BucketMetadata { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[allow(clippy::large_enum_variant)] -pub enum BucketEntry { - Liveentry(LedgerEntry), - Initentry(LedgerEntry), - Deadentry(LedgerKey), - Metaentry(BucketMetadata), +#[repr(i32)] +pub enum LedgerUpgradeType { + Version = 1, + BaseFee = 2, + MaxTxSetSize = 3, + BaseReserve = 4, + Flags = 5, + Config = 6, + MaxSorobanTxSetSize = 7, } -impl BucketEntry { - pub const VARIANTS: [BucketEntryType; 4] = [ - BucketEntryType::Liveentry, - BucketEntryType::Initentry, - BucketEntryType::Deadentry, - BucketEntryType::Metaentry, +impl LedgerUpgradeType { + pub const VARIANTS: [LedgerUpgradeType; 7] = [ + LedgerUpgradeType::Version, + LedgerUpgradeType::BaseFee, + LedgerUpgradeType::MaxTxSetSize, + LedgerUpgradeType::BaseReserve, + LedgerUpgradeType::Flags, + LedgerUpgradeType::Config, + LedgerUpgradeType::MaxSorobanTxSetSize, + ]; + pub const VARIANTS_STR: [&'static str; 7] = [ + "Version", + "BaseFee", + "MaxTxSetSize", + "BaseReserve", + "Flags", + "Config", + "MaxSorobanTxSetSize", ]; - pub const VARIANTS_STR: [&'static str; 4] = - ["Liveentry", "Initentry", "Deadentry", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Liveentry(_) => "Liveentry", - Self::Initentry(_) => "Initentry", - Self::Deadentry(_) => "Deadentry", - Self::Metaentry(_) => "Metaentry", - } - } - - #[must_use] - pub const fn discriminant(&self) -> BucketEntryType { - #[allow(clippy::match_same_arms)] - match self { - Self::Liveentry(_) => BucketEntryType::Liveentry, - Self::Initentry(_) => BucketEntryType::Initentry, - Self::Deadentry(_) => BucketEntryType::Deadentry, - Self::Metaentry(_) => BucketEntryType::Metaentry, + Self::Version => "Version", + Self::BaseFee => "BaseFee", + Self::MaxTxSetSize => "MaxTxSetSize", + Self::BaseReserve => "BaseReserve", + Self::Flags => "Flags", + Self::Config => "Config", + Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize", } } #[must_use] - pub const fn variants() -> [BucketEntryType; 4] { + pub const fn variants() -> [LedgerUpgradeType; 7] { Self::VARIANTS } } -impl Name for BucketEntry { +impl Name for LedgerUpgradeType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for BucketEntry { - #[must_use] - fn discriminant(&self) -> BucketEntryType { - Self::discriminant(self) +impl Variants for LedgerUpgradeType { + fn variants() -> slice::Iter<'static, LedgerUpgradeType> { + Self::VARIANTS.iter() } } -impl Variants for BucketEntry { - fn variants() -> slice::Iter<'static, BucketEntryType> { - Self::VARIANTS.iter() +impl Enum for LedgerUpgradeType {} + +impl fmt::Display for LedgerUpgradeType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl Union for BucketEntry {} +impl TryFrom for LedgerUpgradeType { + type Error = Error; -impl ReadXdr for BucketEntry { + fn try_from(i: i32) -> Result { + let e = match i { + 1 => LedgerUpgradeType::Version, + 2 => LedgerUpgradeType::BaseFee, + 3 => LedgerUpgradeType::MaxTxSetSize, + 4 => LedgerUpgradeType::BaseReserve, + 5 => LedgerUpgradeType::Flags, + 6 => LedgerUpgradeType::Config, + 7 => LedgerUpgradeType::MaxSorobanTxSetSize, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) + } +} + +impl From for i32 { + #[must_use] + fn from(e: LedgerUpgradeType) -> Self { + e as Self + } +} + +impl ReadXdr for LedgerUpgradeType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: BucketEntryType = ::read_xdr(r)?; - #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] - let v = match dv { - BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?), - BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?), - BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?), - BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?), - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; Ok(v) }) } } -impl WriteXdr for BucketEntry { +impl WriteXdr for LedgerUpgradeType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.discriminant().write_xdr(w)?; - #[allow(clippy::match_same_arms)] - match self { - Self::Liveentry(v) => v.write_xdr(w)?, - Self::Initentry(v) => v.write_xdr(w)?, - Self::Deadentry(v) => v.write_xdr(w)?, - Self::Metaentry(v) => v.write_xdr(w)?, - }; + let i: i32 = (*self).into(); + i.write_xdr(w) + }) + } +} + +/// ConfigUpgradeSetKey is an XDR Struct defines as: +/// +/// ```text +/// struct ConfigUpgradeSetKey { +/// Hash contractID; +/// Hash contentHash; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ConfigUpgradeSetKey { + pub contract_id: Hash, + pub content_hash: Hash, +} + +impl ReadXdr for ConfigUpgradeSetKey { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + contract_id: Hash::read_xdr(r)?, + content_hash: Hash::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ConfigUpgradeSetKey { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.contract_id.write_xdr(w)?; + self.content_hash.write_xdr(w)?; Ok(()) }) } } -/// HotArchiveBucketEntry is an XDR Union defines as: +/// LedgerUpgrade is an XDR Union defines as: /// /// ```text -/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) +/// union LedgerUpgrade switch (LedgerUpgradeType type) /// { -/// case HOT_ARCHIVE_ARCHIVED: -/// LedgerEntry archivedEntry; -/// -/// case HOT_ARCHIVE_LIVE: -/// case HOT_ARCHIVE_DELETED: -/// LedgerKey key; -/// case HOT_ARCHIVE_METAENTRY: -/// BucketMetadata metaEntry; +/// case LEDGER_UPGRADE_VERSION: +/// uint32 newLedgerVersion; // update ledgerVersion +/// case LEDGER_UPGRADE_BASE_FEE: +/// uint32 newBaseFee; // update baseFee +/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: +/// uint32 newMaxTxSetSize; // update maxTxSetSize +/// case LEDGER_UPGRADE_BASE_RESERVE: +/// uint32 newBaseReserve; // update baseReserve +/// case LEDGER_UPGRADE_FLAGS: +/// uint32 newFlags; // update flags +/// case LEDGER_UPGRADE_CONFIG: +/// // Update arbitrary `ConfigSetting` entries identified by the key. +/// ConfigUpgradeSetKey newConfig; +/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: +/// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without +/// // using `LEDGER_UPGRADE_CONFIG`. +/// uint32 newMaxSorobanTxSetSize; /// }; /// ``` /// -// union with discriminant HotArchiveBucketEntryType +// union with discriminant LedgerUpgradeType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -19465,84 +19867,106 @@ impl WriteXdr for BucketEntry { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum HotArchiveBucketEntry { - Archived(LedgerEntry), - Live(LedgerKey), - Deleted(LedgerKey), - Metaentry(BucketMetadata), +pub enum LedgerUpgrade { + Version(u32), + BaseFee(u32), + MaxTxSetSize(u32), + BaseReserve(u32), + Flags(u32), + Config(ConfigUpgradeSetKey), + MaxSorobanTxSetSize(u32), } -impl HotArchiveBucketEntry { - pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ - HotArchiveBucketEntryType::Archived, - HotArchiveBucketEntryType::Live, - HotArchiveBucketEntryType::Deleted, - HotArchiveBucketEntryType::Metaentry, +impl LedgerUpgrade { + pub const VARIANTS: [LedgerUpgradeType; 7] = [ + LedgerUpgradeType::Version, + LedgerUpgradeType::BaseFee, + LedgerUpgradeType::MaxTxSetSize, + LedgerUpgradeType::BaseReserve, + LedgerUpgradeType::Flags, + LedgerUpgradeType::Config, + LedgerUpgradeType::MaxSorobanTxSetSize, + ]; + pub const VARIANTS_STR: [&'static str; 7] = [ + "Version", + "BaseFee", + "MaxTxSetSize", + "BaseReserve", + "Flags", + "Config", + "MaxSorobanTxSetSize", ]; - pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Archived(_) => "Archived", - Self::Live(_) => "Live", - Self::Deleted(_) => "Deleted", - Self::Metaentry(_) => "Metaentry", + Self::Version(_) => "Version", + Self::BaseFee(_) => "BaseFee", + Self::MaxTxSetSize(_) => "MaxTxSetSize", + Self::BaseReserve(_) => "BaseReserve", + Self::Flags(_) => "Flags", + Self::Config(_) => "Config", + Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize", } } #[must_use] - pub const fn discriminant(&self) -> HotArchiveBucketEntryType { + pub const fn discriminant(&self) -> LedgerUpgradeType { #[allow(clippy::match_same_arms)] match self { - Self::Archived(_) => HotArchiveBucketEntryType::Archived, - Self::Live(_) => HotArchiveBucketEntryType::Live, - Self::Deleted(_) => HotArchiveBucketEntryType::Deleted, - Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry, + Self::Version(_) => LedgerUpgradeType::Version, + Self::BaseFee(_) => LedgerUpgradeType::BaseFee, + Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize, + Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve, + Self::Flags(_) => LedgerUpgradeType::Flags, + Self::Config(_) => LedgerUpgradeType::Config, + Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize, } } #[must_use] - pub const fn variants() -> [HotArchiveBucketEntryType; 4] { + pub const fn variants() -> [LedgerUpgradeType; 7] { Self::VARIANTS } } -impl Name for HotArchiveBucketEntry { +impl Name for LedgerUpgrade { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for HotArchiveBucketEntry { +impl Discriminant for LedgerUpgrade { #[must_use] - fn discriminant(&self) -> HotArchiveBucketEntryType { + fn discriminant(&self) -> LedgerUpgradeType { Self::discriminant(self) } } -impl Variants for HotArchiveBucketEntry { - fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { +impl Variants for LedgerUpgrade { + fn variants() -> slice::Iter<'static, LedgerUpgradeType> { Self::VARIANTS.iter() } } -impl Union for HotArchiveBucketEntry {} +impl Union for LedgerUpgrade {} -impl ReadXdr for HotArchiveBucketEntry { +impl ReadXdr for LedgerUpgrade { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: HotArchiveBucketEntryType = - ::read_xdr(r)?; + let dv: LedgerUpgradeType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?), - HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?), - HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?), - HotArchiveBucketEntryType::Metaentry => { - Self::Metaentry(BucketMetadata::read_xdr(r)?) + LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?), + LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?), + LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?), + LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?), + LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?), + LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?), + LedgerUpgradeType::MaxSorobanTxSetSize => { + Self::MaxSorobanTxSetSize(u32::read_xdr(r)?) } #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), @@ -19552,23 +19976,67 @@ impl ReadXdr for HotArchiveBucketEntry { } } -impl WriteXdr for HotArchiveBucketEntry { +impl WriteXdr for LedgerUpgrade { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::Archived(v) => v.write_xdr(w)?, - Self::Live(v) => v.write_xdr(w)?, - Self::Deleted(v) => v.write_xdr(w)?, - Self::Metaentry(v) => v.write_xdr(w)?, + Self::Version(v) => v.write_xdr(w)?, + Self::BaseFee(v) => v.write_xdr(w)?, + Self::MaxTxSetSize(v) => v.write_xdr(w)?, + Self::BaseReserve(v) => v.write_xdr(w)?, + Self::Flags(v) => v.write_xdr(w)?, + Self::Config(v) => v.write_xdr(w)?, + Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?, }; Ok(()) }) } } +/// ConfigUpgradeSet is an XDR Struct defines as: +/// +/// ```text +/// struct ConfigUpgradeSet { +/// ConfigSettingEntry updatedEntry<>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ConfigUpgradeSet { + pub updated_entry: VecM, +} + +impl ReadXdr for ConfigUpgradeSet { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + updated_entry: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ConfigUpgradeSet { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.updated_entry.write_xdr(w)?; + Ok(()) + }) + } +} + /// TxSetComponentType is an XDR Enum defines as: /// /// ```text @@ -31394,6 +31862,544 @@ impl WriteXdr for LedgerFootprint { } } +/// ArchivalProofType is an XDR Enum defines as: +/// +/// ```text +/// enum ArchivalProofType +/// { +/// EXISTENCE = 0, +/// NONEXISTENCE = 1 +/// }; +/// ``` +/// +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[repr(i32)] +pub enum ArchivalProofType { + Existence = 0, + Nonexistence = 1, +} + +impl ArchivalProofType { + pub const VARIANTS: [ArchivalProofType; 2] = [ + ArchivalProofType::Existence, + ArchivalProofType::Nonexistence, + ]; + pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Existence => "Existence", + Self::Nonexistence => "Nonexistence", + } + } + + #[must_use] + pub const fn variants() -> [ArchivalProofType; 2] { + Self::VARIANTS + } +} + +impl Name for ArchivalProofType { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Variants for ArchivalProofType { + fn variants() -> slice::Iter<'static, ArchivalProofType> { + Self::VARIANTS.iter() + } +} + +impl Enum for ArchivalProofType {} + +impl fmt::Display for ArchivalProofType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) + } +} + +impl TryFrom for ArchivalProofType { + type Error = Error; + + fn try_from(i: i32) -> Result { + let e = match i { + 0 => ArchivalProofType::Existence, + 1 => ArchivalProofType::Nonexistence, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) + } +} + +impl From for i32 { + #[must_use] + fn from(e: ArchivalProofType) -> Self { + e as Self + } +} + +impl ReadXdr for ArchivalProofType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) + }) + } +} + +impl WriteXdr for ArchivalProofType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + let i: i32 = (*self).into(); + i.write_xdr(w) + }) + } +} + +/// ArchivalProofNode is an XDR Struct defines as: +/// +/// ```text +/// struct ArchivalProofNode +/// { +/// uint32 index; +/// Hash hash; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ArchivalProofNode { + pub index: u32, + pub hash: Hash, +} + +impl ReadXdr for ArchivalProofNode { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + hash: Hash::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ArchivalProofNode { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.hash.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ProofLevel is an XDR Typedef defines as: +/// +/// ```text +/// typedef ArchivalProofNode ProofLevel<>; +/// ``` +/// +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[derive(Default)] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[derive(Debug)] +pub struct ProofLevel(pub VecM); + +impl From for VecM { + #[must_use] + fn from(x: ProofLevel) -> Self { + x.0 + } +} + +impl From> for ProofLevel { + #[must_use] + fn from(x: VecM) -> Self { + ProofLevel(x) + } +} + +impl AsRef> for ProofLevel { + #[must_use] + fn as_ref(&self) -> &VecM { + &self.0 + } +} + +impl ReadXdr for ProofLevel { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let i = VecM::::read_xdr(r)?; + let v = ProofLevel(i); + Ok(v) + }) + } +} + +impl WriteXdr for ProofLevel { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| self.0.write_xdr(w)) + } +} + +impl Deref for ProofLevel { + type Target = VecM; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl From for Vec { + #[must_use] + fn from(x: ProofLevel) -> Self { + x.0 .0 + } +} + +impl TryFrom> for ProofLevel { + type Error = Error; + fn try_from(x: Vec) -> Result { + Ok(ProofLevel(x.try_into()?)) + } +} + +#[cfg(feature = "alloc")] +impl TryFrom<&Vec> for ProofLevel { + type Error = Error; + fn try_from(x: &Vec) -> Result { + Ok(ProofLevel(x.try_into()?)) + } +} + +impl AsRef> for ProofLevel { + #[must_use] + fn as_ref(&self) -> &Vec { + &self.0 .0 + } +} + +impl AsRef<[ArchivalProofNode]> for ProofLevel { + #[cfg(feature = "alloc")] + #[must_use] + fn as_ref(&self) -> &[ArchivalProofNode] { + &self.0 .0 + } + #[cfg(not(feature = "alloc"))] + #[must_use] + fn as_ref(&self) -> &[ArchivalProofNode] { + self.0 .0 + } +} + +/// NonexistenceProofBody is an XDR Struct defines as: +/// +/// ```text +/// struct NonexistenceProofBody +/// { +/// ColdArchiveBucketEntry entriesToProve<>; +/// +/// // Vector of vectors, where proofLevels[level] +/// // contains all HashNodes that correspond with that level +/// ProofLevel proofLevels<>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct NonexistenceProofBody { + pub entries_to_prove: VecM, + pub proof_levels: VecM, +} + +impl ReadXdr for NonexistenceProofBody { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + entries_to_prove: VecM::::read_xdr(r)?, + proof_levels: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for NonexistenceProofBody { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.entries_to_prove.write_xdr(w)?; + self.proof_levels.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ExistenceProofBody is an XDR Struct defines as: +/// +/// ```text +/// struct ExistenceProofBody +/// { +/// LedgerKey keysToProve<>; +/// +/// // Bounds for each key being proved, where bound[n] +/// // corresponds to keysToProve[n] +/// ColdArchiveBucketEntry lowBoundEntries<>; +/// ColdArchiveBucketEntry highBoundEntries<>; +/// +/// // Vector of vectors, where proofLevels[level] +/// // contains all HashNodes that correspond with that level +/// ProofLevel proofLevels<>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ExistenceProofBody { + pub keys_to_prove: VecM, + pub low_bound_entries: VecM, + pub high_bound_entries: VecM, + pub proof_levels: VecM, +} + +impl ReadXdr for ExistenceProofBody { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + keys_to_prove: VecM::::read_xdr(r)?, + low_bound_entries: VecM::::read_xdr(r)?, + high_bound_entries: VecM::::read_xdr(r)?, + proof_levels: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ExistenceProofBody { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.keys_to_prove.write_xdr(w)?; + self.low_bound_entries.write_xdr(w)?; + self.high_bound_entries.write_xdr(w)?; + self.proof_levels.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ArchivalProofBody is an XDR NestedUnion defines as: +/// +/// ```text +/// union switch (ArchivalProofType t) +/// { +/// case EXISTENCE: +/// NonexistenceProofBody nonexistenceProof; +/// case NONEXISTENCE: +/// ExistenceProofBody existenceProof; +/// } +/// ``` +/// +// union with discriminant ArchivalProofType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum ArchivalProofBody { + Existence(NonexistenceProofBody), + Nonexistence(ExistenceProofBody), +} + +impl ArchivalProofBody { + pub const VARIANTS: [ArchivalProofType; 2] = [ + ArchivalProofType::Existence, + ArchivalProofType::Nonexistence, + ]; + pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Existence(_) => "Existence", + Self::Nonexistence(_) => "Nonexistence", + } + } + + #[must_use] + pub const fn discriminant(&self) -> ArchivalProofType { + #[allow(clippy::match_same_arms)] + match self { + Self::Existence(_) => ArchivalProofType::Existence, + Self::Nonexistence(_) => ArchivalProofType::Nonexistence, + } + } + + #[must_use] + pub const fn variants() -> [ArchivalProofType; 2] { + Self::VARIANTS + } +} + +impl Name for ArchivalProofBody { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for ArchivalProofBody { + #[must_use] + fn discriminant(&self) -> ArchivalProofType { + Self::discriminant(self) + } +} + +impl Variants for ArchivalProofBody { + fn variants() -> slice::Iter<'static, ArchivalProofType> { + Self::VARIANTS.iter() + } +} + +impl Union for ArchivalProofBody {} + +impl ReadXdr for ArchivalProofBody { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: ArchivalProofType = ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + ArchivalProofType::Existence => { + Self::Existence(NonexistenceProofBody::read_xdr(r)?) + } + ArchivalProofType::Nonexistence => { + Self::Nonexistence(ExistenceProofBody::read_xdr(r)?) + } + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for ArchivalProofBody { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::Existence(v) => v.write_xdr(w)?, + Self::Nonexistence(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// ArchivalProof is an XDR Struct defines as: +/// +/// ```text +/// struct ArchivalProof +/// { +/// uint32 epoch; // AST Subtree for this proof +/// +/// union switch (ArchivalProofType t) +/// { +/// case EXISTENCE: +/// NonexistenceProofBody nonexistenceProof; +/// case NONEXISTENCE: +/// ExistenceProofBody existenceProof; +/// } body; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ArchivalProof { + pub epoch: u32, + pub body: ArchivalProofBody, +} + +impl ReadXdr for ArchivalProof { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + epoch: u32::read_xdr(r)?, + body: ArchivalProofBody::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ArchivalProof { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.epoch.write_xdr(w)?; + self.body.write_xdr(w)?; + Ok(()) + }) + } +} + /// SorobanResources is an XDR Struct defines as: /// /// ```text @@ -45234,6 +46240,19 @@ pub enum TypeVariant { LedgerKeyConfigSetting, LedgerKeyTtl, EnvelopeType, + BucketListType, + BucketEntryType, + HotArchiveBucketEntryType, + ColdArchiveBucketEntryType, + BucketMetadata, + BucketMetadataExt, + BucketEntry, + HotArchiveBucketEntry, + ColdArchiveArchivedLeaf, + ColdArchiveDeletedLeaf, + ColdArchiveBoundaryLeaf, + ColdArchiveHashEntry, + ColdArchiveBucketEntry, UpgradeType, StellarValueType, LedgerCloseValueSignature, @@ -45248,13 +46267,6 @@ pub enum TypeVariant { ConfigUpgradeSetKey, LedgerUpgrade, ConfigUpgradeSet, - BucketListType, - BucketEntryType, - HotArchiveBucketEntryType, - BucketMetadata, - BucketMetadataExt, - BucketEntry, - HotArchiveBucketEntry, TxSetComponentType, TxSetComponent, TxSetComponentTxsMaybeDiscountedFee, @@ -45403,6 +46415,13 @@ pub enum TypeVariant { PreconditionType, Preconditions, LedgerFootprint, + ArchivalProofType, + ArchivalProofNode, + ProofLevel, + NonexistenceProofBody, + ExistenceProofBody, + ArchivalProof, + ArchivalProofBody, SorobanResources, SorobanTransactionData, TransactionV0, @@ -45522,7 +46541,7 @@ pub enum TypeVariant { } impl TypeVariant { - pub const VARIANTS: [TypeVariant; 445] = [ + pub const VARIANTS: [TypeVariant; 458] = [ TypeVariant::Value, TypeVariant::ScpBallot, TypeVariant::ScpStatementType, @@ -45683,6 +46702,19 @@ impl TypeVariant { TypeVariant::LedgerKeyConfigSetting, TypeVariant::LedgerKeyTtl, TypeVariant::EnvelopeType, + TypeVariant::BucketListType, + TypeVariant::BucketEntryType, + TypeVariant::HotArchiveBucketEntryType, + TypeVariant::ColdArchiveBucketEntryType, + TypeVariant::BucketMetadata, + TypeVariant::BucketMetadataExt, + TypeVariant::BucketEntry, + TypeVariant::HotArchiveBucketEntry, + TypeVariant::ColdArchiveArchivedLeaf, + TypeVariant::ColdArchiveDeletedLeaf, + TypeVariant::ColdArchiveBoundaryLeaf, + TypeVariant::ColdArchiveHashEntry, + TypeVariant::ColdArchiveBucketEntry, TypeVariant::UpgradeType, TypeVariant::StellarValueType, TypeVariant::LedgerCloseValueSignature, @@ -45697,13 +46729,6 @@ impl TypeVariant { TypeVariant::ConfigUpgradeSetKey, TypeVariant::LedgerUpgrade, TypeVariant::ConfigUpgradeSet, - TypeVariant::BucketListType, - TypeVariant::BucketEntryType, - TypeVariant::HotArchiveBucketEntryType, - TypeVariant::BucketMetadata, - TypeVariant::BucketMetadataExt, - TypeVariant::BucketEntry, - TypeVariant::HotArchiveBucketEntry, TypeVariant::TxSetComponentType, TypeVariant::TxSetComponent, TypeVariant::TxSetComponentTxsMaybeDiscountedFee, @@ -45852,6 +46877,13 @@ impl TypeVariant { TypeVariant::PreconditionType, TypeVariant::Preconditions, TypeVariant::LedgerFootprint, + TypeVariant::ArchivalProofType, + TypeVariant::ArchivalProofNode, + TypeVariant::ProofLevel, + TypeVariant::NonexistenceProofBody, + TypeVariant::ExistenceProofBody, + TypeVariant::ArchivalProof, + TypeVariant::ArchivalProofBody, TypeVariant::SorobanResources, TypeVariant::SorobanTransactionData, TypeVariant::TransactionV0, @@ -45969,7 +47001,7 @@ impl TypeVariant { TypeVariant::BinaryFuseFilterType, TypeVariant::SerializedBinaryFuseFilter, ]; - pub const VARIANTS_STR: [&'static str; 445] = [ + pub const VARIANTS_STR: [&'static str; 458] = [ "Value", "ScpBallot", "ScpStatementType", @@ -46130,6 +47162,19 @@ impl TypeVariant { "LedgerKeyConfigSetting", "LedgerKeyTtl", "EnvelopeType", + "BucketListType", + "BucketEntryType", + "HotArchiveBucketEntryType", + "ColdArchiveBucketEntryType", + "BucketMetadata", + "BucketMetadataExt", + "BucketEntry", + "HotArchiveBucketEntry", + "ColdArchiveArchivedLeaf", + "ColdArchiveDeletedLeaf", + "ColdArchiveBoundaryLeaf", + "ColdArchiveHashEntry", + "ColdArchiveBucketEntry", "UpgradeType", "StellarValueType", "LedgerCloseValueSignature", @@ -46144,13 +47189,6 @@ impl TypeVariant { "ConfigUpgradeSetKey", "LedgerUpgrade", "ConfigUpgradeSet", - "BucketListType", - "BucketEntryType", - "HotArchiveBucketEntryType", - "BucketMetadata", - "BucketMetadataExt", - "BucketEntry", - "HotArchiveBucketEntry", "TxSetComponentType", "TxSetComponent", "TxSetComponentTxsMaybeDiscountedFee", @@ -46299,6 +47337,13 @@ impl TypeVariant { "PreconditionType", "Preconditions", "LedgerFootprint", + "ArchivalProofType", + "ArchivalProofNode", + "ProofLevel", + "NonexistenceProofBody", + "ExistenceProofBody", + "ArchivalProof", + "ArchivalProofBody", "SorobanResources", "SorobanTransactionData", "TransactionV0", @@ -46583,6 +47628,19 @@ impl TypeVariant { Self::LedgerKeyConfigSetting => "LedgerKeyConfigSetting", Self::LedgerKeyTtl => "LedgerKeyTtl", Self::EnvelopeType => "EnvelopeType", + Self::BucketListType => "BucketListType", + Self::BucketEntryType => "BucketEntryType", + Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType", + Self::ColdArchiveBucketEntryType => "ColdArchiveBucketEntryType", + Self::BucketMetadata => "BucketMetadata", + Self::BucketMetadataExt => "BucketMetadataExt", + Self::BucketEntry => "BucketEntry", + Self::HotArchiveBucketEntry => "HotArchiveBucketEntry", + Self::ColdArchiveArchivedLeaf => "ColdArchiveArchivedLeaf", + Self::ColdArchiveDeletedLeaf => "ColdArchiveDeletedLeaf", + Self::ColdArchiveBoundaryLeaf => "ColdArchiveBoundaryLeaf", + Self::ColdArchiveHashEntry => "ColdArchiveHashEntry", + Self::ColdArchiveBucketEntry => "ColdArchiveBucketEntry", Self::UpgradeType => "UpgradeType", Self::StellarValueType => "StellarValueType", Self::LedgerCloseValueSignature => "LedgerCloseValueSignature", @@ -46597,13 +47655,6 @@ impl TypeVariant { Self::ConfigUpgradeSetKey => "ConfigUpgradeSetKey", Self::LedgerUpgrade => "LedgerUpgrade", Self::ConfigUpgradeSet => "ConfigUpgradeSet", - Self::BucketListType => "BucketListType", - Self::BucketEntryType => "BucketEntryType", - Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType", - Self::BucketMetadata => "BucketMetadata", - Self::BucketMetadataExt => "BucketMetadataExt", - Self::BucketEntry => "BucketEntry", - Self::HotArchiveBucketEntry => "HotArchiveBucketEntry", Self::TxSetComponentType => "TxSetComponentType", Self::TxSetComponent => "TxSetComponent", Self::TxSetComponentTxsMaybeDiscountedFee => "TxSetComponentTxsMaybeDiscountedFee", @@ -46758,6 +47809,13 @@ impl TypeVariant { Self::PreconditionType => "PreconditionType", Self::Preconditions => "Preconditions", Self::LedgerFootprint => "LedgerFootprint", + Self::ArchivalProofType => "ArchivalProofType", + Self::ArchivalProofNode => "ArchivalProofNode", + Self::ProofLevel => "ProofLevel", + Self::NonexistenceProofBody => "NonexistenceProofBody", + Self::ExistenceProofBody => "ExistenceProofBody", + Self::ArchivalProof => "ArchivalProof", + Self::ArchivalProofBody => "ArchivalProofBody", Self::SorobanResources => "SorobanResources", Self::SorobanTransactionData => "SorobanTransactionData", Self::TransactionV0 => "TransactionV0", @@ -46883,7 +47941,7 @@ impl TypeVariant { #[must_use] #[allow(clippy::too_many_lines)] - pub const fn variants() -> [TypeVariant; 445] { + pub const fn variants() -> [TypeVariant; 458] { Self::VARIANTS } @@ -47096,6 +48154,23 @@ impl TypeVariant { Self::LedgerKeyConfigSetting => gen.into_root_schema_for::(), Self::LedgerKeyTtl => gen.into_root_schema_for::(), Self::EnvelopeType => gen.into_root_schema_for::(), + Self::BucketListType => gen.into_root_schema_for::(), + Self::BucketEntryType => gen.into_root_schema_for::(), + Self::HotArchiveBucketEntryType => { + gen.into_root_schema_for::() + } + Self::ColdArchiveBucketEntryType => { + gen.into_root_schema_for::() + } + Self::BucketMetadata => gen.into_root_schema_for::(), + Self::BucketMetadataExt => gen.into_root_schema_for::(), + Self::BucketEntry => gen.into_root_schema_for::(), + Self::HotArchiveBucketEntry => gen.into_root_schema_for::(), + Self::ColdArchiveArchivedLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveDeletedLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveBoundaryLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveHashEntry => gen.into_root_schema_for::(), + Self::ColdArchiveBucketEntry => gen.into_root_schema_for::(), Self::UpgradeType => gen.into_root_schema_for::(), Self::StellarValueType => gen.into_root_schema_for::(), Self::LedgerCloseValueSignature => { @@ -47114,15 +48189,6 @@ impl TypeVariant { Self::ConfigUpgradeSetKey => gen.into_root_schema_for::(), Self::LedgerUpgrade => gen.into_root_schema_for::(), Self::ConfigUpgradeSet => gen.into_root_schema_for::(), - Self::BucketListType => gen.into_root_schema_for::(), - Self::BucketEntryType => gen.into_root_schema_for::(), - Self::HotArchiveBucketEntryType => { - gen.into_root_schema_for::() - } - Self::BucketMetadata => gen.into_root_schema_for::(), - Self::BucketMetadataExt => gen.into_root_schema_for::(), - Self::BucketEntry => gen.into_root_schema_for::(), - Self::HotArchiveBucketEntry => gen.into_root_schema_for::(), Self::TxSetComponentType => gen.into_root_schema_for::(), Self::TxSetComponent => gen.into_root_schema_for::(), Self::TxSetComponentTxsMaybeDiscountedFee => { @@ -47345,6 +48411,13 @@ impl TypeVariant { Self::PreconditionType => gen.into_root_schema_for::(), Self::Preconditions => gen.into_root_schema_for::(), Self::LedgerFootprint => gen.into_root_schema_for::(), + Self::ArchivalProofType => gen.into_root_schema_for::(), + Self::ArchivalProofNode => gen.into_root_schema_for::(), + Self::ProofLevel => gen.into_root_schema_for::(), + Self::NonexistenceProofBody => gen.into_root_schema_for::(), + Self::ExistenceProofBody => gen.into_root_schema_for::(), + Self::ArchivalProof => gen.into_root_schema_for::(), + Self::ArchivalProofBody => gen.into_root_schema_for::(), Self::SorobanResources => gen.into_root_schema_for::(), Self::SorobanTransactionData => gen.into_root_schema_for::(), Self::TransactionV0 => gen.into_root_schema_for::(), @@ -47729,6 +48802,19 @@ impl core::str::FromStr for TypeVariant { "LedgerKeyConfigSetting" => Ok(Self::LedgerKeyConfigSetting), "LedgerKeyTtl" => Ok(Self::LedgerKeyTtl), "EnvelopeType" => Ok(Self::EnvelopeType), + "BucketListType" => Ok(Self::BucketListType), + "BucketEntryType" => Ok(Self::BucketEntryType), + "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType), + "ColdArchiveBucketEntryType" => Ok(Self::ColdArchiveBucketEntryType), + "BucketMetadata" => Ok(Self::BucketMetadata), + "BucketMetadataExt" => Ok(Self::BucketMetadataExt), + "BucketEntry" => Ok(Self::BucketEntry), + "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry), + "ColdArchiveArchivedLeaf" => Ok(Self::ColdArchiveArchivedLeaf), + "ColdArchiveDeletedLeaf" => Ok(Self::ColdArchiveDeletedLeaf), + "ColdArchiveBoundaryLeaf" => Ok(Self::ColdArchiveBoundaryLeaf), + "ColdArchiveHashEntry" => Ok(Self::ColdArchiveHashEntry), + "ColdArchiveBucketEntry" => Ok(Self::ColdArchiveBucketEntry), "UpgradeType" => Ok(Self::UpgradeType), "StellarValueType" => Ok(Self::StellarValueType), "LedgerCloseValueSignature" => Ok(Self::LedgerCloseValueSignature), @@ -47743,13 +48829,6 @@ impl core::str::FromStr for TypeVariant { "ConfigUpgradeSetKey" => Ok(Self::ConfigUpgradeSetKey), "LedgerUpgrade" => Ok(Self::LedgerUpgrade), "ConfigUpgradeSet" => Ok(Self::ConfigUpgradeSet), - "BucketListType" => Ok(Self::BucketListType), - "BucketEntryType" => Ok(Self::BucketEntryType), - "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType), - "BucketMetadata" => Ok(Self::BucketMetadata), - "BucketMetadataExt" => Ok(Self::BucketMetadataExt), - "BucketEntry" => Ok(Self::BucketEntry), - "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry), "TxSetComponentType" => Ok(Self::TxSetComponentType), "TxSetComponent" => Ok(Self::TxSetComponent), "TxSetComponentTxsMaybeDiscountedFee" => Ok(Self::TxSetComponentTxsMaybeDiscountedFee), @@ -47910,6 +48989,13 @@ impl core::str::FromStr for TypeVariant { "PreconditionType" => Ok(Self::PreconditionType), "Preconditions" => Ok(Self::Preconditions), "LedgerFootprint" => Ok(Self::LedgerFootprint), + "ArchivalProofType" => Ok(Self::ArchivalProofType), + "ArchivalProofNode" => Ok(Self::ArchivalProofNode), + "ProofLevel" => Ok(Self::ProofLevel), + "NonexistenceProofBody" => Ok(Self::NonexistenceProofBody), + "ExistenceProofBody" => Ok(Self::ExistenceProofBody), + "ArchivalProof" => Ok(Self::ArchivalProof), + "ArchivalProofBody" => Ok(Self::ArchivalProofBody), "SorobanResources" => Ok(Self::SorobanResources), "SorobanTransactionData" => Ok(Self::SorobanTransactionData), "TransactionV0" => Ok(Self::TransactionV0), @@ -48208,6 +49294,19 @@ pub enum Type { LedgerKeyConfigSetting(Box), LedgerKeyTtl(Box), EnvelopeType(Box), + BucketListType(Box), + BucketEntryType(Box), + HotArchiveBucketEntryType(Box), + ColdArchiveBucketEntryType(Box), + BucketMetadata(Box), + BucketMetadataExt(Box), + BucketEntry(Box), + HotArchiveBucketEntry(Box), + ColdArchiveArchivedLeaf(Box), + ColdArchiveDeletedLeaf(Box), + ColdArchiveBoundaryLeaf(Box), + ColdArchiveHashEntry(Box), + ColdArchiveBucketEntry(Box), UpgradeType(Box), StellarValueType(Box), LedgerCloseValueSignature(Box), @@ -48222,13 +49321,6 @@ pub enum Type { ConfigUpgradeSetKey(Box), LedgerUpgrade(Box), ConfigUpgradeSet(Box), - BucketListType(Box), - BucketEntryType(Box), - HotArchiveBucketEntryType(Box), - BucketMetadata(Box), - BucketMetadataExt(Box), - BucketEntry(Box), - HotArchiveBucketEntry(Box), TxSetComponentType(Box), TxSetComponent(Box), TxSetComponentTxsMaybeDiscountedFee(Box), @@ -48377,6 +49469,13 @@ pub enum Type { PreconditionType(Box), Preconditions(Box), LedgerFootprint(Box), + ArchivalProofType(Box), + ArchivalProofNode(Box), + ProofLevel(Box), + NonexistenceProofBody(Box), + ExistenceProofBody(Box), + ArchivalProof(Box), + ArchivalProofBody(Box), SorobanResources(Box), SorobanTransactionData(Box), TransactionV0(Box), @@ -48496,7 +49595,7 @@ pub enum Type { } impl Type { - pub const VARIANTS: [TypeVariant; 445] = [ + pub const VARIANTS: [TypeVariant; 458] = [ TypeVariant::Value, TypeVariant::ScpBallot, TypeVariant::ScpStatementType, @@ -48657,6 +49756,19 @@ impl Type { TypeVariant::LedgerKeyConfigSetting, TypeVariant::LedgerKeyTtl, TypeVariant::EnvelopeType, + TypeVariant::BucketListType, + TypeVariant::BucketEntryType, + TypeVariant::HotArchiveBucketEntryType, + TypeVariant::ColdArchiveBucketEntryType, + TypeVariant::BucketMetadata, + TypeVariant::BucketMetadataExt, + TypeVariant::BucketEntry, + TypeVariant::HotArchiveBucketEntry, + TypeVariant::ColdArchiveArchivedLeaf, + TypeVariant::ColdArchiveDeletedLeaf, + TypeVariant::ColdArchiveBoundaryLeaf, + TypeVariant::ColdArchiveHashEntry, + TypeVariant::ColdArchiveBucketEntry, TypeVariant::UpgradeType, TypeVariant::StellarValueType, TypeVariant::LedgerCloseValueSignature, @@ -48671,13 +49783,6 @@ impl Type { TypeVariant::ConfigUpgradeSetKey, TypeVariant::LedgerUpgrade, TypeVariant::ConfigUpgradeSet, - TypeVariant::BucketListType, - TypeVariant::BucketEntryType, - TypeVariant::HotArchiveBucketEntryType, - TypeVariant::BucketMetadata, - TypeVariant::BucketMetadataExt, - TypeVariant::BucketEntry, - TypeVariant::HotArchiveBucketEntry, TypeVariant::TxSetComponentType, TypeVariant::TxSetComponent, TypeVariant::TxSetComponentTxsMaybeDiscountedFee, @@ -48826,6 +49931,13 @@ impl Type { TypeVariant::PreconditionType, TypeVariant::Preconditions, TypeVariant::LedgerFootprint, + TypeVariant::ArchivalProofType, + TypeVariant::ArchivalProofNode, + TypeVariant::ProofLevel, + TypeVariant::NonexistenceProofBody, + TypeVariant::ExistenceProofBody, + TypeVariant::ArchivalProof, + TypeVariant::ArchivalProofBody, TypeVariant::SorobanResources, TypeVariant::SorobanTransactionData, TypeVariant::TransactionV0, @@ -48943,7 +50055,7 @@ impl Type { TypeVariant::BinaryFuseFilterType, TypeVariant::SerializedBinaryFuseFilter, ]; - pub const VARIANTS_STR: [&'static str; 445] = [ + pub const VARIANTS_STR: [&'static str; 458] = [ "Value", "ScpBallot", "ScpStatementType", @@ -49104,6 +50216,19 @@ impl Type { "LedgerKeyConfigSetting", "LedgerKeyTtl", "EnvelopeType", + "BucketListType", + "BucketEntryType", + "HotArchiveBucketEntryType", + "ColdArchiveBucketEntryType", + "BucketMetadata", + "BucketMetadataExt", + "BucketEntry", + "HotArchiveBucketEntry", + "ColdArchiveArchivedLeaf", + "ColdArchiveDeletedLeaf", + "ColdArchiveBoundaryLeaf", + "ColdArchiveHashEntry", + "ColdArchiveBucketEntry", "UpgradeType", "StellarValueType", "LedgerCloseValueSignature", @@ -49118,13 +50243,6 @@ impl Type { "ConfigUpgradeSetKey", "LedgerUpgrade", "ConfigUpgradeSet", - "BucketListType", - "BucketEntryType", - "HotArchiveBucketEntryType", - "BucketMetadata", - "BucketMetadataExt", - "BucketEntry", - "HotArchiveBucketEntry", "TxSetComponentType", "TxSetComponent", "TxSetComponentTxsMaybeDiscountedFee", @@ -49273,6 +50391,13 @@ impl Type { "PreconditionType", "Preconditions", "LedgerFootprint", + "ArchivalProofType", + "ArchivalProofNode", + "ProofLevel", + "NonexistenceProofBody", + "ExistenceProofBody", + "ArchivalProof", + "ArchivalProofBody", "SorobanResources", "SorobanTransactionData", "TransactionV0", @@ -50051,6 +51176,65 @@ impl Type { TypeVariant::EnvelopeType => r.with_limited_depth(|r| { Ok(Self::EnvelopeType(Box::new(EnvelopeType::read_xdr(r)?))) }), + TypeVariant::BucketListType => r.with_limited_depth(|r| { + Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?))) + }), + TypeVariant::BucketEntryType => r.with_limited_depth(|r| { + Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr( + r, + )?))) + }), + TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| { + Ok(Self::HotArchiveBucketEntryType(Box::new( + HotArchiveBucketEntryType::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBucketEntryType => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBucketEntryType(Box::new( + ColdArchiveBucketEntryType::read_xdr(r)?, + ))) + }), + TypeVariant::BucketMetadata => r.with_limited_depth(|r| { + Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?))) + }), + TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| { + Ok(Self::BucketMetadataExt(Box::new( + BucketMetadataExt::read_xdr(r)?, + ))) + }), + TypeVariant::BucketEntry => { + r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?)))) + } + TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| { + Ok(Self::HotArchiveBucketEntry(Box::new( + HotArchiveBucketEntry::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveArchivedLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveArchivedLeaf(Box::new( + ColdArchiveArchivedLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveDeletedLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveDeletedLeaf(Box::new( + ColdArchiveDeletedLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBoundaryLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBoundaryLeaf(Box::new( + ColdArchiveBoundaryLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveHashEntry => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveHashEntry(Box::new( + ColdArchiveHashEntry::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBucketEntry => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBucketEntry(Box::new( + ColdArchiveBucketEntry::read_xdr(r)?, + ))) + }), TypeVariant::UpgradeType => { r.with_limited_depth(|r| Ok(Self::UpgradeType(Box::new(UpgradeType::read_xdr(r)?)))) } @@ -50113,35 +51297,6 @@ impl Type { ConfigUpgradeSet::read_xdr(r)?, ))) }), - TypeVariant::BucketListType => r.with_limited_depth(|r| { - Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?))) - }), - TypeVariant::BucketEntryType => r.with_limited_depth(|r| { - Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr( - r, - )?))) - }), - TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| { - Ok(Self::HotArchiveBucketEntryType(Box::new( - HotArchiveBucketEntryType::read_xdr(r)?, - ))) - }), - TypeVariant::BucketMetadata => r.with_limited_depth(|r| { - Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?))) - }), - TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| { - Ok(Self::BucketMetadataExt(Box::new( - BucketMetadataExt::read_xdr(r)?, - ))) - }), - TypeVariant::BucketEntry => { - r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?)))) - } - TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| { - Ok(Self::HotArchiveBucketEntry(Box::new( - HotArchiveBucketEntry::read_xdr(r)?, - ))) - }), TypeVariant::TxSetComponentType => r.with_limited_depth(|r| { Ok(Self::TxSetComponentType(Box::new( TxSetComponentType::read_xdr(r)?, @@ -50802,6 +51957,37 @@ impl Type { r, )?))) }), + TypeVariant::ArchivalProofType => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofType(Box::new( + ArchivalProofType::read_xdr(r)?, + ))) + }), + TypeVariant::ArchivalProofNode => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofNode(Box::new( + ArchivalProofNode::read_xdr(r)?, + ))) + }), + TypeVariant::ProofLevel => { + r.with_limited_depth(|r| Ok(Self::ProofLevel(Box::new(ProofLevel::read_xdr(r)?)))) + } + TypeVariant::NonexistenceProofBody => r.with_limited_depth(|r| { + Ok(Self::NonexistenceProofBody(Box::new( + NonexistenceProofBody::read_xdr(r)?, + ))) + }), + TypeVariant::ExistenceProofBody => r.with_limited_depth(|r| { + Ok(Self::ExistenceProofBody(Box::new( + ExistenceProofBody::read_xdr(r)?, + ))) + }), + TypeVariant::ArchivalProof => r.with_limited_depth(|r| { + Ok(Self::ArchivalProof(Box::new(ArchivalProof::read_xdr(r)?))) + }), + TypeVariant::ArchivalProofBody => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofBody(Box::new( + ArchivalProofBody::read_xdr(r)?, + ))) + }), TypeVariant::SorobanResources => r.with_limited_depth(|r| { Ok(Self::SorobanResources(Box::new( SorobanResources::read_xdr(r)?, @@ -52038,6 +53224,58 @@ impl Type { ReadXdrIter::<_, EnvelopeType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, ColdArchiveHashEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, UpgradeType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))), @@ -52094,34 +53332,6 @@ impl Type { ReadXdrIter::<_, ConfigUpgradeSet>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, TxSetComponentType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))), @@ -52764,6 +53974,34 @@ impl Type { ReadXdrIter::<_, LedgerFootprint>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, ArchivalProofType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, ArchivalProofNode>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, ProofLevel>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, NonexistenceProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, ExistenceProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, ArchivalProof>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, ArchivalProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, SorobanResources>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))), @@ -54042,6 +55280,76 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t.0)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t.0)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t.0)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t.0)))), @@ -54107,37 +55415,6 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t.0)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, Frame>::new( - &mut r.inner, - r.limits.clone(), - ) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t.0)))), @@ -54890,6 +56167,34 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t.0)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t.0)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t.0)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t.0)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t.0)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t.0)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t.0)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t.0)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t.0)))), @@ -56157,6 +57462,58 @@ impl Type { ReadXdrIter::<_, EnvelopeType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, ColdArchiveHashEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, UpgradeType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))), @@ -56213,34 +57570,6 @@ impl Type { ReadXdrIter::<_, ConfigUpgradeSet>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, TxSetComponentType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))), @@ -56844,6 +58173,34 @@ impl Type { ReadXdrIter::<_, LedgerFootprint>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, ArchivalProofType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, ArchivalProofNode>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, ProofLevel>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, NonexistenceProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, ExistenceProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, ArchivalProof>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, ArchivalProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, SorobanResources>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))), @@ -57751,6 +59108,45 @@ impl Type { TypeVariant::EnvelopeType => { Ok(Self::EnvelopeType(Box::new(serde_json::from_reader(r)?))) } + TypeVariant::BucketListType => { + Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::BucketEntryType => { + Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType( + Box::new(serde_json::from_reader(r)?), + )), + TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType( + Box::new(serde_json::from_reader(r)?), + )), + TypeVariant::BucketMetadata => { + Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::BucketEntry => { + Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new( + serde_json::from_reader(r)?, + ))), TypeVariant::UpgradeType => { Ok(Self::UpgradeType(Box::new(serde_json::from_reader(r)?))) } @@ -57793,27 +59189,6 @@ impl Type { TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new( serde_json::from_reader(r)?, ))), - TypeVariant::BucketListType => { - Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::BucketEntryType => { - Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType( - Box::new(serde_json::from_reader(r)?), - )), - TypeVariant::BucketMetadata => { - Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new( - serde_json::from_reader(r)?, - ))), - TypeVariant::BucketEntry => { - Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new( - serde_json::from_reader(r)?, - ))), TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new( serde_json::from_reader(r)?, ))), @@ -58232,6 +59607,25 @@ impl Type { TypeVariant::LedgerFootprint => { Ok(Self::LedgerFootprint(Box::new(serde_json::from_reader(r)?))) } + TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(serde_json::from_reader(r)?))), + TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ArchivalProof => { + Ok(Self::ArchivalProof(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new( + serde_json::from_reader(r)?, + ))), TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new( serde_json::from_reader(r)?, ))), @@ -58725,6 +60119,19 @@ impl Type { Self::LedgerKeyConfigSetting(ref v) => v.as_ref(), Self::LedgerKeyTtl(ref v) => v.as_ref(), Self::EnvelopeType(ref v) => v.as_ref(), + Self::BucketListType(ref v) => v.as_ref(), + Self::BucketEntryType(ref v) => v.as_ref(), + Self::HotArchiveBucketEntryType(ref v) => v.as_ref(), + Self::ColdArchiveBucketEntryType(ref v) => v.as_ref(), + Self::BucketMetadata(ref v) => v.as_ref(), + Self::BucketMetadataExt(ref v) => v.as_ref(), + Self::BucketEntry(ref v) => v.as_ref(), + Self::HotArchiveBucketEntry(ref v) => v.as_ref(), + Self::ColdArchiveArchivedLeaf(ref v) => v.as_ref(), + Self::ColdArchiveDeletedLeaf(ref v) => v.as_ref(), + Self::ColdArchiveBoundaryLeaf(ref v) => v.as_ref(), + Self::ColdArchiveHashEntry(ref v) => v.as_ref(), + Self::ColdArchiveBucketEntry(ref v) => v.as_ref(), Self::UpgradeType(ref v) => v.as_ref(), Self::StellarValueType(ref v) => v.as_ref(), Self::LedgerCloseValueSignature(ref v) => v.as_ref(), @@ -58739,13 +60146,6 @@ impl Type { Self::ConfigUpgradeSetKey(ref v) => v.as_ref(), Self::LedgerUpgrade(ref v) => v.as_ref(), Self::ConfigUpgradeSet(ref v) => v.as_ref(), - Self::BucketListType(ref v) => v.as_ref(), - Self::BucketEntryType(ref v) => v.as_ref(), - Self::HotArchiveBucketEntryType(ref v) => v.as_ref(), - Self::BucketMetadata(ref v) => v.as_ref(), - Self::BucketMetadataExt(ref v) => v.as_ref(), - Self::BucketEntry(ref v) => v.as_ref(), - Self::HotArchiveBucketEntry(ref v) => v.as_ref(), Self::TxSetComponentType(ref v) => v.as_ref(), Self::TxSetComponent(ref v) => v.as_ref(), Self::TxSetComponentTxsMaybeDiscountedFee(ref v) => v.as_ref(), @@ -58894,6 +60294,13 @@ impl Type { Self::PreconditionType(ref v) => v.as_ref(), Self::Preconditions(ref v) => v.as_ref(), Self::LedgerFootprint(ref v) => v.as_ref(), + Self::ArchivalProofType(ref v) => v.as_ref(), + Self::ArchivalProofNode(ref v) => v.as_ref(), + Self::ProofLevel(ref v) => v.as_ref(), + Self::NonexistenceProofBody(ref v) => v.as_ref(), + Self::ExistenceProofBody(ref v) => v.as_ref(), + Self::ArchivalProof(ref v) => v.as_ref(), + Self::ArchivalProofBody(ref v) => v.as_ref(), Self::SorobanResources(ref v) => v.as_ref(), Self::SorobanTransactionData(ref v) => v.as_ref(), Self::TransactionV0(ref v) => v.as_ref(), @@ -59183,6 +60590,19 @@ impl Type { Self::LedgerKeyConfigSetting(_) => "LedgerKeyConfigSetting", Self::LedgerKeyTtl(_) => "LedgerKeyTtl", Self::EnvelopeType(_) => "EnvelopeType", + Self::BucketListType(_) => "BucketListType", + Self::BucketEntryType(_) => "BucketEntryType", + Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType", + Self::ColdArchiveBucketEntryType(_) => "ColdArchiveBucketEntryType", + Self::BucketMetadata(_) => "BucketMetadata", + Self::BucketMetadataExt(_) => "BucketMetadataExt", + Self::BucketEntry(_) => "BucketEntry", + Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry", + Self::ColdArchiveArchivedLeaf(_) => "ColdArchiveArchivedLeaf", + Self::ColdArchiveDeletedLeaf(_) => "ColdArchiveDeletedLeaf", + Self::ColdArchiveBoundaryLeaf(_) => "ColdArchiveBoundaryLeaf", + Self::ColdArchiveHashEntry(_) => "ColdArchiveHashEntry", + Self::ColdArchiveBucketEntry(_) => "ColdArchiveBucketEntry", Self::UpgradeType(_) => "UpgradeType", Self::StellarValueType(_) => "StellarValueType", Self::LedgerCloseValueSignature(_) => "LedgerCloseValueSignature", @@ -59197,13 +60617,6 @@ impl Type { Self::ConfigUpgradeSetKey(_) => "ConfigUpgradeSetKey", Self::LedgerUpgrade(_) => "LedgerUpgrade", Self::ConfigUpgradeSet(_) => "ConfigUpgradeSet", - Self::BucketListType(_) => "BucketListType", - Self::BucketEntryType(_) => "BucketEntryType", - Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType", - Self::BucketMetadata(_) => "BucketMetadata", - Self::BucketMetadataExt(_) => "BucketMetadataExt", - Self::BucketEntry(_) => "BucketEntry", - Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry", Self::TxSetComponentType(_) => "TxSetComponentType", Self::TxSetComponent(_) => "TxSetComponent", Self::TxSetComponentTxsMaybeDiscountedFee(_) => "TxSetComponentTxsMaybeDiscountedFee", @@ -59362,6 +60775,13 @@ impl Type { Self::PreconditionType(_) => "PreconditionType", Self::Preconditions(_) => "Preconditions", Self::LedgerFootprint(_) => "LedgerFootprint", + Self::ArchivalProofType(_) => "ArchivalProofType", + Self::ArchivalProofNode(_) => "ArchivalProofNode", + Self::ProofLevel(_) => "ProofLevel", + Self::NonexistenceProofBody(_) => "NonexistenceProofBody", + Self::ExistenceProofBody(_) => "ExistenceProofBody", + Self::ArchivalProof(_) => "ArchivalProof", + Self::ArchivalProofBody(_) => "ArchivalProofBody", Self::SorobanResources(_) => "SorobanResources", Self::SorobanTransactionData(_) => "SorobanTransactionData", Self::TransactionV0(_) => "TransactionV0", @@ -59491,7 +60911,7 @@ impl Type { #[must_use] #[allow(clippy::too_many_lines)] - pub const fn variants() -> [TypeVariant; 445] { + pub const fn variants() -> [TypeVariant; 458] { Self::VARIANTS } @@ -59675,6 +61095,19 @@ impl Type { Self::LedgerKeyConfigSetting(_) => TypeVariant::LedgerKeyConfigSetting, Self::LedgerKeyTtl(_) => TypeVariant::LedgerKeyTtl, Self::EnvelopeType(_) => TypeVariant::EnvelopeType, + Self::BucketListType(_) => TypeVariant::BucketListType, + Self::BucketEntryType(_) => TypeVariant::BucketEntryType, + Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType, + Self::ColdArchiveBucketEntryType(_) => TypeVariant::ColdArchiveBucketEntryType, + Self::BucketMetadata(_) => TypeVariant::BucketMetadata, + Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt, + Self::BucketEntry(_) => TypeVariant::BucketEntry, + Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry, + Self::ColdArchiveArchivedLeaf(_) => TypeVariant::ColdArchiveArchivedLeaf, + Self::ColdArchiveDeletedLeaf(_) => TypeVariant::ColdArchiveDeletedLeaf, + Self::ColdArchiveBoundaryLeaf(_) => TypeVariant::ColdArchiveBoundaryLeaf, + Self::ColdArchiveHashEntry(_) => TypeVariant::ColdArchiveHashEntry, + Self::ColdArchiveBucketEntry(_) => TypeVariant::ColdArchiveBucketEntry, Self::UpgradeType(_) => TypeVariant::UpgradeType, Self::StellarValueType(_) => TypeVariant::StellarValueType, Self::LedgerCloseValueSignature(_) => TypeVariant::LedgerCloseValueSignature, @@ -59689,13 +61122,6 @@ impl Type { Self::ConfigUpgradeSetKey(_) => TypeVariant::ConfigUpgradeSetKey, Self::LedgerUpgrade(_) => TypeVariant::LedgerUpgrade, Self::ConfigUpgradeSet(_) => TypeVariant::ConfigUpgradeSet, - Self::BucketListType(_) => TypeVariant::BucketListType, - Self::BucketEntryType(_) => TypeVariant::BucketEntryType, - Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType, - Self::BucketMetadata(_) => TypeVariant::BucketMetadata, - Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt, - Self::BucketEntry(_) => TypeVariant::BucketEntry, - Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry, Self::TxSetComponentType(_) => TypeVariant::TxSetComponentType, Self::TxSetComponent(_) => TypeVariant::TxSetComponent, Self::TxSetComponentTxsMaybeDiscountedFee(_) => { @@ -59868,6 +61294,13 @@ impl Type { Self::PreconditionType(_) => TypeVariant::PreconditionType, Self::Preconditions(_) => TypeVariant::Preconditions, Self::LedgerFootprint(_) => TypeVariant::LedgerFootprint, + Self::ArchivalProofType(_) => TypeVariant::ArchivalProofType, + Self::ArchivalProofNode(_) => TypeVariant::ArchivalProofNode, + Self::ProofLevel(_) => TypeVariant::ProofLevel, + Self::NonexistenceProofBody(_) => TypeVariant::NonexistenceProofBody, + Self::ExistenceProofBody(_) => TypeVariant::ExistenceProofBody, + Self::ArchivalProof(_) => TypeVariant::ArchivalProof, + Self::ArchivalProofBody(_) => TypeVariant::ArchivalProofBody, Self::SorobanResources(_) => TypeVariant::SorobanResources, Self::SorobanTransactionData(_) => TypeVariant::SorobanTransactionData, Self::TransactionV0(_) => TypeVariant::TransactionV0, @@ -60192,6 +61625,19 @@ impl WriteXdr for Type { Self::LedgerKeyConfigSetting(v) => v.write_xdr(w), Self::LedgerKeyTtl(v) => v.write_xdr(w), Self::EnvelopeType(v) => v.write_xdr(w), + Self::BucketListType(v) => v.write_xdr(w), + Self::BucketEntryType(v) => v.write_xdr(w), + Self::HotArchiveBucketEntryType(v) => v.write_xdr(w), + Self::ColdArchiveBucketEntryType(v) => v.write_xdr(w), + Self::BucketMetadata(v) => v.write_xdr(w), + Self::BucketMetadataExt(v) => v.write_xdr(w), + Self::BucketEntry(v) => v.write_xdr(w), + Self::HotArchiveBucketEntry(v) => v.write_xdr(w), + Self::ColdArchiveArchivedLeaf(v) => v.write_xdr(w), + Self::ColdArchiveDeletedLeaf(v) => v.write_xdr(w), + Self::ColdArchiveBoundaryLeaf(v) => v.write_xdr(w), + Self::ColdArchiveHashEntry(v) => v.write_xdr(w), + Self::ColdArchiveBucketEntry(v) => v.write_xdr(w), Self::UpgradeType(v) => v.write_xdr(w), Self::StellarValueType(v) => v.write_xdr(w), Self::LedgerCloseValueSignature(v) => v.write_xdr(w), @@ -60206,13 +61652,6 @@ impl WriteXdr for Type { Self::ConfigUpgradeSetKey(v) => v.write_xdr(w), Self::LedgerUpgrade(v) => v.write_xdr(w), Self::ConfigUpgradeSet(v) => v.write_xdr(w), - Self::BucketListType(v) => v.write_xdr(w), - Self::BucketEntryType(v) => v.write_xdr(w), - Self::HotArchiveBucketEntryType(v) => v.write_xdr(w), - Self::BucketMetadata(v) => v.write_xdr(w), - Self::BucketMetadataExt(v) => v.write_xdr(w), - Self::BucketEntry(v) => v.write_xdr(w), - Self::HotArchiveBucketEntry(v) => v.write_xdr(w), Self::TxSetComponentType(v) => v.write_xdr(w), Self::TxSetComponent(v) => v.write_xdr(w), Self::TxSetComponentTxsMaybeDiscountedFee(v) => v.write_xdr(w), @@ -60361,6 +61800,13 @@ impl WriteXdr for Type { Self::PreconditionType(v) => v.write_xdr(w), Self::Preconditions(v) => v.write_xdr(w), Self::LedgerFootprint(v) => v.write_xdr(w), + Self::ArchivalProofType(v) => v.write_xdr(w), + Self::ArchivalProofNode(v) => v.write_xdr(w), + Self::ProofLevel(v) => v.write_xdr(w), + Self::NonexistenceProofBody(v) => v.write_xdr(w), + Self::ExistenceProofBody(v) => v.write_xdr(w), + Self::ArchivalProof(v) => v.write_xdr(w), + Self::ArchivalProofBody(v) => v.write_xdr(w), Self::SorobanResources(v) => v.write_xdr(w), Self::SorobanTransactionData(v) => v.write_xdr(w), Self::TransactionV0(v) => v.write_xdr(w), diff --git a/src/next/generated.rs b/src/next/generated.rs index 93099b1d..15458e50 100644 --- a/src/next/generated.rs +++ b/src/next/generated.rs @@ -46,11 +46,11 @@ pub const XDR_FILES_SHA256: [(&str, &str); 12] = [ ), ( "xdr/next/Stellar-ledger-entries.x", - "77dc7062ae6d0812136333e12e35b2294d7c2896a536be9c811eb0ed2abbbccb", + "5dea4f695f01aeb57ad97b97646f3da7dcf5ec35748e5065b19de429fb762cbc", ), ( "xdr/next/Stellar-ledger.x", - "0faadb179156fa2664366812e3757f0c6e637439dc2e7941c5dfcc8650b5d93d", + "79692619a21814327f00560b47742f0074c9d9712051bbdc135d851ffe3fcfed", ), ( "xdr/next/Stellar-overlay.x", @@ -58,7 +58,7 @@ pub const XDR_FILES_SHA256: [(&str, &str); 12] = [ ), ( "xdr/next/Stellar-transaction.x", - "747639c267aa298c01e5c026a776679454171d717207ef60aed158c5dedae957", + "bf6050037be5e1a42371a1cc151be23c8908b35220a8f1d8b0d4d6bd7f3b36ed", ), ( "xdr/next/Stellar-types.x", @@ -17526,119 +17526,131 @@ impl WriteXdr for EnvelopeType { } } -/// UpgradeType is an XDR Typedef defines as: +/// BucketListType is an XDR Enum defines as: /// /// ```text -/// typedef opaque UpgradeType<128>; +/// enum BucketListType +/// { +/// LIVE = 0, +/// HOT_ARCHIVE = 1, +/// COLD_ARCHIVE = 2 +/// }; /// ``` /// -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[derive(Default)] #[cfg_attr( all(feature = "serde", feature = "alloc"), derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[derive(Debug)] -pub struct UpgradeType(pub BytesM<128>); - -impl From for BytesM<128> { - #[must_use] - fn from(x: UpgradeType) -> Self { - x.0 - } +#[repr(i32)] +pub enum BucketListType { + Live = 0, + HotArchive = 1, + ColdArchive = 2, } -impl From> for UpgradeType { +impl BucketListType { + pub const VARIANTS: [BucketListType; 3] = [ + BucketListType::Live, + BucketListType::HotArchive, + BucketListType::ColdArchive, + ]; + pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"]; + #[must_use] - fn from(x: BytesM<128>) -> Self { - UpgradeType(x) + pub const fn name(&self) -> &'static str { + match self { + Self::Live => "Live", + Self::HotArchive => "HotArchive", + Self::ColdArchive => "ColdArchive", + } } -} -impl AsRef> for UpgradeType { #[must_use] - fn as_ref(&self) -> &BytesM<128> { - &self.0 + pub const fn variants() -> [BucketListType; 3] { + Self::VARIANTS } } -impl ReadXdr for UpgradeType { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - let i = BytesM::<128>::read_xdr(r)?; - let v = UpgradeType(i); - Ok(v) - }) +impl Name for BucketListType { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) } } -impl WriteXdr for UpgradeType { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| self.0.write_xdr(w)) +impl Variants for BucketListType { + fn variants() -> slice::Iter<'static, BucketListType> { + Self::VARIANTS.iter() } } -impl Deref for UpgradeType { - type Target = BytesM<128>; - fn deref(&self) -> &Self::Target { - &self.0 - } -} +impl Enum for BucketListType {} -impl From for Vec { - #[must_use] - fn from(x: UpgradeType) -> Self { - x.0 .0 +impl fmt::Display for BucketListType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl TryFrom> for UpgradeType { +impl TryFrom for BucketListType { type Error = Error; - fn try_from(x: Vec) -> Result { - Ok(UpgradeType(x.try_into()?)) - } -} -#[cfg(feature = "alloc")] -impl TryFrom<&Vec> for UpgradeType { - type Error = Error; - fn try_from(x: &Vec) -> Result { - Ok(UpgradeType(x.try_into()?)) + fn try_from(i: i32) -> Result { + let e = match i { + 0 => BucketListType::Live, + 1 => BucketListType::HotArchive, + 2 => BucketListType::ColdArchive, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) } } -impl AsRef> for UpgradeType { +impl From for i32 { #[must_use] - fn as_ref(&self) -> &Vec { - &self.0 .0 + fn from(e: BucketListType) -> Self { + e as Self } } -impl AsRef<[u8]> for UpgradeType { - #[cfg(feature = "alloc")] - #[must_use] - fn as_ref(&self) -> &[u8] { - &self.0 .0 +impl ReadXdr for BucketListType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) + }) } - #[cfg(not(feature = "alloc"))] - #[must_use] - fn as_ref(&self) -> &[u8] { - self.0 .0 +} + +impl WriteXdr for BucketListType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + let i: i32 = (*self).into(); + i.write_xdr(w) + }) } } -/// StellarValueType is an XDR Enum defines as: +/// BucketEntryType is an XDR Enum defines as: /// /// ```text -/// enum StellarValueType +/// enum BucketEntryType /// { -/// STELLAR_VALUE_BASIC = 0, -/// STELLAR_VALUE_SIGNED = 1 +/// METAENTRY = +/// -1, // At-and-after protocol 11: bucket metadata, should come first. +/// LIVEENTRY = 0, // Before protocol 11: created-or-updated; +/// // At-and-after protocol 11: only updated. +/// DEADENTRY = 1, +/// INITENTRY = 2 // At-and-after protocol 11: only created. /// }; /// ``` /// @@ -17652,57 +17664,69 @@ impl AsRef<[u8]> for UpgradeType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum StellarValueType { - Basic = 0, - Signed = 1, +pub enum BucketEntryType { + Metaentry = -1, + Liveentry = 0, + Deadentry = 1, + Initentry = 2, } -impl StellarValueType { - pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; - pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; +impl BucketEntryType { + pub const VARIANTS: [BucketEntryType; 4] = [ + BucketEntryType::Metaentry, + BucketEntryType::Liveentry, + BucketEntryType::Deadentry, + BucketEntryType::Initentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = + ["Metaentry", "Liveentry", "Deadentry", "Initentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Basic => "Basic", - Self::Signed => "Signed", + Self::Metaentry => "Metaentry", + Self::Liveentry => "Liveentry", + Self::Deadentry => "Deadentry", + Self::Initentry => "Initentry", } } #[must_use] - pub const fn variants() -> [StellarValueType; 2] { + pub const fn variants() -> [BucketEntryType; 4] { Self::VARIANTS } } -impl Name for StellarValueType { +impl Name for BucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for StellarValueType { - fn variants() -> slice::Iter<'static, StellarValueType> { +impl Variants for BucketEntryType { + fn variants() -> slice::Iter<'static, BucketEntryType> { Self::VARIANTS.iter() } } -impl Enum for StellarValueType {} +impl Enum for BucketEntryType {} -impl fmt::Display for StellarValueType { +impl fmt::Display for BucketEntryType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for StellarValueType { +impl TryFrom for BucketEntryType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 0 => StellarValueType::Basic, - 1 => StellarValueType::Signed, + -1 => BucketEntryType::Metaentry, + 0 => BucketEntryType::Liveentry, + 1 => BucketEntryType::Deadentry, + 2 => BucketEntryType::Initentry, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -17710,14 +17734,14 @@ impl TryFrom for StellarValueType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: StellarValueType) -> Self { + fn from(e: BucketEntryType) -> Self { e as Self } } -impl ReadXdr for StellarValueType { +impl ReadXdr for BucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -17728,7 +17752,7 @@ impl ReadXdr for StellarValueType { } } -impl WriteXdr for StellarValueType { +impl WriteXdr for BucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -17738,66 +17762,22 @@ impl WriteXdr for StellarValueType { } } -/// LedgerCloseValueSignature is an XDR Struct defines as: +/// HotArchiveBucketEntryType is an XDR Enum defines as: /// /// ```text -/// struct LedgerCloseValueSignature +/// enum HotArchiveBucketEntryType /// { -/// NodeID nodeID; // which node introduced the value -/// Signature signature; // nodeID's signature +/// HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +/// HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived +/// HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but +/// // has been added back to the live BucketList. +/// // Does not need to be persisted. +/// HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) /// }; /// ``` /// -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerCloseValueSignature { - pub node_id: NodeId, - pub signature: Signature, -} - -impl ReadXdr for LedgerCloseValueSignature { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - Ok(Self { - node_id: NodeId::read_xdr(r)?, - signature: Signature::read_xdr(r)?, - }) - }) - } -} - -impl WriteXdr for LedgerCloseValueSignature { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| { - self.node_id.write_xdr(w)?; - self.signature.write_xdr(w)?; - Ok(()) - }) - } -} - -/// StellarValueExt is an XDR NestedUnion defines as: -/// -/// ```text -/// union switch (StellarValueType v) -/// { -/// case STELLAR_VALUE_BASIC: -/// void; -/// case STELLAR_VALUE_SIGNED: -/// LedgerCloseValueSignature lcValueSignature; -/// } -/// ``` -/// -// union with discriminant StellarValueType -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -17805,178 +17785,114 @@ impl WriteXdr for LedgerCloseValueSignature { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[allow(clippy::large_enum_variant)] -pub enum StellarValueExt { - Basic, - Signed(LedgerCloseValueSignature), +#[repr(i32)] +pub enum HotArchiveBucketEntryType { + Metaentry = -1, + Archived = 0, + Live = 1, + Deleted = 2, } -impl StellarValueExt { - pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; - pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; +impl HotArchiveBucketEntryType { + pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ + HotArchiveBucketEntryType::Metaentry, + HotArchiveBucketEntryType::Archived, + HotArchiveBucketEntryType::Live, + HotArchiveBucketEntryType::Deleted, + ]; + pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Basic => "Basic", - Self::Signed(_) => "Signed", - } - } - - #[must_use] - pub const fn discriminant(&self) -> StellarValueType { - #[allow(clippy::match_same_arms)] - match self { - Self::Basic => StellarValueType::Basic, - Self::Signed(_) => StellarValueType::Signed, + Self::Metaentry => "Metaentry", + Self::Archived => "Archived", + Self::Live => "Live", + Self::Deleted => "Deleted", } } #[must_use] - pub const fn variants() -> [StellarValueType; 2] { + pub const fn variants() -> [HotArchiveBucketEntryType; 4] { Self::VARIANTS } } -impl Name for StellarValueExt { +impl Name for HotArchiveBucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for StellarValueExt { - #[must_use] - fn discriminant(&self) -> StellarValueType { - Self::discriminant(self) - } -} - -impl Variants for StellarValueExt { - fn variants() -> slice::Iter<'static, StellarValueType> { +impl Variants for HotArchiveBucketEntryType { + fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { Self::VARIANTS.iter() } } -impl Union for StellarValueExt {} +impl Enum for HotArchiveBucketEntryType {} -impl ReadXdr for StellarValueExt { - #[cfg(feature = "std")] - fn read_xdr(r: &mut Limited) -> Result { - r.with_limited_depth(|r| { - let dv: StellarValueType = ::read_xdr(r)?; - #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] - let v = match dv { - StellarValueType::Basic => Self::Basic, - StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?), - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(v) - }) +impl fmt::Display for HotArchiveBucketEntryType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl WriteXdr for StellarValueExt { - #[cfg(feature = "std")] - fn write_xdr(&self, w: &mut Limited) -> Result<()> { - w.with_limited_depth(|w| { - self.discriminant().write_xdr(w)?; - #[allow(clippy::match_same_arms)] - match self { - Self::Basic => ().write_xdr(w)?, - Self::Signed(v) => v.write_xdr(w)?, - }; - Ok(()) - }) +impl TryFrom for HotArchiveBucketEntryType { + type Error = Error; + + fn try_from(i: i32) -> Result { + let e = match i { + -1 => HotArchiveBucketEntryType::Metaentry, + 0 => HotArchiveBucketEntryType::Archived, + 1 => HotArchiveBucketEntryType::Live, + 2 => HotArchiveBucketEntryType::Deleted, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) } } -/// StellarValue is an XDR Struct defines as: -/// -/// ```text -/// struct StellarValue -/// { -/// Hash txSetHash; // transaction set to apply to previous ledger -/// TimePoint closeTime; // network close time -/// -/// // upgrades to apply to the previous ledger (usually empty) -/// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop -/// // unknown steps during consensus if needed. -/// // see notes below on 'LedgerUpgrade' for more detail -/// // max size is dictated by number of upgrade types (+ room for future) -/// UpgradeType upgrades<6>; -/// -/// // reserved for future use -/// union switch (StellarValueType v) -/// { -/// case STELLAR_VALUE_BASIC: -/// void; -/// case STELLAR_VALUE_SIGNED: -/// LedgerCloseValueSignature lcValueSignature; -/// } -/// ext; -/// }; -/// ``` -/// -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct StellarValue { - pub tx_set_hash: Hash, - pub close_time: TimePoint, - pub upgrades: VecM, - pub ext: StellarValueExt, +impl From for i32 { + #[must_use] + fn from(e: HotArchiveBucketEntryType) -> Self { + e as Self + } } -impl ReadXdr for StellarValue { +impl ReadXdr for HotArchiveBucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - Ok(Self { - tx_set_hash: Hash::read_xdr(r)?, - close_time: TimePoint::read_xdr(r)?, - upgrades: VecM::::read_xdr(r)?, - ext: StellarValueExt::read_xdr(r)?, - }) + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) }) } } -impl WriteXdr for StellarValue { +impl WriteXdr for HotArchiveBucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.tx_set_hash.write_xdr(w)?; - self.close_time.write_xdr(w)?; - self.upgrades.write_xdr(w)?; - self.ext.write_xdr(w)?; - Ok(()) + let i: i32 = (*self).into(); + i.write_xdr(w) }) } } -/// MaskLedgerHeaderFlags is an XDR Const defines as: -/// -/// ```text -/// const MASK_LEDGER_HEADER_FLAGS = 0x7; -/// ``` -/// -pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; - -/// LedgerHeaderFlags is an XDR Enum defines as: +/// ColdArchiveBucketEntryType is an XDR Enum defines as: /// /// ```text -/// enum LedgerHeaderFlags +/// enum ColdArchiveBucketEntryType /// { -/// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, -/// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, -/// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 +/// COLD_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +/// COLD_ARCHIVE_ARCHIVED_LEAF = 0, // Full LedgerEntry that was archived during the epoch +/// COLD_ARCHIVE_DELETED_LEAF = 1, // LedgerKey that was deleted during the epoch +/// COLD_ARCHIVE_BOUNDARY_LEAF = 2, // Dummy leaf representing low/high bound +/// COLD_ARCHIVE_HASH = 3 // Intermediary Merkle hash entry /// }; /// ``` /// @@ -17990,64 +17906,78 @@ pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum LedgerHeaderFlags { - TradingFlag = 1, - DepositFlag = 2, - WithdrawalFlag = 4, +pub enum ColdArchiveBucketEntryType { + Metaentry = -1, + ArchivedLeaf = 0, + DeletedLeaf = 1, + BoundaryLeaf = 2, + Hash = 3, } -impl LedgerHeaderFlags { - pub const VARIANTS: [LedgerHeaderFlags; 3] = [ - LedgerHeaderFlags::TradingFlag, - LedgerHeaderFlags::DepositFlag, - LedgerHeaderFlags::WithdrawalFlag, +impl ColdArchiveBucketEntryType { + pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [ + ColdArchiveBucketEntryType::Metaentry, + ColdArchiveBucketEntryType::ArchivedLeaf, + ColdArchiveBucketEntryType::DeletedLeaf, + ColdArchiveBucketEntryType::BoundaryLeaf, + ColdArchiveBucketEntryType::Hash, + ]; + pub const VARIANTS_STR: [&'static str; 5] = [ + "Metaentry", + "ArchivedLeaf", + "DeletedLeaf", + "BoundaryLeaf", + "Hash", ]; - pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::TradingFlag => "TradingFlag", - Self::DepositFlag => "DepositFlag", - Self::WithdrawalFlag => "WithdrawalFlag", + Self::Metaentry => "Metaentry", + Self::ArchivedLeaf => "ArchivedLeaf", + Self::DeletedLeaf => "DeletedLeaf", + Self::BoundaryLeaf => "BoundaryLeaf", + Self::Hash => "Hash", } } #[must_use] - pub const fn variants() -> [LedgerHeaderFlags; 3] { + pub const fn variants() -> [ColdArchiveBucketEntryType; 5] { Self::VARIANTS } } -impl Name for LedgerHeaderFlags { +impl Name for ColdArchiveBucketEntryType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for LedgerHeaderFlags { - fn variants() -> slice::Iter<'static, LedgerHeaderFlags> { +impl Variants for ColdArchiveBucketEntryType { + fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> { Self::VARIANTS.iter() } } -impl Enum for LedgerHeaderFlags {} +impl Enum for ColdArchiveBucketEntryType {} -impl fmt::Display for LedgerHeaderFlags { +impl fmt::Display for ColdArchiveBucketEntryType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for LedgerHeaderFlags { +impl TryFrom for ColdArchiveBucketEntryType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 1 => LedgerHeaderFlags::TradingFlag, - 2 => LedgerHeaderFlags::DepositFlag, - 4 => LedgerHeaderFlags::WithdrawalFlag, + -1 => ColdArchiveBucketEntryType::Metaentry, + 0 => ColdArchiveBucketEntryType::ArchivedLeaf, + 1 => ColdArchiveBucketEntryType::DeletedLeaf, + 2 => ColdArchiveBucketEntryType::BoundaryLeaf, + 3 => ColdArchiveBucketEntryType::Hash, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18055,14 +17985,14 @@ impl TryFrom for LedgerHeaderFlags { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: LedgerHeaderFlags) -> Self { + fn from(e: ColdArchiveBucketEntryType) -> Self { e as Self } } -impl ReadXdr for LedgerHeaderFlags { +impl ReadXdr for ColdArchiveBucketEntryType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18073,7 +18003,7 @@ impl ReadXdr for LedgerHeaderFlags { } } -impl WriteXdr for LedgerHeaderFlags { +impl WriteXdr for ColdArchiveBucketEntryType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18083,13 +18013,15 @@ impl WriteXdr for LedgerHeaderFlags { } } -/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: +/// BucketMetadataExt is an XDR NestedUnion defines as: /// /// ```text /// union switch (int v) /// { /// case 0: /// void; +/// case 1: +/// BucketListType bucketListType; /// } /// ``` /// @@ -18103,18 +18035,20 @@ impl WriteXdr for LedgerHeaderFlags { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerHeaderExtensionV1Ext { +pub enum BucketMetadataExt { V0, + V1(BucketListType), } -impl LedgerHeaderExtensionV1Ext { - pub const VARIANTS: [i32; 1] = [0]; - pub const VARIANTS_STR: [&'static str; 1] = ["V0"]; +impl BucketMetadataExt { + pub const VARIANTS: [i32; 2] = [0, 1]; + pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; #[must_use] pub const fn name(&self) -> &'static str { match self { Self::V0 => "V0", + Self::V1(_) => "V1", } } @@ -18123,38 +18057,39 @@ impl LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms)] match self { Self::V0 => 0, + Self::V1(_) => 1, } } #[must_use] - pub const fn variants() -> [i32; 1] { + pub const fn variants() -> [i32; 2] { Self::VARIANTS } } -impl Name for LedgerHeaderExtensionV1Ext { +impl Name for BucketMetadataExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerHeaderExtensionV1Ext { +impl Discriminant for BucketMetadataExt { #[must_use] fn discriminant(&self) -> i32 { Self::discriminant(self) } } -impl Variants for LedgerHeaderExtensionV1Ext { +impl Variants for BucketMetadataExt { fn variants() -> slice::Iter<'static, i32> { Self::VARIANTS.iter() } } -impl Union for LedgerHeaderExtensionV1Ext {} +impl Union for BucketMetadataExt {} -impl ReadXdr for LedgerHeaderExtensionV1Ext { +impl ReadXdr for BucketMetadataExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18162,6 +18097,7 @@ impl ReadXdr for LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { 0 => Self::V0, + 1 => Self::V1(BucketListType::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18170,7 +18106,7 @@ impl ReadXdr for LedgerHeaderExtensionV1Ext { } } -impl WriteXdr for LedgerHeaderExtensionV1Ext { +impl WriteXdr for BucketMetadataExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18178,23 +18114,28 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { #[allow(clippy::match_same_arms)] match self { Self::V0 => ().write_xdr(w)?, + Self::V1(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// LedgerHeaderExtensionV1 is an XDR Struct defines as: +/// BucketMetadata is an XDR Struct defines as: /// /// ```text -/// struct LedgerHeaderExtensionV1 +/// struct BucketMetadata /// { -/// uint32 flags; // LedgerHeaderFlags +/// // Indicates the protocol version used to create / merge this bucket. +/// uint32 ledgerVersion; /// +/// // reserved for future use /// union switch (int v) /// { /// case 0: /// void; +/// case 1: +/// BucketListType bucketListType; /// } /// ext; /// }; @@ -18208,47 +18149,51 @@ impl WriteXdr for LedgerHeaderExtensionV1Ext { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerHeaderExtensionV1 { - pub flags: u32, - pub ext: LedgerHeaderExtensionV1Ext, +pub struct BucketMetadata { + pub ledger_version: u32, + pub ext: BucketMetadataExt, } -impl ReadXdr for LedgerHeaderExtensionV1 { +impl ReadXdr for BucketMetadata { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - flags: u32::read_xdr(r)?, - ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?, + ledger_version: u32::read_xdr(r)?, + ext: BucketMetadataExt::read_xdr(r)?, }) }) } } -impl WriteXdr for LedgerHeaderExtensionV1 { +impl WriteXdr for BucketMetadata { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.flags.write_xdr(w)?; + self.ledger_version.write_xdr(w)?; self.ext.write_xdr(w)?; Ok(()) }) } } -/// LedgerHeaderExt is an XDR NestedUnion defines as: +/// BucketEntry is an XDR Union defines as: /// /// ```text -/// union switch (int v) -/// { -/// case 0: -/// void; -/// case 1: -/// LedgerHeaderExtensionV1 v1; -/// } +/// union BucketEntry switch (BucketEntryType type) +/// { +/// case LIVEENTRY: +/// case INITENTRY: +/// LedgerEntry liveEntry; +/// +/// case DEADENTRY: +/// LedgerKey deadEntry; +/// case METAENTRY: +/// BucketMetadata metaEntry; +/// }; /// ``` /// -// union with discriminant i32 +// union with discriminant BucketEntryType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -18258,69 +18203,83 @@ impl WriteXdr for LedgerHeaderExtensionV1 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerHeaderExt { - V0, - V1(LedgerHeaderExtensionV1), +pub enum BucketEntry { + Liveentry(LedgerEntry), + Initentry(LedgerEntry), + Deadentry(LedgerKey), + Metaentry(BucketMetadata), } -impl LedgerHeaderExt { - pub const VARIANTS: [i32; 2] = [0, 1]; - pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; +impl BucketEntry { + pub const VARIANTS: [BucketEntryType; 4] = [ + BucketEntryType::Liveentry, + BucketEntryType::Initentry, + BucketEntryType::Deadentry, + BucketEntryType::Metaentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = + ["Liveentry", "Initentry", "Deadentry", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::V0 => "V0", - Self::V1(_) => "V1", + Self::Liveentry(_) => "Liveentry", + Self::Initentry(_) => "Initentry", + Self::Deadentry(_) => "Deadentry", + Self::Metaentry(_) => "Metaentry", } } #[must_use] - pub const fn discriminant(&self) -> i32 { + pub const fn discriminant(&self) -> BucketEntryType { #[allow(clippy::match_same_arms)] match self { - Self::V0 => 0, - Self::V1(_) => 1, + Self::Liveentry(_) => BucketEntryType::Liveentry, + Self::Initentry(_) => BucketEntryType::Initentry, + Self::Deadentry(_) => BucketEntryType::Deadentry, + Self::Metaentry(_) => BucketEntryType::Metaentry, } } #[must_use] - pub const fn variants() -> [i32; 2] { + pub const fn variants() -> [BucketEntryType; 4] { Self::VARIANTS } } -impl Name for LedgerHeaderExt { +impl Name for BucketEntry { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerHeaderExt { +impl Discriminant for BucketEntry { #[must_use] - fn discriminant(&self) -> i32 { + fn discriminant(&self) -> BucketEntryType { Self::discriminant(self) } } -impl Variants for LedgerHeaderExt { - fn variants() -> slice::Iter<'static, i32> { +impl Variants for BucketEntry { + fn variants() -> slice::Iter<'static, BucketEntryType> { Self::VARIANTS.iter() } } -impl Union for LedgerHeaderExt {} +impl Union for BucketEntry {} -impl ReadXdr for LedgerHeaderExt { +impl ReadXdr for BucketEntry { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: i32 = ::read_xdr(r)?; + let dv: BucketEntryType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - 0 => Self::V0, - 1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?), + BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?), + BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?), + BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?), + BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18329,62 +18288,299 @@ impl ReadXdr for LedgerHeaderExt { } } -impl WriteXdr for LedgerHeaderExt { +impl WriteXdr for BucketEntry { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::V0 => ().write_xdr(w)?, - Self::V1(v) => v.write_xdr(w)?, + Self::Liveentry(v) => v.write_xdr(w)?, + Self::Initentry(v) => v.write_xdr(w)?, + Self::Deadentry(v) => v.write_xdr(w)?, + Self::Metaentry(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// LedgerHeader is an XDR Struct defines as: +/// HotArchiveBucketEntry is an XDR Union defines as: /// /// ```text -/// struct LedgerHeader +/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) /// { -/// uint32 ledgerVersion; // the protocol version of the ledger -/// Hash previousLedgerHash; // hash of the previous ledger header -/// StellarValue scpValue; // what consensus agreed to -/// Hash txSetResultHash; // the TransactionResultSet that led to this ledger -/// Hash bucketListHash; // hash of the ledger state +/// case HOT_ARCHIVE_ARCHIVED: +/// LedgerEntry archivedEntry; /// -/// uint32 ledgerSeq; // sequence number of this ledger +/// case HOT_ARCHIVE_LIVE: +/// case HOT_ARCHIVE_DELETED: +/// LedgerKey key; +/// case HOT_ARCHIVE_METAENTRY: +/// BucketMetadata metaEntry; +/// }; +/// ``` /// -/// int64 totalCoins; // total number of stroops in existence. -/// // 10,000,000 stroops in 1 XLM +// union with discriminant HotArchiveBucketEntryType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum HotArchiveBucketEntry { + Archived(LedgerEntry), + Live(LedgerKey), + Deleted(LedgerKey), + Metaentry(BucketMetadata), +} + +impl HotArchiveBucketEntry { + pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ + HotArchiveBucketEntryType::Archived, + HotArchiveBucketEntryType::Live, + HotArchiveBucketEntryType::Deleted, + HotArchiveBucketEntryType::Metaentry, + ]; + pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Archived(_) => "Archived", + Self::Live(_) => "Live", + Self::Deleted(_) => "Deleted", + Self::Metaentry(_) => "Metaentry", + } + } + + #[must_use] + pub const fn discriminant(&self) -> HotArchiveBucketEntryType { + #[allow(clippy::match_same_arms)] + match self { + Self::Archived(_) => HotArchiveBucketEntryType::Archived, + Self::Live(_) => HotArchiveBucketEntryType::Live, + Self::Deleted(_) => HotArchiveBucketEntryType::Deleted, + Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry, + } + } + + #[must_use] + pub const fn variants() -> [HotArchiveBucketEntryType; 4] { + Self::VARIANTS + } +} + +impl Name for HotArchiveBucketEntry { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for HotArchiveBucketEntry { + #[must_use] + fn discriminant(&self) -> HotArchiveBucketEntryType { + Self::discriminant(self) + } +} + +impl Variants for HotArchiveBucketEntry { + fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { + Self::VARIANTS.iter() + } +} + +impl Union for HotArchiveBucketEntry {} + +impl ReadXdr for HotArchiveBucketEntry { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: HotArchiveBucketEntryType = + ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?), + HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?), + HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?), + HotArchiveBucketEntryType::Metaentry => { + Self::Metaentry(BucketMetadata::read_xdr(r)?) + } + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for HotArchiveBucketEntry { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::Archived(v) => v.write_xdr(w)?, + Self::Live(v) => v.write_xdr(w)?, + Self::Deleted(v) => v.write_xdr(w)?, + Self::Metaentry(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// ColdArchiveArchivedLeaf is an XDR Struct defines as: /// -/// int64 feePool; // fees burned since last inflation run -/// uint32 inflationSeq; // inflation sequence number +/// ```text +/// struct ColdArchiveArchivedLeaf +/// { +/// uint32 index; +/// LedgerEntry archivedEntry; +/// }; +/// ``` /// -/// uint64 idPool; // last used global ID, used for generating objects +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveArchivedLeaf { + pub index: u32, + pub archived_entry: LedgerEntry, +} + +impl ReadXdr for ColdArchiveArchivedLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + archived_entry: LedgerEntry::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveArchivedLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.archived_entry.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveDeletedLeaf is an XDR Struct defines as: /// -/// uint32 baseFee; // base fee per operation in stroops -/// uint32 baseReserve; // account base reserve in stroops +/// ```text +/// struct ColdArchiveDeletedLeaf +/// { +/// uint32 index; +/// LedgerKey deletedKey; +/// }; +/// ``` /// -/// uint32 maxTxSetSize; // maximum size a transaction set can be +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveDeletedLeaf { + pub index: u32, + pub deleted_key: LedgerKey, +} + +impl ReadXdr for ColdArchiveDeletedLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + deleted_key: LedgerKey::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveDeletedLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.deleted_key.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveBoundaryLeaf is an XDR Struct defines as: /// -/// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back -/// // in time without walking the chain back ledger by ledger -/// // each slot contains the oldest ledger that is mod of -/// // either 50 5000 50000 or 500000 depending on index -/// // skipList[0] mod(50), skipList[1] mod(5000), etc +/// ```text +/// struct ColdArchiveBoundaryLeaf +/// { +/// uint32 index; +/// bool isLowerBound; +/// }; +/// ``` /// -/// // reserved for future use -/// union switch (int v) -/// { -/// case 0: -/// void; -/// case 1: -/// LedgerHeaderExtensionV1 v1; -/// } -/// ext; +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ColdArchiveBoundaryLeaf { + pub index: u32, + pub is_lower_bound: bool, +} + +impl ReadXdr for ColdArchiveBoundaryLeaf { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + index: u32::read_xdr(r)?, + is_lower_bound: bool::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ColdArchiveBoundaryLeaf { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.index.write_xdr(w)?; + self.is_lower_bound.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ColdArchiveHashEntry is an XDR Struct defines as: +/// +/// ```text +/// struct ColdArchiveHashEntry +/// { +/// uint32 index; +/// uint32 level; +/// Hash hash; /// }; /// ``` /// @@ -18396,85 +18592,300 @@ impl WriteXdr for LedgerHeaderExt { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerHeader { - pub ledger_version: u32, - pub previous_ledger_hash: Hash, - pub scp_value: StellarValue, - pub tx_set_result_hash: Hash, - pub bucket_list_hash: Hash, - pub ledger_seq: u32, - pub total_coins: i64, - pub fee_pool: i64, - pub inflation_seq: u32, - pub id_pool: u64, - pub base_fee: u32, - pub base_reserve: u32, - pub max_tx_set_size: u32, - pub skip_list: [Hash; 4], - pub ext: LedgerHeaderExt, +pub struct ColdArchiveHashEntry { + pub index: u32, + pub level: u32, + pub hash: Hash, } -impl ReadXdr for LedgerHeader { +impl ReadXdr for ColdArchiveHashEntry { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - ledger_version: u32::read_xdr(r)?, - previous_ledger_hash: Hash::read_xdr(r)?, - scp_value: StellarValue::read_xdr(r)?, - tx_set_result_hash: Hash::read_xdr(r)?, - bucket_list_hash: Hash::read_xdr(r)?, - ledger_seq: u32::read_xdr(r)?, - total_coins: i64::read_xdr(r)?, - fee_pool: i64::read_xdr(r)?, - inflation_seq: u32::read_xdr(r)?, - id_pool: u64::read_xdr(r)?, - base_fee: u32::read_xdr(r)?, - base_reserve: u32::read_xdr(r)?, - max_tx_set_size: u32::read_xdr(r)?, - skip_list: <[Hash; 4]>::read_xdr(r)?, - ext: LedgerHeaderExt::read_xdr(r)?, + index: u32::read_xdr(r)?, + level: u32::read_xdr(r)?, + hash: Hash::read_xdr(r)?, }) }) } } -impl WriteXdr for LedgerHeader { +impl WriteXdr for ColdArchiveHashEntry { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.ledger_version.write_xdr(w)?; - self.previous_ledger_hash.write_xdr(w)?; - self.scp_value.write_xdr(w)?; - self.tx_set_result_hash.write_xdr(w)?; - self.bucket_list_hash.write_xdr(w)?; - self.ledger_seq.write_xdr(w)?; - self.total_coins.write_xdr(w)?; - self.fee_pool.write_xdr(w)?; - self.inflation_seq.write_xdr(w)?; - self.id_pool.write_xdr(w)?; - self.base_fee.write_xdr(w)?; - self.base_reserve.write_xdr(w)?; - self.max_tx_set_size.write_xdr(w)?; - self.skip_list.write_xdr(w)?; - self.ext.write_xdr(w)?; + self.index.write_xdr(w)?; + self.level.write_xdr(w)?; + self.hash.write_xdr(w)?; Ok(()) }) } } -/// LedgerUpgradeType is an XDR Enum defines as: +/// ColdArchiveBucketEntry is an XDR Union defines as: /// /// ```text -/// enum LedgerUpgradeType +/// union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type) /// { -/// LEDGER_UPGRADE_VERSION = 1, -/// LEDGER_UPGRADE_BASE_FEE = 2, -/// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, -/// LEDGER_UPGRADE_BASE_RESERVE = 4, -/// LEDGER_UPGRADE_FLAGS = 5, -/// LEDGER_UPGRADE_CONFIG = 6, -/// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 +/// case COLD_ARCHIVE_METAENTRY: +/// BucketMetadata metaEntry; +/// case COLD_ARCHIVE_ARCHIVED_LEAF: +/// ColdArchiveArchivedLeaf archivedLeaf; +/// case COLD_ARCHIVE_DELETED_LEAF: +/// ColdArchiveDeletedLeaf deletedLeaf; +/// case COLD_ARCHIVE_BOUNDARY_LEAF: +/// ColdArchiveBoundaryLeaf boundaryLeaf; +/// case COLD_ARCHIVE_HASH: +/// ColdArchiveHashEntry hashEntry; +/// }; +/// ``` +/// +// union with discriminant ColdArchiveBucketEntryType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum ColdArchiveBucketEntry { + Metaentry(BucketMetadata), + ArchivedLeaf(ColdArchiveArchivedLeaf), + DeletedLeaf(ColdArchiveDeletedLeaf), + BoundaryLeaf(ColdArchiveBoundaryLeaf), + Hash(ColdArchiveHashEntry), +} + +impl ColdArchiveBucketEntry { + pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [ + ColdArchiveBucketEntryType::Metaentry, + ColdArchiveBucketEntryType::ArchivedLeaf, + ColdArchiveBucketEntryType::DeletedLeaf, + ColdArchiveBucketEntryType::BoundaryLeaf, + ColdArchiveBucketEntryType::Hash, + ]; + pub const VARIANTS_STR: [&'static str; 5] = [ + "Metaentry", + "ArchivedLeaf", + "DeletedLeaf", + "BoundaryLeaf", + "Hash", + ]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Metaentry(_) => "Metaentry", + Self::ArchivedLeaf(_) => "ArchivedLeaf", + Self::DeletedLeaf(_) => "DeletedLeaf", + Self::BoundaryLeaf(_) => "BoundaryLeaf", + Self::Hash(_) => "Hash", + } + } + + #[must_use] + pub const fn discriminant(&self) -> ColdArchiveBucketEntryType { + #[allow(clippy::match_same_arms)] + match self { + Self::Metaentry(_) => ColdArchiveBucketEntryType::Metaentry, + Self::ArchivedLeaf(_) => ColdArchiveBucketEntryType::ArchivedLeaf, + Self::DeletedLeaf(_) => ColdArchiveBucketEntryType::DeletedLeaf, + Self::BoundaryLeaf(_) => ColdArchiveBucketEntryType::BoundaryLeaf, + Self::Hash(_) => ColdArchiveBucketEntryType::Hash, + } + } + + #[must_use] + pub const fn variants() -> [ColdArchiveBucketEntryType; 5] { + Self::VARIANTS + } +} + +impl Name for ColdArchiveBucketEntry { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for ColdArchiveBucketEntry { + #[must_use] + fn discriminant(&self) -> ColdArchiveBucketEntryType { + Self::discriminant(self) + } +} + +impl Variants for ColdArchiveBucketEntry { + fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> { + Self::VARIANTS.iter() + } +} + +impl Union for ColdArchiveBucketEntry {} + +impl ReadXdr for ColdArchiveBucketEntry { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: ColdArchiveBucketEntryType = + ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + ColdArchiveBucketEntryType::Metaentry => { + Self::Metaentry(BucketMetadata::read_xdr(r)?) + } + ColdArchiveBucketEntryType::ArchivedLeaf => { + Self::ArchivedLeaf(ColdArchiveArchivedLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::DeletedLeaf => { + Self::DeletedLeaf(ColdArchiveDeletedLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::BoundaryLeaf => { + Self::BoundaryLeaf(ColdArchiveBoundaryLeaf::read_xdr(r)?) + } + ColdArchiveBucketEntryType::Hash => Self::Hash(ColdArchiveHashEntry::read_xdr(r)?), + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for ColdArchiveBucketEntry { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::Metaentry(v) => v.write_xdr(w)?, + Self::ArchivedLeaf(v) => v.write_xdr(w)?, + Self::DeletedLeaf(v) => v.write_xdr(w)?, + Self::BoundaryLeaf(v) => v.write_xdr(w)?, + Self::Hash(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// UpgradeType is an XDR Typedef defines as: +/// +/// ```text +/// typedef opaque UpgradeType<128>; +/// ``` +/// +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[derive(Default)] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[derive(Debug)] +pub struct UpgradeType(pub BytesM<128>); + +impl From for BytesM<128> { + #[must_use] + fn from(x: UpgradeType) -> Self { + x.0 + } +} + +impl From> for UpgradeType { + #[must_use] + fn from(x: BytesM<128>) -> Self { + UpgradeType(x) + } +} + +impl AsRef> for UpgradeType { + #[must_use] + fn as_ref(&self) -> &BytesM<128> { + &self.0 + } +} + +impl ReadXdr for UpgradeType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let i = BytesM::<128>::read_xdr(r)?; + let v = UpgradeType(i); + Ok(v) + }) + } +} + +impl WriteXdr for UpgradeType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| self.0.write_xdr(w)) + } +} + +impl Deref for UpgradeType { + type Target = BytesM<128>; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl From for Vec { + #[must_use] + fn from(x: UpgradeType) -> Self { + x.0 .0 + } +} + +impl TryFrom> for UpgradeType { + type Error = Error; + fn try_from(x: Vec) -> Result { + Ok(UpgradeType(x.try_into()?)) + } +} + +#[cfg(feature = "alloc")] +impl TryFrom<&Vec> for UpgradeType { + type Error = Error; + fn try_from(x: &Vec) -> Result { + Ok(UpgradeType(x.try_into()?)) + } +} + +impl AsRef> for UpgradeType { + #[must_use] + fn as_ref(&self) -> &Vec { + &self.0 .0 + } +} + +impl AsRef<[u8]> for UpgradeType { + #[cfg(feature = "alloc")] + #[must_use] + fn as_ref(&self) -> &[u8] { + &self.0 .0 + } + #[cfg(not(feature = "alloc"))] + #[must_use] + fn as_ref(&self) -> &[u8] { + self.0 .0 + } +} + +/// StellarValueType is an XDR Enum defines as: +/// +/// ```text +/// enum StellarValueType +/// { +/// STELLAR_VALUE_BASIC = 0, +/// STELLAR_VALUE_SIGNED = 1 /// }; /// ``` /// @@ -18488,88 +18899,57 @@ impl WriteXdr for LedgerHeader { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum LedgerUpgradeType { - Version = 1, - BaseFee = 2, - MaxTxSetSize = 3, - BaseReserve = 4, - Flags = 5, - Config = 6, - MaxSorobanTxSetSize = 7, +pub enum StellarValueType { + Basic = 0, + Signed = 1, } -impl LedgerUpgradeType { - pub const VARIANTS: [LedgerUpgradeType; 7] = [ - LedgerUpgradeType::Version, - LedgerUpgradeType::BaseFee, - LedgerUpgradeType::MaxTxSetSize, - LedgerUpgradeType::BaseReserve, - LedgerUpgradeType::Flags, - LedgerUpgradeType::Config, - LedgerUpgradeType::MaxSorobanTxSetSize, - ]; - pub const VARIANTS_STR: [&'static str; 7] = [ - "Version", - "BaseFee", - "MaxTxSetSize", - "BaseReserve", - "Flags", - "Config", - "MaxSorobanTxSetSize", - ]; +impl StellarValueType { + pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; + pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Version => "Version", - Self::BaseFee => "BaseFee", - Self::MaxTxSetSize => "MaxTxSetSize", - Self::BaseReserve => "BaseReserve", - Self::Flags => "Flags", - Self::Config => "Config", - Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize", + Self::Basic => "Basic", + Self::Signed => "Signed", } } #[must_use] - pub const fn variants() -> [LedgerUpgradeType; 7] { + pub const fn variants() -> [StellarValueType; 2] { Self::VARIANTS } } -impl Name for LedgerUpgradeType { +impl Name for StellarValueType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for LedgerUpgradeType { - fn variants() -> slice::Iter<'static, LedgerUpgradeType> { +impl Variants for StellarValueType { + fn variants() -> slice::Iter<'static, StellarValueType> { Self::VARIANTS.iter() } } -impl Enum for LedgerUpgradeType {} +impl Enum for StellarValueType {} -impl fmt::Display for LedgerUpgradeType { +impl fmt::Display for StellarValueType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for LedgerUpgradeType { +impl TryFrom for StellarValueType { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 1 => LedgerUpgradeType::Version, - 2 => LedgerUpgradeType::BaseFee, - 3 => LedgerUpgradeType::MaxTxSetSize, - 4 => LedgerUpgradeType::BaseReserve, - 5 => LedgerUpgradeType::Flags, - 6 => LedgerUpgradeType::Config, - 7 => LedgerUpgradeType::MaxSorobanTxSetSize, + 0 => StellarValueType::Basic, + 1 => StellarValueType::Signed, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18577,14 +18957,14 @@ impl TryFrom for LedgerUpgradeType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: LedgerUpgradeType) -> Self { + fn from(e: StellarValueType) -> Self { e as Self } } -impl ReadXdr for LedgerUpgradeType { +impl ReadXdr for StellarValueType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18595,7 +18975,7 @@ impl ReadXdr for LedgerUpgradeType { } } -impl WriteXdr for LedgerUpgradeType { +impl WriteXdr for StellarValueType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18605,12 +18985,13 @@ impl WriteXdr for LedgerUpgradeType { } } -/// ConfigUpgradeSetKey is an XDR Struct defines as: +/// LedgerCloseValueSignature is an XDR Struct defines as: /// /// ```text -/// struct ConfigUpgradeSetKey { -/// Hash contractID; -/// Hash contentHash; +/// struct LedgerCloseValueSignature +/// { +/// NodeID nodeID; // which node introduced the value +/// Signature signature; // nodeID's signature /// }; /// ``` /// @@ -18622,60 +19003,47 @@ impl WriteXdr for LedgerUpgradeType { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct ConfigUpgradeSetKey { - pub contract_id: Hash, - pub content_hash: Hash, +pub struct LedgerCloseValueSignature { + pub node_id: NodeId, + pub signature: Signature, } -impl ReadXdr for ConfigUpgradeSetKey { +impl ReadXdr for LedgerCloseValueSignature { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - contract_id: Hash::read_xdr(r)?, - content_hash: Hash::read_xdr(r)?, + node_id: NodeId::read_xdr(r)?, + signature: Signature::read_xdr(r)?, }) }) } } -impl WriteXdr for ConfigUpgradeSetKey { +impl WriteXdr for LedgerCloseValueSignature { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.contract_id.write_xdr(w)?; - self.content_hash.write_xdr(w)?; + self.node_id.write_xdr(w)?; + self.signature.write_xdr(w)?; Ok(()) }) } } -/// LedgerUpgrade is an XDR Union defines as: +/// StellarValueExt is an XDR NestedUnion defines as: /// /// ```text -/// union LedgerUpgrade switch (LedgerUpgradeType type) -/// { -/// case LEDGER_UPGRADE_VERSION: -/// uint32 newLedgerVersion; // update ledgerVersion -/// case LEDGER_UPGRADE_BASE_FEE: -/// uint32 newBaseFee; // update baseFee -/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: -/// uint32 newMaxTxSetSize; // update maxTxSetSize -/// case LEDGER_UPGRADE_BASE_RESERVE: -/// uint32 newBaseReserve; // update baseReserve -/// case LEDGER_UPGRADE_FLAGS: -/// uint32 newFlags; // update flags -/// case LEDGER_UPGRADE_CONFIG: -/// // Update arbitrary `ConfigSetting` entries identified by the key. -/// ConfigUpgradeSetKey newConfig; -/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: -/// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without -/// // using `LEDGER_UPGRADE_CONFIG`. -/// uint32 newMaxSorobanTxSetSize; -/// }; +/// union switch (StellarValueType v) +/// { +/// case STELLAR_VALUE_BASIC: +/// void; +/// case STELLAR_VALUE_SIGNED: +/// LedgerCloseValueSignature lcValueSignature; +/// } /// ``` /// -// union with discriminant LedgerUpgradeType +// union with discriminant StellarValueType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -18685,107 +19053,69 @@ impl WriteXdr for ConfigUpgradeSetKey { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum LedgerUpgrade { - Version(u32), - BaseFee(u32), - MaxTxSetSize(u32), - BaseReserve(u32), - Flags(u32), - Config(ConfigUpgradeSetKey), - MaxSorobanTxSetSize(u32), +pub enum StellarValueExt { + Basic, + Signed(LedgerCloseValueSignature), } -impl LedgerUpgrade { - pub const VARIANTS: [LedgerUpgradeType; 7] = [ - LedgerUpgradeType::Version, - LedgerUpgradeType::BaseFee, - LedgerUpgradeType::MaxTxSetSize, - LedgerUpgradeType::BaseReserve, - LedgerUpgradeType::Flags, - LedgerUpgradeType::Config, - LedgerUpgradeType::MaxSorobanTxSetSize, - ]; - pub const VARIANTS_STR: [&'static str; 7] = [ - "Version", - "BaseFee", - "MaxTxSetSize", - "BaseReserve", - "Flags", - "Config", - "MaxSorobanTxSetSize", - ]; +impl StellarValueExt { + pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed]; + pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Version(_) => "Version", - Self::BaseFee(_) => "BaseFee", - Self::MaxTxSetSize(_) => "MaxTxSetSize", - Self::BaseReserve(_) => "BaseReserve", - Self::Flags(_) => "Flags", - Self::Config(_) => "Config", - Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize", + Self::Basic => "Basic", + Self::Signed(_) => "Signed", } } #[must_use] - pub const fn discriminant(&self) -> LedgerUpgradeType { + pub const fn discriminant(&self) -> StellarValueType { #[allow(clippy::match_same_arms)] match self { - Self::Version(_) => LedgerUpgradeType::Version, - Self::BaseFee(_) => LedgerUpgradeType::BaseFee, - Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize, - Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve, - Self::Flags(_) => LedgerUpgradeType::Flags, - Self::Config(_) => LedgerUpgradeType::Config, - Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize, + Self::Basic => StellarValueType::Basic, + Self::Signed(_) => StellarValueType::Signed, } } #[must_use] - pub const fn variants() -> [LedgerUpgradeType; 7] { + pub const fn variants() -> [StellarValueType; 2] { Self::VARIANTS } } -impl Name for LedgerUpgrade { +impl Name for StellarValueExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for LedgerUpgrade { +impl Discriminant for StellarValueExt { #[must_use] - fn discriminant(&self) -> LedgerUpgradeType { + fn discriminant(&self) -> StellarValueType { Self::discriminant(self) } } -impl Variants for LedgerUpgrade { - fn variants() -> slice::Iter<'static, LedgerUpgradeType> { +impl Variants for StellarValueExt { + fn variants() -> slice::Iter<'static, StellarValueType> { Self::VARIANTS.iter() } } -impl Union for LedgerUpgrade {} +impl Union for StellarValueExt {} -impl ReadXdr for LedgerUpgrade { +impl ReadXdr for StellarValueExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: LedgerUpgradeType = ::read_xdr(r)?; + let dv: StellarValueType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?), - LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?), - LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?), - LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?), - LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?), - LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?), - LedgerUpgradeType::MaxSorobanTxSetSize => { - Self::MaxSorobanTxSetSize(u32::read_xdr(r)?) - } + StellarValueType::Basic => Self::Basic, + StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18794,31 +19124,45 @@ impl ReadXdr for LedgerUpgrade { } } -impl WriteXdr for LedgerUpgrade { +impl WriteXdr for StellarValueExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::Version(v) => v.write_xdr(w)?, - Self::BaseFee(v) => v.write_xdr(w)?, - Self::MaxTxSetSize(v) => v.write_xdr(w)?, - Self::BaseReserve(v) => v.write_xdr(w)?, - Self::Flags(v) => v.write_xdr(w)?, - Self::Config(v) => v.write_xdr(w)?, - Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?, + Self::Basic => ().write_xdr(w)?, + Self::Signed(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// ConfigUpgradeSet is an XDR Struct defines as: +/// StellarValue is an XDR Struct defines as: /// /// ```text -/// struct ConfigUpgradeSet { -/// ConfigSettingEntry updatedEntry<>; +/// struct StellarValue +/// { +/// Hash txSetHash; // transaction set to apply to previous ledger +/// TimePoint closeTime; // network close time +/// +/// // upgrades to apply to the previous ledger (usually empty) +/// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop +/// // unknown steps during consensus if needed. +/// // see notes below on 'LedgerUpgrade' for more detail +/// // max size is dictated by number of upgrade types (+ room for future) +/// UpgradeType upgrades<6>; +/// +/// // reserved for future use +/// union switch (StellarValueType v) +/// { +/// case STELLAR_VALUE_BASIC: +/// void; +/// case STELLAR_VALUE_SIGNED: +/// LedgerCloseValueSignature lcValueSignature; +/// } +/// ext; /// }; /// ``` /// @@ -18830,39 +19174,56 @@ impl WriteXdr for LedgerUpgrade { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct ConfigUpgradeSet { - pub updated_entry: VecM, +pub struct StellarValue { + pub tx_set_hash: Hash, + pub close_time: TimePoint, + pub upgrades: VecM, + pub ext: StellarValueExt, } -impl ReadXdr for ConfigUpgradeSet { +impl ReadXdr for StellarValue { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - updated_entry: VecM::::read_xdr(r)?, + tx_set_hash: Hash::read_xdr(r)?, + close_time: TimePoint::read_xdr(r)?, + upgrades: VecM::::read_xdr(r)?, + ext: StellarValueExt::read_xdr(r)?, }) }) } } -impl WriteXdr for ConfigUpgradeSet { +impl WriteXdr for StellarValue { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.updated_entry.write_xdr(w)?; + self.tx_set_hash.write_xdr(w)?; + self.close_time.write_xdr(w)?; + self.upgrades.write_xdr(w)?; + self.ext.write_xdr(w)?; Ok(()) }) } } -/// BucketListType is an XDR Enum defines as: +/// MaskLedgerHeaderFlags is an XDR Const defines as: /// /// ```text -/// enum BucketListType +/// const MASK_LEDGER_HEADER_FLAGS = 0x7; +/// ``` +/// +pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7; + +/// LedgerHeaderFlags is an XDR Enum defines as: +/// +/// ```text +/// enum LedgerHeaderFlags /// { -/// LIVE = 0, -/// HOT_ARCHIVE = 1, -/// COLD_ARCHIVE = 2 +/// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, +/// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, +/// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 /// }; /// ``` /// @@ -18876,64 +19237,64 @@ impl WriteXdr for ConfigUpgradeSet { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[repr(i32)] -pub enum BucketListType { - Live = 0, - HotArchive = 1, - ColdArchive = 2, +pub enum LedgerHeaderFlags { + TradingFlag = 1, + DepositFlag = 2, + WithdrawalFlag = 4, } -impl BucketListType { - pub const VARIANTS: [BucketListType; 3] = [ - BucketListType::Live, - BucketListType::HotArchive, - BucketListType::ColdArchive, +impl LedgerHeaderFlags { + pub const VARIANTS: [LedgerHeaderFlags; 3] = [ + LedgerHeaderFlags::TradingFlag, + LedgerHeaderFlags::DepositFlag, + LedgerHeaderFlags::WithdrawalFlag, ]; - pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"]; + pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Live => "Live", - Self::HotArchive => "HotArchive", - Self::ColdArchive => "ColdArchive", + Self::TradingFlag => "TradingFlag", + Self::DepositFlag => "DepositFlag", + Self::WithdrawalFlag => "WithdrawalFlag", } } #[must_use] - pub const fn variants() -> [BucketListType; 3] { + pub const fn variants() -> [LedgerHeaderFlags; 3] { Self::VARIANTS } } -impl Name for BucketListType { +impl Name for LedgerHeaderFlags { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for BucketListType { - fn variants() -> slice::Iter<'static, BucketListType> { +impl Variants for LedgerHeaderFlags { + fn variants() -> slice::Iter<'static, LedgerHeaderFlags> { Self::VARIANTS.iter() } } -impl Enum for BucketListType {} +impl Enum for LedgerHeaderFlags {} -impl fmt::Display for BucketListType { +impl fmt::Display for LedgerHeaderFlags { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.name()) } } -impl TryFrom for BucketListType { +impl TryFrom for LedgerHeaderFlags { type Error = Error; fn try_from(i: i32) -> Result { let e = match i { - 0 => BucketListType::Live, - 1 => BucketListType::HotArchive, - 2 => BucketListType::ColdArchive, + 1 => LedgerHeaderFlags::TradingFlag, + 2 => LedgerHeaderFlags::DepositFlag, + 4 => LedgerHeaderFlags::WithdrawalFlag, #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -18941,14 +19302,14 @@ impl TryFrom for BucketListType { } } -impl From for i32 { +impl From for i32 { #[must_use] - fn from(e: BucketListType) -> Self { + fn from(e: LedgerHeaderFlags) -> Self { e as Self } } -impl ReadXdr for BucketListType { +impl ReadXdr for LedgerHeaderFlags { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -18959,7 +19320,7 @@ impl ReadXdr for BucketListType { } } -impl WriteXdr for BucketListType { +impl WriteXdr for LedgerHeaderFlags { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -18969,22 +19330,18 @@ impl WriteXdr for BucketListType { } } -/// BucketEntryType is an XDR Enum defines as: +/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: /// /// ```text -/// enum BucketEntryType -/// { -/// METAENTRY = -/// -1, // At-and-after protocol 11: bucket metadata, should come first. -/// LIVEENTRY = 0, // Before protocol 11: created-or-updated; -/// // At-and-after protocol 11: only updated. -/// DEADENTRY = 1, -/// INITENTRY = 2 // At-and-after protocol 11: only created. -/// }; +/// union switch (int v) +/// { +/// case 0: +/// void; +/// } /// ``` /// -// enum -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// union with discriminant i32 +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -18992,227 +19349,141 @@ impl WriteXdr for BucketListType { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[repr(i32)] -pub enum BucketEntryType { - Metaentry = -1, - Liveentry = 0, - Deadentry = 1, - Initentry = 2, +#[allow(clippy::large_enum_variant)] +pub enum LedgerHeaderExtensionV1Ext { + V0, } -impl BucketEntryType { - pub const VARIANTS: [BucketEntryType; 4] = [ - BucketEntryType::Metaentry, - BucketEntryType::Liveentry, - BucketEntryType::Deadentry, - BucketEntryType::Initentry, - ]; - pub const VARIANTS_STR: [&'static str; 4] = - ["Metaentry", "Liveentry", "Deadentry", "Initentry"]; +impl LedgerHeaderExtensionV1Ext { + pub const VARIANTS: [i32; 1] = [0]; + pub const VARIANTS_STR: [&'static str; 1] = ["V0"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Metaentry => "Metaentry", - Self::Liveentry => "Liveentry", - Self::Deadentry => "Deadentry", - Self::Initentry => "Initentry", + Self::V0 => "V0", } } #[must_use] - pub const fn variants() -> [BucketEntryType; 4] { + pub const fn discriminant(&self) -> i32 { + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => 0, + } + } + + #[must_use] + pub const fn variants() -> [i32; 1] { Self::VARIANTS } } -impl Name for BucketEntryType { +impl Name for LedgerHeaderExtensionV1Ext { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Variants for BucketEntryType { - fn variants() -> slice::Iter<'static, BucketEntryType> { - Self::VARIANTS.iter() - } -} - -impl Enum for BucketEntryType {} - -impl fmt::Display for BucketEntryType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.name()) +impl Discriminant for LedgerHeaderExtensionV1Ext { + #[must_use] + fn discriminant(&self) -> i32 { + Self::discriminant(self) } } -impl TryFrom for BucketEntryType { - type Error = Error; - - fn try_from(i: i32) -> Result { - let e = match i { - -1 => BucketEntryType::Metaentry, - 0 => BucketEntryType::Liveentry, - 1 => BucketEntryType::Deadentry, - 2 => BucketEntryType::Initentry, - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(e) +impl Variants for LedgerHeaderExtensionV1Ext { + fn variants() -> slice::Iter<'static, i32> { + Self::VARIANTS.iter() } } -impl From for i32 { - #[must_use] - fn from(e: BucketEntryType) -> Self { - e as Self - } -} +impl Union for LedgerHeaderExtensionV1Ext {} -impl ReadXdr for BucketEntryType { +impl ReadXdr for LedgerHeaderExtensionV1Ext { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let e = i32::read_xdr(r)?; - let v: Self = e.try_into()?; + let dv: i32 = ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + 0 => Self::V0, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; Ok(v) }) } } -impl WriteXdr for BucketEntryType { +impl WriteXdr for LedgerHeaderExtensionV1Ext { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - let i: i32 = (*self).into(); - i.write_xdr(w) + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => ().write_xdr(w)?, + }; + Ok(()) }) } } -/// HotArchiveBucketEntryType is an XDR Enum defines as: +/// LedgerHeaderExtensionV1 is an XDR Struct defines as: /// /// ```text -/// enum HotArchiveBucketEntryType +/// struct LedgerHeaderExtensionV1 /// { -/// HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. -/// HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived -/// HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but -/// // has been added back to the live BucketList. -/// // Does not need to be persisted. -/// HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) +/// uint32 flags; // LedgerHeaderFlags +/// +/// union switch (int v) +/// { +/// case 0: +/// void; +/// } +/// ext; /// }; /// ``` /// -// enum -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[cfg_attr( - all(feature = "serde", feature = "alloc"), - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[repr(i32)] -pub enum HotArchiveBucketEntryType { - Metaentry = -1, - Archived = 0, - Live = 1, - Deleted = 2, -} - -impl HotArchiveBucketEntryType { - pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ - HotArchiveBucketEntryType::Metaentry, - HotArchiveBucketEntryType::Archived, - HotArchiveBucketEntryType::Live, - HotArchiveBucketEntryType::Deleted, - ]; - pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"]; - - #[must_use] - pub const fn name(&self) -> &'static str { - match self { - Self::Metaentry => "Metaentry", - Self::Archived => "Archived", - Self::Live => "Live", - Self::Deleted => "Deleted", - } - } - - #[must_use] - pub const fn variants() -> [HotArchiveBucketEntryType; 4] { - Self::VARIANTS - } -} - -impl Name for HotArchiveBucketEntryType { - #[must_use] - fn name(&self) -> &'static str { - Self::name(self) - } -} - -impl Variants for HotArchiveBucketEntryType { - fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { - Self::VARIANTS.iter() - } -} - -impl Enum for HotArchiveBucketEntryType {} - -impl fmt::Display for HotArchiveBucketEntryType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.name()) - } -} - -impl TryFrom for HotArchiveBucketEntryType { - type Error = Error; - - fn try_from(i: i32) -> Result { - let e = match i { - -1 => HotArchiveBucketEntryType::Metaentry, - 0 => HotArchiveBucketEntryType::Archived, - 1 => HotArchiveBucketEntryType::Live, - 2 => HotArchiveBucketEntryType::Deleted, - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(e) - } -} - -impl From for i32 { - #[must_use] - fn from(e: HotArchiveBucketEntryType) -> Self { - e as Self - } +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct LedgerHeaderExtensionV1 { + pub flags: u32, + pub ext: LedgerHeaderExtensionV1Ext, } -impl ReadXdr for HotArchiveBucketEntryType { +impl ReadXdr for LedgerHeaderExtensionV1 { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let e = i32::read_xdr(r)?; - let v: Self = e.try_into()?; - Ok(v) + Ok(Self { + flags: u32::read_xdr(r)?, + ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?, + }) }) } } -impl WriteXdr for HotArchiveBucketEntryType { +impl WriteXdr for LedgerHeaderExtensionV1 { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - let i: i32 = (*self).into(); - i.write_xdr(w) + self.flags.write_xdr(w)?; + self.ext.write_xdr(w)?; + Ok(()) }) } } -/// BucketMetadataExt is an XDR NestedUnion defines as: +/// LedgerHeaderExt is an XDR NestedUnion defines as: /// /// ```text /// union switch (int v) @@ -19220,7 +19491,7 @@ impl WriteXdr for HotArchiveBucketEntryType { /// case 0: /// void; /// case 1: -/// BucketListType bucketListType; +/// LedgerHeaderExtensionV1 v1; /// } /// ``` /// @@ -19234,12 +19505,12 @@ impl WriteXdr for HotArchiveBucketEntryType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum BucketMetadataExt { +pub enum LedgerHeaderExt { V0, - V1(BucketListType), + V1(LedgerHeaderExtensionV1), } -impl BucketMetadataExt { +impl LedgerHeaderExt { pub const VARIANTS: [i32; 2] = [0, 1]; pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; @@ -19266,29 +19537,29 @@ impl BucketMetadataExt { } } -impl Name for BucketMetadataExt { +impl Name for LedgerHeaderExt { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for BucketMetadataExt { +impl Discriminant for LedgerHeaderExt { #[must_use] fn discriminant(&self) -> i32 { Self::discriminant(self) } } -impl Variants for BucketMetadataExt { +impl Variants for LedgerHeaderExt { fn variants() -> slice::Iter<'static, i32> { Self::VARIANTS.iter() } } -impl Union for BucketMetadataExt {} +impl Union for LedgerHeaderExt {} -impl ReadXdr for BucketMetadataExt { +impl ReadXdr for LedgerHeaderExt { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { @@ -19296,7 +19567,7 @@ impl ReadXdr for BucketMetadataExt { #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { 0 => Self::V0, - 1 => Self::V1(BucketListType::read_xdr(r)?), + 1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?), #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -19305,7 +19576,7 @@ impl ReadXdr for BucketMetadataExt { } } -impl WriteXdr for BucketMetadataExt { +impl WriteXdr for LedgerHeaderExt { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -19320,13 +19591,37 @@ impl WriteXdr for BucketMetadataExt { } } -/// BucketMetadata is an XDR Struct defines as: +/// LedgerHeader is an XDR Struct defines as: /// /// ```text -/// struct BucketMetadata +/// struct LedgerHeader /// { -/// // Indicates the protocol version used to create / merge this bucket. -/// uint32 ledgerVersion; +/// uint32 ledgerVersion; // the protocol version of the ledger +/// Hash previousLedgerHash; // hash of the previous ledger header +/// StellarValue scpValue; // what consensus agreed to +/// Hash txSetResultHash; // the TransactionResultSet that led to this ledger +/// Hash bucketListHash; // hash of the ledger state +/// +/// uint32 ledgerSeq; // sequence number of this ledger +/// +/// int64 totalCoins; // total number of stroops in existence. +/// // 10,000,000 stroops in 1 XLM +/// +/// int64 feePool; // fees burned since last inflation run +/// uint32 inflationSeq; // inflation sequence number +/// +/// uint64 idPool; // last used global ID, used for generating objects +/// +/// uint32 baseFee; // base fee per operation in stroops +/// uint32 baseReserve; // account base reserve in stroops +/// +/// uint32 maxTxSetSize; // maximum size a transaction set can be +/// +/// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back +/// // in time without walking the chain back ledger by ledger +/// // each slot contains the oldest ledger that is mod of +/// // either 50 5000 50000 or 500000 depending on index +/// // skipList[0] mod(50), skipList[1] mod(5000), etc /// /// // reserved for future use /// union switch (int v) @@ -19334,7 +19629,7 @@ impl WriteXdr for BucketMetadataExt { /// case 0: /// void; /// case 1: -/// BucketListType bucketListType; +/// LedgerHeaderExtensionV1 v1; /// } /// ext; /// }; @@ -19348,52 +19643,90 @@ impl WriteXdr for BucketMetadataExt { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct BucketMetadata { +pub struct LedgerHeader { pub ledger_version: u32, - pub ext: BucketMetadataExt, + pub previous_ledger_hash: Hash, + pub scp_value: StellarValue, + pub tx_set_result_hash: Hash, + pub bucket_list_hash: Hash, + pub ledger_seq: u32, + pub total_coins: i64, + pub fee_pool: i64, + pub inflation_seq: u32, + pub id_pool: u64, + pub base_fee: u32, + pub base_reserve: u32, + pub max_tx_set_size: u32, + pub skip_list: [Hash; 4], + pub ext: LedgerHeaderExt, } -impl ReadXdr for BucketMetadata { +impl ReadXdr for LedgerHeader { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { ledger_version: u32::read_xdr(r)?, - ext: BucketMetadataExt::read_xdr(r)?, + previous_ledger_hash: Hash::read_xdr(r)?, + scp_value: StellarValue::read_xdr(r)?, + tx_set_result_hash: Hash::read_xdr(r)?, + bucket_list_hash: Hash::read_xdr(r)?, + ledger_seq: u32::read_xdr(r)?, + total_coins: i64::read_xdr(r)?, + fee_pool: i64::read_xdr(r)?, + inflation_seq: u32::read_xdr(r)?, + id_pool: u64::read_xdr(r)?, + base_fee: u32::read_xdr(r)?, + base_reserve: u32::read_xdr(r)?, + max_tx_set_size: u32::read_xdr(r)?, + skip_list: <[Hash; 4]>::read_xdr(r)?, + ext: LedgerHeaderExt::read_xdr(r)?, }) }) } } -impl WriteXdr for BucketMetadata { +impl WriteXdr for LedgerHeader { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.ledger_version.write_xdr(w)?; + self.previous_ledger_hash.write_xdr(w)?; + self.scp_value.write_xdr(w)?; + self.tx_set_result_hash.write_xdr(w)?; + self.bucket_list_hash.write_xdr(w)?; + self.ledger_seq.write_xdr(w)?; + self.total_coins.write_xdr(w)?; + self.fee_pool.write_xdr(w)?; + self.inflation_seq.write_xdr(w)?; + self.id_pool.write_xdr(w)?; + self.base_fee.write_xdr(w)?; + self.base_reserve.write_xdr(w)?; + self.max_tx_set_size.write_xdr(w)?; + self.skip_list.write_xdr(w)?; self.ext.write_xdr(w)?; Ok(()) }) } } -/// BucketEntry is an XDR Union defines as: +/// LedgerUpgradeType is an XDR Enum defines as: /// /// ```text -/// union BucketEntry switch (BucketEntryType type) +/// enum LedgerUpgradeType /// { -/// case LIVEENTRY: -/// case INITENTRY: -/// LedgerEntry liveEntry; -/// -/// case DEADENTRY: -/// LedgerKey deadEntry; -/// case METAENTRY: -/// BucketMetadata metaEntry; +/// LEDGER_UPGRADE_VERSION = 1, +/// LEDGER_UPGRADE_BASE_FEE = 2, +/// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, +/// LEDGER_UPGRADE_BASE_RESERVE = 4, +/// LEDGER_UPGRADE_FLAGS = 5, +/// LEDGER_UPGRADE_CONFIG = 6, +/// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 /// }; /// ``` /// -// union with discriminant BucketEntryType -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -19401,126 +19734,195 @@ impl WriteXdr for BucketMetadata { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[allow(clippy::large_enum_variant)] -pub enum BucketEntry { - Liveentry(LedgerEntry), - Initentry(LedgerEntry), - Deadentry(LedgerKey), - Metaentry(BucketMetadata), +#[repr(i32)] +pub enum LedgerUpgradeType { + Version = 1, + BaseFee = 2, + MaxTxSetSize = 3, + BaseReserve = 4, + Flags = 5, + Config = 6, + MaxSorobanTxSetSize = 7, } -impl BucketEntry { - pub const VARIANTS: [BucketEntryType; 4] = [ - BucketEntryType::Liveentry, - BucketEntryType::Initentry, - BucketEntryType::Deadentry, - BucketEntryType::Metaentry, +impl LedgerUpgradeType { + pub const VARIANTS: [LedgerUpgradeType; 7] = [ + LedgerUpgradeType::Version, + LedgerUpgradeType::BaseFee, + LedgerUpgradeType::MaxTxSetSize, + LedgerUpgradeType::BaseReserve, + LedgerUpgradeType::Flags, + LedgerUpgradeType::Config, + LedgerUpgradeType::MaxSorobanTxSetSize, + ]; + pub const VARIANTS_STR: [&'static str; 7] = [ + "Version", + "BaseFee", + "MaxTxSetSize", + "BaseReserve", + "Flags", + "Config", + "MaxSorobanTxSetSize", ]; - pub const VARIANTS_STR: [&'static str; 4] = - ["Liveentry", "Initentry", "Deadentry", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Liveentry(_) => "Liveentry", - Self::Initentry(_) => "Initentry", - Self::Deadentry(_) => "Deadentry", - Self::Metaentry(_) => "Metaentry", - } - } - - #[must_use] - pub const fn discriminant(&self) -> BucketEntryType { - #[allow(clippy::match_same_arms)] - match self { - Self::Liveentry(_) => BucketEntryType::Liveentry, - Self::Initentry(_) => BucketEntryType::Initentry, - Self::Deadentry(_) => BucketEntryType::Deadentry, - Self::Metaentry(_) => BucketEntryType::Metaentry, + Self::Version => "Version", + Self::BaseFee => "BaseFee", + Self::MaxTxSetSize => "MaxTxSetSize", + Self::BaseReserve => "BaseReserve", + Self::Flags => "Flags", + Self::Config => "Config", + Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize", } } #[must_use] - pub const fn variants() -> [BucketEntryType; 4] { + pub const fn variants() -> [LedgerUpgradeType; 7] { Self::VARIANTS } } -impl Name for BucketEntry { +impl Name for LedgerUpgradeType { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for BucketEntry { - #[must_use] - fn discriminant(&self) -> BucketEntryType { - Self::discriminant(self) +impl Variants for LedgerUpgradeType { + fn variants() -> slice::Iter<'static, LedgerUpgradeType> { + Self::VARIANTS.iter() } } -impl Variants for BucketEntry { - fn variants() -> slice::Iter<'static, BucketEntryType> { - Self::VARIANTS.iter() +impl Enum for LedgerUpgradeType {} + +impl fmt::Display for LedgerUpgradeType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) } } -impl Union for BucketEntry {} +impl TryFrom for LedgerUpgradeType { + type Error = Error; -impl ReadXdr for BucketEntry { + fn try_from(i: i32) -> Result { + let e = match i { + 1 => LedgerUpgradeType::Version, + 2 => LedgerUpgradeType::BaseFee, + 3 => LedgerUpgradeType::MaxTxSetSize, + 4 => LedgerUpgradeType::BaseReserve, + 5 => LedgerUpgradeType::Flags, + 6 => LedgerUpgradeType::Config, + 7 => LedgerUpgradeType::MaxSorobanTxSetSize, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) + } +} + +impl From for i32 { + #[must_use] + fn from(e: LedgerUpgradeType) -> Self { + e as Self + } +} + +impl ReadXdr for LedgerUpgradeType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: BucketEntryType = ::read_xdr(r)?; - #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] - let v = match dv { - BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?), - BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?), - BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?), - BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?), - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; Ok(v) }) } } -impl WriteXdr for BucketEntry { +impl WriteXdr for LedgerUpgradeType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.discriminant().write_xdr(w)?; - #[allow(clippy::match_same_arms)] - match self { - Self::Liveentry(v) => v.write_xdr(w)?, - Self::Initentry(v) => v.write_xdr(w)?, - Self::Deadentry(v) => v.write_xdr(w)?, - Self::Metaentry(v) => v.write_xdr(w)?, - }; + let i: i32 = (*self).into(); + i.write_xdr(w) + }) + } +} + +/// ConfigUpgradeSetKey is an XDR Struct defines as: +/// +/// ```text +/// struct ConfigUpgradeSetKey { +/// Hash contractID; +/// Hash contentHash; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ConfigUpgradeSetKey { + pub contract_id: Hash, + pub content_hash: Hash, +} + +impl ReadXdr for ConfigUpgradeSetKey { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + contract_id: Hash::read_xdr(r)?, + content_hash: Hash::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ConfigUpgradeSetKey { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.contract_id.write_xdr(w)?; + self.content_hash.write_xdr(w)?; Ok(()) }) } } -/// HotArchiveBucketEntry is an XDR Union defines as: +/// LedgerUpgrade is an XDR Union defines as: /// /// ```text -/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) +/// union LedgerUpgrade switch (LedgerUpgradeType type) /// { -/// case HOT_ARCHIVE_ARCHIVED: -/// LedgerEntry archivedEntry; -/// -/// case HOT_ARCHIVE_LIVE: -/// case HOT_ARCHIVE_DELETED: -/// LedgerKey key; -/// case HOT_ARCHIVE_METAENTRY: -/// BucketMetadata metaEntry; +/// case LEDGER_UPGRADE_VERSION: +/// uint32 newLedgerVersion; // update ledgerVersion +/// case LEDGER_UPGRADE_BASE_FEE: +/// uint32 newBaseFee; // update baseFee +/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: +/// uint32 newMaxTxSetSize; // update maxTxSetSize +/// case LEDGER_UPGRADE_BASE_RESERVE: +/// uint32 newBaseReserve; // update baseReserve +/// case LEDGER_UPGRADE_FLAGS: +/// uint32 newFlags; // update flags +/// case LEDGER_UPGRADE_CONFIG: +/// // Update arbitrary `ConfigSetting` entries identified by the key. +/// ConfigUpgradeSetKey newConfig; +/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: +/// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without +/// // using `LEDGER_UPGRADE_CONFIG`. +/// uint32 newMaxSorobanTxSetSize; /// }; /// ``` /// -// union with discriminant HotArchiveBucketEntryType +// union with discriminant LedgerUpgradeType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -19530,84 +19932,106 @@ impl WriteXdr for BucketEntry { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum HotArchiveBucketEntry { - Archived(LedgerEntry), - Live(LedgerKey), - Deleted(LedgerKey), - Metaentry(BucketMetadata), +pub enum LedgerUpgrade { + Version(u32), + BaseFee(u32), + MaxTxSetSize(u32), + BaseReserve(u32), + Flags(u32), + Config(ConfigUpgradeSetKey), + MaxSorobanTxSetSize(u32), } -impl HotArchiveBucketEntry { - pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [ - HotArchiveBucketEntryType::Archived, - HotArchiveBucketEntryType::Live, - HotArchiveBucketEntryType::Deleted, - HotArchiveBucketEntryType::Metaentry, +impl LedgerUpgrade { + pub const VARIANTS: [LedgerUpgradeType; 7] = [ + LedgerUpgradeType::Version, + LedgerUpgradeType::BaseFee, + LedgerUpgradeType::MaxTxSetSize, + LedgerUpgradeType::BaseReserve, + LedgerUpgradeType::Flags, + LedgerUpgradeType::Config, + LedgerUpgradeType::MaxSorobanTxSetSize, + ]; + pub const VARIANTS_STR: [&'static str; 7] = [ + "Version", + "BaseFee", + "MaxTxSetSize", + "BaseReserve", + "Flags", + "Config", + "MaxSorobanTxSetSize", ]; - pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::Archived(_) => "Archived", - Self::Live(_) => "Live", - Self::Deleted(_) => "Deleted", - Self::Metaentry(_) => "Metaentry", + Self::Version(_) => "Version", + Self::BaseFee(_) => "BaseFee", + Self::MaxTxSetSize(_) => "MaxTxSetSize", + Self::BaseReserve(_) => "BaseReserve", + Self::Flags(_) => "Flags", + Self::Config(_) => "Config", + Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize", } } #[must_use] - pub const fn discriminant(&self) -> HotArchiveBucketEntryType { + pub const fn discriminant(&self) -> LedgerUpgradeType { #[allow(clippy::match_same_arms)] match self { - Self::Archived(_) => HotArchiveBucketEntryType::Archived, - Self::Live(_) => HotArchiveBucketEntryType::Live, - Self::Deleted(_) => HotArchiveBucketEntryType::Deleted, - Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry, + Self::Version(_) => LedgerUpgradeType::Version, + Self::BaseFee(_) => LedgerUpgradeType::BaseFee, + Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize, + Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve, + Self::Flags(_) => LedgerUpgradeType::Flags, + Self::Config(_) => LedgerUpgradeType::Config, + Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize, } } #[must_use] - pub const fn variants() -> [HotArchiveBucketEntryType; 4] { + pub const fn variants() -> [LedgerUpgradeType; 7] { Self::VARIANTS } } -impl Name for HotArchiveBucketEntry { +impl Name for LedgerUpgrade { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for HotArchiveBucketEntry { +impl Discriminant for LedgerUpgrade { #[must_use] - fn discriminant(&self) -> HotArchiveBucketEntryType { + fn discriminant(&self) -> LedgerUpgradeType { Self::discriminant(self) } } -impl Variants for HotArchiveBucketEntry { - fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> { +impl Variants for LedgerUpgrade { + fn variants() -> slice::Iter<'static, LedgerUpgradeType> { Self::VARIANTS.iter() } } -impl Union for HotArchiveBucketEntry {} +impl Union for LedgerUpgrade {} -impl ReadXdr for HotArchiveBucketEntry { +impl ReadXdr for LedgerUpgrade { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: HotArchiveBucketEntryType = - ::read_xdr(r)?; + let dv: LedgerUpgradeType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?), - HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?), - HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?), - HotArchiveBucketEntryType::Metaentry => { - Self::Metaentry(BucketMetadata::read_xdr(r)?) + LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?), + LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?), + LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?), + LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?), + LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?), + LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?), + LedgerUpgradeType::MaxSorobanTxSetSize => { + Self::MaxSorobanTxSetSize(u32::read_xdr(r)?) } #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), @@ -19617,23 +20041,67 @@ impl ReadXdr for HotArchiveBucketEntry { } } -impl WriteXdr for HotArchiveBucketEntry { +impl WriteXdr for LedgerUpgrade { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::Archived(v) => v.write_xdr(w)?, - Self::Live(v) => v.write_xdr(w)?, - Self::Deleted(v) => v.write_xdr(w)?, - Self::Metaentry(v) => v.write_xdr(w)?, + Self::Version(v) => v.write_xdr(w)?, + Self::BaseFee(v) => v.write_xdr(w)?, + Self::MaxTxSetSize(v) => v.write_xdr(w)?, + Self::BaseReserve(v) => v.write_xdr(w)?, + Self::Flags(v) => v.write_xdr(w)?, + Self::Config(v) => v.write_xdr(w)?, + Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?, }; Ok(()) }) } } +/// ConfigUpgradeSet is an XDR Struct defines as: +/// +/// ```text +/// struct ConfigUpgradeSet { +/// ConfigSettingEntry updatedEntry<>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ConfigUpgradeSet { + pub updated_entry: VecM, +} + +impl ReadXdr for ConfigUpgradeSet { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + updated_entry: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ConfigUpgradeSet { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.updated_entry.write_xdr(w)?; + Ok(()) + }) + } +} + /// TxSetComponentType is an XDR Enum defines as: /// /// ```text @@ -31144,7 +31612,419 @@ impl ReadXdr for Memo { } } -impl WriteXdr for Memo { +impl WriteXdr for Memo { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::None => ().write_xdr(w)?, + Self::Text(v) => v.write_xdr(w)?, + Self::Id(v) => v.write_xdr(w)?, + Self::Hash(v) => v.write_xdr(w)?, + Self::Return(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + +/// TimeBounds is an XDR Struct defines as: +/// +/// ```text +/// struct TimeBounds +/// { +/// TimePoint minTime; +/// TimePoint maxTime; // 0 here means no maxTime +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct TimeBounds { + pub min_time: TimePoint, + pub max_time: TimePoint, +} + +impl ReadXdr for TimeBounds { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + min_time: TimePoint::read_xdr(r)?, + max_time: TimePoint::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for TimeBounds { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.min_time.write_xdr(w)?; + self.max_time.write_xdr(w)?; + Ok(()) + }) + } +} + +/// LedgerBounds is an XDR Struct defines as: +/// +/// ```text +/// struct LedgerBounds +/// { +/// uint32 minLedger; +/// uint32 maxLedger; // 0 here means no maxLedger +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct LedgerBounds { + pub min_ledger: u32, + pub max_ledger: u32, +} + +impl ReadXdr for LedgerBounds { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + min_ledger: u32::read_xdr(r)?, + max_ledger: u32::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for LedgerBounds { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.min_ledger.write_xdr(w)?; + self.max_ledger.write_xdr(w)?; + Ok(()) + }) + } +} + +/// PreconditionsV2 is an XDR Struct defines as: +/// +/// ```text +/// struct PreconditionsV2 +/// { +/// TimeBounds* timeBounds; +/// +/// // Transaction only valid for ledger numbers n such that +/// // minLedger <= n < maxLedger (if maxLedger == 0, then +/// // only minLedger is checked) +/// LedgerBounds* ledgerBounds; +/// +/// // If NULL, only valid when sourceAccount's sequence number +/// // is seqNum - 1. Otherwise, valid when sourceAccount's +/// // sequence number n satisfies minSeqNum <= n < tx.seqNum. +/// // Note that after execution the account's sequence number +/// // is always raised to tx.seqNum, and a transaction is not +/// // valid if tx.seqNum is too high to ensure replay protection. +/// SequenceNumber* minSeqNum; +/// +/// // For the transaction to be valid, the current ledger time must +/// // be at least minSeqAge greater than sourceAccount's seqTime. +/// Duration minSeqAge; +/// +/// // For the transaction to be valid, the current ledger number +/// // must be at least minSeqLedgerGap greater than sourceAccount's +/// // seqLedger. +/// uint32 minSeqLedgerGap; +/// +/// // For the transaction to be valid, there must be a signature +/// // corresponding to every Signer in this array, even if the +/// // signature is not otherwise required by the sourceAccount or +/// // operations. +/// SignerKey extraSigners<2>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct PreconditionsV2 { + pub time_bounds: Option, + pub ledger_bounds: Option, + pub min_seq_num: Option, + pub min_seq_age: Duration, + pub min_seq_ledger_gap: u32, + pub extra_signers: VecM, +} + +impl ReadXdr for PreconditionsV2 { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + time_bounds: Option::::read_xdr(r)?, + ledger_bounds: Option::::read_xdr(r)?, + min_seq_num: Option::::read_xdr(r)?, + min_seq_age: Duration::read_xdr(r)?, + min_seq_ledger_gap: u32::read_xdr(r)?, + extra_signers: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for PreconditionsV2 { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.time_bounds.write_xdr(w)?; + self.ledger_bounds.write_xdr(w)?; + self.min_seq_num.write_xdr(w)?; + self.min_seq_age.write_xdr(w)?; + self.min_seq_ledger_gap.write_xdr(w)?; + self.extra_signers.write_xdr(w)?; + Ok(()) + }) + } +} + +/// PreconditionType is an XDR Enum defines as: +/// +/// ```text +/// enum PreconditionType +/// { +/// PRECOND_NONE = 0, +/// PRECOND_TIME = 1, +/// PRECOND_V2 = 2 +/// }; +/// ``` +/// +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[repr(i32)] +pub enum PreconditionType { + None = 0, + Time = 1, + V2 = 2, +} + +impl PreconditionType { + pub const VARIANTS: [PreconditionType; 3] = [ + PreconditionType::None, + PreconditionType::Time, + PreconditionType::V2, + ]; + pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::None => "None", + Self::Time => "Time", + Self::V2 => "V2", + } + } + + #[must_use] + pub const fn variants() -> [PreconditionType; 3] { + Self::VARIANTS + } +} + +impl Name for PreconditionType { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Variants for PreconditionType { + fn variants() -> slice::Iter<'static, PreconditionType> { + Self::VARIANTS.iter() + } +} + +impl Enum for PreconditionType {} + +impl fmt::Display for PreconditionType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) + } +} + +impl TryFrom for PreconditionType { + type Error = Error; + + fn try_from(i: i32) -> Result { + let e = match i { + 0 => PreconditionType::None, + 1 => PreconditionType::Time, + 2 => PreconditionType::V2, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) + } +} + +impl From for i32 { + #[must_use] + fn from(e: PreconditionType) -> Self { + e as Self + } +} + +impl ReadXdr for PreconditionType { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) + }) + } +} + +impl WriteXdr for PreconditionType { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + let i: i32 = (*self).into(); + i.write_xdr(w) + }) + } +} + +/// Preconditions is an XDR Union defines as: +/// +/// ```text +/// union Preconditions switch (PreconditionType type) +/// { +/// case PRECOND_NONE: +/// void; +/// case PRECOND_TIME: +/// TimeBounds timeBounds; +/// case PRECOND_V2: +/// PreconditionsV2 v2; +/// }; +/// ``` +/// +// union with discriminant PreconditionType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum Preconditions { + None, + Time(TimeBounds), + V2(PreconditionsV2), +} + +impl Preconditions { + pub const VARIANTS: [PreconditionType; 3] = [ + PreconditionType::None, + PreconditionType::Time, + PreconditionType::V2, + ]; + pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::None => "None", + Self::Time(_) => "Time", + Self::V2(_) => "V2", + } + } + + #[must_use] + pub const fn discriminant(&self) -> PreconditionType { + #[allow(clippy::match_same_arms)] + match self { + Self::None => PreconditionType::None, + Self::Time(_) => PreconditionType::Time, + Self::V2(_) => PreconditionType::V2, + } + } + + #[must_use] + pub const fn variants() -> [PreconditionType; 3] { + Self::VARIANTS + } +} + +impl Name for Preconditions { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for Preconditions { + #[must_use] + fn discriminant(&self) -> PreconditionType { + Self::discriminant(self) + } +} + +impl Variants for Preconditions { + fn variants() -> slice::Iter<'static, PreconditionType> { + Self::VARIANTS.iter() + } +} + +impl Union for Preconditions {} + +impl ReadXdr for Preconditions { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: PreconditionType = ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + PreconditionType::None => Self::None, + PreconditionType::Time => Self::Time(TimeBounds::read_xdr(r)?), + PreconditionType::V2 => Self::V2(PreconditionsV2::read_xdr(r)?), + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for Preconditions { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { @@ -31152,23 +32032,21 @@ impl WriteXdr for Memo { #[allow(clippy::match_same_arms)] match self { Self::None => ().write_xdr(w)?, - Self::Text(v) => v.write_xdr(w)?, - Self::Id(v) => v.write_xdr(w)?, - Self::Hash(v) => v.write_xdr(w)?, - Self::Return(v) => v.write_xdr(w)?, + Self::Time(v) => v.write_xdr(w)?, + Self::V2(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// TimeBounds is an XDR Struct defines as: +/// LedgerFootprint is an XDR Struct defines as: /// /// ```text -/// struct TimeBounds +/// struct LedgerFootprint /// { -/// TimePoint minTime; -/// TimePoint maxTime; // 0 here means no maxTime +/// LedgerKey readOnly<>; +/// LedgerKey readWrite<>; /// }; /// ``` /// @@ -31180,45 +32058,46 @@ impl WriteXdr for Memo { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct TimeBounds { - pub min_time: TimePoint, - pub max_time: TimePoint, +pub struct LedgerFootprint { + pub read_only: VecM, + pub read_write: VecM, } -impl ReadXdr for TimeBounds { +impl ReadXdr for LedgerFootprint { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - min_time: TimePoint::read_xdr(r)?, - max_time: TimePoint::read_xdr(r)?, + read_only: VecM::::read_xdr(r)?, + read_write: VecM::::read_xdr(r)?, }) }) } } -impl WriteXdr for TimeBounds { +impl WriteXdr for LedgerFootprint { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.min_time.write_xdr(w)?; - self.max_time.write_xdr(w)?; + self.read_only.write_xdr(w)?; + self.read_write.write_xdr(w)?; Ok(()) }) } } -/// LedgerBounds is an XDR Struct defines as: +/// ArchivalProofType is an XDR Enum defines as: /// /// ```text -/// struct LedgerBounds +/// enum ArchivalProofType /// { -/// uint32 minLedger; -/// uint32 maxLedger; // 0 here means no maxLedger +/// EXISTENCE = 0, +/// NONEXISTENCE = 1 /// }; /// ``` /// -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +// enum +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( all(feature = "serde", feature = "alloc"), @@ -31226,68 +32105,103 @@ impl WriteXdr for TimeBounds { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerBounds { - pub min_ledger: u32, - pub max_ledger: u32, +#[repr(i32)] +pub enum ArchivalProofType { + Existence = 0, + Nonexistence = 1, } -impl ReadXdr for LedgerBounds { +impl ArchivalProofType { + pub const VARIANTS: [ArchivalProofType; 2] = [ + ArchivalProofType::Existence, + ArchivalProofType::Nonexistence, + ]; + pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::Existence => "Existence", + Self::Nonexistence => "Nonexistence", + } + } + + #[must_use] + pub const fn variants() -> [ArchivalProofType; 2] { + Self::VARIANTS + } +} + +impl Name for ArchivalProofType { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Variants for ArchivalProofType { + fn variants() -> slice::Iter<'static, ArchivalProofType> { + Self::VARIANTS.iter() + } +} + +impl Enum for ArchivalProofType {} + +impl fmt::Display for ArchivalProofType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) + } +} + +impl TryFrom for ArchivalProofType { + type Error = Error; + + fn try_from(i: i32) -> Result { + let e = match i { + 0 => ArchivalProofType::Existence, + 1 => ArchivalProofType::Nonexistence, + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(e) + } +} + +impl From for i32 { + #[must_use] + fn from(e: ArchivalProofType) -> Self { + e as Self + } +} + +impl ReadXdr for ArchivalProofType { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - Ok(Self { - min_ledger: u32::read_xdr(r)?, - max_ledger: u32::read_xdr(r)?, - }) + let e = i32::read_xdr(r)?; + let v: Self = e.try_into()?; + Ok(v) }) } } -impl WriteXdr for LedgerBounds { +impl WriteXdr for ArchivalProofType { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.min_ledger.write_xdr(w)?; - self.max_ledger.write_xdr(w)?; - Ok(()) + let i: i32 = (*self).into(); + i.write_xdr(w) }) } } -/// PreconditionsV2 is an XDR Struct defines as: +/// ArchivalProofNode is an XDR Struct defines as: /// /// ```text -/// struct PreconditionsV2 +/// struct ArchivalProofNode /// { -/// TimeBounds* timeBounds; -/// -/// // Transaction only valid for ledger numbers n such that -/// // minLedger <= n < maxLedger (if maxLedger == 0, then -/// // only minLedger is checked) -/// LedgerBounds* ledgerBounds; -/// -/// // If NULL, only valid when sourceAccount's sequence number -/// // is seqNum - 1. Otherwise, valid when sourceAccount's -/// // sequence number n satisfies minSeqNum <= n < tx.seqNum. -/// // Note that after execution the account's sequence number -/// // is always raised to tx.seqNum, and a transaction is not -/// // valid if tx.seqNum is too high to ensure replay protection. -/// SequenceNumber* minSeqNum; -/// -/// // For the transaction to be valid, the current ledger time must -/// // be at least minSeqAge greater than sourceAccount's seqTime. -/// Duration minSeqAge; -/// -/// // For the transaction to be valid, the current ledger number -/// // must be at least minSeqLedgerGap greater than sourceAccount's -/// // seqLedger. -/// uint32 minSeqLedgerGap; -/// -/// // For the transaction to be valid, there must be a signature -/// // corresponding to every Signer in this array, even if the -/// // signature is not otherwise required by the sourceAccount or -/// // operations. -/// SignerKey extraSigners<2>; +/// uint32 index; +/// Hash hash; /// }; /// ``` /// @@ -31299,175 +32213,262 @@ impl WriteXdr for LedgerBounds { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct PreconditionsV2 { - pub time_bounds: Option, - pub ledger_bounds: Option, - pub min_seq_num: Option, - pub min_seq_age: Duration, - pub min_seq_ledger_gap: u32, - pub extra_signers: VecM, +pub struct ArchivalProofNode { + pub index: u32, + pub hash: Hash, } -impl ReadXdr for PreconditionsV2 { +impl ReadXdr for ArchivalProofNode { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - time_bounds: Option::::read_xdr(r)?, - ledger_bounds: Option::::read_xdr(r)?, - min_seq_num: Option::::read_xdr(r)?, - min_seq_age: Duration::read_xdr(r)?, - min_seq_ledger_gap: u32::read_xdr(r)?, - extra_signers: VecM::::read_xdr(r)?, + index: u32::read_xdr(r)?, + hash: Hash::read_xdr(r)?, }) }) } } -impl WriteXdr for PreconditionsV2 { +impl WriteXdr for ArchivalProofNode { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.time_bounds.write_xdr(w)?; - self.ledger_bounds.write_xdr(w)?; - self.min_seq_num.write_xdr(w)?; - self.min_seq_age.write_xdr(w)?; - self.min_seq_ledger_gap.write_xdr(w)?; - self.extra_signers.write_xdr(w)?; + self.index.write_xdr(w)?; + self.hash.write_xdr(w)?; Ok(()) }) } } -/// PreconditionType is an XDR Enum defines as: +/// ProofLevel is an XDR Typedef defines as: /// /// ```text -/// enum PreconditionType -/// { -/// PRECOND_NONE = 0, -/// PRECOND_TIME = 1, -/// PRECOND_V2 = 2 -/// }; +/// typedef ArchivalProofNode ProofLevel<>; /// ``` /// -// enum -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[derive(Default)] #[cfg_attr( all(feature = "serde", feature = "alloc"), derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[repr(i32)] -pub enum PreconditionType { - None = 0, - Time = 1, - V2 = 2, -} - -impl PreconditionType { - pub const VARIANTS: [PreconditionType; 3] = [ - PreconditionType::None, - PreconditionType::Time, - PreconditionType::V2, - ]; - pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"]; +#[derive(Debug)] +pub struct ProofLevel(pub VecM); +impl From for VecM { #[must_use] - pub const fn name(&self) -> &'static str { - match self { - Self::None => "None", - Self::Time => "Time", - Self::V2 => "V2", - } + fn from(x: ProofLevel) -> Self { + x.0 } +} +impl From> for ProofLevel { #[must_use] - pub const fn variants() -> [PreconditionType; 3] { - Self::VARIANTS + fn from(x: VecM) -> Self { + ProofLevel(x) } } -impl Name for PreconditionType { +impl AsRef> for ProofLevel { #[must_use] - fn name(&self) -> &'static str { - Self::name(self) + fn as_ref(&self) -> &VecM { + &self.0 } } -impl Variants for PreconditionType { - fn variants() -> slice::Iter<'static, PreconditionType> { - Self::VARIANTS.iter() +impl ReadXdr for ProofLevel { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let i = VecM::::read_xdr(r)?; + let v = ProofLevel(i); + Ok(v) + }) } } -impl Enum for PreconditionType {} +impl WriteXdr for ProofLevel { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| self.0.write_xdr(w)) + } +} -impl fmt::Display for PreconditionType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.name()) +impl Deref for ProofLevel { + type Target = VecM; + fn deref(&self) -> &Self::Target { + &self.0 } } -impl TryFrom for PreconditionType { +impl From for Vec { + #[must_use] + fn from(x: ProofLevel) -> Self { + x.0 .0 + } +} + +impl TryFrom> for ProofLevel { type Error = Error; + fn try_from(x: Vec) -> Result { + Ok(ProofLevel(x.try_into()?)) + } +} - fn try_from(i: i32) -> Result { - let e = match i { - 0 => PreconditionType::None, - 1 => PreconditionType::Time, - 2 => PreconditionType::V2, - #[allow(unreachable_patterns)] - _ => return Err(Error::Invalid), - }; - Ok(e) +#[cfg(feature = "alloc")] +impl TryFrom<&Vec> for ProofLevel { + type Error = Error; + fn try_from(x: &Vec) -> Result { + Ok(ProofLevel(x.try_into()?)) } } -impl From for i32 { +impl AsRef> for ProofLevel { #[must_use] - fn from(e: PreconditionType) -> Self { - e as Self + fn as_ref(&self) -> &Vec { + &self.0 .0 } } -impl ReadXdr for PreconditionType { +impl AsRef<[ArchivalProofNode]> for ProofLevel { + #[cfg(feature = "alloc")] + #[must_use] + fn as_ref(&self) -> &[ArchivalProofNode] { + &self.0 .0 + } + #[cfg(not(feature = "alloc"))] + #[must_use] + fn as_ref(&self) -> &[ArchivalProofNode] { + self.0 .0 + } +} + +/// NonexistenceProofBody is an XDR Struct defines as: +/// +/// ```text +/// struct NonexistenceProofBody +/// { +/// ColdArchiveBucketEntry entriesToProve<>; +/// +/// // Vector of vectors, where proofLevels[level] +/// // contains all HashNodes that correspond with that level +/// ProofLevel proofLevels<>; +/// }; +/// ``` +/// +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct NonexistenceProofBody { + pub entries_to_prove: VecM, + pub proof_levels: VecM, +} + +impl ReadXdr for NonexistenceProofBody { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let e = i32::read_xdr(r)?; - let v: Self = e.try_into()?; - Ok(v) + Ok(Self { + entries_to_prove: VecM::::read_xdr(r)?, + proof_levels: VecM::::read_xdr(r)?, + }) }) } } -impl WriteXdr for PreconditionType { +impl WriteXdr for NonexistenceProofBody { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - let i: i32 = (*self).into(); - i.write_xdr(w) + self.entries_to_prove.write_xdr(w)?; + self.proof_levels.write_xdr(w)?; + Ok(()) }) } } -/// Preconditions is an XDR Union defines as: +/// ExistenceProofBody is an XDR Struct defines as: /// /// ```text -/// union Preconditions switch (PreconditionType type) +/// struct ExistenceProofBody /// { -/// case PRECOND_NONE: -/// void; -/// case PRECOND_TIME: -/// TimeBounds timeBounds; -/// case PRECOND_V2: -/// PreconditionsV2 v2; +/// LedgerKey keysToProve<>; +/// +/// // Bounds for each key being proved, where bound[n] +/// // corresponds to keysToProve[n] +/// ColdArchiveBucketEntry lowBoundEntries<>; +/// ColdArchiveBucketEntry highBoundEntries<>; +/// +/// // Vector of vectors, where proofLevels[level] +/// // contains all HashNodes that correspond with that level +/// ProofLevel proofLevels<>; /// }; /// ``` /// -// union with discriminant PreconditionType +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +pub struct ExistenceProofBody { + pub keys_to_prove: VecM, + pub low_bound_entries: VecM, + pub high_bound_entries: VecM, + pub proof_levels: VecM, +} + +impl ReadXdr for ExistenceProofBody { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + Ok(Self { + keys_to_prove: VecM::::read_xdr(r)?, + low_bound_entries: VecM::::read_xdr(r)?, + high_bound_entries: VecM::::read_xdr(r)?, + proof_levels: VecM::::read_xdr(r)?, + }) + }) + } +} + +impl WriteXdr for ExistenceProofBody { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.keys_to_prove.write_xdr(w)?; + self.low_bound_entries.write_xdr(w)?; + self.high_bound_entries.write_xdr(w)?; + self.proof_levels.write_xdr(w)?; + Ok(()) + }) + } +} + +/// ArchivalProofBody is an XDR NestedUnion defines as: +/// +/// ```text +/// union switch (ArchivalProofType t) +/// { +/// case EXISTENCE: +/// NonexistenceProofBody nonexistenceProof; +/// case NONEXISTENCE: +/// ExistenceProofBody existenceProof; +/// } +/// ``` +/// +// union with discriminant ArchivalProofType #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[cfg_attr( @@ -31477,77 +32478,76 @@ impl WriteXdr for PreconditionType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[allow(clippy::large_enum_variant)] -pub enum Preconditions { - None, - Time(TimeBounds), - V2(PreconditionsV2), +pub enum ArchivalProofBody { + Existence(NonexistenceProofBody), + Nonexistence(ExistenceProofBody), } -impl Preconditions { - pub const VARIANTS: [PreconditionType; 3] = [ - PreconditionType::None, - PreconditionType::Time, - PreconditionType::V2, +impl ArchivalProofBody { + pub const VARIANTS: [ArchivalProofType; 2] = [ + ArchivalProofType::Existence, + ArchivalProofType::Nonexistence, ]; - pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"]; + pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"]; #[must_use] pub const fn name(&self) -> &'static str { match self { - Self::None => "None", - Self::Time(_) => "Time", - Self::V2(_) => "V2", + Self::Existence(_) => "Existence", + Self::Nonexistence(_) => "Nonexistence", } } #[must_use] - pub const fn discriminant(&self) -> PreconditionType { + pub const fn discriminant(&self) -> ArchivalProofType { #[allow(clippy::match_same_arms)] match self { - Self::None => PreconditionType::None, - Self::Time(_) => PreconditionType::Time, - Self::V2(_) => PreconditionType::V2, + Self::Existence(_) => ArchivalProofType::Existence, + Self::Nonexistence(_) => ArchivalProofType::Nonexistence, } } #[must_use] - pub const fn variants() -> [PreconditionType; 3] { + pub const fn variants() -> [ArchivalProofType; 2] { Self::VARIANTS } } -impl Name for Preconditions { +impl Name for ArchivalProofBody { #[must_use] fn name(&self) -> &'static str { Self::name(self) } } -impl Discriminant for Preconditions { +impl Discriminant for ArchivalProofBody { #[must_use] - fn discriminant(&self) -> PreconditionType { + fn discriminant(&self) -> ArchivalProofType { Self::discriminant(self) } } -impl Variants for Preconditions { - fn variants() -> slice::Iter<'static, PreconditionType> { +impl Variants for ArchivalProofBody { + fn variants() -> slice::Iter<'static, ArchivalProofType> { Self::VARIANTS.iter() } } -impl Union for Preconditions {} +impl Union for ArchivalProofBody {} -impl ReadXdr for Preconditions { +impl ReadXdr for ArchivalProofBody { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { - let dv: PreconditionType = ::read_xdr(r)?; + let dv: ArchivalProofType = ::read_xdr(r)?; #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] let v = match dv { - PreconditionType::None => Self::None, - PreconditionType::Time => Self::Time(TimeBounds::read_xdr(r)?), - PreconditionType::V2 => Self::V2(PreconditionsV2::read_xdr(r)?), + ArchivalProofType::Existence => { + Self::Existence(NonexistenceProofBody::read_xdr(r)?) + } + ArchivalProofType::Nonexistence => { + Self::Nonexistence(ExistenceProofBody::read_xdr(r)?) + } #[allow(unreachable_patterns)] _ => return Err(Error::Invalid), }; @@ -31556,29 +32556,35 @@ impl ReadXdr for Preconditions { } } -impl WriteXdr for Preconditions { +impl WriteXdr for ArchivalProofBody { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { self.discriminant().write_xdr(w)?; #[allow(clippy::match_same_arms)] match self { - Self::None => ().write_xdr(w)?, - Self::Time(v) => v.write_xdr(w)?, - Self::V2(v) => v.write_xdr(w)?, + Self::Existence(v) => v.write_xdr(w)?, + Self::Nonexistence(v) => v.write_xdr(w)?, }; Ok(()) }) } } -/// LedgerFootprint is an XDR Struct defines as: +/// ArchivalProof is an XDR Struct defines as: /// /// ```text -/// struct LedgerFootprint +/// struct ArchivalProof /// { -/// LedgerKey readOnly<>; -/// LedgerKey readWrite<>; +/// uint32 epoch; // AST Subtree for this proof +/// +/// union switch (ArchivalProofType t) +/// { +/// case EXISTENCE: +/// NonexistenceProofBody nonexistenceProof; +/// case NONEXISTENCE: +/// ExistenceProofBody existenceProof; +/// } body; /// }; /// ``` /// @@ -31590,29 +32596,29 @@ impl WriteXdr for Preconditions { serde(rename_all = "snake_case") )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LedgerFootprint { - pub read_only: VecM, - pub read_write: VecM, +pub struct ArchivalProof { + pub epoch: u32, + pub body: ArchivalProofBody, } -impl ReadXdr for LedgerFootprint { +impl ReadXdr for ArchivalProof { #[cfg(feature = "std")] fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - read_only: VecM::::read_xdr(r)?, - read_write: VecM::::read_xdr(r)?, + epoch: u32::read_xdr(r)?, + body: ArchivalProofBody::read_xdr(r)?, }) }) } } -impl WriteXdr for LedgerFootprint { +impl WriteXdr for ArchivalProof { #[cfg(feature = "std")] fn write_xdr(&self, w: &mut Limited) -> Result<()> { w.with_limited_depth(|w| { - self.read_only.write_xdr(w)?; - self.read_write.write_xdr(w)?; + self.epoch.write_xdr(w)?; + self.body.write_xdr(w)?; Ok(()) }) } @@ -31677,12 +32683,126 @@ impl WriteXdr for SorobanResources { } } +/// SorobanTransactionDataExt is an XDR NestedUnion defines as: +/// +/// ```text +/// union switch (int v) +/// { +/// case 0: +/// void; +/// case 1: +/// ArchivalProof proofs<>; +/// } +/// ``` +/// +// union with discriminant i32 +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "arbitrary", derive(Arbitrary))] +#[cfg_attr( + all(feature = "serde", feature = "alloc"), + derive(serde::Serialize, serde::Deserialize), + serde(rename_all = "snake_case") +)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[allow(clippy::large_enum_variant)] +pub enum SorobanTransactionDataExt { + V0, + V1(VecM), +} + +impl SorobanTransactionDataExt { + pub const VARIANTS: [i32; 2] = [0, 1]; + pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"]; + + #[must_use] + pub const fn name(&self) -> &'static str { + match self { + Self::V0 => "V0", + Self::V1(_) => "V1", + } + } + + #[must_use] + pub const fn discriminant(&self) -> i32 { + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => 0, + Self::V1(_) => 1, + } + } + + #[must_use] + pub const fn variants() -> [i32; 2] { + Self::VARIANTS + } +} + +impl Name for SorobanTransactionDataExt { + #[must_use] + fn name(&self) -> &'static str { + Self::name(self) + } +} + +impl Discriminant for SorobanTransactionDataExt { + #[must_use] + fn discriminant(&self) -> i32 { + Self::discriminant(self) + } +} + +impl Variants for SorobanTransactionDataExt { + fn variants() -> slice::Iter<'static, i32> { + Self::VARIANTS.iter() + } +} + +impl Union for SorobanTransactionDataExt {} + +impl ReadXdr for SorobanTransactionDataExt { + #[cfg(feature = "std")] + fn read_xdr(r: &mut Limited) -> Result { + r.with_limited_depth(|r| { + let dv: i32 = ::read_xdr(r)?; + #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)] + let v = match dv { + 0 => Self::V0, + 1 => Self::V1(VecM::::read_xdr(r)?), + #[allow(unreachable_patterns)] + _ => return Err(Error::Invalid), + }; + Ok(v) + }) + } +} + +impl WriteXdr for SorobanTransactionDataExt { + #[cfg(feature = "std")] + fn write_xdr(&self, w: &mut Limited) -> Result<()> { + w.with_limited_depth(|w| { + self.discriminant().write_xdr(w)?; + #[allow(clippy::match_same_arms)] + match self { + Self::V0 => ().write_xdr(w)?, + Self::V1(v) => v.write_xdr(w)?, + }; + Ok(()) + }) + } +} + /// SorobanTransactionData is an XDR Struct defines as: /// /// ```text /// struct SorobanTransactionData /// { -/// ExtensionPoint ext; +/// union switch (int v) +/// { +/// case 0: +/// void; +/// case 1: +/// ArchivalProof proofs<>; +/// } ext; /// SorobanResources resources; /// // Amount of the transaction `fee` allocated to the Soroban resource fees. /// // The fraction of `resourceFee` corresponding to `resources` specified @@ -31706,7 +32826,7 @@ impl WriteXdr for SorobanResources { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SorobanTransactionData { - pub ext: ExtensionPoint, + pub ext: SorobanTransactionDataExt, pub resources: SorobanResources, pub resource_fee: i64, } @@ -31716,7 +32836,7 @@ impl ReadXdr for SorobanTransactionData { fn read_xdr(r: &mut Limited) -> Result { r.with_limited_depth(|r| { Ok(Self { - ext: ExtensionPoint::read_xdr(r)?, + ext: SorobanTransactionDataExt::read_xdr(r)?, resources: SorobanResources::read_xdr(r)?, resource_fee: i64::read_xdr(r)?, }) @@ -45459,6 +46579,19 @@ pub enum TypeVariant { LedgerKeyConfigSetting, LedgerKeyTtl, EnvelopeType, + BucketListType, + BucketEntryType, + HotArchiveBucketEntryType, + ColdArchiveBucketEntryType, + BucketMetadata, + BucketMetadataExt, + BucketEntry, + HotArchiveBucketEntry, + ColdArchiveArchivedLeaf, + ColdArchiveDeletedLeaf, + ColdArchiveBoundaryLeaf, + ColdArchiveHashEntry, + ColdArchiveBucketEntry, UpgradeType, StellarValueType, LedgerCloseValueSignature, @@ -45473,13 +46606,6 @@ pub enum TypeVariant { ConfigUpgradeSetKey, LedgerUpgrade, ConfigUpgradeSet, - BucketListType, - BucketEntryType, - HotArchiveBucketEntryType, - BucketMetadata, - BucketMetadataExt, - BucketEntry, - HotArchiveBucketEntry, TxSetComponentType, TxExecutionThread, ParallelTxExecutionStage, @@ -45630,8 +46756,16 @@ pub enum TypeVariant { PreconditionType, Preconditions, LedgerFootprint, + ArchivalProofType, + ArchivalProofNode, + ProofLevel, + NonexistenceProofBody, + ExistenceProofBody, + ArchivalProof, + ArchivalProofBody, SorobanResources, SorobanTransactionData, + SorobanTransactionDataExt, TransactionV0, TransactionV0Ext, TransactionV0Envelope, @@ -45749,7 +46883,7 @@ pub enum TypeVariant { } impl TypeVariant { - pub const VARIANTS: [TypeVariant; 448] = [ + pub const VARIANTS: [TypeVariant; 462] = [ TypeVariant::Value, TypeVariant::ScpBallot, TypeVariant::ScpStatementType, @@ -45911,6 +47045,19 @@ impl TypeVariant { TypeVariant::LedgerKeyConfigSetting, TypeVariant::LedgerKeyTtl, TypeVariant::EnvelopeType, + TypeVariant::BucketListType, + TypeVariant::BucketEntryType, + TypeVariant::HotArchiveBucketEntryType, + TypeVariant::ColdArchiveBucketEntryType, + TypeVariant::BucketMetadata, + TypeVariant::BucketMetadataExt, + TypeVariant::BucketEntry, + TypeVariant::HotArchiveBucketEntry, + TypeVariant::ColdArchiveArchivedLeaf, + TypeVariant::ColdArchiveDeletedLeaf, + TypeVariant::ColdArchiveBoundaryLeaf, + TypeVariant::ColdArchiveHashEntry, + TypeVariant::ColdArchiveBucketEntry, TypeVariant::UpgradeType, TypeVariant::StellarValueType, TypeVariant::LedgerCloseValueSignature, @@ -45925,13 +47072,6 @@ impl TypeVariant { TypeVariant::ConfigUpgradeSetKey, TypeVariant::LedgerUpgrade, TypeVariant::ConfigUpgradeSet, - TypeVariant::BucketListType, - TypeVariant::BucketEntryType, - TypeVariant::HotArchiveBucketEntryType, - TypeVariant::BucketMetadata, - TypeVariant::BucketMetadataExt, - TypeVariant::BucketEntry, - TypeVariant::HotArchiveBucketEntry, TypeVariant::TxSetComponentType, TypeVariant::TxExecutionThread, TypeVariant::ParallelTxExecutionStage, @@ -46082,8 +47222,16 @@ impl TypeVariant { TypeVariant::PreconditionType, TypeVariant::Preconditions, TypeVariant::LedgerFootprint, + TypeVariant::ArchivalProofType, + TypeVariant::ArchivalProofNode, + TypeVariant::ProofLevel, + TypeVariant::NonexistenceProofBody, + TypeVariant::ExistenceProofBody, + TypeVariant::ArchivalProof, + TypeVariant::ArchivalProofBody, TypeVariant::SorobanResources, TypeVariant::SorobanTransactionData, + TypeVariant::SorobanTransactionDataExt, TypeVariant::TransactionV0, TypeVariant::TransactionV0Ext, TypeVariant::TransactionV0Envelope, @@ -46199,7 +47347,7 @@ impl TypeVariant { TypeVariant::BinaryFuseFilterType, TypeVariant::SerializedBinaryFuseFilter, ]; - pub const VARIANTS_STR: [&'static str; 448] = [ + pub const VARIANTS_STR: [&'static str; 462] = [ "Value", "ScpBallot", "ScpStatementType", @@ -46361,6 +47509,19 @@ impl TypeVariant { "LedgerKeyConfigSetting", "LedgerKeyTtl", "EnvelopeType", + "BucketListType", + "BucketEntryType", + "HotArchiveBucketEntryType", + "ColdArchiveBucketEntryType", + "BucketMetadata", + "BucketMetadataExt", + "BucketEntry", + "HotArchiveBucketEntry", + "ColdArchiveArchivedLeaf", + "ColdArchiveDeletedLeaf", + "ColdArchiveBoundaryLeaf", + "ColdArchiveHashEntry", + "ColdArchiveBucketEntry", "UpgradeType", "StellarValueType", "LedgerCloseValueSignature", @@ -46375,13 +47536,6 @@ impl TypeVariant { "ConfigUpgradeSetKey", "LedgerUpgrade", "ConfigUpgradeSet", - "BucketListType", - "BucketEntryType", - "HotArchiveBucketEntryType", - "BucketMetadata", - "BucketMetadataExt", - "BucketEntry", - "HotArchiveBucketEntry", "TxSetComponentType", "TxExecutionThread", "ParallelTxExecutionStage", @@ -46532,8 +47686,16 @@ impl TypeVariant { "PreconditionType", "Preconditions", "LedgerFootprint", + "ArchivalProofType", + "ArchivalProofNode", + "ProofLevel", + "NonexistenceProofBody", + "ExistenceProofBody", + "ArchivalProof", + "ArchivalProofBody", "SorobanResources", "SorobanTransactionData", + "SorobanTransactionDataExt", "TransactionV0", "TransactionV0Ext", "TransactionV0Envelope", @@ -46819,6 +47981,19 @@ impl TypeVariant { Self::LedgerKeyConfigSetting => "LedgerKeyConfigSetting", Self::LedgerKeyTtl => "LedgerKeyTtl", Self::EnvelopeType => "EnvelopeType", + Self::BucketListType => "BucketListType", + Self::BucketEntryType => "BucketEntryType", + Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType", + Self::ColdArchiveBucketEntryType => "ColdArchiveBucketEntryType", + Self::BucketMetadata => "BucketMetadata", + Self::BucketMetadataExt => "BucketMetadataExt", + Self::BucketEntry => "BucketEntry", + Self::HotArchiveBucketEntry => "HotArchiveBucketEntry", + Self::ColdArchiveArchivedLeaf => "ColdArchiveArchivedLeaf", + Self::ColdArchiveDeletedLeaf => "ColdArchiveDeletedLeaf", + Self::ColdArchiveBoundaryLeaf => "ColdArchiveBoundaryLeaf", + Self::ColdArchiveHashEntry => "ColdArchiveHashEntry", + Self::ColdArchiveBucketEntry => "ColdArchiveBucketEntry", Self::UpgradeType => "UpgradeType", Self::StellarValueType => "StellarValueType", Self::LedgerCloseValueSignature => "LedgerCloseValueSignature", @@ -46833,13 +48008,6 @@ impl TypeVariant { Self::ConfigUpgradeSetKey => "ConfigUpgradeSetKey", Self::LedgerUpgrade => "LedgerUpgrade", Self::ConfigUpgradeSet => "ConfigUpgradeSet", - Self::BucketListType => "BucketListType", - Self::BucketEntryType => "BucketEntryType", - Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType", - Self::BucketMetadata => "BucketMetadata", - Self::BucketMetadataExt => "BucketMetadataExt", - Self::BucketEntry => "BucketEntry", - Self::HotArchiveBucketEntry => "HotArchiveBucketEntry", Self::TxSetComponentType => "TxSetComponentType", Self::TxExecutionThread => "TxExecutionThread", Self::ParallelTxExecutionStage => "ParallelTxExecutionStage", @@ -46996,8 +48164,16 @@ impl TypeVariant { Self::PreconditionType => "PreconditionType", Self::Preconditions => "Preconditions", Self::LedgerFootprint => "LedgerFootprint", + Self::ArchivalProofType => "ArchivalProofType", + Self::ArchivalProofNode => "ArchivalProofNode", + Self::ProofLevel => "ProofLevel", + Self::NonexistenceProofBody => "NonexistenceProofBody", + Self::ExistenceProofBody => "ExistenceProofBody", + Self::ArchivalProof => "ArchivalProof", + Self::ArchivalProofBody => "ArchivalProofBody", Self::SorobanResources => "SorobanResources", Self::SorobanTransactionData => "SorobanTransactionData", + Self::SorobanTransactionDataExt => "SorobanTransactionDataExt", Self::TransactionV0 => "TransactionV0", Self::TransactionV0Ext => "TransactionV0Ext", Self::TransactionV0Envelope => "TransactionV0Envelope", @@ -47121,7 +48297,7 @@ impl TypeVariant { #[must_use] #[allow(clippy::too_many_lines)] - pub const fn variants() -> [TypeVariant; 448] { + pub const fn variants() -> [TypeVariant; 462] { Self::VARIANTS } @@ -47337,6 +48513,23 @@ impl TypeVariant { Self::LedgerKeyConfigSetting => gen.into_root_schema_for::(), Self::LedgerKeyTtl => gen.into_root_schema_for::(), Self::EnvelopeType => gen.into_root_schema_for::(), + Self::BucketListType => gen.into_root_schema_for::(), + Self::BucketEntryType => gen.into_root_schema_for::(), + Self::HotArchiveBucketEntryType => { + gen.into_root_schema_for::() + } + Self::ColdArchiveBucketEntryType => { + gen.into_root_schema_for::() + } + Self::BucketMetadata => gen.into_root_schema_for::(), + Self::BucketMetadataExt => gen.into_root_schema_for::(), + Self::BucketEntry => gen.into_root_schema_for::(), + Self::HotArchiveBucketEntry => gen.into_root_schema_for::(), + Self::ColdArchiveArchivedLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveDeletedLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveBoundaryLeaf => gen.into_root_schema_for::(), + Self::ColdArchiveHashEntry => gen.into_root_schema_for::(), + Self::ColdArchiveBucketEntry => gen.into_root_schema_for::(), Self::UpgradeType => gen.into_root_schema_for::(), Self::StellarValueType => gen.into_root_schema_for::(), Self::LedgerCloseValueSignature => { @@ -47355,15 +48548,6 @@ impl TypeVariant { Self::ConfigUpgradeSetKey => gen.into_root_schema_for::(), Self::LedgerUpgrade => gen.into_root_schema_for::(), Self::ConfigUpgradeSet => gen.into_root_schema_for::(), - Self::BucketListType => gen.into_root_schema_for::(), - Self::BucketEntryType => gen.into_root_schema_for::(), - Self::HotArchiveBucketEntryType => { - gen.into_root_schema_for::() - } - Self::BucketMetadata => gen.into_root_schema_for::(), - Self::BucketMetadataExt => gen.into_root_schema_for::(), - Self::BucketEntry => gen.into_root_schema_for::(), - Self::HotArchiveBucketEntry => gen.into_root_schema_for::(), Self::TxSetComponentType => gen.into_root_schema_for::(), Self::TxExecutionThread => gen.into_root_schema_for::(), Self::ParallelTxExecutionStage => { @@ -47590,8 +48774,18 @@ impl TypeVariant { Self::PreconditionType => gen.into_root_schema_for::(), Self::Preconditions => gen.into_root_schema_for::(), Self::LedgerFootprint => gen.into_root_schema_for::(), + Self::ArchivalProofType => gen.into_root_schema_for::(), + Self::ArchivalProofNode => gen.into_root_schema_for::(), + Self::ProofLevel => gen.into_root_schema_for::(), + Self::NonexistenceProofBody => gen.into_root_schema_for::(), + Self::ExistenceProofBody => gen.into_root_schema_for::(), + Self::ArchivalProof => gen.into_root_schema_for::(), + Self::ArchivalProofBody => gen.into_root_schema_for::(), Self::SorobanResources => gen.into_root_schema_for::(), Self::SorobanTransactionData => gen.into_root_schema_for::(), + Self::SorobanTransactionDataExt => { + gen.into_root_schema_for::() + } Self::TransactionV0 => gen.into_root_schema_for::(), Self::TransactionV0Ext => gen.into_root_schema_for::(), Self::TransactionV0Envelope => gen.into_root_schema_for::(), @@ -47977,6 +49171,19 @@ impl core::str::FromStr for TypeVariant { "LedgerKeyConfigSetting" => Ok(Self::LedgerKeyConfigSetting), "LedgerKeyTtl" => Ok(Self::LedgerKeyTtl), "EnvelopeType" => Ok(Self::EnvelopeType), + "BucketListType" => Ok(Self::BucketListType), + "BucketEntryType" => Ok(Self::BucketEntryType), + "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType), + "ColdArchiveBucketEntryType" => Ok(Self::ColdArchiveBucketEntryType), + "BucketMetadata" => Ok(Self::BucketMetadata), + "BucketMetadataExt" => Ok(Self::BucketMetadataExt), + "BucketEntry" => Ok(Self::BucketEntry), + "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry), + "ColdArchiveArchivedLeaf" => Ok(Self::ColdArchiveArchivedLeaf), + "ColdArchiveDeletedLeaf" => Ok(Self::ColdArchiveDeletedLeaf), + "ColdArchiveBoundaryLeaf" => Ok(Self::ColdArchiveBoundaryLeaf), + "ColdArchiveHashEntry" => Ok(Self::ColdArchiveHashEntry), + "ColdArchiveBucketEntry" => Ok(Self::ColdArchiveBucketEntry), "UpgradeType" => Ok(Self::UpgradeType), "StellarValueType" => Ok(Self::StellarValueType), "LedgerCloseValueSignature" => Ok(Self::LedgerCloseValueSignature), @@ -47991,13 +49198,6 @@ impl core::str::FromStr for TypeVariant { "ConfigUpgradeSetKey" => Ok(Self::ConfigUpgradeSetKey), "LedgerUpgrade" => Ok(Self::LedgerUpgrade), "ConfigUpgradeSet" => Ok(Self::ConfigUpgradeSet), - "BucketListType" => Ok(Self::BucketListType), - "BucketEntryType" => Ok(Self::BucketEntryType), - "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType), - "BucketMetadata" => Ok(Self::BucketMetadata), - "BucketMetadataExt" => Ok(Self::BucketMetadataExt), - "BucketEntry" => Ok(Self::BucketEntry), - "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry), "TxSetComponentType" => Ok(Self::TxSetComponentType), "TxExecutionThread" => Ok(Self::TxExecutionThread), "ParallelTxExecutionStage" => Ok(Self::ParallelTxExecutionStage), @@ -48160,8 +49360,16 @@ impl core::str::FromStr for TypeVariant { "PreconditionType" => Ok(Self::PreconditionType), "Preconditions" => Ok(Self::Preconditions), "LedgerFootprint" => Ok(Self::LedgerFootprint), + "ArchivalProofType" => Ok(Self::ArchivalProofType), + "ArchivalProofNode" => Ok(Self::ArchivalProofNode), + "ProofLevel" => Ok(Self::ProofLevel), + "NonexistenceProofBody" => Ok(Self::NonexistenceProofBody), + "ExistenceProofBody" => Ok(Self::ExistenceProofBody), + "ArchivalProof" => Ok(Self::ArchivalProof), + "ArchivalProofBody" => Ok(Self::ArchivalProofBody), "SorobanResources" => Ok(Self::SorobanResources), "SorobanTransactionData" => Ok(Self::SorobanTransactionData), + "SorobanTransactionDataExt" => Ok(Self::SorobanTransactionDataExt), "TransactionV0" => Ok(Self::TransactionV0), "TransactionV0Ext" => Ok(Self::TransactionV0Ext), "TransactionV0Envelope" => Ok(Self::TransactionV0Envelope), @@ -48459,6 +49667,19 @@ pub enum Type { LedgerKeyConfigSetting(Box), LedgerKeyTtl(Box), EnvelopeType(Box), + BucketListType(Box), + BucketEntryType(Box), + HotArchiveBucketEntryType(Box), + ColdArchiveBucketEntryType(Box), + BucketMetadata(Box), + BucketMetadataExt(Box), + BucketEntry(Box), + HotArchiveBucketEntry(Box), + ColdArchiveArchivedLeaf(Box), + ColdArchiveDeletedLeaf(Box), + ColdArchiveBoundaryLeaf(Box), + ColdArchiveHashEntry(Box), + ColdArchiveBucketEntry(Box), UpgradeType(Box), StellarValueType(Box), LedgerCloseValueSignature(Box), @@ -48473,13 +49694,6 @@ pub enum Type { ConfigUpgradeSetKey(Box), LedgerUpgrade(Box), ConfigUpgradeSet(Box), - BucketListType(Box), - BucketEntryType(Box), - HotArchiveBucketEntryType(Box), - BucketMetadata(Box), - BucketMetadataExt(Box), - BucketEntry(Box), - HotArchiveBucketEntry(Box), TxSetComponentType(Box), TxExecutionThread(Box), ParallelTxExecutionStage(Box), @@ -48630,8 +49844,16 @@ pub enum Type { PreconditionType(Box), Preconditions(Box), LedgerFootprint(Box), + ArchivalProofType(Box), + ArchivalProofNode(Box), + ProofLevel(Box), + NonexistenceProofBody(Box), + ExistenceProofBody(Box), + ArchivalProof(Box), + ArchivalProofBody(Box), SorobanResources(Box), SorobanTransactionData(Box), + SorobanTransactionDataExt(Box), TransactionV0(Box), TransactionV0Ext(Box), TransactionV0Envelope(Box), @@ -48749,7 +49971,7 @@ pub enum Type { } impl Type { - pub const VARIANTS: [TypeVariant; 448] = [ + pub const VARIANTS: [TypeVariant; 462] = [ TypeVariant::Value, TypeVariant::ScpBallot, TypeVariant::ScpStatementType, @@ -48911,6 +50133,19 @@ impl Type { TypeVariant::LedgerKeyConfigSetting, TypeVariant::LedgerKeyTtl, TypeVariant::EnvelopeType, + TypeVariant::BucketListType, + TypeVariant::BucketEntryType, + TypeVariant::HotArchiveBucketEntryType, + TypeVariant::ColdArchiveBucketEntryType, + TypeVariant::BucketMetadata, + TypeVariant::BucketMetadataExt, + TypeVariant::BucketEntry, + TypeVariant::HotArchiveBucketEntry, + TypeVariant::ColdArchiveArchivedLeaf, + TypeVariant::ColdArchiveDeletedLeaf, + TypeVariant::ColdArchiveBoundaryLeaf, + TypeVariant::ColdArchiveHashEntry, + TypeVariant::ColdArchiveBucketEntry, TypeVariant::UpgradeType, TypeVariant::StellarValueType, TypeVariant::LedgerCloseValueSignature, @@ -48925,13 +50160,6 @@ impl Type { TypeVariant::ConfigUpgradeSetKey, TypeVariant::LedgerUpgrade, TypeVariant::ConfigUpgradeSet, - TypeVariant::BucketListType, - TypeVariant::BucketEntryType, - TypeVariant::HotArchiveBucketEntryType, - TypeVariant::BucketMetadata, - TypeVariant::BucketMetadataExt, - TypeVariant::BucketEntry, - TypeVariant::HotArchiveBucketEntry, TypeVariant::TxSetComponentType, TypeVariant::TxExecutionThread, TypeVariant::ParallelTxExecutionStage, @@ -49082,8 +50310,16 @@ impl Type { TypeVariant::PreconditionType, TypeVariant::Preconditions, TypeVariant::LedgerFootprint, + TypeVariant::ArchivalProofType, + TypeVariant::ArchivalProofNode, + TypeVariant::ProofLevel, + TypeVariant::NonexistenceProofBody, + TypeVariant::ExistenceProofBody, + TypeVariant::ArchivalProof, + TypeVariant::ArchivalProofBody, TypeVariant::SorobanResources, TypeVariant::SorobanTransactionData, + TypeVariant::SorobanTransactionDataExt, TypeVariant::TransactionV0, TypeVariant::TransactionV0Ext, TypeVariant::TransactionV0Envelope, @@ -49199,7 +50435,7 @@ impl Type { TypeVariant::BinaryFuseFilterType, TypeVariant::SerializedBinaryFuseFilter, ]; - pub const VARIANTS_STR: [&'static str; 448] = [ + pub const VARIANTS_STR: [&'static str; 462] = [ "Value", "ScpBallot", "ScpStatementType", @@ -49361,6 +50597,19 @@ impl Type { "LedgerKeyConfigSetting", "LedgerKeyTtl", "EnvelopeType", + "BucketListType", + "BucketEntryType", + "HotArchiveBucketEntryType", + "ColdArchiveBucketEntryType", + "BucketMetadata", + "BucketMetadataExt", + "BucketEntry", + "HotArchiveBucketEntry", + "ColdArchiveArchivedLeaf", + "ColdArchiveDeletedLeaf", + "ColdArchiveBoundaryLeaf", + "ColdArchiveHashEntry", + "ColdArchiveBucketEntry", "UpgradeType", "StellarValueType", "LedgerCloseValueSignature", @@ -49375,13 +50624,6 @@ impl Type { "ConfigUpgradeSetKey", "LedgerUpgrade", "ConfigUpgradeSet", - "BucketListType", - "BucketEntryType", - "HotArchiveBucketEntryType", - "BucketMetadata", - "BucketMetadataExt", - "BucketEntry", - "HotArchiveBucketEntry", "TxSetComponentType", "TxExecutionThread", "ParallelTxExecutionStage", @@ -49532,8 +50774,16 @@ impl Type { "PreconditionType", "Preconditions", "LedgerFootprint", + "ArchivalProofType", + "ArchivalProofNode", + "ProofLevel", + "NonexistenceProofBody", + "ExistenceProofBody", + "ArchivalProof", + "ArchivalProofBody", "SorobanResources", "SorobanTransactionData", + "SorobanTransactionDataExt", "TransactionV0", "TransactionV0Ext", "TransactionV0Envelope", @@ -50315,6 +51565,65 @@ impl Type { TypeVariant::EnvelopeType => r.with_limited_depth(|r| { Ok(Self::EnvelopeType(Box::new(EnvelopeType::read_xdr(r)?))) }), + TypeVariant::BucketListType => r.with_limited_depth(|r| { + Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?))) + }), + TypeVariant::BucketEntryType => r.with_limited_depth(|r| { + Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr( + r, + )?))) + }), + TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| { + Ok(Self::HotArchiveBucketEntryType(Box::new( + HotArchiveBucketEntryType::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBucketEntryType => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBucketEntryType(Box::new( + ColdArchiveBucketEntryType::read_xdr(r)?, + ))) + }), + TypeVariant::BucketMetadata => r.with_limited_depth(|r| { + Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?))) + }), + TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| { + Ok(Self::BucketMetadataExt(Box::new( + BucketMetadataExt::read_xdr(r)?, + ))) + }), + TypeVariant::BucketEntry => { + r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?)))) + } + TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| { + Ok(Self::HotArchiveBucketEntry(Box::new( + HotArchiveBucketEntry::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveArchivedLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveArchivedLeaf(Box::new( + ColdArchiveArchivedLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveDeletedLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveDeletedLeaf(Box::new( + ColdArchiveDeletedLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBoundaryLeaf => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBoundaryLeaf(Box::new( + ColdArchiveBoundaryLeaf::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveHashEntry => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveHashEntry(Box::new( + ColdArchiveHashEntry::read_xdr(r)?, + ))) + }), + TypeVariant::ColdArchiveBucketEntry => r.with_limited_depth(|r| { + Ok(Self::ColdArchiveBucketEntry(Box::new( + ColdArchiveBucketEntry::read_xdr(r)?, + ))) + }), TypeVariant::UpgradeType => { r.with_limited_depth(|r| Ok(Self::UpgradeType(Box::new(UpgradeType::read_xdr(r)?)))) } @@ -50377,35 +51686,6 @@ impl Type { ConfigUpgradeSet::read_xdr(r)?, ))) }), - TypeVariant::BucketListType => r.with_limited_depth(|r| { - Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?))) - }), - TypeVariant::BucketEntryType => r.with_limited_depth(|r| { - Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr( - r, - )?))) - }), - TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| { - Ok(Self::HotArchiveBucketEntryType(Box::new( - HotArchiveBucketEntryType::read_xdr(r)?, - ))) - }), - TypeVariant::BucketMetadata => r.with_limited_depth(|r| { - Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?))) - }), - TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| { - Ok(Self::BucketMetadataExt(Box::new( - BucketMetadataExt::read_xdr(r)?, - ))) - }), - TypeVariant::BucketEntry => { - r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?)))) - } - TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| { - Ok(Self::HotArchiveBucketEntry(Box::new( - HotArchiveBucketEntry::read_xdr(r)?, - ))) - }), TypeVariant::TxSetComponentType => r.with_limited_depth(|r| { Ok(Self::TxSetComponentType(Box::new( TxSetComponentType::read_xdr(r)?, @@ -51076,6 +52356,37 @@ impl Type { r, )?))) }), + TypeVariant::ArchivalProofType => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofType(Box::new( + ArchivalProofType::read_xdr(r)?, + ))) + }), + TypeVariant::ArchivalProofNode => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofNode(Box::new( + ArchivalProofNode::read_xdr(r)?, + ))) + }), + TypeVariant::ProofLevel => { + r.with_limited_depth(|r| Ok(Self::ProofLevel(Box::new(ProofLevel::read_xdr(r)?)))) + } + TypeVariant::NonexistenceProofBody => r.with_limited_depth(|r| { + Ok(Self::NonexistenceProofBody(Box::new( + NonexistenceProofBody::read_xdr(r)?, + ))) + }), + TypeVariant::ExistenceProofBody => r.with_limited_depth(|r| { + Ok(Self::ExistenceProofBody(Box::new( + ExistenceProofBody::read_xdr(r)?, + ))) + }), + TypeVariant::ArchivalProof => r.with_limited_depth(|r| { + Ok(Self::ArchivalProof(Box::new(ArchivalProof::read_xdr(r)?))) + }), + TypeVariant::ArchivalProofBody => r.with_limited_depth(|r| { + Ok(Self::ArchivalProofBody(Box::new( + ArchivalProofBody::read_xdr(r)?, + ))) + }), TypeVariant::SorobanResources => r.with_limited_depth(|r| { Ok(Self::SorobanResources(Box::new( SorobanResources::read_xdr(r)?, @@ -51086,6 +52397,11 @@ impl Type { SorobanTransactionData::read_xdr(r)?, ))) }), + TypeVariant::SorobanTransactionDataExt => r.with_limited_depth(|r| { + Ok(Self::SorobanTransactionDataExt(Box::new( + SorobanTransactionDataExt::read_xdr(r)?, + ))) + }), TypeVariant::TransactionV0 => r.with_limited_depth(|r| { Ok(Self::TransactionV0(Box::new(TransactionV0::read_xdr(r)?))) }), @@ -52319,6 +53635,58 @@ impl Type { ReadXdrIter::<_, EnvelopeType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, ColdArchiveHashEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, UpgradeType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))), @@ -52375,34 +53743,6 @@ impl Type { ReadXdrIter::<_, ConfigUpgradeSet>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, TxSetComponentType>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))), @@ -53053,6 +54393,34 @@ impl Type { ReadXdrIter::<_, LedgerFootprint>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, ArchivalProofType>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, ArchivalProofNode>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, ProofLevel>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, NonexistenceProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, ExistenceProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, ArchivalProof>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, ArchivalProofBody>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, SorobanResources>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))), @@ -53061,6 +54429,10 @@ impl Type { ReadXdrIter::<_, SorobanTransactionData>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))), ), + TypeVariant::SorobanTransactionDataExt => Box::new( + ReadXdrIter::<_, SorobanTransactionDataExt>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t)))), + ), TypeVariant::TransactionV0 => Box::new( ReadXdrIter::<_, TransactionV0>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))), @@ -54338,6 +55710,76 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t.0)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t.0)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t.0)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t.0)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t.0)))), @@ -54403,37 +55845,6 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t.0)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, Frame>::new( - &mut r.inner, - r.limits.clone(), - ) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t.0)))), @@ -55197,6 +56608,34 @@ impl Type { ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t.0)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t.0)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t.0)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t.0)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t.0)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t.0)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t.0)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t.0)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t.0)))), @@ -55208,6 +56647,13 @@ impl Type { ) .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t.0)))), ), + TypeVariant::SorobanTransactionDataExt => Box::new( + ReadXdrIter::<_, Frame>::new( + &mut r.inner, + r.limits.clone(), + ) + .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t.0)))), + ), TypeVariant::TransactionV0 => Box::new( ReadXdrIter::<_, Frame>::new(&mut r.inner, r.limits.clone()) .map(|r| r.map(|t| Self::TransactionV0(Box::new(t.0)))), @@ -56471,6 +57917,58 @@ impl Type { ReadXdrIter::<_, EnvelopeType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))), ), + TypeVariant::BucketListType => Box::new( + ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), + ), + TypeVariant::BucketEntryType => Box::new( + ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntryType => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))), + ), + TypeVariant::BucketMetadata => Box::new( + ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), + ), + TypeVariant::BucketMetadataExt => Box::new( + ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), + ), + TypeVariant::BucketEntry => Box::new( + ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), + ), + TypeVariant::HotArchiveBucketEntry => Box::new( + ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveArchivedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveDeletedLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveBoundaryLeaf => Box::new( + ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))), + ), + TypeVariant::ColdArchiveHashEntry => Box::new( + ReadXdrIter::<_, ColdArchiveHashEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))), + ), + TypeVariant::ColdArchiveBucketEntry => Box::new( + ReadXdrIter::<_, ColdArchiveBucketEntry>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))), + ), TypeVariant::UpgradeType => Box::new( ReadXdrIter::<_, UpgradeType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))), @@ -56527,34 +58025,6 @@ impl Type { ReadXdrIter::<_, ConfigUpgradeSet>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))), ), - TypeVariant::BucketListType => Box::new( - ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))), - ), - TypeVariant::BucketEntryType => Box::new( - ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntryType => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))), - ), - TypeVariant::BucketMetadata => Box::new( - ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))), - ), - TypeVariant::BucketMetadataExt => Box::new( - ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))), - ), - TypeVariant::BucketEntry => Box::new( - ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))), - ), - TypeVariant::HotArchiveBucketEntry => Box::new( - ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone()) - .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))), - ), TypeVariant::TxSetComponentType => Box::new( ReadXdrIter::<_, TxSetComponentType>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))), @@ -57166,6 +58636,34 @@ impl Type { ReadXdrIter::<_, LedgerFootprint>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))), ), + TypeVariant::ArchivalProofType => Box::new( + ReadXdrIter::<_, ArchivalProofType>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))), + ), + TypeVariant::ArchivalProofNode => Box::new( + ReadXdrIter::<_, ArchivalProofNode>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))), + ), + TypeVariant::ProofLevel => Box::new( + ReadXdrIter::<_, ProofLevel>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))), + ), + TypeVariant::NonexistenceProofBody => Box::new( + ReadXdrIter::<_, NonexistenceProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))), + ), + TypeVariant::ExistenceProofBody => Box::new( + ReadXdrIter::<_, ExistenceProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))), + ), + TypeVariant::ArchivalProof => Box::new( + ReadXdrIter::<_, ArchivalProof>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))), + ), + TypeVariant::ArchivalProofBody => Box::new( + ReadXdrIter::<_, ArchivalProofBody>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))), + ), TypeVariant::SorobanResources => Box::new( ReadXdrIter::<_, SorobanResources>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))), @@ -57174,6 +58672,10 @@ impl Type { ReadXdrIter::<_, SorobanTransactionData>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))), ), + TypeVariant::SorobanTransactionDataExt => Box::new( + ReadXdrIter::<_, SorobanTransactionDataExt>::new(dec, r.limits.clone()) + .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t)))), + ), TypeVariant::TransactionV0 => Box::new( ReadXdrIter::<_, TransactionV0>::new(dec, r.limits.clone()) .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))), @@ -58076,6 +59578,45 @@ impl Type { TypeVariant::EnvelopeType => { Ok(Self::EnvelopeType(Box::new(serde_json::from_reader(r)?))) } + TypeVariant::BucketListType => { + Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::BucketEntryType => { + Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType( + Box::new(serde_json::from_reader(r)?), + )), + TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType( + Box::new(serde_json::from_reader(r)?), + )), + TypeVariant::BucketMetadata => { + Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::BucketEntry => { + Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new( + serde_json::from_reader(r)?, + ))), TypeVariant::UpgradeType => { Ok(Self::UpgradeType(Box::new(serde_json::from_reader(r)?))) } @@ -58118,27 +59659,6 @@ impl Type { TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new( serde_json::from_reader(r)?, ))), - TypeVariant::BucketListType => { - Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::BucketEntryType => { - Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType( - Box::new(serde_json::from_reader(r)?), - )), - TypeVariant::BucketMetadata => { - Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new( - serde_json::from_reader(r)?, - ))), - TypeVariant::BucketEntry => { - Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?))) - } - TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new( - serde_json::from_reader(r)?, - ))), TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new( serde_json::from_reader(r)?, ))), @@ -58563,12 +60083,34 @@ impl Type { TypeVariant::LedgerFootprint => { Ok(Self::LedgerFootprint(Box::new(serde_json::from_reader(r)?))) } + TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(serde_json::from_reader(r)?))), + TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new( + serde_json::from_reader(r)?, + ))), + TypeVariant::ArchivalProof => { + Ok(Self::ArchivalProof(Box::new(serde_json::from_reader(r)?))) + } + TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new( + serde_json::from_reader(r)?, + ))), TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new( serde_json::from_reader(r)?, ))), TypeVariant::SorobanTransactionData => Ok(Self::SorobanTransactionData(Box::new( serde_json::from_reader(r)?, ))), + TypeVariant::SorobanTransactionDataExt => Ok(Self::SorobanTransactionDataExt( + Box::new(serde_json::from_reader(r)?), + )), TypeVariant::TransactionV0 => { Ok(Self::TransactionV0(Box::new(serde_json::from_reader(r)?))) } @@ -59057,6 +60599,19 @@ impl Type { Self::LedgerKeyConfigSetting(ref v) => v.as_ref(), Self::LedgerKeyTtl(ref v) => v.as_ref(), Self::EnvelopeType(ref v) => v.as_ref(), + Self::BucketListType(ref v) => v.as_ref(), + Self::BucketEntryType(ref v) => v.as_ref(), + Self::HotArchiveBucketEntryType(ref v) => v.as_ref(), + Self::ColdArchiveBucketEntryType(ref v) => v.as_ref(), + Self::BucketMetadata(ref v) => v.as_ref(), + Self::BucketMetadataExt(ref v) => v.as_ref(), + Self::BucketEntry(ref v) => v.as_ref(), + Self::HotArchiveBucketEntry(ref v) => v.as_ref(), + Self::ColdArchiveArchivedLeaf(ref v) => v.as_ref(), + Self::ColdArchiveDeletedLeaf(ref v) => v.as_ref(), + Self::ColdArchiveBoundaryLeaf(ref v) => v.as_ref(), + Self::ColdArchiveHashEntry(ref v) => v.as_ref(), + Self::ColdArchiveBucketEntry(ref v) => v.as_ref(), Self::UpgradeType(ref v) => v.as_ref(), Self::StellarValueType(ref v) => v.as_ref(), Self::LedgerCloseValueSignature(ref v) => v.as_ref(), @@ -59071,13 +60626,6 @@ impl Type { Self::ConfigUpgradeSetKey(ref v) => v.as_ref(), Self::LedgerUpgrade(ref v) => v.as_ref(), Self::ConfigUpgradeSet(ref v) => v.as_ref(), - Self::BucketListType(ref v) => v.as_ref(), - Self::BucketEntryType(ref v) => v.as_ref(), - Self::HotArchiveBucketEntryType(ref v) => v.as_ref(), - Self::BucketMetadata(ref v) => v.as_ref(), - Self::BucketMetadataExt(ref v) => v.as_ref(), - Self::BucketEntry(ref v) => v.as_ref(), - Self::HotArchiveBucketEntry(ref v) => v.as_ref(), Self::TxSetComponentType(ref v) => v.as_ref(), Self::TxExecutionThread(ref v) => v.as_ref(), Self::ParallelTxExecutionStage(ref v) => v.as_ref(), @@ -59228,8 +60776,16 @@ impl Type { Self::PreconditionType(ref v) => v.as_ref(), Self::Preconditions(ref v) => v.as_ref(), Self::LedgerFootprint(ref v) => v.as_ref(), + Self::ArchivalProofType(ref v) => v.as_ref(), + Self::ArchivalProofNode(ref v) => v.as_ref(), + Self::ProofLevel(ref v) => v.as_ref(), + Self::NonexistenceProofBody(ref v) => v.as_ref(), + Self::ExistenceProofBody(ref v) => v.as_ref(), + Self::ArchivalProof(ref v) => v.as_ref(), + Self::ArchivalProofBody(ref v) => v.as_ref(), Self::SorobanResources(ref v) => v.as_ref(), Self::SorobanTransactionData(ref v) => v.as_ref(), + Self::SorobanTransactionDataExt(ref v) => v.as_ref(), Self::TransactionV0(ref v) => v.as_ref(), Self::TransactionV0Ext(ref v) => v.as_ref(), Self::TransactionV0Envelope(ref v) => v.as_ref(), @@ -59520,6 +61076,19 @@ impl Type { Self::LedgerKeyConfigSetting(_) => "LedgerKeyConfigSetting", Self::LedgerKeyTtl(_) => "LedgerKeyTtl", Self::EnvelopeType(_) => "EnvelopeType", + Self::BucketListType(_) => "BucketListType", + Self::BucketEntryType(_) => "BucketEntryType", + Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType", + Self::ColdArchiveBucketEntryType(_) => "ColdArchiveBucketEntryType", + Self::BucketMetadata(_) => "BucketMetadata", + Self::BucketMetadataExt(_) => "BucketMetadataExt", + Self::BucketEntry(_) => "BucketEntry", + Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry", + Self::ColdArchiveArchivedLeaf(_) => "ColdArchiveArchivedLeaf", + Self::ColdArchiveDeletedLeaf(_) => "ColdArchiveDeletedLeaf", + Self::ColdArchiveBoundaryLeaf(_) => "ColdArchiveBoundaryLeaf", + Self::ColdArchiveHashEntry(_) => "ColdArchiveHashEntry", + Self::ColdArchiveBucketEntry(_) => "ColdArchiveBucketEntry", Self::UpgradeType(_) => "UpgradeType", Self::StellarValueType(_) => "StellarValueType", Self::LedgerCloseValueSignature(_) => "LedgerCloseValueSignature", @@ -59534,13 +61103,6 @@ impl Type { Self::ConfigUpgradeSetKey(_) => "ConfigUpgradeSetKey", Self::LedgerUpgrade(_) => "LedgerUpgrade", Self::ConfigUpgradeSet(_) => "ConfigUpgradeSet", - Self::BucketListType(_) => "BucketListType", - Self::BucketEntryType(_) => "BucketEntryType", - Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType", - Self::BucketMetadata(_) => "BucketMetadata", - Self::BucketMetadataExt(_) => "BucketMetadataExt", - Self::BucketEntry(_) => "BucketEntry", - Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry", Self::TxSetComponentType(_) => "TxSetComponentType", Self::TxExecutionThread(_) => "TxExecutionThread", Self::ParallelTxExecutionStage(_) => "ParallelTxExecutionStage", @@ -59701,8 +61263,16 @@ impl Type { Self::PreconditionType(_) => "PreconditionType", Self::Preconditions(_) => "Preconditions", Self::LedgerFootprint(_) => "LedgerFootprint", + Self::ArchivalProofType(_) => "ArchivalProofType", + Self::ArchivalProofNode(_) => "ArchivalProofNode", + Self::ProofLevel(_) => "ProofLevel", + Self::NonexistenceProofBody(_) => "NonexistenceProofBody", + Self::ExistenceProofBody(_) => "ExistenceProofBody", + Self::ArchivalProof(_) => "ArchivalProof", + Self::ArchivalProofBody(_) => "ArchivalProofBody", Self::SorobanResources(_) => "SorobanResources", Self::SorobanTransactionData(_) => "SorobanTransactionData", + Self::SorobanTransactionDataExt(_) => "SorobanTransactionDataExt", Self::TransactionV0(_) => "TransactionV0", Self::TransactionV0Ext(_) => "TransactionV0Ext", Self::TransactionV0Envelope(_) => "TransactionV0Envelope", @@ -59830,7 +61400,7 @@ impl Type { #[must_use] #[allow(clippy::too_many_lines)] - pub const fn variants() -> [TypeVariant; 448] { + pub const fn variants() -> [TypeVariant; 462] { Self::VARIANTS } @@ -60017,6 +61587,19 @@ impl Type { Self::LedgerKeyConfigSetting(_) => TypeVariant::LedgerKeyConfigSetting, Self::LedgerKeyTtl(_) => TypeVariant::LedgerKeyTtl, Self::EnvelopeType(_) => TypeVariant::EnvelopeType, + Self::BucketListType(_) => TypeVariant::BucketListType, + Self::BucketEntryType(_) => TypeVariant::BucketEntryType, + Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType, + Self::ColdArchiveBucketEntryType(_) => TypeVariant::ColdArchiveBucketEntryType, + Self::BucketMetadata(_) => TypeVariant::BucketMetadata, + Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt, + Self::BucketEntry(_) => TypeVariant::BucketEntry, + Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry, + Self::ColdArchiveArchivedLeaf(_) => TypeVariant::ColdArchiveArchivedLeaf, + Self::ColdArchiveDeletedLeaf(_) => TypeVariant::ColdArchiveDeletedLeaf, + Self::ColdArchiveBoundaryLeaf(_) => TypeVariant::ColdArchiveBoundaryLeaf, + Self::ColdArchiveHashEntry(_) => TypeVariant::ColdArchiveHashEntry, + Self::ColdArchiveBucketEntry(_) => TypeVariant::ColdArchiveBucketEntry, Self::UpgradeType(_) => TypeVariant::UpgradeType, Self::StellarValueType(_) => TypeVariant::StellarValueType, Self::LedgerCloseValueSignature(_) => TypeVariant::LedgerCloseValueSignature, @@ -60031,13 +61614,6 @@ impl Type { Self::ConfigUpgradeSetKey(_) => TypeVariant::ConfigUpgradeSetKey, Self::LedgerUpgrade(_) => TypeVariant::LedgerUpgrade, Self::ConfigUpgradeSet(_) => TypeVariant::ConfigUpgradeSet, - Self::BucketListType(_) => TypeVariant::BucketListType, - Self::BucketEntryType(_) => TypeVariant::BucketEntryType, - Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType, - Self::BucketMetadata(_) => TypeVariant::BucketMetadata, - Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt, - Self::BucketEntry(_) => TypeVariant::BucketEntry, - Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry, Self::TxSetComponentType(_) => TypeVariant::TxSetComponentType, Self::TxExecutionThread(_) => TypeVariant::TxExecutionThread, Self::ParallelTxExecutionStage(_) => TypeVariant::ParallelTxExecutionStage, @@ -60212,8 +61788,16 @@ impl Type { Self::PreconditionType(_) => TypeVariant::PreconditionType, Self::Preconditions(_) => TypeVariant::Preconditions, Self::LedgerFootprint(_) => TypeVariant::LedgerFootprint, + Self::ArchivalProofType(_) => TypeVariant::ArchivalProofType, + Self::ArchivalProofNode(_) => TypeVariant::ArchivalProofNode, + Self::ProofLevel(_) => TypeVariant::ProofLevel, + Self::NonexistenceProofBody(_) => TypeVariant::NonexistenceProofBody, + Self::ExistenceProofBody(_) => TypeVariant::ExistenceProofBody, + Self::ArchivalProof(_) => TypeVariant::ArchivalProof, + Self::ArchivalProofBody(_) => TypeVariant::ArchivalProofBody, Self::SorobanResources(_) => TypeVariant::SorobanResources, Self::SorobanTransactionData(_) => TypeVariant::SorobanTransactionData, + Self::SorobanTransactionDataExt(_) => TypeVariant::SorobanTransactionDataExt, Self::TransactionV0(_) => TypeVariant::TransactionV0, Self::TransactionV0Ext(_) => TypeVariant::TransactionV0Ext, Self::TransactionV0Envelope(_) => TypeVariant::TransactionV0Envelope, @@ -60537,6 +62121,19 @@ impl WriteXdr for Type { Self::LedgerKeyConfigSetting(v) => v.write_xdr(w), Self::LedgerKeyTtl(v) => v.write_xdr(w), Self::EnvelopeType(v) => v.write_xdr(w), + Self::BucketListType(v) => v.write_xdr(w), + Self::BucketEntryType(v) => v.write_xdr(w), + Self::HotArchiveBucketEntryType(v) => v.write_xdr(w), + Self::ColdArchiveBucketEntryType(v) => v.write_xdr(w), + Self::BucketMetadata(v) => v.write_xdr(w), + Self::BucketMetadataExt(v) => v.write_xdr(w), + Self::BucketEntry(v) => v.write_xdr(w), + Self::HotArchiveBucketEntry(v) => v.write_xdr(w), + Self::ColdArchiveArchivedLeaf(v) => v.write_xdr(w), + Self::ColdArchiveDeletedLeaf(v) => v.write_xdr(w), + Self::ColdArchiveBoundaryLeaf(v) => v.write_xdr(w), + Self::ColdArchiveHashEntry(v) => v.write_xdr(w), + Self::ColdArchiveBucketEntry(v) => v.write_xdr(w), Self::UpgradeType(v) => v.write_xdr(w), Self::StellarValueType(v) => v.write_xdr(w), Self::LedgerCloseValueSignature(v) => v.write_xdr(w), @@ -60551,13 +62148,6 @@ impl WriteXdr for Type { Self::ConfigUpgradeSetKey(v) => v.write_xdr(w), Self::LedgerUpgrade(v) => v.write_xdr(w), Self::ConfigUpgradeSet(v) => v.write_xdr(w), - Self::BucketListType(v) => v.write_xdr(w), - Self::BucketEntryType(v) => v.write_xdr(w), - Self::HotArchiveBucketEntryType(v) => v.write_xdr(w), - Self::BucketMetadata(v) => v.write_xdr(w), - Self::BucketMetadataExt(v) => v.write_xdr(w), - Self::BucketEntry(v) => v.write_xdr(w), - Self::HotArchiveBucketEntry(v) => v.write_xdr(w), Self::TxSetComponentType(v) => v.write_xdr(w), Self::TxExecutionThread(v) => v.write_xdr(w), Self::ParallelTxExecutionStage(v) => v.write_xdr(w), @@ -60708,8 +62298,16 @@ impl WriteXdr for Type { Self::PreconditionType(v) => v.write_xdr(w), Self::Preconditions(v) => v.write_xdr(w), Self::LedgerFootprint(v) => v.write_xdr(w), + Self::ArchivalProofType(v) => v.write_xdr(w), + Self::ArchivalProofNode(v) => v.write_xdr(w), + Self::ProofLevel(v) => v.write_xdr(w), + Self::NonexistenceProofBody(v) => v.write_xdr(w), + Self::ExistenceProofBody(v) => v.write_xdr(w), + Self::ArchivalProof(v) => v.write_xdr(w), + Self::ArchivalProofBody(v) => v.write_xdr(w), Self::SorobanResources(v) => v.write_xdr(w), Self::SorobanTransactionData(v) => v.write_xdr(w), + Self::SorobanTransactionDataExt(v) => v.write_xdr(w), Self::TransactionV0(v) => v.write_xdr(w), Self::TransactionV0Ext(v) => v.write_xdr(w), Self::TransactionV0Envelope(v) => v.write_xdr(w), diff --git a/xdr/curr b/xdr/curr index 72868e9c..4ec28d95 160000 --- a/xdr/curr +++ b/xdr/curr @@ -1 +1 @@ -Subproject commit 72868e9ca22a57eec9a21610c9df67e07705f8fb +Subproject commit 4ec28d95dd84b109253e22b151314478d6f00522 diff --git a/xdr/curr-version b/xdr/curr-version index 8195b908..20860efd 100644 --- a/xdr/curr-version +++ b/xdr/curr-version @@ -1 +1 @@ -72868e9ca22a57eec9a21610c9df67e07705f8fb \ No newline at end of file +4ec28d95dd84b109253e22b151314478d6f00522 \ No newline at end of file diff --git a/xdr/next b/xdr/next index e303b4c8..86b4ff57 160000 --- a/xdr/next +++ b/xdr/next @@ -1 +1 @@ -Subproject commit e303b4c8e7d823822511a3de88d51eacf4875975 +Subproject commit 86b4ff573c3e9a475f9280b97645cc75e2c75b6e diff --git a/xdr/next-version b/xdr/next-version index b397d30c..a1789d6e 100644 --- a/xdr/next-version +++ b/xdr/next-version @@ -1 +1 @@ -e303b4c8e7d823822511a3de88d51eacf4875975 \ No newline at end of file +86b4ff573c3e9a475f9280b97645cc75e2c75b6e \ No newline at end of file