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

Add restoration and state archival meta #221

Merged
merged 1 commit into from
Sep 26, 2024
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
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
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
{
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;
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
};

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
14 changes: 8 additions & 6 deletions Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ struct ArchivalProofNode

typedef ArchivalProofNode ProofLevel<>;

struct NonexistenceProofBody
struct ExistenceProofBody
{
ColdArchiveBucketEntry entriesToProve<>;

Expand All @@ -846,7 +846,7 @@ struct NonexistenceProofBody
ProofLevel proofLevels<>;
};

struct ExistenceProofBody
struct NonexistenceProofBody
{
LedgerKey keysToProve<>;

Expand All @@ -866,9 +866,9 @@ struct ArchivalProof

union switch (ArchivalProofType t)
{
case EXISTENCE:
NonexistenceProofBody nonexistenceProof;
case NONEXISTENCE:
NonexistenceProofBody nonexistenceProof;
case EXISTENCE:
ExistenceProofBody existenceProof;
} body;
};
Expand Down 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
Loading