Skip to content

Commit

Permalink
Add BucketList size window and remove eviction iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Jun 16, 2023
1 parent 7a4cfa1 commit c46d0cf
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
};
Expand All @@ -156,27 +156,11 @@ struct StateExpirationSettings {
// 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;
};
// Maximum number of kilobytes that we scan for eviction per ledger
uint32 evictionScanSize;

// 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;
// Number of snapshots to use when calculating average BucketList size
uint32 bucketListSizeWindowSampleSize;
};

// limits the ContractCostParams size to 20kB
Expand All @@ -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)
Expand Down Expand Up @@ -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<>;
};
}

0 comments on commit c46d0cf

Please sign in to comment.