Commit Graph

99 Commits

Author SHA1 Message Date
tequ
7a7d64979e Merge branch 'dev' into HookFeeV2 2026-09-25 15:55:22 +09:00
tequ
ba130f8363 AMMClawback supported::no (#827)
Co-authored-by: Richard Holland <richard.holland@starstone.co.nz>
2026-09-25 12:36:31 +10:00
tequ
e87eabd8be HookOnV2_1 Amendment (#766) 2026-09-25 11:17:12 +10:00
Niq Dudfield
2e32b5c6bb feat(server_definitions): distinguish config-forced from ledger-enabled amendments (#765) 2026-09-23 15:33:43 +10:00
tequ
ec6e57cc00 Merge branch 'dev' into HookFeeV2 2026-09-09 15:32:29 +09:00
tequ
401a35957d retire fixXahauV1, fixXahauV2 Amendments (#722) 2026-09-09 13:00:24 +10:00
tequ
8b7bdd6303 Change log message output to distinguish between hook and cbak costs 2026-09-08 22:02:16 +09:00
tequ
e93c46b3f5 fix guard-checker log 2026-09-08 21:16:40 +09:00
tequ
ddbaeedbfe fix guard_checker.cpp to return cost instead fee 2026-09-08 20:41:54 +09:00
tequ
27592e7fec HookFeeV2: flat cost model (0.1 drop per instruction, 10 drops per API call)
Per-API cost tables and the votable HookGasPrice move to the HookFeeV3
branch. V2 charges one cost unit per wasm instruction and 100 units per
hook API call (including _g), with ten units per drop rounded up.

- Guard.h: drop the per-import cost map, charge a fixed api_call_cost on
  every import call
- Remove sfHookGasPrice, FeeSettings/SetFee/validation fields, fee voting,
  server_info output and the hook_gas_price config knob
- hookCostToFee no longer depends on the ledger view
- Restore genesis ledger, jtx Env and fragile-hash tests to dev
- Update expected hook costs in SetHook_test
2026-09-07 18:24:30 +09:00
tequ
0ebdd68807 Merge remote-tracking branch 'upstream/dev' into HookFeeV2 2026-09-07 15:06:26 +09:00
tequ
69e3c361d0 Update cost 2026-09-07 14:45:19 +09:00
Richard Holland
6191c1e09d Onchain manifests (#779) 2026-09-07 13:19:25 +10:00
tequ
0a13e3b5c4 Merge branch 'dev' into HookFeeV2 2026-09-06 01:48:49 +09:00
tequ
f1a3a775a1 Add optional Hooks data to account_info response (#789) 2026-09-02 17:22:53 +10:00
tequ
c1dabe5576 Fix comments (#768) 2026-09-01 14:18:28 +10:00
tequ
c484619967 Add HookDefinitionUpdate tests (partially) 2026-08-13 03:30:32 +09:00
tequ
3b51e2b68e Merge branch 'dev' into HookFeeV2 2026-08-13 01:50:09 +09:00
tequ
a238935038 Fix hook api cost accounting in the guard checker
Api costs were looked up as import_type_map[callee_idx], but that map is
keyed by wasm type index while callee_idx is a function index. A hook was
charged whichever api happened to occupy the callee's index, or nothing at
all when no type carried that index, and imports sharing a signature
collapsed to a single cost. Reordering imports was enough to call
util_verify, the most expensive api, for free. Costs now come from
import_cost_map, keyed by import function index, and import_type_map is
reduced to the signature checking it is actually used for.

compute_wce() applied the loop multiplier to instruction_count only, so an
api call inside a guarded loop was charged for one iteration no matter how
many the guard allowed. The multiplier now applies to execution_cost as
well, with the same floor instruction_count uses.
2026-08-05 15:00:16 +09:00
Richard Holland
639ea34377 Fixhookmap (#756) 2026-06-16 17:06:25 +10:00
tequ
78167e09c0 change sfHookOn of ltHookDefinition to soeOptional for HookOnV2 (#755) 2026-06-16 13:58:53 +10:00
tequ
607a7fdf98 Change AMM to Supported::no (#758) 2026-06-16 13:56:58 +10:00
tequ
4599fedd40 fix 2026-06-10 14:04:31 +09:00
tequ
93c135aabc Custom Hook API Cost 2026-06-09 16:12:47 +09:00
tequ
1b75b9f72f Merge branch 'dev' into HookFeeV2 2026-06-09 13:07:02 +09:00
tequ
cb91b4e88e Restore pre-reserved tem codes (#754) 2026-05-27 07:57:55 +10:00
tequ
90333b6fd0 Fix HookAPI Expected and Refactor Enum classes (#729) 2026-05-26 11:02:17 +10:00
tequ
b9e0c56def Guard depth 32 (#653) 2026-05-25 11:10:49 +10:00
tequ
3a2cc49106 Merge branch 'dev' into HookFeeV2 2026-05-21 20:56:35 +09:00
tequ
663ed4edb8 Named Hook (#718) 2026-05-19 12:00:25 +10:00
tequ
5e8d26f67a refactor: Calculate numFeatures automatically (#5324) (#739)
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-04-30 18:17:50 +10:00
tequ
a6186d7855 IOURewardClaim (#500) 2026-04-30 15:27:51 +10:00
tequ
49fd0c33b5 fixIOULockedBalanceInvariant Amendment (#732) 2026-04-29 17:05:18 +10:00
tequ
61138058a6 Delete unused sfHookDefinition (#715) 2026-04-29 16:45:35 +10:00
tequ
8dd17973d0 Add hook header ls_flags.h and tx_flags.h (#717) 2026-04-29 16:41:52 +10:00
tequ
55710c4baf Disallow setting a AMM account as Issuer/Destination/Inform (#709) 2026-04-29 11:00:25 +10:00
tequ
f1f44ae232 Build xahau.h from source and check in workflow https://github.com/Xahau/xahaud/pull/674 2026-04-28 18:28:59 +10:00
tequ
d3d24f781b Merge fixAMMClawbackRounding amendment into featureAMMClawback amendment 2026-04-28 18:23:31 +10:00
yinyiqian1
131d659032 fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
Due to rounding, the LPTokenBalance of the last LP might not match the LP's trustline balance. This was fixed for `AMMWithdraw` in `fixAMMv1_1` by adjusting the LPTokenBalance to be the same as the trustline balance. Since `AMMClawback` is also performing a withdrawal, we need to adjust LPTokenBalance as well in `AMMClawback.`

This change includes:
1. Refactored `verifyAndAdjustLPTokenBalance` function in `AMMUtils`, which both`AMMWithdraw` and `AMMClawback` call to adjust LPTokenBalance.
2. Added the unit test `testLastHolderLPTokenBalance` to test the scenario.
3. Modify the existing unit tests for `fixAMMClawbackRounding`.
2026-04-28 18:23:31 +10:00
tequ
503dee619a Merge fixAMMv1_3 amendment into featureAMM amendment 2026-04-28 18:23:31 +10:00
Gregory Tsipenyuk
1703d96a48 fix: Add AMMv1_3 amendment (#5203)
* Add AMM bid/create/deposit/swap/withdraw/vote invariants:
  - Deposit, Withdrawal invariants: `sqrt(asset1Balance * asset2Balance) >= LPTokens`.
  - Bid: `sqrt(asset1Balance * asset2Balance) > LPTokens` and the pool balances don't change.
  - Create: `sqrt(asset1Balance * assetBalance2) == LPTokens`.
  - Swap: `asset1BalanceAfter * asset2BalanceAfter >= asset1BalanceBefore * asset2BalanceBefore`
     and `LPTokens` don't change.
  - Vote: `LPTokens` and pool balances don't change.
  - All AMM and swap transactions: amounts and tokens are greater than zero, except on withdrawal if all tokens
    are withdrawn.
* Add AMM deposit and withdraw rounding to ensure AMM invariant:
  - On deposit, tokens out are rounded downward and deposit amount is rounded upward.
  - On withdrawal, tokens in are rounded upward and withdrawal amount is rounded downward.
* Add Order Book Offer invariant to verify consumed amounts. Consumed amounts are less than the offer.
* Fix Bid validation. `AuthAccount` can't have duplicate accounts or the submitter account.
2026-04-28 18:23:31 +10:00
Nicholas Dudfield
fff46e3dd0 chore: clang-format 2026-02-20 08:22:49 +09:00
tequ
57c4e3c9cc Support new STIs for sto_* HookAPI (#657) 2026-02-20 08:18:45 +09:00
tequ
8e1ae86ce2 Add new keylets to util_keylet (#533) 2026-02-20 08:18:45 +09:00
tequ
73f14374b4 VoteBehavior::DefaultYes for new fix Amendments
- NFToken related fix Amendments remains as `DefaultNo`.
2026-02-20 08:15:13 +09:00
tequ
05f0186572 Supported::No for featurePermissionedDomains 2026-02-20 08:10:52 +09:00
tequ
d4db9276c6 Supported::No for featureDynamicNFT 2026-02-20 08:10:51 +09:00
tequ
a6824770fc Supported::No for featureCredentials 2026-02-20 08:10:50 +09:00
tequ
5678b8fbb1 Supported::No for featureMPTokensV1 2026-02-20 08:10:50 +09:00
tequ
bfeef7fd91 Supported::No for featureNFTokenMintOffer 2026-02-20 08:10:49 +09:00