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

Rename state expiration to state archival #157

Merged
merged 1 commit into from
Oct 9, 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
18 changes: 9 additions & 9 deletions Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ struct ContractCostParamEntry {
int64 linearTerm;
};

struct StateExpirationSettings {
uint32 maxEntryExpiration;
uint32 minTempEntryExpiration;
uint32 minPersistentEntryExpiration;
struct StateArchivalSettings {
uint32 maxEntryTTL;
uint32 minTemporaryTTL;
uint32 minPersistentTTL;

// rent_fee = wfee_rate_average / rent_rate_denominator_for_type
int64 persistentRentRateDenominator;
int64 tempRentRateDenominator;

// max number of entries that emit expiration meta in a single ledger
uint32 maxEntriesToExpire;
// max number of entries that emit archival meta in a single ledger
uint32 maxEntriesToArchive;

// Number of snapshots to use when calculating average BucketList size
uint32 bucketListSizeWindowSampleSize;
Expand Down Expand Up @@ -208,7 +208,7 @@ enum ConfigSettingID
CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7,
CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8,
CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9,
CONFIG_SETTING_STATE_EXPIRATION = 10,
CONFIG_SETTING_STATE_ARCHIVAL = 10,
CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11,
CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12,
CONFIG_SETTING_EVICTION_ITERATOR = 13
Expand Down Expand Up @@ -236,8 +236,8 @@ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES:
uint32 contractDataKeySizeBytes;
case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES:
uint32 contractDataEntrySizeBytes;
case CONFIG_SETTING_STATE_EXPIRATION:
StateExpirationSettings stateExpirationSettings;
case CONFIG_SETTING_STATE_ARCHIVAL:
StateArchivalSettings stateArchivalSettings;
case CONFIG_SETTING_CONTRACT_EXECUTION_LANES:
ConfigSettingContractExecutionLanesV0 contractExecutionLanes;
case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW:
Expand Down
18 changes: 9 additions & 9 deletions Stellar-ledger-entries.x
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ enum LedgerEntryType
CONTRACT_DATA = 6,
CONTRACT_CODE = 7,
CONFIG_SETTING = 8,
EXPIRATION = 9
TTL = 9
};

struct Signer
Expand Down Expand Up @@ -515,10 +515,10 @@ struct ContractCodeEntry {
opaque code<>;
};

struct ExpirationEntry {
// Hash of the LedgerKey that is associated with this ExpirationEntry
struct TTLEntry {
// Hash of the LedgerKey that is associated with this TTLEntry
Hash keyHash;
uint32 expirationLedgerSeq;
uint32 liveUntilLedgerSeq;
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
};

struct LedgerEntryExtensionV1
Expand Down Expand Up @@ -557,8 +557,8 @@ struct LedgerEntry
ContractCodeEntry contractCode;
case CONFIG_SETTING:
ConfigSettingEntry configSetting;
case EXPIRATION:
ExpirationEntry expiration;
case TTL:
TTLEntry ttl;
}
data;

Expand Down Expand Up @@ -630,12 +630,12 @@ case CONFIG_SETTING:
{
ConfigSettingID configSettingID;
} configSetting;
case EXPIRATION:
case TTL:
struct
{
// Hash of the LedgerKey that is associated with this ExpirationEntry
// Hash of the LedgerKey that is associated with this TTLEntry
Hash keyHash;
} expiration;
} ttl;
};

// list of all envelope types used in the application
Expand Down
4 changes: 2 additions & 2 deletions Stellar-ledger.x
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ struct LedgerCloseMetaV1
// systems calculating storage fees correctly.
uint64 totalByteSizeOfBucketList;

// Expired temp keys that are being evicted at this ledger.
// Temp keys that are being evicted at this ledger.
LedgerKey evictedTemporaryLedgerKeys<>;

// Expired restorable ledger entries that are being
// Archived restorable ledger entries that are being
// evicted at this ledger.
LedgerEntry evictedPersistentLedgerEntries<>;
};
Expand Down
46 changes: 23 additions & 23 deletions Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum OperationType
LIQUIDITY_POOL_DEPOSIT = 22,
LIQUIDITY_POOL_WITHDRAW = 23,
INVOKE_HOST_FUNCTION = 24,
BUMP_FOOTPRINT_EXPIRATION = 25,
EXTEND_FOOTPRINT_TTL = 25,
RESTORE_FOOTPRINT = 26
};

Expand Down Expand Up @@ -585,19 +585,19 @@ struct InvokeHostFunctionOp
SorobanAuthorizationEntry auth<>;
};

/* Bump the expiration ledger of the entries specified in the readOnly footprint
so they'll expire at least ledgersToExpire ledgers from lcl.
/* Extend the TTL of the entries specified in the readOnly footprint
so they will live at least extendTo ledgers from lcl.

Threshold: med
Result: BumpFootprintExpirationResult
Result: ExtendFootprintTTLResult
*/
struct BumpFootprintExpirationOp
struct ExtendFootprintTTLOp
{
ExtensionPoint ext;
uint32 ledgersToExpire;
uint32 extendTo;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the field semantics changes to an absolute value and not relative?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. is this just a rename?

};

/* Restore the expired or evicted entries specified in the readWrite footprint.
/* Restore the archived entries specified in the readWrite footprint.

Threshold: med
Result: RestoreFootprintOp
Expand Down Expand Up @@ -667,8 +667,8 @@ struct Operation
LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
case INVOKE_HOST_FUNCTION:
InvokeHostFunctionOp invokeHostFunctionOp;
case BUMP_FOOTPRINT_EXPIRATION:
BumpFootprintExpirationOp bumpFootprintExpirationOp;
case EXTEND_FOOTPRINT_TTL:
ExtendFootprintTTLOp extendFootprintTTLOp;
case RESTORE_FOOTPRINT:
RestoreFootprintOp restoreFootprintOp;
}
Expand Down Expand Up @@ -1797,7 +1797,7 @@ enum InvokeHostFunctionResultCode
INVOKE_HOST_FUNCTION_MALFORMED = -1,
INVOKE_HOST_FUNCTION_TRAPPED = -2,
INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4,
INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4,
INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
};

Expand All @@ -1808,29 +1808,29 @@ case INVOKE_HOST_FUNCTION_SUCCESS:
case INVOKE_HOST_FUNCTION_MALFORMED:
case INVOKE_HOST_FUNCTION_TRAPPED:
case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED:
case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED:
case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE:
void;
};

enum BumpFootprintExpirationResultCode
enum ExtendFootprintTTLResultCode
{
// codes considered as "success" for the operation
BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0,
EXTEND_FOOTPRINT_TTL_SUCCESS = 0,

// codes considered as "failure" for the operation
BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1,
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2,
BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3
EXTEND_FOOTPRINT_TTL_MALFORMED = -1,
EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2,
EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3
};

union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code)
union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code)
{
case BUMP_FOOTPRINT_EXPIRATION_SUCCESS:
case EXTEND_FOOTPRINT_TTL_SUCCESS:
void;
case BUMP_FOOTPRINT_EXPIRATION_MALFORMED:
case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED:
case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE:
case EXTEND_FOOTPRINT_TTL_MALFORMED:
case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED:
case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE:
void;
};

Expand Down Expand Up @@ -1923,8 +1923,8 @@ case opINNER:
LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
case INVOKE_HOST_FUNCTION:
InvokeHostFunctionResult invokeHostFunctionResult;
case BUMP_FOOTPRINT_EXPIRATION:
BumpFootprintExpirationResult bumpFootprintExpirationResult;
case EXTEND_FOOTPRINT_TTL:
ExtendFootprintTTLResult ExtendFootprintTTLResult;
case RESTORE_FOOTPRINT:
RestoreFootprintResult restoreFootprintResult;
}
Expand Down