feat: add Anyone Protocol collector and fix CI worker manifest#77
Conversation
- Add AnyoneCollector that queries AO relay-rewards contract by fingerprint and converts ANYONE tokens to USD via CoinGecko - Fix build.yml manifest step: only create multi-arch manifests when the corresponding arch-specific builds actually succeeded - Register anyone-protocol in collector map with fingerprints credential
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an Anyone Protocol collector that queries AO CU dry-run endpoints per fingerprint, converts ANYONE tokens to USD via CoinGecko, registers the collector, updates the service manifest to use an auto collector with fingerprint credentials, and adds deep tests and CI manifest guards. ChangesCI Build Manifest Dependencies
Anyone Protocol Collector
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
==========================================
+ Coverage 90.96% 91.00% +0.04%
==========================================
Files 25 26 +1
Lines 2755 2812 +57
==========================================
+ Hits 2506 2559 +53
- Misses 249 253 +4
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/collectors/anyone.py (1)
98-110: ⚡ Quick winAdd retry wrapper for reward/price calls inside
collect().These awaits fail the whole run on the first transient network error. Wrap them with
BaseCollector._retry(...)to harden collection without changing output semantics.Proposed diff
for fp in self.fingerprints: - tokens = await self._get_rewards_for_fingerprint(client, fp) + tokens = await self._retry( + lambda fp=fp: self._get_rewards_for_fingerprint(client, fp) + ) total_tokens += tokens logger.debug("Fingerprint %s: %.6f ANYONE", fp, tokens) @@ - price = await self._get_token_price(client) + price = await self._retry(lambda: self._get_token_price(client))As per coding guidelines,
app/**: Check for proper error handling and logging.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/collectors/anyone.py` around lines 98 - 110, The collect() loop currently awaits self._get_rewards_for_fingerprint(...) and self._get_token_price(...) directly which allows transient network errors to abort the run; wrap both calls with the class retry helper BaseCollector._retry so they are retried on transient failures (i.e., call await self._retry(lambda: self._get_rewards_for_fingerprint(client, fp)) within the for fp in self.fingerprints loop and await self._retry(lambda: self._get_token_price(client)) before using price), preserving return types and existing logging/behavior when retries ultimately fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/collectors/anyone.py`:
- Around line 98-110: The collect() loop currently awaits
self._get_rewards_for_fingerprint(...) and self._get_token_price(...) directly
which allows transient network errors to abort the run; wrap both calls with the
class retry helper BaseCollector._retry so they are retried on transient
failures (i.e., call await self._retry(lambda:
self._get_rewards_for_fingerprint(client, fp)) within the for fp in
self.fingerprints loop and await self._retry(lambda:
self._get_token_price(client)) before using price), preserving return types and
existing logging/behavior when retries ultimately fail.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6da040e9-3acc-4588-b756-52c86a97f70a
📒 Files selected for processing (5)
.github/workflows/build.ymlapp/collectors/__init__.pyapp/collectors/anyone.pyservices/depin/anyone-protocol.ymltests/test_collectors_deep.py
Summary
AnyoneCollectorthat queries the AO relay-rewards smart contract (relay-rewards.lua) by relay fingerprint, converts ANYONE tokens to USD via CoinGeckobuild.ymlmanifest step: only creates multi-arch manifests when the corresponding arch-specific builds actually succeeded (was trying to create worker manifests from non-existent arch tags when worker builds were skipped)anyone-protocolin collector registry withfingerprintscredentialDetails
Anyone Protocol Collector:
cu.anyone.techwithGet-Rewardsaction by fingerprintairtor-protocol)CI Fix:
needs.build-worker-amd64.result == 'success'guards to manifest creation stepsmanifest unknownerrors when only UI is rebuiltTest plan
Summary by CodeRabbit