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

Expiration bump op #106

Merged
merged 3 commits into from
Jun 14, 2023
Merged
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
47 changes: 46 additions & 1 deletion Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ enum OperationType
SET_TRUST_LINE_FLAGS = 21,
LIQUIDITY_POOL_DEPOSIT = 22,
LIQUIDITY_POOL_WITHDRAW = 23,
INVOKE_HOST_FUNCTION = 24
INVOKE_HOST_FUNCTION = 24,
BUMP_EXPIRATION = 25
};

/* CreateAccount
Expand Down Expand Up @@ -571,6 +572,11 @@ struct SorobanAuthorizationEntry
SorobanAuthorizedInvocation rootInvocation;
};

/* Upload WASM, create, and invoke contracts in Soroban.

Threshold: med
Result: InvokeHostFunctionResult
*/
struct InvokeHostFunctionOp
{
// Host function to invoke.
Expand All @@ -579,6 +585,23 @@ struct InvokeHostFunctionOp
SorobanAuthorizationEntry auth<>;
};

enum BumpExpirationType
sisuresh marked this conversation as resolved.
Show resolved Hide resolved
{
BUMP_EXPIRATION_UNIFORM = 0
};

/* Bump the expiration ledger of the entries specified in the readOnly footprint
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
so they'll expire at least ledgersToExpire ledgers from lcl.

Threshold: med
Result: BumpExpirationResult
*/
union BumpExpirationOp switch (BumpExpirationType type)
{
case BUMP_EXPIRATION_UNIFORM:
uint32 ledgersToExpire;
};

/* An operation is the lowest unit of work that a transaction does */
struct Operation
{
Expand Down Expand Up @@ -639,6 +662,8 @@ struct Operation
LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
case INVOKE_HOST_FUNCTION:
InvokeHostFunctionOp invokeHostFunctionOp;
case BUMP_EXPIRATION:
BumpExpirationOp bumpExpirationOp;
}
body;
};
Expand Down Expand Up @@ -1773,6 +1798,24 @@ case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
void;
};

enum BumpExpirationOpResultCode
{
// codes considered as "success" for the operation
BUMP_EXPIRATION_SUCCESS = 0,

// codes considered as "failure" for the operation
BUMP_EXPIRATION_MALFORMED = -1,
BUMP_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2
};

union BumpExpirationResult switch (BumpExpirationOpResultCode code)
{
case BUMP_EXPIRATION_SUCCESS:
void;
case BUMP_EXPIRATION_MALFORMED:
void;
};

/* High level Operation Result */
enum OperationResultCode
{
Expand Down Expand Up @@ -1841,6 +1884,8 @@ case opINNER:
LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
case INVOKE_HOST_FUNCTION:
InvokeHostFunctionResult invokeHostFunctionResult;
case BUMP_EXPIRATION:
BumpExpirationResult bumpExpirationResult;
}
tr;
case opBAD_AUTH:
Expand Down