Commit Graph

13533 Commits

Author SHA1 Message Date
Ed Hennis
ffbc068dc8 Add LoanBrokerCoverDeposit transaction
- Untested. Will need Withdraw to do a good test.
2025-05-07 12:11:52 -04:00
Ed Hennis
fc66227f69 Move all detail namespaces to be under ripple
- Avoids problems with namespace collisions / ambiguous symbol issues
  with unity builds, especially when adding or removing files.
2025-05-07 12:11:52 -04:00
Ed Hennis
27fbf2db8e Start writing Loan Broker invariants and tests
- Specifically those mentioned for LoanBrokerDelete
2025-05-07 12:11:52 -04:00
Ed Hennis
7ab5bdbf3d Refactor ApplyView::dirAdd to give access to low-level operations
- Takes a page from #5362, which may turn out to be useful!
2025-05-07 12:11:52 -04:00
Ed Hennis
7d6155cc99 Clean ups 2025-05-07 12:11:52 -04:00
Ed Hennis
17a970d80c Continue updating LoanBroker tests
- It builds now
2025-05-07 12:11:51 -04:00
Ed Hennis
da10ba6fd0 Start adding tests for LoanBrokerDelete
- Start fixing the inevitable problems found along the way
- Generalize the LoanBroker lifecycle test
2025-05-07 12:11:51 -04:00
Ed Hennis
853c42fb9e Initial implementation of LoanBrokerDelete
- Completely untested
2025-05-07 12:11:51 -04:00
Ed Hennis
cc0fe0db07 LoanBrokerSet will charge a reserve increment when creating
- Refactor: Add a Transactor base function to make it easier to get the
  owner reserve increment as a fee.
- Refactor: Add an overload jtx::fee(increment) to pay an owner reserve.
2025-05-07 12:11:51 -04:00
Ed Hennis
781136ed2e Clang wants an explicit ctor to emplace in a vector 2025-05-07 12:11:51 -04:00
Ed Hennis
5db3c5e023 Fix a few build errors 2025-05-07 12:11:51 -04:00
Ed Hennis
a8118ff582 Add unit tests for new invariants:
- NoModifiedUnmodifiableFields and ValidPseudoAccounts
- Move the Invariants_test class into the test namespace
2025-05-07 12:11:51 -04:00
Ed Hennis
e3241dc143 Clean up more Invariant privilege checking
- Change more "failed" messages. The goal here is to be able to search
  the log for "failed" and ONLY get test failures.
2025-05-07 12:11:50 -04:00
Ed Hennis
c63cc88dc6 Fix a couple more build errors 2025-05-07 12:11:50 -04:00
Ed Hennis
ed27377435 Add a validity range for sfDebtMaximum
- Fix several test and build errors
2025-05-07 12:11:50 -04:00
Ed Hennis
41d83a4b24 Fix account creation to check both amendments 2025-05-07 12:11:50 -04:00
Ed Hennis
b7152496c1 Add LoanBroker update tests
- Move some helper functions.
- Check the regular key in the pseudo-transaction invariant check.
- Transactor::checkSign will always fail for a pseudo-account, so even
  if someone figures out how to get a good signature, it won't work.
2025-05-07 12:11:50 -04:00
Ed Hennis
1db5e9b4d3 Pseudo-account improvements
- Define pseudo-account fields with an sfield flag
- Pseudo-account invariant checks rules whenever a pseudo-account is
  created or modified.
2025-05-07 12:11:50 -04:00
Ed Hennis
1bbe5383ca Reserve a few values between Vault and Lending for future use
- Ledger objects and transactions
2025-05-07 12:11:49 -04:00
Ed Hennis
33e666bfff Enumerate transaction privileges for invariants
- Allows them to be defined in transactions.macro instead of needing to
  scrutinize every existing Invariant class.
- List is not necessarily comprehensive, but does cover every check
  where more than one transaction type is involved.
2025-05-07 12:11:49 -04:00
Ed Hennis
3b59817952 Generalize some of the Invariant checks using macro files
- Valid ledger entry type
- Valid new account root and pseudo account check
2025-05-07 12:11:49 -04:00
Ed Hennis
d4c2d46984 Update tests, update pseudo-account checking 2025-05-07 12:11:49 -04:00
Ed Hennis
47fa8ff59f Fix formatting 2025-05-07 12:11:49 -04:00
Ed Hennis
0d26065321 Start writing LoanBrokerSet tests 2025-05-07 12:11:49 -04:00
Ed Hennis
943a52cf2e Fix some build errors and typos 2025-05-07 12:11:48 -04:00
Ed Hennis
301a64be10 Add more fields 2025-05-07 12:11:48 -04:00
Ed Hennis
95e7cf4fc6 Fix formatting 2025-05-07 12:11:48 -04:00
Ed Hennis
19900bb87e Finish creating helper classes for JTx fields
- Also change the pseudo account field lookup to a function that uses
  a switch
2025-05-07 12:11:48 -04:00
Ed Hennis
536af58316 Fix formatting 2025-05-07 12:11:48 -04:00
Ed Hennis
abf5f08297 Update type of CoverRate fields 2025-05-07 12:11:48 -04:00
Ed Hennis
f77d435fdc Create some helper classes for transaction fields
- Test that they work by converting some of the existing classes
2025-05-07 12:11:48 -04:00
Ed Hennis
6489d73766 Rename LoanBroker.* files to LoanBrokerSet.* 2025-05-07 12:11:47 -04:00
Ed Hennis
f8c708f20c Finish LoanBrokerSet
- Update changed field name.
- Modify modifiable fields in an update. Note there are only two.
- Add a node field to dirLink, defaulting sfOwnerNode, so other
  relationships can be updated.
2025-05-07 12:11:47 -04:00
Ed Hennis
a04c07c5c4 Fix a couple of build errors 2025-05-07 12:11:47 -04:00
Ed Hennis
24374c548b [WIP] Define remaining transactions, start implementing LoanBrokerSet
- Does not build
- Transactions: LoanDelete, LoanManage, LoanDraw, LoanPay
- LoanBrokerSet creation mostly done. Need update.
- Also added a lookup table for pseudo account fields.
2025-05-07 12:11:47 -04:00
Ed Hennis
009ae8183f refactor: Generalize Transactor preflight:
- Derived classes no longer need to explicitly check amendments, nor
  call into preflight1 or preflight2.
- Untested.
2025-05-07 12:11:47 -04:00
Ed Hennis
145215d4ab Fix bug in new invariant 2025-05-07 12:11:47 -04:00
Ed Hennis
34f7bc7502 refactor: Check transaction flags in preflight0
- Adds a flagMask parameter to preflight1 so that it's impossible to
  forget to check flags.
- Also adds a short hash prefix to all Transactor log messages.
2025-05-07 12:11:46 -04:00
Ed Hennis
c6127ef034 Update list of "constant" fields from spec
- Also add a general check for all object types for the type and index
  fields
2025-05-07 12:11:46 -04:00
Ed Hennis
319e7a6bcb Start adding transaction layouts, flags, and fields
(Does not compile)
2025-05-07 12:11:46 -04:00
Ed Hennis
9d1b98a5a4 Fix some duplicated SField codes, speed up SField by name lookup 2025-05-07 12:11:46 -04:00
Ed Hennis
687b7944fb Fix build error - missing include 2025-05-07 12:11:46 -04:00
Ed Hennis
60a888619b Add Loan Broker and Loan ledger objects:
- Also add new SFields, Keylet functions, and an Invariant to verify no
  illegal field modification
2025-05-07 12:11:46 -04:00
Ed Hennis
8165f9d5b1 Add the LendingProtocol amendment 2025-05-07 12:11:46 -04:00
Bronek Kozicki
fc9197837c Add // LCOV_EXCL_LINE 2025-05-07 16:57:15 +01:00
Bronek Kozicki
65fe44a449 Review feedback 2025-05-06 20:07:02 +01:00
Bronek Kozicki
ac0e4dec96 Do not use isIntegral() 2025-05-06 19:57:15 +01:00
Bronek Kozicki
aead1bfb3d Review feedback 2025-05-06 19:06:45 +01:00
Bronek Kozicki
e6b9108d26 Add unit tests 2025-05-06 13:10:21 +01:00
Bronek Kozicki
8eaa9e7b96 Minor, use tecLOCKED when appropriate 2025-05-06 12:01:23 +01:00