Skip to content
14 changes: 13 additions & 1 deletion Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ enum ConfigSettingID
CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6,
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_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9,
CONFIG_SETTING_MAXIMUM_ENTRY_LIFETIME = 10,
CONFIG_SETTING_MINIMUM_TEMP_ENTRY_LIFETIME = 11,
CONFIG_SETTING_MINIMUM_RESTORABLE_ENTRY_LIFETIME = 12,
CONFIG_SETTING_AUTO_BUMP_NUM_LEDGERS = 13
};

union ConfigSettingEntry switch (ConfigSettingID configSettingID)
Expand All @@ -177,5 +181,13 @@ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES:
uint32 contractDataKeySizeBytes;
case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES:
uint32 contractDataEntrySizeBytes;
case CONFIG_SETTING_MAXIMUM_ENTRY_LIFETIME:
uint32 maximumEntryLifetime;
case CONFIG_SETTING_MINIMUM_TEMP_ENTRY_LIFETIME:
uint32 minimumTempEntryLifetime;
case CONFIG_SETTING_MINIMUM_RESTORABLE_ENTRY_LIFETIME:
uint32 minimumRestorableEntryLifetime;
case CONFIG_SETTING_AUTO_BUMP_NUM_LEDGERS:
uint32 autoBumpLedgers;
};
}
59 changes: 57 additions & 2 deletions Stellar-ledger-entries.x
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,56 @@ struct LiquidityPoolEntry
body;
};

enum ContractLedgerEntryType {
DATA_ENTRY = 0,
LIFETIME_EXTENSION = 1
};

enum ContractDataFlags {
// When set, the given entry does not recieve automatic lifetime bumps
// on access. Note that entries can still be bumped manually via the footprint.
NO_AUTOBUMP = 0x1
};

enum ContractDataType {
TEMPORARY = 0,
RECREATABLE = 1,
UNIQUE = 2
};

struct ContractDataEntry {
Hash contractID;
SCVal key;
SCVal val;
ContractDataType type;

union switch (ContractLedgerEntryType leType)
{
case DATA_ENTRY:
struct
{
uint32 flags;
SCVal val;
} data;
case LIFETIME_EXTENSION:
void;
} body;

uint32 expirationLedgerSeq;
};

struct ContractCodeEntry {
ExtensionPoint ext;

Hash hash;
opaque code<SCVAL_LIMIT>;
union switch (ContractLedgerEntryType leType)
{
case DATA_ENTRY:
opaque code<SCVAL_LIMIT>;
case LIFETIME_EXTENSION:
void;
} body;

uint32 expirationLedgerSeq;
};


Expand Down Expand Up @@ -602,11 +641,27 @@ case CONTRACT_DATA:
{
Hash contractID;
SCVal key;
ContractDataType type;

// ContractLedgerEntryType t is part of key type, but is inside a switch in the actual entry,
// so we need to mirror the switch structure here with no body
union switch (ContractLedgerEntryType leType)
{
case DATA_ENTRY:
case LIFETIME_EXTENSION:
void;
} body;
} contractData;
case CONTRACT_CODE:
struct
{
Hash hash;
union switch (ContractLedgerEntryType leType)
{
case DATA_ENTRY:
case LIFETIME_EXTENSION:
void;
} body;
} contractCode;
case CONFIG_SETTING:
struct
Expand Down
11 changes: 9 additions & 2 deletions Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -775,11 +775,18 @@ case PRECOND_V2:
PreconditionsV2 v2;
};

// If bumpLedgers is not empty, the given key's lifetime is increased by bumpLedgers
struct FootprintEntry
{
LedgerKey key;
uint32* bumpLedgers;
};

// Ledger key sets touched by a smart contract transaction.
struct LedgerFootprint
{
LedgerKey readOnly<>;
LedgerKey readWrite<>;
FootprintEntry readOnly<>;
FootprintEntry readWrite<>;
};

// Resource limits for a Soroban transaction.
Expand Down