Skip to content

Commit

Permalink
Add errors for exceeding the refundable fee.
Browse files Browse the repository at this point in the history
These have to be operation errors, as core is hard-wired to only return `txFAILED` on transaction failure and modifying this behavior is risky/slow.
  • Loading branch information
dmkozh committed Aug 18, 2023
1 parent 1894f09 commit f5ef13c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,8 @@ enum InvokeHostFunctionResultCode
INVOKE_HOST_FUNCTION_MALFORMED = -1,
INVOKE_HOST_FUNCTION_TRAPPED = -2,
INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4
INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4,
INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
};

union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
Expand All @@ -1804,6 +1805,7 @@ case INVOKE_HOST_FUNCTION_MALFORMED:
case INVOKE_HOST_FUNCTION_TRAPPED:
case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED:
case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE:
void;
};

Expand All @@ -1814,7 +1816,8 @@ enum BumpFootprintExpirationResultCode

// codes considered as "failure" for the operation
BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1,
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2,
BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3
};

union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code)
Expand All @@ -1823,6 +1826,7 @@ case BUMP_FOOTPRINT_EXPIRATION_SUCCESS:
void;
case BUMP_FOOTPRINT_EXPIRATION_MALFORMED:
case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED:
case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE:
void;
};

Expand All @@ -1833,7 +1837,8 @@ enum RestoreFootprintResultCode

// codes considered as "failure" for the operation
RESTORE_FOOTPRINT_MALFORMED = -1,
RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2
RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2,
RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3
};

union RestoreFootprintResult switch (RestoreFootprintResultCode code)
Expand All @@ -1842,6 +1847,7 @@ case RESTORE_FOOTPRINT_SUCCESS:
void;
case RESTORE_FOOTPRINT_MALFORMED:
case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED:
case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE:
void;
};

Expand Down

0 comments on commit f5ef13c

Please sign in to comment.