Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiration Entry rework #137

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
57 changes: 19 additions & 38 deletions Stellar-ledger-entries.x
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
uint32 expirationLedgerSeq;
};
}


struct LedgerEntryExtensionV1
Expand Down Expand Up @@ -583,6 +558,8 @@ struct LedgerEntry
ContractCodeEntry contractCode;
case CONFIG_SETTING:
ConfigSettingEntry configSetting;
case EXPIRATION:
ExpirationEntry expiration;
}
data;

Expand Down Expand Up @@ -643,19 +620,23 @@ 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 of the LedgerKey that is associated with this ExpirationEntry
Hash keyHash;
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
} expiration;
};

// list of all envelope types used in the application
Expand Down