Skip to content

Commit 4a4eea8

Browse files
authored
xdr: Synchronizes monorepo XDR with Stellar Core (#4355)
1 parent 586a6a8 commit 4a4eea8

File tree

5 files changed

+144
-101
lines changed

5 files changed

+144
-101
lines changed

gxdr/xdr_generated.go

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xdr/Stellar-ledger-entries.x

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ struct TrustLineEntry
306306

307307
enum OfferEntryFlags
308308
{
309-
// an offer with this flag will not act on and take a reverse offer of equal price
309+
// an offer with this flag will not act on and take a reverse offer of equal
310+
// price
310311
PASSIVE_FLAG = 1
311312
};
312313

@@ -387,7 +388,7 @@ case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME:
387388
int64 absBefore; // Predicate will be true if closeTime < absBefore
388389
case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
389390
int64 relBefore; // Seconds since closeTime of the ledger in which the
390-
// ClaimableBalanceEntry was created
391+
// ClaimableBalanceEntry was created
391392
};
392393

393394
enum ClaimantType
@@ -466,7 +467,7 @@ struct LiquidityPoolConstantProductParameters
466467
{
467468
Asset assetA; // assetA < assetB
468469
Asset assetB;
469-
int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
470+
int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
470471
};
471472

472473
struct LiquidityPoolEntry
@@ -483,7 +484,8 @@ struct LiquidityPoolEntry
483484
int64 reserveA; // amount of A in the pool
484485
int64 reserveB; // amount of B in the pool
485486
int64 totalPoolShares; // total number of pool shares issued
486-
int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares
487+
int64 poolSharesTrustLineCount; // number of trust lines for the
488+
// associated pool shares
487489
} constantProduct;
488490
}
489491
body;

xdr/Stellar-transaction.x

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ const LIQUIDITY_POOL_FEE_V18 = 30;
445445
struct LiquidityPoolDepositOp
446446
{
447447
PoolID liquidityPoolID;
448-
int64 maxAmountA; // maximum amount of first asset to deposit
449-
int64 maxAmountB; // maximum amount of second asset to deposit
450-
Price minPrice; // minimum depositA/depositB
451-
Price maxPrice; // maximum depositA/depositB
448+
int64 maxAmountA; // maximum amount of first asset to deposit
449+
int64 maxAmountB; // maximum amount of second asset to deposit
450+
Price minPrice; // minimum depositA/depositB
451+
Price maxPrice; // maximum depositA/depositB
452452
};
453453

454454
/* Withdraw assets from a liquidity pool
@@ -460,9 +460,9 @@ struct LiquidityPoolDepositOp
460460
struct LiquidityPoolWithdrawOp
461461
{
462462
PoolID liquidityPoolID;
463-
int64 amount; // amount of pool shares to withdraw
464-
int64 minAmountA; // minimum amount of first asset to withdraw
465-
int64 minAmountB; // minimum amount of second asset to withdraw
463+
int64 amount; // amount of pool shares to withdraw
464+
int64 minAmountA; // minimum amount of first asset to withdraw
465+
int64 minAmountB; // minimum amount of second asset to withdraw
466466
};
467467

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

585-
struct PreconditionsV2 {
586-
TimeBounds *timeBounds;
585+
struct PreconditionsV2
586+
{
587+
TimeBounds* timeBounds;
587588

588589
// Transaction only valid for ledger numbers n such that
589590
// minLedger <= n < maxLedger (if maxLedger == 0, then
590591
// only minLedger is checked)
591-
LedgerBounds *ledgerBounds;
592+
LedgerBounds* ledgerBounds;
592593

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

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

617-
enum PreconditionType {
618+
enum PreconditionType
619+
{
618620
PRECOND_NONE = 0,
619621
PRECOND_TIME = 1,
620622
PRECOND_V2 = 2
621623
};
622624

623-
union Preconditions switch (PreconditionType type) {
624-
case PRECOND_NONE:
625-
void;
626-
case PRECOND_TIME:
627-
TimeBounds timeBounds;
628-
case PRECOND_V2:
629-
PreconditionsV2 v2;
625+
union Preconditions switch (PreconditionType type)
626+
{
627+
case PRECOND_NONE:
628+
void;
629+
case PRECOND_TIME:
630+
TimeBounds timeBounds;
631+
case PRECOND_V2:
632+
PreconditionsV2 v2;
630633
};
631634

632635
// maximum number of operations per transaction
@@ -1107,10 +1110,12 @@ enum ChangeTrustResultCode
11071110
// cannot create with a limit of 0
11081111
CHANGE_TRUST_LOW_RESERVE =
11091112
-4, // not enough funds to create a new trust line,
1110-
CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
1113+
CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
11111114
CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool
1112-
CHANGE_TRUST_CANNOT_DELETE = -7, // Asset trustline is still referenced in a pool
1113-
CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 // Asset trustline is deauthorized
1115+
CHANGE_TRUST_CANNOT_DELETE =
1116+
-7, // Asset trustline is still referenced in a pool
1117+
CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES =
1118+
-8 // Asset trustline is deauthorized
11141119
};
11151120

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

11411146
union AllowTrustResult switch (AllowTrustResultCode code)
@@ -1432,8 +1437,7 @@ enum LiquidityPoolDepositResultCode
14321437
LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 // pool reserves are full
14331438
};
14341439

1435-
union LiquidityPoolDepositResult switch (
1436-
LiquidityPoolDepositResultCode code)
1440+
union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code)
14371441
{
14381442
case LIQUIDITY_POOL_DEPOSIT_SUCCESS:
14391443
void;
@@ -1449,18 +1453,17 @@ enum LiquidityPoolWithdrawResultCode
14491453
LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0,
14501454

14511455
// codes considered as "failure" for the operation
1452-
LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
1453-
LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
1454-
// assets
1455-
LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
1456-
// pool share
1457-
LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
1458-
// of the assets
1459-
LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
1456+
LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
1457+
LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
1458+
// assets
1459+
LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
1460+
// pool share
1461+
LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
1462+
// of the assets
1463+
LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
14601464
};
14611465

1462-
union LiquidityPoolWithdrawResult switch (
1463-
LiquidityPoolWithdrawResultCode code)
1466+
union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code)
14641467
{
14651468
case LIQUIDITY_POOL_WITHDRAW_SUCCESS:
14661469
void;
@@ -1562,7 +1565,9 @@ enum TransactionResultCode
15621565
txNOT_SUPPORTED = -12, // transaction type not supported
15631566
txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed
15641567
txBAD_SPONSORSHIP = -14, // sponsorship not confirmed
1565-
txBAD_MIN_SEQ_AGE_OR_GAP = -15 //minSeqAge or minSeqLedgerGap conditions not met
1568+
txBAD_MIN_SEQ_AGE_OR_GAP =
1569+
-15, // minSeqAge or minSeqLedgerGap conditions not met
1570+
txMALFORMED = -16 // precondition is invalid
15661571
};
15671572

15681573
// InnerTransactionResult must be binary compatible with TransactionResult
@@ -1592,6 +1597,7 @@ struct InnerTransactionResult
15921597
// txFEE_BUMP_INNER_FAILED is not included
15931598
case txBAD_SPONSORSHIP:
15941599
case txBAD_MIN_SEQ_AGE_OR_GAP:
1600+
case txMALFORMED:
15951601
void;
15961602
}
15971603
result;

xdr/Stellar-types.x

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ typedef hyper int64;
1717
// An ExtensionPoint is always marshaled as a 32-bit 0 value. At a
1818
// later point, it can be replaced by a different union so as to
1919
// extend a structure.
20-
union ExtensionPoint switch (int v) {
20+
union ExtensionPoint switch (int v)
21+
{
2122
case 0:
22-
void;
23+
void;
2324
};
2425

2526
enum CryptoKeyType
@@ -63,7 +64,8 @@ case SIGNER_KEY_TYPE_HASH_X:
6364
/* Hash of random 256 bit preimage X */
6465
uint256 hashX;
6566
case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
66-
struct {
67+
struct
68+
{
6769
/* Public key that must sign the payload. */
6870
uint256 ed25519;
6971
/* Payload to be raw signed by ed25519. */

0 commit comments

Comments
 (0)