Skip to content

Commit 8a65f61

Browse files
authored
Expiration Entry rework (#137)
1 parent 7015193 commit 8a65f61

2 files changed

Lines changed: 19 additions & 39 deletions

File tree

Stellar-contract-config-setting.x

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ struct StateExpirationSettings {
164164
uint32 maxEntryExpiration;
165165
uint32 minTempEntryExpiration;
166166
uint32 minPersistentEntryExpiration;
167-
uint32 autoBumpLedgers;
168167

169168
// rent_fee = wfee_rate_average / rent_rate_denominator_for_type
170169
int64 persistentRentRateDenominator;

Stellar-ledger-entries.x

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ enum LedgerEntryType
100100
LIQUIDITY_POOL = 5,
101101
CONTRACT_DATA = 6,
102102
CONTRACT_CODE = 7,
103-
CONFIG_SETTING = 8
103+
CONFIG_SETTING = 8,
104+
EXPIRATION = 9
104105
};
105106

106107
struct Signer
@@ -493,58 +494,32 @@ struct LiquidityPoolEntry
493494
body;
494495
};
495496

496-
enum ContractEntryBodyType {
497-
DATA_ENTRY = 0,
498-
EXPIRATION_EXTENSION = 1
499-
};
500-
501-
const MASK_CONTRACT_DATA_FLAGS_V20 = 0x1;
502-
503-
enum ContractDataFlags {
504-
// When set, the given entry does not recieve automatic expiration bumps
505-
// on access. Note that entries can still be bumped manually via the footprint.
506-
NO_AUTOBUMP = 0x1
507-
};
508-
509497
enum ContractDataDurability {
510498
TEMPORARY = 0,
511499
PERSISTENT = 1
512500
};
513501

514502
struct ContractDataEntry {
503+
ExtensionPoint ext;
504+
515505
SCAddress contract;
516506
SCVal key;
517507
ContractDataDurability durability;
518-
519-
union switch (ContractEntryBodyType bodyType)
520-
{
521-
case DATA_ENTRY:
522-
struct
523-
{
524-
uint32 flags;
525-
SCVal val;
526-
} data;
527-
case EXPIRATION_EXTENSION:
528-
void;
529-
} body;
530-
531-
uint32 expirationLedgerSeq;
508+
SCVal val;
532509
};
533510

534511
struct ContractCodeEntry {
535512
ExtensionPoint ext;
536513

537514
Hash hash;
538-
union switch (ContractEntryBodyType bodyType)
539-
{
540-
case DATA_ENTRY:
541-
opaque code<>;
542-
case EXPIRATION_EXTENSION:
543-
void;
544-
} body;
515+
opaque code<>;
516+
};
545517

518+
struct ExpirationEntry {
519+
// Hash of the LedgerKey that is associated with this ExpirationEntry
520+
Hash keyHash;
546521
uint32 expirationLedgerSeq;
547-
};
522+
}
548523

549524

550525
struct LedgerEntryExtensionV1
@@ -583,6 +558,8 @@ struct LedgerEntry
583558
ContractCodeEntry contractCode;
584559
case CONFIG_SETTING:
585560
ConfigSettingEntry configSetting;
561+
case EXPIRATION:
562+
ExpirationEntry expiration;
586563
}
587564
data;
588565

@@ -643,19 +620,23 @@ case CONTRACT_DATA:
643620
SCAddress contract;
644621
SCVal key;
645622
ContractDataDurability durability;
646-
ContractEntryBodyType bodyType;
647623
} contractData;
648624
case CONTRACT_CODE:
649625
struct
650626
{
651627
Hash hash;
652-
ContractEntryBodyType bodyType;
653628
} contractCode;
654629
case CONFIG_SETTING:
655630
struct
656631
{
657632
ConfigSettingID configSettingID;
658633
} configSetting;
634+
case EXPIRATION:
635+
struct
636+
{
637+
// Hash of the LedgerKey that is associated with this ExpirationEntry
638+
Hash keyHash;
639+
} expiration;
659640
};
660641

661642
// list of all envelope types used in the application

0 commit comments

Comments
 (0)