Skip to content

fix(settlement): correct epoch_ledger table and column names in anchor job#129

Merged
Satelink-Protocol merged 5 commits into
mainfrom
develop
Jun 14, 2026
Merged

fix(settlement): correct epoch_ledger table and column names in anchor job#129
Satelink-Protocol merged 5 commits into
mainfrom
develop

Conversation

@Satelink-Protocol

Copy link
Copy Markdown
Owner

Summary

Fixes settlement_anchor_job.js, which queried a non-existent epochs table and *_usdt columns. The real schema is epoch_ledger with total_revenue, platform_fee, and closed_at. This left closed epochs perpetually unanchored.

Changes

  • run() main query: epochsepoch_ledger, with total_revenue AS total_revenue_usdt, platform_fee AS platform_share_usdt, closed_at AS ends_at; also skip rows already anchored (tx_hash IS NULL OR tx_hash = '').
  • Dust-count query: epochsepoch_ledger, total_revenue_usdttotal_revenue.
  • anchorEpochById() query: epochsepoch_ledger with the same aliased columns.
  • epoch_ledger tx_hash update: match on id = epoch.id instead of the bogus epoch_id = 'epoch-<id>' string.

Verification

  • node --check passes on the modified file.

🤖 Generated with Claude Code

Satelink-Protocol and others added 5 commits June 13, 2026 03:13
Non-breaking npm audit fix. Cleared 2 high + 1 moderate (semver-compatible).
Remaining 29 all require breaking major bumps, deliberately NOT applied:
- ws via @ethersproject (needs ethers@5.8.0 major) — risky on Polygon mainnet
- shell-quote/concurrently 2 criticals (needs concurrently@10 major) — dev-tooling only

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(intelligence): capture User-Agent in free-tier gate for traffic classification

Without this we cannot distinguish developers from crawlers.
User-Agent is not PII — it is a software identifier, not a person.
Stored alongside hashed client_id (ftua:<ip>, same daily TTL), never with raw IP.

Enables automated classification: curl/wget/python=script, ethers/viem/web3=developer,
Mozilla=browser, *bot/spider=crawler. conversion_targets export now includes
user_agent + classification. Captured once per IP per day (first call), so the hot
path takes a single extra Redis write.

Also adds docs/TRAFFIC_INTELLIGENCE_REPORT.md: volume-based classification of the
current 354k calls/day across 2,204 IPs. Key finding: 78% of traffic is 6 crawlers
(now 429 abuse-blocked); developers are unidentifiable until this UA field exists.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…r job

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 14, 2026 10:41am

@Satelink-Protocol Satelink-Protocol merged commit 79300c7 into main Jun 14, 2026
13 of 15 checks passed
@Satelink-Protocol Satelink-Protocol deleted the develop branch June 14, 2026 11:02
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