Repository navigation
Seed closed-ended vaults for setup's loan brokers - #97
Closed
manasip-prog wants to merge 6 commits into
Closed
manasip-prog wants to merge 6 commits into
manasip-prog wants to merge 6 commits into
Conversation
Track the four Vault/LoanBroker fields the amendment moves (AssetsTotal, AssetsAvailable, LossUnrealized, DebtTotal) and stamp Vault.LEVersion on any result touching a Vault node, since LEVersion -- not amendment activation -- gates which accounting model a Vault follows and both coexist post-activation.
…-65) LendingProtocolV1_1 adds VaultKind/SubscriptionDate/RedemptionDate to VaultCreate and an optional MemoData deletion reason to VaultDelete. The pinned xrpl-py has neither the model fields nor the codec definitions, so lending_v1_1_compat registers the field headers into the live binarycodec maps and subclasses both models. Length and range checks stay server-side so faulty handlers can still build the out-of-range cases. The amendment is latched off metadata, not config: a validated Vault's LEVersion is 1 only once LendingProtocolV1_1 is active, so the V1.1 fields join only after one has been seen. Pre-amendment they are temDISABLED, which never validates and would starve the failure bucket. VaultCreate now mints a minority of closed-ended vaults, so open-ended ones keep the phase-free deposit/withdraw valid paths stocked. Vault tracks the kind and both dates from the created node, and deposit/withdraw pick a vault whose current phase permits the transaction. Faulty vectors cover the sub-kMinInvestmentPeriod gap, already-expired dates, an out-of-enum VaultKind, and for VaultDelete an empty and an over-256-byte MemoData (validDataLength rejects both). Genesis was activating only Supported::Yes amendments, but Dockerfile.xrpld rewrites Supported::No to Yes before building, so LendingProtocolV1_1 was known to the binary yet inactive in the ledger. Genesis now includes those too, skipping VoteBehavior::Obsolete (enabling one amendment-blocks the node). Also scopes XRPLD_NO_PATCH_NIX_BINARY to the fuzzer's conan install, whose build folder lacks the loader script rippled's PatchNixBinary.cmake expects. RXT-832
Every XLS-65 path is gated on lending_v1_1_compat.enabled(), which latches off a validated Vault's LEVersion. If that never flips -- amendment inactive, or a genesis regression -- the whole feature goes dark while VaultCreate's success/failure dims stay satisfied off the open-ended vectors, so a run would report green having exercised none of it. Five sometimes buckets off tx_result's validated stream: lending_v1_1_active (the latch itself), vault_closed_ended_created (created node carries a nonzero VaultKind), vault_deposit_phase_blocked (tecEXPIRED) and vault_withdraw_phase_blocked (tecTOO_SOON) for the two phase gates, and vault_delete_reason_used (validated MemoData). All must_hit=False, matching conf_mpt_version_monotonic: they only fire against an xrpld with LendingProtocolV1_1 active, so a run without it must not starve. _fire_sometimes takes must_hit so the fire site can match its catalog entry. RXT-832
Collaborator
Author
|
Closing in favour of a cleaner branch. This one also picked up 3200 lines of unrelated local files via |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #91. Setup currently creates only open-ended vaults, so on 3.4.x every
LoanBrokerSetis rejected and the run aborts before it starts:3.4.x's
LoanBrokerSet::preclaimreturnstecNO_PERMISSIONfor a broker on an open-ended vault oncefeatureLendingProtocolV1_1is active, which the genesis rewrite always enables.The window is constrained from both sides:
VaultDepositonly succeeds in Subscription, and 3.4.x'sLoanSetreturnstecTOO_SOONin Subscription andtecEXPIREDin Redemption — so a loan can only be created during Investment. Setup therefore has to cross the boundary, with deposits in phase 7b and loans in phase 13.params.setup_broker_vault_dates()— subscription closes 120s out, redemption 26h beyond that. The intervening phases (8–12 plus cover_deposits) supply the elapsed time, so no artificial wait is needed. Redemption is deliberately past any run length soStartDate + interval × total + kLoanRedemptionBufferclears it for loans created at any point.closed_ended_dates()is unusable here — it is tuned to make driver vaults transition phases quickly.LEVersionis what latcheslending_v1_1_compat.enabled(), and_run_phasepolls until the state updater has fired. The four XRP broker vaults are then created closed-ended in 7a.With the amendment inactive — 3.3.x —
enabled()is false, no V1.1 fields are sent and the filter is skipped, so behaviour is unchanged.This clears the
loan_brokersabort. It does not claim to clear the whole chain: 3.4.x carries ~690 lines of V1.1 changes across 12 lending and vault transactors, and_run_phaseis fail-loud, so any further incompatibility surfaces as the next phase to abort.🤖 Generated with Claude Code