From f521e3256bd014ef1a4d057e11304f79807847dd Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Wed, 16 Aug 2023 16:18:20 -0700 Subject: [PATCH] Expiration Entry rework --- Stellar-contract-config-setting.x | 1 - Stellar-ledger-entries.x | 56 ++++++++++--------------------- 2 files changed, 18 insertions(+), 39 deletions(-) diff --git a/Stellar-contract-config-setting.x b/Stellar-contract-config-setting.x index bb76b3c..9512f0c 100644 --- a/Stellar-contract-config-setting.x +++ b/Stellar-contract-config-setting.x @@ -164,7 +164,6 @@ struct StateExpirationSettings { uint32 maxEntryExpiration; uint32 minTempEntryExpiration; uint32 minPersistentEntryExpiration; - uint32 autoBumpLedgers; // rent_fee = wfee_rate_average / rent_rate_denominator_for_type int64 persistentRentRateDenominator; diff --git a/Stellar-ledger-entries.x b/Stellar-ledger-entries.x index 5eaccac..34e9fb9 100644 --- a/Stellar-ledger-entries.x +++ b/Stellar-ledger-entries.x @@ -100,7 +100,8 @@ enum LedgerEntryType LIQUIDITY_POOL = 5, CONTRACT_DATA = 6, CONTRACT_CODE = 7, - CONFIG_SETTING = 8 + CONFIG_SETTING = 8, + EXPIRATION = 9 }; struct Signer @@ -493,58 +494,32 @@ struct LiquidityPoolEntry body; }; -enum ContractEntryBodyType { - DATA_ENTRY = 0, - EXPIRATION_EXTENSION = 1 -}; - -const MASK_CONTRACT_DATA_FLAGS_V20 = 0x1; - -enum ContractDataFlags { - // When set, the given entry does not recieve automatic expiration bumps - // on access. Note that entries can still be bumped manually via the footprint. - NO_AUTOBUMP = 0x1 -}; - enum ContractDataDurability { TEMPORARY = 0, PERSISTENT = 1 }; struct ContractDataEntry { + ExtensionPoint ext; + SCAddress contract; SCVal key; ContractDataDurability durability; - - union switch (ContractEntryBodyType bodyType) - { - case DATA_ENTRY: - struct - { - uint32 flags; - SCVal val; - } data; - case EXPIRATION_EXTENSION: - void; - } body; - - uint32 expirationLedgerSeq; + SCVal val; }; struct ContractCodeEntry { ExtensionPoint ext; Hash hash; - union switch (ContractEntryBodyType bodyType) - { - case DATA_ENTRY: - opaque code<>; - case EXPIRATION_EXTENSION: - void; - } body; + opaque code<>; +}; +struct ExpirationEntry { + // Hash of the LedgerKey that is associated with this ExpirationEntry + Hash keyHash; uint32 expirationLedgerSeq; -}; +} struct LedgerEntryExtensionV1 @@ -583,6 +558,8 @@ struct LedgerEntry ContractCodeEntry contractCode; case CONFIG_SETTING: ConfigSettingEntry configSetting; + case EXPIRATION: + ExpirationEntry expiration; } data; @@ -643,19 +620,22 @@ case CONTRACT_DATA: SCAddress contract; SCVal key; ContractDataDurability durability; - ContractEntryBodyType bodyType; } contractData; case CONTRACT_CODE: struct { Hash hash; - ContractEntryBodyType bodyType; } contractCode; case CONFIG_SETTING: struct { ConfigSettingID configSettingID; } configSetting; +case EXPIRATION: + struct + { + Hash keyHash; + } expiration; }; // list of all envelope types used in the application