From e104b2b91d6c98e8627dc2bdd4fed7cf1f4a0c3e Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Fri, 16 Jun 2023 15:38:49 -0700 Subject: [PATCH] Add BucketList size window and remove eviction iterator --- Stellar-contract-config-setting.x | 38 +++++++++---------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/Stellar-contract-config-setting.x b/Stellar-contract-config-setting.x index 29887ff..57f29e8 100644 --- a/Stellar-contract-config-setting.x +++ b/Stellar-contract-config-setting.x @@ -47,7 +47,7 @@ struct ConfigSettingContractLedgerCostV0 int64 feeReadLedgerEntry; // Fee per ledger entry read int64 feeWriteLedgerEntry; // Fee per ledger entry write - int64 feeRead1KB; // Fee for reading 1KB + int64 feeRead1KB; // Fee for reading 1KB int64 feeWrite1KB; // Fee for writing 1KB // Bucket list fees grow slowly up to that size @@ -138,7 +138,7 @@ enum ContractCostType { struct ContractCostParamEntry { // use `ext` to add more terms (e.g. higher order polynomials) in the future ExtensionPoint ext; - + int64 constTerm; int64 linearTerm; }; @@ -146,37 +146,21 @@ struct ContractCostParamEntry { struct StateExpirationSettings { uint32 maxEntryExpiration; uint32 minTempEntryExpiration; - uint32 minRestorableEntryExpiration; + uint32 minPersistentEntryExpiration; uint32 autoBumpLedgers; // rent_fee = wfee_rate_average / rent_rate_denominator_for_type - int64 restorableRentRateDenominator; + int64 persistentRentRateDenominator; int64 tempRentRateDenominator; // max number of entries that emit expiration meta in a single ledger uint32 maxEntriesToExpire; - // maximum bytes to scan the BucketList for expired entries in a single ledger, in megabytes - uint32 maxBytesToScan; - - union switch (int v) - { - case 0: - void; - } ext; -}; + // Number of snapshots to use when calculating average BucketList size + uint32 bucketListSizeWindowSampleSize; -// Points to BucketEntry in BucketList where expiration scan last stopped -struct ExpirationIterator { - uint32 bucketListLevel; - bool isCurrBucket; - uint64 bucketFileOffset; - - union switch (int v) - { - case 0: - void; - } ext; + // Maximum number of bytes that we scan for eviction per ledger + uint64 evictionScanSize; }; // limits the ContractCostParams size to 20kB @@ -199,7 +183,7 @@ enum ConfigSettingID CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, CONFIG_SETTING_STATE_EXPIRATION = 10, CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, - CONFIG_SETTING_EXPIRATION_ITERATOR = 12 + CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12 }; union ConfigSettingEntry switch (ConfigSettingID configSettingID) @@ -228,7 +212,7 @@ case CONFIG_SETTING_STATE_EXPIRATION: StateExpirationSettings stateExpirationSettings; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0 contractExecutionLanes; -case CONFIG_SETTING_EXPIRATION_ITERATOR: - ExpirationIterator expirationIterator; +case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: + uint64 bucketListSizeWindow<>; }; } \ No newline at end of file