Commit Graph

14178 Commits

Author SHA1 Message Date
Nicholas Dudfield
8e2c69deb2 Scope hook test include path to external sources 2026-04-01 12:29:25 +07:00
Nicholas Dudfield
ff763a500c feat: log transform for test output (r-address → Account(name), prefix)
- Log.h: add setTransform/applyTransform on Logs for message rewriting
- SuiteJournal.h: wire transform into SuiteJournalSink so test output
  goes through it (previously bypassed Logs::write entirely)
- Env.h: pass Logs* to SuiteJournalSink
- TestEnv.h: add setPrefix() for per-phase log labels, prepend prefix
  in transform

usage:
  auto env = makeEnv(features);
  auto const& alice = env.account("alice");
  env.setPrefix("deposit phase");
  // logs: TRC:HooksTrace [deposit phase] HookTrace[Account(alice)-...]: ...

  TESTENV_LOGGING="HooksTrace=trace,View=debug"
2026-03-31 17:45:44 +07:00
Nicholas Dudfield
a605aec57a chore: remove unused SuiteLogsWithOverrides.h 2026-03-31 16:44:26 +07:00
Nicholas Dudfield
bfcbbc3c5e feat: migrate coverage from sancov to hookz __on_source_line
replace sancov-based coverage instrumentation with hookz's DWARF-based
__on_source_line(line, col) approach. line/col arrive as direct arguments
so no post-processing symbolication step is needed.

- Guard.h: allow result_count == 0 for void-returning whitelisted imports
- Enum.h: replace sancov whitelist entries with __on_source_line
- applyHook.h: replace sancov callbacks with onSourceLine, emit line:col
- SetHook.cpp: re-enable guard validation (was disabled for sancov testing)
- CMake: use hookz build-test-hooks, add HOOKS_FORCE_RECOMPILE support
- remove obsolete HookCoverage sancov test files
2026-03-31 16:38:28 +07:00
Nicholas Dudfield
d782f8cab4 feat: snapshot cmake change 2026-03-31 13:11:17 +07:00
Nicholas Dudfield
8a61dd44e0 feat: chorse: 2026-03-27 22:54:03 +07:00
Nicholas Dudfield
a8ca62a148 feat: add TestEnv with named accounts, log transform, and env-var logging
TestEnv wraps Env with:
- account("name"): auto-registers r-address → Account(name) in logs
- TESTENV_LOGGING env var: "HooksTrace=trace,View=debug" sets
  per-partition log levels without code changes
2026-03-27 22:19:13 +07:00
Nicholas Dudfield
b7aeff95a9 feat: add log transform to Logs for test-time message rewriting
Logs::setTransform(fn) installs a function that transforms every log
message before output. Useful in tests to replace raw r-addresses
with human-readable account names.

Usage:
  env.app().logs().setTransform([&](std::string const& text) {
      std::string out = text;
      // replace rG1QQv2... with Account(alice)
      boost::algorithm::replace_all(out, toBase58(alice.id()), "Account(alice)");
      return out;
  });
  // Pass nullptr to clear:
  env.app().logs().setTransform(nullptr);
2026-03-27 21:59:31 +07:00
tequ
b880c80c2b Fix BEAST_ENHANCED_LOGGING not working and restore original behavior 2026-03-27 21:27:38 +07:00
Nicholas Dudfield
8666cdfb71 fix: remove stdout duplicate from StderrJournalSink 2026-03-27 20:53:22 +07:00
Nicholas Dudfield
6d2a0b4e8b feat: also write overridden journal output to stdout with prefix 2026-03-27 20:43:47 +07:00
Nicholas Dudfield
739ebfaba4 rename: HooksApi journal → HooksTrace 2026-03-27 20:28:38 +07:00
Nicholas Dudfield
65166a9329 feat: route hook trace output to dedicated HooksApi journal
- Macro.h: add `jh` journal for HooksApi partition in HOOK_SETUP()
- applyHook.cpp: trace, trace_num, trace_float now use jh + JLOG macro
  for line numbers and separate partition filtering
- SuiteLogsWithOverrides.h: per-partition severity overrides for tests

Usage in tests:
  Env env{*this, envconfig(), features,
      std::make_unique<SuiteLogsWithOverrides>(*this,
          SuiteLogsWithOverrides::Overrides{{"HooksApi", Sev::kTrace}})};
2026-03-27 20:10:56 +07:00
Nicholas Dudfield
ca469b5d22 feat: wasm hook coverage instrumentation support
- Enum.h: add sancov callbacks to import whitelist with void_t return
- applyHook.h: sancov host callbacks (trace guard + init), global
  coverage accumulator with label support, coverageReset/Hits/Dump API
- SetHook.cpp: bypass guard validation for coverage-instrumented hooks
- RippledCore.cmake: HOOKS_TEST_DIR, HOOKS_C_DIR, HOOKS_COVERAGE,
  HOOKS_TEST_ONLY env vars for external hook test compilation
2026-03-27 19:32:43 +07:00
tequ
8cfee6c8a3 Merge fixAMMClawbackRounding amendment into featureAMMClawback amendment 2026-02-25 19:07:45 +10:00
yinyiqian1
8673599d2b 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-02-25 19:07:45 +10:00
tequ
ec65e622aa Merge fixAMMv1_3 amendment into featureAMM amendment 2026-02-25 16:20:43 +10:00
Gregory Tsipenyuk
65837f49e1 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-02-25 16:20:43 +10:00
RichardAH
e5b21f026e Merge pull request #692 from Xahau/sync-2.4.0-rebased
Sync: Ripple(d) 2.4.0
2026-02-24 16:07:09 +10:00
tequ
8d08d8f1db fix workflow 2026-02-20 09:11:47 +09:00
Nicholas Dudfield
fff46e3dd0 chore: clang-format 2026-02-20 08:22:49 +09:00
Nicholas Dudfield
52369f3ebb fix: resolve merge issues from dev sync
- Add missing getHookOn declaration and implementation (build blocker)
- Add else branches for HookOnOutgoing/HookOnIncoming in hsoUPDATE path
- Guard unprotected optional dereferences in hsoINSTALL path
- Reorder features.macro per review (HookOnV2/HooksUpdate2 before fixHookAPI20251128)
2026-02-20 08:22:15 +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
bed5473540 Update CMake version to 3.25.3 in macOS workflow 2026-02-20 08:15:17 +09:00
tequ
de1f57819f Fix differences such as LedgerHash that occurred due to NetworkID in ltFeeSettings 2026-02-20 08:15:16 +09:00
tequ
6dd6393bb8 Add ltORACLE for Remarks target (#562) 2026-02-20 08:15:16 +09:00
tequ
73861a4bfe Conan Release Builder (2.4.0 sync) (#528) 2026-02-20 08:15:15 +09:00
tequ
5a2bf0e0b1 Add Remit test to AMM Account 2026-02-20 08:15:14 +09:00
tequ
5e9d961c5d Optimize AccountDelete and Creadentials tests, Update tests priority 2026-02-20 08:15:14 +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
3380b7e2fd Add TSH processing for AMM, AMMClawback, Clawback, Oracle (#532)
* Add TSH processing for `AMM`, `AMMClawback`, `Oracle`, `Clawback`

* Add empty TSH processing for other transaction types

* Add AMMTsh tests
2026-02-20 08:14:39 +09:00
tequ
da6bd8cac1 Support Hook execution in simulate RPC (#531) 2026-02-20 08:10:52 +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
tequ
b78c4abece Supported::No for featureDID 2026-02-20 08:10:49 +09:00
tequ
a9d1f2aa69 Supported::No for featureXChainBridge 2026-02-20 08:10:48 +09:00
tequ
3540148941 Combine AMM Amendments (#521)
* fixAMMv1_2
* fixAMMv1_1
* fixAMMOverflowOffer
* fixLPTokenTransfer
* suppress AMM test logs
* exclude `ltAMM` from `fixPreviousTxnID` Amendment
    - make `sfPreviousTxnID` and `sfPreviousTxnLgrSeq` required for ltAMM
2026-02-20 08:10:43 +09:00
tequ
8ec0e9bb22 Combine XChainBridge Amendments (#523) 2026-02-20 08:10:05 +09:00
tequ
7bfa595c6c Combine fixInnerObjTemplate Amendments (#524) 2026-02-20 08:10:05 +09:00
tequ
a57e819ac5 Disable instrumentation-build workflow (#530) 2026-02-20 08:10:01 +09:00
Denis Angell
825e923081 fix cmake & xrpl_core 2026-02-20 08:10:00 +09:00
tequ
30f8f7de00 fix release-builder, workflow building 2026-02-20 08:10:00 +09:00
tequ
0c236573fb remove checkpatterns workflow 2026-02-20 08:09:59 +09:00
tequ
293266519d Combine DID Amendments (#522)
fixEmptyDID -> featureDID
2026-02-20 08:09:58 +09:00
tequ
96e3851c51 Additional support for HookDefinition, HookState, ImportVLSequence at fixPreviousTxnID Amendment 2026-02-20 08:09:58 +09:00
Mark Travis
c9e886e5e3 Log detailed correlated consensus data together (#5302)
Combine multiple related debug log data points into a single
message. Allows quick correlation of events that
previously were either not logged or, if logged, strewn
across multiple lines, making correlation difficult.
The Heartbeat Timer and consensus ledger accept processing
each have this capability.

Also guarantees that log entries will be written if the
node is a validator, regardless of log severity level.
Otherwise, the level of these messages is at INFO severity.
2026-02-20 08:09:57 +09:00