Skip to content

feat: p4-compatible resource recharging ledger #989

Draft
charmful0x wants to merge 22 commits into
edgefrom
feat/recharging-ledger
Draft

feat: p4-compatible resource recharging ledger #989
charmful0x wants to merge 22 commits into
edgefrom
feat/recharging-ledger

Conversation

@charmful0x

@charmful0x charmful0x commented Jun 24, 2026

Copy link
Copy Markdown

metering rejection benchmark (p4 bundler case)

setup

  • local HyperBEAM HTTP nodes.
  • p4@1.0 + metering@1.0 + recharging-ledger@1.0 + bundler@1.0
  • AO-provider case used trusted published recharger-ao-balance@1.0
  • 25 rejected uploads per case (first attempt pass through, so expecting 24 402'd rejection)

results

default recharging-ledger only

avg   58.855 ms
p50   56.208 ms
min   51.857 ms
max   87.227 ms
402   25/25

recharging-ledger@1.0 + recharger-ao-balance@1.0 (external device package)

avg   598.738 ms
p50   591.374 ms
p95   644.382 ms
min   566.185 ms
max   677.337 ms
402   25/25

grace window

added recharging-ledger-grace as a small post-metering tolerance window -- this dont increase the user's visible/spendable balance. balance/3 still return the actual account balance, and p4 still uses that actual balance for preflight checks.

the grace only applies at charge/3: if the post-metering charge drifts slightly below zero, the ledger can accept it down to -Grace instead of rejecting after the work already ran

-> Default: 3600 units

todo

  • metering rejection benchmark
  • add charge-time grace window for small post-metering negative drift
  • prepare hb config integration

@charmful0x charmful0x marked this pull request as draft June 24, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant