Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into hooks-merge
Browse files Browse the repository at this point in the history
* upstream/develop:
  Address rare corruption of NFTokenPage linked list (4945)
  • Loading branch information
ximinez committed Aug 9, 2024
2 parents 6d1a576 + c19a88f commit 7e6e4f2
Show file tree
Hide file tree
Showing 22 changed files with 2,168 additions and 245 deletions.
3 changes: 2 additions & 1 deletion include/xrpl/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 80;
static constexpr std::size_t numFeatures = 81;

/** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated
Expand Down Expand Up @@ -371,6 +371,7 @@ extern uint256 const fixReducedOffersV2;
extern uint256 const fixEnforceNFTokenTrustline;
extern uint256 const fixInnerObjTemplate2;
extern uint256 const featureInvariantsV1_1;
extern uint256 const fixNFTokenPageLinks;
extern uint256 const featureHooks;
extern uint256 const featurePaychanAndEscrowForTokens;

Expand Down
1 change: 1 addition & 0 deletions include/xrpl/protocol/SField.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ extern SF_UINT16 const sfHookEmitCount;
extern SF_UINT16 const sfHookExecutionIndex;
extern SF_UINT16 const sfHookApiVersion;
extern SF_UINT16 const sfDiscountedFee;
extern SF_UINT16 const sfLedgerFixType;

// 32-bit integers (common)
extern SF_UINT32 const sfNetworkID;
Expand Down
1 change: 1 addition & 0 deletions include/xrpl/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ enum TEFcodes : TERUnderlyingType {
tefTOO_BIG,
tefNO_TICKET,
tefNFTOKEN_IS_NOT_TRANSFERABLE,
tefINVALID_LEDGER_FIX_TYPE,
};

//------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion include/xrpl/protocol/TxFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ enum TxType : std::uint16_t
/** This transaction type deletes a DID */
ttDID_DELETE = 50,


/** This transaction type creates an Oracle instance */
ttORACLE_SET = 51,

/** This transaction type deletes an Oracle instance */
ttORACLE_DELETE = 52,

/** This transaction type fixes a problem in the ledger state */
ttLEDGER_STATE_FIX = 53,


/** This system-generated transaction type is used to update the status of the various amendments.
For details, see: https://xrpl.org/amendments.html
Expand Down
229 changes: 115 additions & 114 deletions include/xrpl/protocol/jss.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,121 +41,122 @@ namespace jss {
error: Common properties of RPC error responses.
*/

JSS(AL_size); // out: GetCounts
JSS(AL_hit_rate); // out: GetCounts
JSS(Account); // in: TransactionSign; field.
JSS(AccountDelete); // transaction type.
JSS(AccountRoot); // ledger type.
JSS(AccountSet); // transaction type.
JSS(AMM); // ledger type
JSS(AMMBid); // transaction type
JSS(AMMID); // field
JSS(AMMCreate); // transaction type
JSS(AMMDeposit); // transaction type
JSS(AMMDelete); // transaction type
JSS(AMMVote); // transaction type
JSS(AMMWithdraw); // transaction type
JSS(Amendments); // ledger type.
JSS(Amount); // in: TransactionSign; field.
JSS(Amount2); // in/out: AMM IOU/XRP pool, deposit, withdraw amount
JSS(Asset); // in: AMM Asset1
JSS(Asset2); // in: AMM Asset2
JSS(AssetClass); // in: Oracle
JSS(AssetPrice); // in: Oracle
JSS(AuthAccount); // in: AMM Auction Slot
JSS(AuthAccounts); // in: AMM Auction Slot
JSS(BaseAsset); // in: Oracle
JSS(Bridge); // ledger type.
JSS(Check); // ledger type.
JSS(CheckCancel); // transaction type.
JSS(CheckCash); // transaction type.
JSS(CheckCreate); // transaction type.
JSS(Clawback); // transaction type.
JSS(ClearFlag); // field.
JSS(DID); // ledger type.
JSS(DIDDelete); // transaction type.
JSS(DIDSet); // transaction type.
JSS(DeliverMax); // out: alias to Amount
JSS(DeliverMin); // in: TransactionSign
JSS(DepositPreauth); // transaction and ledger type.
JSS(Destination); // in: TransactionSign; field.
JSS(DirectoryNode); // ledger type.
JSS(Emitted); // ledger type.
JSS(EmitFailure); // transaction type. (cleanup emit)
JSS(EnableAmendment); // transaction type.
JSS(EPrice); // in: AMM Deposit option
JSS(Escrow); // ledger type.
JSS(EscrowCancel); // transaction type.
JSS(EscrowCreate); // transaction type.
JSS(EscrowFinish); // transaction type.
JSS(Fee); // in/out: TransactionSign; field.
JSS(FeeSettings); // ledger type.
JSS(Flags); // in/out: TransactionSign; field.
JSS(Hook); // ledger type.
JSS(HookState); // ledger type.
JSS(AL_size); // out: GetCounts
JSS(AL_hit_rate); // out: GetCounts
JSS(Account); // in: TransactionSign; field.
JSS(AccountDelete); // transaction type.
JSS(AccountRoot); // ledger type.
JSS(AccountSet); // transaction type.
JSS(AMM); // ledger type
JSS(AMMBid); // transaction type
JSS(AMMID); // field
JSS(AMMCreate); // transaction type
JSS(AMMDeposit); // transaction type
JSS(AMMDelete); // transaction type
JSS(AMMVote); // transaction type
JSS(AMMWithdraw); // transaction type
JSS(Amendments); // ledger type.
JSS(Amount); // in: TransactionSign; field.
JSS(Amount2); // in/out: AMM IOU/XRP pool, deposit, withdraw amount
JSS(Asset); // in: AMM Asset1
JSS(Asset2); // in: AMM Asset2
JSS(AssetClass); // in: Oracle
JSS(AssetPrice); // in: Oracle
JSS(AuthAccount); // in: AMM Auction Slot
JSS(AuthAccounts); // in: AMM Auction Slot
JSS(BaseAsset); // in: Oracle
JSS(Bridge); // ledger type.
JSS(Check); // ledger type.
JSS(CheckCancel); // transaction type.
JSS(CheckCash); // transaction type.
JSS(CheckCreate); // transaction type.
JSS(Clawback); // transaction type.
JSS(ClearFlag); // field.
JSS(DID); // ledger type.
JSS(DIDDelete); // transaction type.
JSS(DIDSet); // transaction type.
JSS(DeliverMax); // out: alias to Amount
JSS(DeliverMin); // in: TransactionSign
JSS(DepositPreauth); // transaction and ledger type.
JSS(Destination); // in: TransactionSign; field.
JSS(DirectoryNode); // ledger type.
JSS(Emitted); // ledger type.
JSS(EmitFailure); // transaction type. (cleanup emit)
JSS(EnableAmendment); // transaction type.
JSS(EPrice); // in: AMM Deposit option
JSS(Escrow); // ledger type.
JSS(EscrowCancel); // transaction type.
JSS(EscrowCreate); // transaction type.
JSS(EscrowFinish); // transaction type.
JSS(Fee); // in/out: TransactionSign; field.
JSS(FeeSettings); // ledger type.
JSS(Flags); // in/out: TransactionSign; field.
JSS(Hook); // ledger type.
JSS(HookState); // ledger type.
JSS(HookDefinition);
JSS(Invalid); //
JSS(LastLedgerSequence); // in: TransactionSign; field
JSS(LastUpdateTime); // field.
JSS(LedgerHashes); // ledger type.
JSS(LimitAmount); // field.
JSS(BidMax); // in: AMM Bid
JSS(BidMin); // in: AMM Bid
JSS(NetworkID); // field.
JSS(NFTokenBurn); // transaction type.
JSS(NFTokenMint); // transaction type.
JSS(NFTokenOffer); // ledger type.
JSS(NFTokenAcceptOffer); // transaction type.
JSS(NFTokenCancelOffer); // transaction type.
JSS(NFTokenCreateOffer); // transaction type.
JSS(NFTokenPage); // ledger type.
JSS(LPTokenOut); // in: AMM Liquidity Provider deposit tokens
JSS(LPTokenIn); // in: AMM Liquidity Provider withdraw tokens
JSS(LPToken); // out: AMM Liquidity Provider tokens info
JSS(Offer); // ledger type.
JSS(OfferCancel); // transaction type.
JSS(OfferCreate); // transaction type.
JSS(OfferSequence); // field.
JSS(Oracle); // ledger type.
JSS(OracleDelete); // transaction type.
JSS(OracleDocumentID); // field
JSS(OracleSet); // transaction type.
JSS(Owner); // field
JSS(Paths); // in/out: TransactionSign
JSS(PayChannel); // ledger type.
JSS(Payment); // transaction type.
JSS(PaymentChannelClaim); // transaction type.
JSS(PaymentChannelCreate); // transaction type.
JSS(PaymentChannelFund); // transaction type.
JSS(PriceDataSeries); // field.
JSS(PriceData); // field.
JSS(Provider); // field.
JSS(QuoteAsset); // in: Oracle.
JSS(RippleState); // ledger type.
JSS(SLE_hit_rate); // out: GetCounts.
JSS(SetFee); // transaction type.
JSS(UNLModify); // transaction type.
JSS(Scale); // field.
JSS(SettleDelay); // in: TransactionSign
JSS(SendMax); // in: TransactionSign
JSS(Sequence); // in/out: TransactionSign; field.
JSS(SetFlag); // field.
JSS(SetHook); // transaction type.
JSS(SetRegularKey); // transaction type.
JSS(SignerList); // ledger type.
JSS(SignerListSet); // transaction type.
JSS(SigningPubKey); // field.
JSS(TakerGets); // field.
JSS(TakerPays); // field.
JSS(Ticket); // ledger type.
JSS(TicketCreate); // transaction type.
JSS(TxnSignature); // field.
JSS(TradingFee); // in/out: AMM trading fee
JSS(TransactionType); // in: TransactionSign.
JSS(TransferRate); // in: TransferRate.
JSS(TrustSet); // transaction type.
JSS(URI); // field.
JSS(VoteSlots); // out: AMM Vote
JSS(Invalid); //
JSS(LastLedgerSequence); // in: TransactionSign; field
JSS(LastUpdateTime); // field.
JSS(LedgerHashes); // ledger type.
JSS(LimitAmount); // field.
JSS(BidMax); // in: AMM Bid
JSS(BidMin); // in: AMM Bid
JSS(NetworkID); // field.
JSS(NFTokenBurn); // transaction type.
JSS(NFTokenMint); // transaction type.
JSS(NFTokenOffer); // ledger type.
JSS(NFTokenAcceptOffer); // transaction type.
JSS(NFTokenCancelOffer); // transaction type.
JSS(NFTokenCreateOffer); // transaction type.
JSS(NFTokenPage); // ledger type.
JSS(LedgerStateFix); // transaction type.
JSS(LPTokenOut); // in: AMM Liquidity Provider deposit tokens
JSS(LPTokenIn); // in: AMM Liquidity Provider withdraw tokens
JSS(LPToken); // out: AMM Liquidity Provider tokens info
JSS(Offer); // ledger type.
JSS(OfferCancel); // transaction type.
JSS(OfferCreate); // transaction type.
JSS(OfferSequence); // field.
JSS(Oracle); // ledger type.
JSS(OracleDelete); // transaction type.
JSS(OracleDocumentID); // field
JSS(OracleSet); // transaction type.
JSS(Owner); // field
JSS(Paths); // in/out: TransactionSign
JSS(PayChannel); // ledger type.
JSS(Payment); // transaction type.
JSS(PaymentChannelClaim); // transaction type.
JSS(PaymentChannelCreate); // transaction type.
JSS(PaymentChannelFund); // transaction type.
JSS(PriceDataSeries); // field.
JSS(PriceData); // field.
JSS(Provider); // field.
JSS(QuoteAsset); // in: Oracle.
JSS(RippleState); // ledger type.
JSS(SLE_hit_rate); // out: GetCounts.
JSS(SetFee); // transaction type.
JSS(UNLModify); // transaction type.
JSS(Scale); // field.
JSS(SettleDelay); // in: TransactionSign
JSS(SendMax); // in: TransactionSign
JSS(Sequence); // in/out: TransactionSign; field.
JSS(SetFlag); // field.
JSS(SetHook); // transaction type.
JSS(SetRegularKey); // transaction type.
JSS(SignerList); // ledger type.
JSS(SignerListSet); // transaction type.
JSS(SigningPubKey); // field.
JSS(TakerGets); // field.
JSS(TakerPays); // field.
JSS(Ticket); // ledger type.
JSS(TicketCreate); // transaction type.
JSS(TxnSignature); // field.
JSS(TradingFee); // in/out: AMM trading fee
JSS(TransactionType); // in: TransactionSign.
JSS(TransferRate); // in: TransferRate.
JSS(TrustSet); // transaction type.
JSS(URI); // field.
JSS(VoteSlots); // out: AMM Vote
JSS(XChainAddAccountCreateAttestation); // transaction type.
JSS(XChainAddClaimAttestation); // transaction type.
JSS(XChainAccountCreateCommit); // transaction type.
Expand Down
1 change: 1 addition & 0 deletions src/libxrpl/protocol/Feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ REGISTER_FEATURE(NFTokenMintOffer, Supported::yes, VoteBehavior::De
REGISTER_FIX (fixReducedOffersV2, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixEnforceNFTokenTrustline, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixInnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixNFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo);
// InvariantsV1_1 will be changes to Supported::yes when all the
// invariants expected to be included under it are complete.
REGISTER_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo);
Expand Down
1 change: 1 addition & 0 deletions src/libxrpl/protocol/SField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ CONSTRUCT_TYPED_SFIELD(sfHookStateChangeCount, "HookStateChangeCount", UINT16,
CONSTRUCT_TYPED_SFIELD(sfHookEmitCount, "HookEmitCount", UINT16, 18);
CONSTRUCT_TYPED_SFIELD(sfHookExecutionIndex, "HookExecutionIndex", UINT16, 19);
CONSTRUCT_TYPED_SFIELD(sfHookApiVersion, "HookApiVersion", UINT16, 20);
CONSTRUCT_TYPED_SFIELD(sfLedgerFixType, "LedgerFixType", UINT16, 21);

// 32-bit integers (common)
CONSTRUCT_TYPED_SFIELD(sfNetworkID, "NetworkID", UINT32, 1);
Expand Down
1 change: 1 addition & 0 deletions src/libxrpl/protocol/TER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ transResults()
MAKE_ERROR(tefTOO_BIG, "Transaction affects too many items."),
MAKE_ERROR(tefNO_TICKET, "Ticket is not in ledger."),
MAKE_ERROR(tefNFTOKEN_IS_NOT_TRANSFERABLE, "The specified NFToken is not transferable."),
MAKE_ERROR(tefINVALID_LEDGER_FIX_TYPE, "The LedgerFixType field has an invalid value."),

MAKE_ERROR(telLOCAL_ERROR, "Local failure."),
MAKE_ERROR(telBAD_DOMAIN, "Domain too long."),
Expand Down
8 changes: 8 additions & 0 deletions src/libxrpl/protocol/TxFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,14 @@ TxFormats::TxFormats()
{sfOracleDocumentID, soeREQUIRED},
},
commonFields);

add(jss::LedgerStateFix,
ttLEDGER_STATE_FIX,
{
{sfLedgerFixType, soeREQUIRED},
{sfOwner, soeOPTIONAL},
},
commonFields);
}

TxFormats const&
Expand Down
Loading

0 comments on commit 7e6e4f2

Please sign in to comment.