Commit Graph

10212 Commits

Author SHA1 Message Date
Mayukha Vadari
6015d56632 feat: Handle Smart Escrow's Bytecode, Data and Gas fields
Add the transaction handling for `EscrowCreate.Bytecode`/`Data` and
`EscrowFinish.Gas`, gated on `featureSmartEscrow`. The field and result-code
plumbing landed in #8157.

EscrowCreate:
* `Bytecode` joins `FinishAfter` and `Condition` as a way to say how an escrow
  completes, but always needs a `CancelAfter`: nothing else can free the funds
  if the contract never accepts.
* `Data` requires `Bytecode` and is capped at `kMaxWasmDataLength`.
* Bytecode is capped at the voted `BytecodeSizeLimit`, and refused outright
  when fee voting has zeroed `GasLimit` or `BytecodeSizeLimit`.
* The fee is ten base fees plus five drops per byte.
* The owner reserve is one increment per 500 bytes beyond the first 500, on
  top of the increment every escrow costs. EscrowCancel and EscrowFinish
  refund what was taken.

EscrowFinish:
* `Gas` is bounded by the voted `GasLimit` and costs `GasPrice` micro-drops
  each.
* `Gas` and the escrow's `Bytecode` must both be present or both absent
  (tefBYTECODE_NOT_INCLUDED / tefNO_BYTECODE).
* The destination and deposit-preauth checks move ahead of the condition
  check, so a contract never runs against a destination that cannot receive.

The WASM engine is not in this build, so nothing runs the bytecode: creating,
funding and cancelling a Smart Escrow works, and finishing one reports
tecFAILED_PROCESSING at the TODO where the contract would run. The gas and
return-code metadata, tecBYTECODE_REJECTED, and the `Data` a rejected contract
leaves behind all arrive with the engine. Reachable only under
`featureSmartEscrow`, which is `Supported::No`.
2026-09-10 18:05:33 -04:00
Mayukha Vadari
4cca58490e test: Assert gas_price on the validations stream
The stream assertions covered `gas_limit` and `bytecode_size_limit` but not
`gas_price`, which is published from the same place and voted by the same
helper. Assert it too, on both the enabled and the disabled path.

Reported by Copilot on #8214.
2026-09-10 18:03:55 -04:00
Mayukha Vadari
a6cc20aa04 fix: Drop an unused include from TestServiceRegistry
`kDropsPerXrp` comes from `XRPAmount.h`, which is already included, so
`Protocol.h` was never used. clang-tidy's misc-include-cleaner failed CI on
it.
2026-09-10 18:03:52 -04:00
Mayukha Vadari
052782a3d4 fix: Don't vote on gas settings before Smart Escrow is enabled
`doVoting` built the three gas votes unconditionally. Before the amendment,
the ledger reports zero for all three while the config targets are non-zero by
default, and the loop that collects validator votes is itself gated on the
amendment — so the vote map held only our own target and every one of the
three reported a change.

The result was a `SetFee` pseudo-transaction on every flag ledger, from every
node running this build, for as long as the amendment stayed disabled. The
transaction carried no gas fields, since that part was gated correctly, so it
proposed no change at all.

Gate the three flags on the amendment, matching `doValidation`, which already
had its gas votes inside the same check.

Reported by xrplf-ai-reviewer on #8214.
2026-09-10 18:03:41 -04:00
Mayukha Vadari
e4476e5821 fix: Carry the configured gas settings into the genesis ledger
`FeeSetup::toFees()` returned the three-argument `Fees`, leaving `gasLimit`,
`bytecodeSizeLimit` and `gasPrice` at zero. `startGenesisLedger` passes that
straight into the genesis `Ledger`, which is where those three are written to
the `FeeSettings` entry — so a network started fresh with `featureSmartEscrow`
in its initial amendment set got a gas limit of zero, i.e. Smart Escrow
switched off no matter what the operator configured.

Carrying them through `toFees()` alone is not enough. Every `Ledger` built
from stored data is seeded with the same `Fees`, and `Ledger::setup()` only
overwrites the fields the `FeeSettings` entry actually carries. A ledger from
before the amendment carries none, so the seed would survive and the node
would read its own configuration back as though the network had agreed to it —
and then never vote for the values it wants, because `doValidation` only votes
when the current setting differs from the target.

So the genesis constructor now clears the three whenever it does not write
them. A ledger reports what its `FeeSettings` entry holds, and nothing more.

Reported by depthfirst-app and Copilot on #8214.
2026-09-10 18:03:20 -04:00
Mayukha Vadari
62d8d84a49 feat: Add Smart Escrow fee voting
Add `GasLimit`, `BytecodeSizeLimit`, and `GasPrice` to the network's votable
fee settings, gated on `featureSmartEscrow`.

The `.macro` and autogen plumbing for these fields landed in #8157; this adds
the behavior behind them: config parsing, fee voting, the `SetFee` pseudo-
transaction, `FeeSettings` genesis and load, and the RPC surfaces that report
fee settings.

`detail::VotableValue` in FeeVoteImpl.cpp becomes a template, since the three
new settings are `std::uint32_t` rather than `XRPAmount`.

`ServiceRegistry::getFees()` exposes the configured settings to code that has
no `ReadView`. It has no production caller yet; the Smart Escrow transactors
call it from `preflight`.
2026-09-10 14:55:08 -04:00
Mayukha Vadari
028783661d feat: Apply .macro changes from ripple/smart-escrow (#8157)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-09 20:05:58 +00:00
yinyiqian1
d5bfe94f15 feat: Support key rotation in MPTokenIssuanceSet (#7915) 2026-09-03 21:13:06 +00:00
Bart
2ad4def35f chore: Bump version to 3.4.0-rc1 (#8171)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-03 20:07:24 +00:00
Valentin Balaschenko
827b50f169 fix: Flaky online delete tests, and cover the health checks added in #5531 (#8137) 2026-09-03 18:56:30 +00:00
Mayukha Vadari
58a59c37ed fix: Add signature prefixes for sfCounterpartySignature and sfSponsorSignature (#8162) 2026-09-03 17:19:07 +00:00
Denis Angell
37cb4cdbe3 fix: Recycle the escrow reserve in EscrowCancel and EscrowFinish (#8142) 2026-09-03 16:27:45 +00:00
Chenna Keshava B S
636d2d4851 fix: Reinforce the priority of AMMClawback in case of insufficient reserves (#7796)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-09-02 20:48:53 +00:00
Kassaking7
7d7275847d fix: PermissionedDEX (CreateOffer/Payment) never deletes expired credentials (#6827) 2026-09-02 19:38:01 +00:00
Bart
f0fd6ad85e fix: Clamp the depth used to index selectBranch's key byte (#7941)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-09-02 18:06:48 +00:00
Timur Yalymov
5d8fd9824e fix: Revert credential cleanup for pseudo-accounts (#8161) 2026-09-02 15:00:50 +00:00
Vito Tumas
346ea40f69 fix: Allow zero-value MPT vault withdraw when the asset holding is missing (#8153) 2026-09-02 13:45:52 +00:00
Vito Tumas
8809bdf3f0 fix: Treat an existing IOU line as a no-op in addEmptyHolding (#8154) 2026-09-02 12:15:29 +00:00
Mayukha Vadari
deaf596494 docs: Add AGENTS.md/CLAUDE.md for AI coding agent guidance (#8067) 2026-09-01 21:57:34 +00:00
Vito Tumas
7863ac8cf6 fix: Add 60s buffer before closed-ended vault redemption (#8151) 2026-09-01 18:27:05 +00:00
Vito Tumas
b3b38e4416 fix: Correct fee-payer XRP delta in ValidVault for sponsored VaultWithdraw (#8141) 2026-09-01 14:43:11 +00:00
Vito Tumas
ccd5dc5e06 fix: Keep LoanBrokerDelete valid for auth-required MPT cover (#8144) 2026-09-01 14:40:53 +00:00
Vito Tumas
b2453b626e fix: Unblock VaultSet and cash-basis LoanSet at AssetsMaximum (#8143) 2026-09-01 14:06:17 +00:00
Vito Tumas
de6e5d3a94 fix: Keep VaultDeposit share count after the assetsTotal clamp (#8140) 2026-09-01 13:51:39 +00:00
Copilot
fac20a06f3 refactor: Add common helper function for injected metadata fields in RPCs (#5706)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-31 17:21:25 +00:00
Ayaz Salikhov
9a7c5ea593 chore: Bump version to 3.4.0-b3 (#8132) 2026-08-27 17:26:55 +00:00
Jingchen
7281e0606a feat: Add vault invariants (#7732)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-27 17:15:17 +00:00
Jingchen
71f5555873 feat: Remove pseudo account field filter (#8042)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-27 13:52:23 +00:00
Vito Tumas
e0151229b6 fix: Waive unrealized-loss discount on sole-holder VaultClawback (#8119) 2026-08-27 08:15:38 +00:00
Gregory Tsipenyuk
dc3bd9cf00 fix: Fix MPT/DEX Audit/Attackathon reports (Phase 1) (#7334) 2026-08-26 18:09:46 +00:00
Vito Tumas
3c47af779c fix: Clamp Vault Deposit, Withdraw, and Clawback to assetsTotal grid (#8057)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-26 17:02:05 +00:00
Ayaz Salikhov
d83a84510e chore: Bump version to 3.4.0-b2 (#8120) 2026-08-26 14:03:01 +00:00
Timur Yalymov
f8fba079fe fix: Refuse a pseudo-account as the vault clawback holder (#8111)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-26 13:55:04 +00:00
Vito Tumas
36c165f74d fix: Prevent early loan impairment and due-date manipulation (#6557)
Co-authored-by: Ed Hennis <ed@ripple.com>
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
2026-08-26 13:38:24 +00:00
Peter Chen
f7ea645bf4 fix: AMMClawback exact LP token boundary (#7373) 2026-08-26 13:14:53 +00:00
Vito Tumas
421af6db79 fix: Reject open-ended vaults at LoanBrokerSet (#8076)
Co-authored-by: Kenny Lei <3003853+kennyzlei@users.noreply.github.com>
2026-08-26 00:08:25 +00:00
Vito Tumas
5e3d20b3ed fix: Prevent vault clawback and withdraw overrun (#8075) 2026-08-25 17:59:37 +00:00
Vito Tumas
ec042fefee fix: Absorb Vault invariant rounding noise (#8055) 2026-08-25 17:07:58 +00:00
Bart
0fdaf69e2c chore: Bump version to 3.4.0-b1 (#8102) 2026-08-24 20:41:58 +00:00
Timur Yalymov
9d41b1bd1c fix: Exempt vault and loan broker accounts from IOU authorization (#8013)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 16:23:43 +00:00
Jingchen
f137d71510 test: Split Invariants_test.cpp into per-topic files (#8077) 2026-08-24 16:17:33 +00:00
Bart
8bc6e81c5f fix: Reject an inner node claimed at leaf depth in verifyProofPath (#7940)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 16:17:12 +00:00
Ed Hennis
764cbe7c29 perf: Pause online delete if there any gaps in recent ledger history (#5531)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-24 14:16:03 +00:00
Timur Yalymov
520650081b fix: Remove credentials pinned to Vault, LoanBroker, and AMM pseudo-accounts (#7877)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-24 13:06:44 +00:00
Timur Yalymov
a097ccebae fix: Tighten destination checks on vault withdrawal (#7977)
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-24 12:50:57 +00:00
Mayukha Vadari
fe4ccdf750 fix: Add assert for account_info flags (#7987) 2026-08-21 15:20:44 +00:00
Timur Yalymov
046d4dd4af fix: Reject vault deposits that move nothing from the depositor (#8014)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-21 12:30:17 +00:00
Ed Hennis
d27beef500 perf: Speed up addition time for drastically different exponents (#7825) 2026-08-20 19:40:42 +00:00
Mayukha Vadari
85512541ad refactor: Collapse transactions.macro settings into a TxSettings struct (#8001)
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-20 19:25:27 +00:00
Gregory Tsipenyuk
3ab5288ef2 fix: Enforce MPT balance invariants under the latest cleanup amendment (#7889) 2026-08-20 19:05:28 +00:00