Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/daily-uptime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Daily Uptime Points

on:
schedule:
- cron: '30 0 * * *' # Daily at 00:30 UTC
workflow_dispatch:

jobs:
uptime:
runs-on: ubuntu-latest
environment: cron-job
steps:
- name: Trigger Daily Uptime
run: |
response=$(curl -s -w "\n%{http_code}" -X POST \
-H "X-Cron-Token: ${{ secrets.CRON_SYNC_TOKEN }}" \
"${{ secrets.API_BASE_URL }}/api/v1/validators/wallets/daily-uptime/")

http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')

echo "Response: $body"
echo "HTTP Code: $http_code"

if [ "$http_code" != "200" ]; then
echo "Daily uptime failed with status $http_code"
exit 1
fi
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,21 @@ All notable user-facing changes to this project will be documented in this file.

## Unreleased

### Added
- Daily uptime points system: automated management command and cron endpoint for granting daily validator uptime contributions
- Multi-network support (asimov + bradbury) with per-network duplicate detection
- Date range backfill support via `--start-date`/`--end-date` with 366-day cap
- Snapshot-based activity verification with fallback to current wallet status for recent dates
- GitHub Actions workflow for daily uptime cron job (00:30 UTC)
- Comprehensive test suite (16 tests) covering all command paths

### Changed
- Refactored `add_daily_uptime` command from per-user saves to bulk_create with batch processing
- Leaderboard updates now use shared `update_user_leaderboard_entries` and `update_referrer_points` helpers
- All contribution creation + leaderboard updates wrapped in atomic transaction

### Fixed
- Migration 0037 no longer crashes in test environments when seed users don't exist

- Direct Cloudinary image upload from Django admin for featured content (ce4c157)
- Responsive hero banner images for tablet and mobile (e5c01b5)
23 changes: 23 additions & 0 deletions backend/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ GET /api/v1/multiplier-periods/
# Steward Submissions (public metrics)
GET /api/v1/steward-submissions/stats/ (public - aggregate stats)
GET /api/v1/steward-submissions/daily-metrics/ (public - time-series data)

# Validators
GET /api/v1/validators/me/ (requires auth)
PATCH /api/v1/validators/me/ (requires auth)
GET /api/v1/validators/newest/
POST /api/v1/validators/link-by-operator/ (requires auth)
GET /api/v1/validators/my-wallets/ (requires auth)
GET /api/v1/validators/wallets/
GET /api/v1/validators/wallets/{id}/
GET /api/v1/validators/wallets/by-operator/{address}/
GET /api/v1/validators/wallets/by-user-address/{address}/
GET /api/v1/validators/wallets/networks/
POST /api/v1/validators/wallets/sync/ (IsCronToken)
POST /api/v1/validators/wallets/daily-uptime/ (IsCronToken)
```

## Environment Variables
Expand Down Expand Up @@ -223,6 +237,15 @@ python manage.py test

# Collect static files
python manage.py collectstatic

# Add daily uptime points for validators with active wallets
python manage.py add_daily_uptime # Today's date
python manage.py add_daily_uptime --date 2025-01-15 # Specific date
python manage.py add_daily_uptime --start-date 2025-01-01 --end-date 2025-01-31 # Date range
python manage.py add_daily_uptime --dry-run --verbose # Preview without changes
python manage.py add_daily_uptime --network asimov # Single network only
python manage.py add_daily_uptime --force # Use default multiplier if none exists
python manage.py add_daily_uptime --points 2 # Custom points per contribution
```

## Authentication Flow
Expand Down
Loading