klaim baseline saldo stabil (V56/B18) + endpoint cek akun payout-eligible /api/voter (V57)
V56/B18: pre-claim liquid balance dibaca SEKALI per window (poll_claim) dan dibawa ke tiap _try_claim_once — klaim yang mendarat di attempt 1 membuat before attempt 2 (ditolak already-claimed) sudah termasuk reward → delta 0 → alert palsu KLAIM MENDARAT · REWARD TAK TERUKUR (kasus 10 Agt: bfa9ab02 reward 1679.3365 vs tx ditolak b0a8b2f9) ; oracle B18 attempt-1-mendarat → claimed + reward asli terukur
V57: db.py single source eligible_voters(owner=None) — SQL jendela payout V40/V52 (last_vote > now−STALE AND first_seen_at IS NOT NULL AND first_seen_at ≤ now−MATURITY, cutoff UTC-naive) dipakai BAIK distribute.py run_distribution (refactor, hapus _eligible_cutoffs) MAUPUN endpoint baru GET /api/voter/<owner> → 200 {owner, is_valid_voter} (DB-snapshot, selalu 200, ⊖ format-validation); BARU/kadaluarsa/hidden/asing → false ; docs §I/§V/V57 + T50 + AGENTS ; oracle test_dashboard (V57 true/false + drift endpoint==db pool + pool distribusi==db) + test_distribute (mock eligible_voters utk no-op, distribusi luas)
This commit is contained in:
1 parent
ee4682da00
commit
8e80653df9
9 files changed
+172
-40
No files matched your search
@@ -411,6 +411,56 @@ def main():
|
||||
row[3] == 1683.0126 and row[4] == 168.3012
|
||||
and row[5] == 'pending' and row[2] == 'txC')
|
||||
|
||||
# ————— V56/B18: klaim mendarat attempt 1, attempt 2 ditolak (already
|
||||
# claimed) — before_balance STABIL per window → reward tetap terukur —————
|
||||
# Kasus 2026-08-10: attempt 1 (bfa9ab02) mendarat tapi confirm baca
|
||||
# basi → retry; attempt 2 (b0a8b2f9) ditolak chain tapi last_claim_time
|
||||
# SUDAH maju → dianggap mendarat; before_balance dibaca SEKALI di awal
|
||||
# window (belum termasuk reward) → delta fallback mengukur reward asli.
|
||||
# Tanpa baseline stabil, `before` attempt 2 sudah post-credit → delta 0
|
||||
# → alert KLAIM MENDARAT palsu.
|
||||
fresh_db('b18land')
|
||||
b18 = {'n': 0}
|
||||
|
||||
def b18_confirm():
|
||||
b18['n'] += 1
|
||||
if b18['n'] <= 4: # baseline + 3 baca attempt 1 → basi (stale)
|
||||
return (claim._utcnow() - timedelta(hours=2)
|
||||
).strftime('%Y-%m-%dT%H:%M:%S')
|
||||
return (claim._utcnow() - timedelta(hours=1)
|
||||
).strftime('%Y-%m-%dT%H:%M:%S') # attempt 2 → maju
|
||||
|
||||
claim.fetch_producer_last_claim = b18_confirm
|
||||
claim.reward_from_tx = lambda txid: None # tx ditolak → ⊥ terbaca
|
||||
bal_seq = iter([Decimal('1000.0000'), Decimal('2679.3365')])
|
||||
dist.fetch_balance = lambda: next(bal_seq) # 1000 = baseline window
|
||||
sends = {'n': 0}
|
||||
|
||||
def send_land_then_reject():
|
||||
sends['n'] += 1
|
||||
if sends['n'] == 1:
|
||||
return FakeSigned('txA1') # attempt 1: mendarat
|
||||
return FakeSigned('txA2', exc=RuntimeError('already claimed'))
|
||||
|
||||
claim.build_claim_action = send_land_then_reject
|
||||
dist.verify_txid = lambda txid: False # Hyperion lag kedua kali
|
||||
notifs = []
|
||||
_orig_ncA = telegram.notify_claim
|
||||
_orig_ncuA = telegram.notify_claim_unmeasured
|
||||
telegram.notify_claim_unmeasured = lambda t: notifs.append('unmeasured')
|
||||
telegram.notify_claim = lambda r, f, w: notifs.append('claimed')
|
||||
deadline = claim._utcnow() + timedelta(seconds=3600)
|
||||
check('V56 klaim attempt-1-mendarat → poll_claim claimed',
|
||||
claim.poll_claim(deadline) == 'claimed')
|
||||
row = last_claim_row()
|
||||
check('V56 reward asli terukur via delta (before_balance stabil)',
|
||||
row[3] == 1679.3365 and row[4] == 167.9336
|
||||
and row[5] == 'pending' and row[2] == 'txA2')
|
||||
check('V56 ⊖ alert tak-terukur, notif sukses dipakai',
|
||||
'unmeasured' not in notifs and 'claimed' in notifs)
|
||||
telegram.notify_claim = _orig_ncA
|
||||
telegram.notify_claim_unmeasured = _orig_ncuA
|
||||
|
||||
# ————— V45: reward dari isi tx (bpay+vpay) → prioritas —————
|
||||
fresh_db('txreward')
|
||||
claim.fetch_producer_last_claim = lambda: (
|
||||
|
||||
Reference in new issue
Block a user