Skip to content

Commit

Permalink
Add restoration and state archival meta
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Sep 25, 2024
1 parent 8c88608 commit a79b5bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
32 changes: 26 additions & 6 deletions Stellar-ledger.x
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ case 0:

enum LedgerEntryChangeType
{
LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
LEDGER_ENTRY_STATE = 3 // value of the entry
LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
LEDGER_ENTRY_STATE = 3, // value of the entry
LEDGER_ENTRY_RESTORED = 4 // archived entry was restored in the ledger
};

union LedgerEntryChange switch (LedgerEntryChangeType type)
Expand All @@ -316,6 +317,8 @@ case LEDGER_ENTRY_REMOVED:
LedgerKey removed;
case LEDGER_ENTRY_STATE:
LedgerEntry state;
case LEDGER_ENTRY_RESTORED:
LedgerEntry restored;
};

typedef LedgerEntryChange LedgerEntryChanges<>;
Expand Down Expand Up @@ -506,12 +509,27 @@ struct LedgerCloseMetaExtV1
int64 sorobanFeeWrite1KB;
};

struct LedgerCloseMetaExtV2
{
ExtensionPoint ext;
int64 sorobanFeeWrite1KB;

uint32 currentArchivalEpoch;

// The last epoch currently stored by validators
// Any entry restored from an epoch older than this will
// require a proof.
uint32 lastArchivalEpochPersisted;
};

union LedgerCloseMetaExt switch (int v)
{
case 0:
void;
case 1:
LedgerCloseMetaExtV1 v1;
case 2:
LedgerCloseMetaExtV2 v2;
};

struct LedgerCloseMetaV1
Expand All @@ -537,10 +555,12 @@ struct LedgerCloseMetaV1
// systems calculating storage fees correctly.
uint64 totalByteSizeOfBucketList;

// Temp keys that are being evicted at this ledger.
// Temp keys and all TTL keys that are being evicted at this ledger.
// Note that this can contain TTL keys for both persistent and temporary
// entries, but the name is kept for legacy reasons.
LedgerKey evictedTemporaryLedgerKeys<>;

// Archived restorable ledger entries that are being
// Archived persistent ledger entries that are being
// evicted at this ledger.
LedgerEntry evictedPersistentLedgerEntries<>;
};
Expand Down
6 changes: 4 additions & 2 deletions Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,8 @@ enum InvokeHostFunctionResultCode
INVOKE_HOST_FUNCTION_TRAPPED = -2,
INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4,
INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5,
INVOKE_HOST_FUNCTION_INVALID_CREATION_PROOF = -6
};

union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
Expand Down Expand Up @@ -1920,7 +1921,8 @@ enum RestoreFootprintResultCode
// codes considered as "failure" for the operation
RESTORE_FOOTPRINT_MALFORMED = -1,
RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2,
RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3
RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3,
RESTORE_FOOTPRINT_INVALID_PROOF = -4
};

union RestoreFootprintResult switch (RestoreFootprintResultCode code)
Expand Down

0 comments on commit a79b5bb

Please sign in to comment.