Skip to content

Support for execution costs per Hook APIs [DO NOT MERGE]#613

Open
tequdev wants to merge 65 commits into
Xahau:devfrom
tequdev:HookFeeV2
Open

Support for execution costs per Hook APIs [DO NOT MERGE]#613
tequdev wants to merge 65 commits into
Xahau:devfrom
tequdev:HookFeeV2

Conversation

@tequdev

@tequdev tequdev commented Oct 26, 2025

Copy link
Copy Markdown
Member

High Level Overview of Change

Context of Change

require: #622

  1. Allow custom costs to be set for each HookAPI, enabling more appropriate execution costs to be billed.
    (Currently, calling HookAPI incurs no additional cost and has the same cost as general Wasm instructions (1 drop))

  2. HookDefinitionUpdate transaction added, allowing guard-checkers to be run on already deployed HookDefinitions.

  3. Change the Hook execution fee format from sfFee/sfHookCallbackFee (STAmount) to sfHookCost/sfHookCallbackCost (uint64), allowing a more flexible and precise drop-based cost model instead of the previous fixed 1-drop-per-instruction structure.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.10749% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.3%. Comparing base (c55420b) to head (4599fed).

Files with missing lines Patch % Lines
src/xrpld/app/tx/detail/HookDefinitionUpdate.cpp 0.0% 43 Missing ⚠️
include/xrpl/hook/Guard.h 88.9% 4 Missing ⚠️
src/xrpld/app/tx/detail/Transactor.cpp 90.5% 4 Missing ⚠️
src/xrpld/app/ledger/Ledger.cpp 86.7% 2 Missing ⚠️
src/xrpld/app/tx/detail/Change.cpp 71.4% 2 Missing ⚠️
include/xrpl/hook/Enum.h 66.7% 1 Missing ⚠️
src/xrpld/app/misc/FeeVoteImpl.cpp 96.4% 1 Missing ⚠️
src/xrpld/app/tx/detail/HookDefinitionUpdate.h 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             dev    #613     +/-   ##
=======================================
- Coverage   77.3%   77.3%   -0.0%     
=======================================
  Files        837     839      +2     
  Lines      78575   78816    +241     
  Branches   11551   11580     +29     
=======================================
+ Hits       60748   60923    +175     
- Misses     17817   17883     +66     
  Partials      10      10             
Files with missing lines Coverage Δ
include/xrpl/hook/hook_api.macro 100.0% <100.0%> (ø)
include/xrpl/protocol/Fees.h 100.0% <ø> (ø)
include/xrpl/protocol/detail/ledger_entries.macro 100.0% <ø> (ø)
include/xrpl/protocol/detail/transactions.macro 100.0% <100.0%> (ø)
src/libxrpl/protocol/STValidation.cpp 81.8% <ø> (ø)
src/xrpld/app/hook/applyHook.h 80.3% <ø> (ø)
src/xrpld/app/hook/detail/applyHook.cpp 85.7% <100.0%> (+0.3%) ⬆️
src/xrpld/app/misc/NetworkOPs.cpp 66.6% <100.0%> (+0.2%) ⬆️
src/xrpld/app/tx/detail/SetHook.cpp 81.0% <100.0%> (-0.5%) ⬇️
src/xrpld/app/tx/detail/Transactor.h 94.1% <ø> (ø)
... and 11 more

... and 9 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Amendment New feature or fix amendment feature Feature Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant