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

xdr: Synchronizes monorepo XDR with Stellar Core. #4355

Merged
merged 1 commit into from
Apr 28, 2022
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
23 changes: 15 additions & 8 deletions gxdr/xdr_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions xdr/Stellar-ledger-entries.x
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ struct TrustLineEntry

enum OfferEntryFlags
{
// an offer with this flag will not act on and take a reverse offer of equal price
// an offer with this flag will not act on and take a reverse offer of equal
// price
PASSIVE_FLAG = 1
};

Expand Down Expand Up @@ -387,7 +388,7 @@ case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME:
int64 absBefore; // Predicate will be true if closeTime < absBefore
case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
int64 relBefore; // Seconds since closeTime of the ledger in which the
// ClaimableBalanceEntry was created
// ClaimableBalanceEntry was created
};

enum ClaimantType
Expand Down Expand Up @@ -466,7 +467,7 @@ struct LiquidityPoolConstantProductParameters
{
Asset assetA; // assetA < assetB
Asset assetB;
int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
};

struct LiquidityPoolEntry
Expand All @@ -483,7 +484,8 @@ struct LiquidityPoolEntry
int64 reserveA; // amount of A in the pool
int64 reserveB; // amount of B in the pool
int64 totalPoolShares; // total number of pool shares issued
int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares
int64 poolSharesTrustLineCount; // number of trust lines for the
// associated pool shares
} constantProduct;
}
body;
Expand Down
82 changes: 44 additions & 38 deletions xdr/Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ const LIQUIDITY_POOL_FEE_V18 = 30;
struct LiquidityPoolDepositOp
{
PoolID liquidityPoolID;
int64 maxAmountA; // maximum amount of first asset to deposit
int64 maxAmountB; // maximum amount of second asset to deposit
Price minPrice; // minimum depositA/depositB
Price maxPrice; // maximum depositA/depositB
int64 maxAmountA; // maximum amount of first asset to deposit
int64 maxAmountB; // maximum amount of second asset to deposit
Price minPrice; // minimum depositA/depositB
Price maxPrice; // maximum depositA/depositB
};

/* Withdraw assets from a liquidity pool
Expand All @@ -460,9 +460,9 @@ struct LiquidityPoolDepositOp
struct LiquidityPoolWithdrawOp
{
PoolID liquidityPoolID;
int64 amount; // amount of pool shares to withdraw
int64 minAmountA; // minimum amount of first asset to withdraw
int64 minAmountB; // minimum amount of second asset to withdraw
int64 amount; // amount of pool shares to withdraw
int64 minAmountA; // minimum amount of first asset to withdraw
int64 minAmountB; // minimum amount of second asset to withdraw
};

/* An operation is the lowest unit of work that a transaction does */
Expand Down Expand Up @@ -582,21 +582,22 @@ struct LedgerBounds
uint32 maxLedger; // 0 here means no maxLedger
};

struct PreconditionsV2 {
TimeBounds *timeBounds;
struct PreconditionsV2
{
TimeBounds* timeBounds;

// Transaction only valid for ledger numbers n such that
// minLedger <= n < maxLedger (if maxLedger == 0, then
// only minLedger is checked)
LedgerBounds *ledgerBounds;
LedgerBounds* ledgerBounds;

// If NULL, only valid when sourceAccount's sequence number
// is seqNum - 1. Otherwise, valid when sourceAccount's
// sequence number n satisfies minSeqNum <= n < tx.seqNum.
// Note that after execution the account's sequence number
// is always raised to tx.seqNum, and a transaction is not
// valid if tx.seqNum is too high to ensure replay protection.
SequenceNumber *minSeqNum;
SequenceNumber* minSeqNum;

// For the transaction to be valid, the current ledger time must
// be at least minSeqAge greater than sourceAccount's seqTime.
Expand All @@ -614,19 +615,21 @@ struct PreconditionsV2 {
SignerKey extraSigners<2>;
};

enum PreconditionType {
enum PreconditionType
{
PRECOND_NONE = 0,
PRECOND_TIME = 1,
PRECOND_V2 = 2
};

union Preconditions switch (PreconditionType type) {
case PRECOND_NONE:
void;
case PRECOND_TIME:
TimeBounds timeBounds;
case PRECOND_V2:
PreconditionsV2 v2;
union Preconditions switch (PreconditionType type)
{
case PRECOND_NONE:
void;
case PRECOND_TIME:
TimeBounds timeBounds;
case PRECOND_V2:
PreconditionsV2 v2;
};

// maximum number of operations per transaction
Expand Down Expand Up @@ -1107,10 +1110,12 @@ enum ChangeTrustResultCode
// cannot create with a limit of 0
CHANGE_TRUST_LOW_RESERVE =
-4, // not enough funds to create a new trust line,
CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool
CHANGE_TRUST_CANNOT_DELETE = -7, // Asset trustline is still referenced in a pool
CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 // Asset trustline is deauthorized
CHANGE_TRUST_CANNOT_DELETE =
-7, // Asset trustline is still referenced in a pool
CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES =
-8 // Asset trustline is deauthorized
};

union ChangeTrustResult switch (ChangeTrustResultCode code)
Expand All @@ -1132,10 +1137,10 @@ enum AllowTrustResultCode
ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
// source account does not require trust
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created
// on revoke due to low reserves
ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created
// on revoke due to low reserves
};

union AllowTrustResult switch (AllowTrustResultCode code)
Expand Down Expand Up @@ -1432,8 +1437,7 @@ enum LiquidityPoolDepositResultCode
LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 // pool reserves are full
};

union LiquidityPoolDepositResult switch (
LiquidityPoolDepositResultCode code)
union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code)
{
case LIQUIDITY_POOL_DEPOSIT_SUCCESS:
void;
Expand All @@ -1449,18 +1453,17 @@ enum LiquidityPoolWithdrawResultCode
LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0,

// codes considered as "failure" for the operation
LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
// assets
LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
// pool share
LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
// of the assets
LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
// assets
LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
// pool share
LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
// of the assets
LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
};

union LiquidityPoolWithdrawResult switch (
LiquidityPoolWithdrawResultCode code)
union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code)
{
case LIQUIDITY_POOL_WITHDRAW_SUCCESS:
void;
Expand Down Expand Up @@ -1562,7 +1565,9 @@ enum TransactionResultCode
txNOT_SUPPORTED = -12, // transaction type not supported
txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed
txBAD_SPONSORSHIP = -14, // sponsorship not confirmed
txBAD_MIN_SEQ_AGE_OR_GAP = -15 //minSeqAge or minSeqLedgerGap conditions not met
txBAD_MIN_SEQ_AGE_OR_GAP =
-15, // minSeqAge or minSeqLedgerGap conditions not met
txMALFORMED = -16 // precondition is invalid
};

// InnerTransactionResult must be binary compatible with TransactionResult
Expand Down Expand Up @@ -1592,6 +1597,7 @@ struct InnerTransactionResult
// txFEE_BUMP_INNER_FAILED is not included
case txBAD_SPONSORSHIP:
case txBAD_MIN_SEQ_AGE_OR_GAP:
case txMALFORMED:
void;
}
result;
Expand Down
8 changes: 5 additions & 3 deletions xdr/Stellar-types.x
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ typedef hyper int64;
// An ExtensionPoint is always marshaled as a 32-bit 0 value. At a
// later point, it can be replaced by a different union so as to
// extend a structure.
union ExtensionPoint switch (int v) {
union ExtensionPoint switch (int v)
{
case 0:
void;
void;
};

enum CryptoKeyType
Expand Down Expand Up @@ -63,7 +64,8 @@ case SIGNER_KEY_TYPE_HASH_X:
/* Hash of random 256 bit preimage X */
uint256 hashX;
case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
struct {
struct
{
/* Public key that must sign the payload. */
uint256 ed25519;
/* Payload to be raw signed by ed25519. */
Expand Down
Loading