GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(ledger): guard the accepted filter of the bootstrap pending count · CortexLM/hypertrain@65f0a18

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tests/ledger
    • test_production_bootstrap_v2.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/ledger/test_production_bootstrap_v2.py‎

Copy file name to clipboardExpand all lines: tests/ledger/test_production_bootstrap_v2.py
+15-3Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ def test_bootstrap_exactly_at_total_issuance_is_accepted(tmp_path: Path) -> None
232232
assert e.balances().issued == 30_000 and e.balances().conserved()
233233

234234

235-
def _pending_reservation(e) -> None:
236-
"""A reserved, not yet accepted shadow round: it will mint round_reward_units."""
235+
def _pending_reservation(e, accepted: str = "null") -> None:
236+
"""A shadow reservation row; `accepted` null = pending, it will mint round_reward_units."""
237237
e.db.execute(
238238
"INSERT INTO records_v2 VALUES(?,?,?,?)",
239-
(e.run_id, "shadow-reservation", "0", '{"binding":{},"accepted":null}'),
239+
(e.run_id, "shadow-reservation", "0", f'{{"binding":{{}},"accepted":{accepted}}}'),
240240
)
241241

242242

@@ -258,3 +258,15 @@ def test_bootstrap_counts_pending_shadow_reservation_against_cap(
258258
with pytest.raises(EscrowError, match="TOTAL_ISSUANCE_BUDGET"):
259259
e.production_bootstrap(bootstrap(e.run_id))
260260
assert e.balances().issued == 0
261+
262+
263+
def test_bootstrap_ignores_accepted_shadow_reservation(tmp_path: Path) -> None:
264+
# Given: an accepted reservation. Its units are already in balances().issued, so counting
265+
# it again as pending would double count and refuse a bootstrap that exactly fits the cap.
266+
s = pinned(E.setup("production"), max_total_issuance=30_000)
267+
e = E.ledger(s, tmp_path / "ledger.db")
268+
_pending_reservation(e, accepted="1")
269+
# When
270+
e.production_bootstrap(bootstrap(e.run_id))
271+
# Then
272+
assert e.balances().issued == 30_000 and e.balances().conserved()

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.