feat: include node account information in config score response#6877
feat: include node account information in config score response#6877jstuczyn wants to merge 11 commits into
Conversation
… self-described data
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Deployment failed with the following error: |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughMigrates described-node models to V3, adds feegrant query primitives and Nyxd chain-detail accessors, extends node-status scoring with per-node chain capability caching, converts the refresher to async startup, and updates consumers/routes/tests to use V3 types. ChangesV2-to-V3 Node Description & Chain Capabilities Migration
🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
🚥 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 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@nym-api/src/node_status_api/cache/refresher.rs`:
- Around line 357-359: The loop that calls
self.chain_capabilities.record(node_id, caps, now) is caching transient feegrant
RPC errors as a fresh "false" (is_feegrant_grantee = false); change the feegrant
query path to propagate errors (e.g., return Result/Option) instead of coercing
errors to false, and update the refresher to only call chain_capabilities.record
when the capability value is a definitive success/false (i.e., from an Ok
result), skipping or retrying when the query returned an Err/None so transient
RPC failures are not stored as a stale false; update the code paths around
is_feegrant_grantee and the fresh.into_inner() consumer to handle Result/Option
accordingly.
- Around line 304-328: When building to_query you currently skip nodes with
missing/invalid addresses but do not evict their stale entries from
self.chain_capabilities; update the logic so that whenever a node has no usable
address (the None branch of description.auxiliary_details.address or
AccountId::from_str fails) you call the chain_capabilities eviction API (e.g.
self.chain_capabilities.remove(node_id) or evict(node_id) depending on the
struct) to delete that node's cached capabilities; do this inside the closure
used by filter_map (or immediately after collecting invalid nodes) so stale
capabilities are removed as soon as an address is found unusable, keeping
retain_live and needs_refresh usage unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dd065450-0552-4c14-a36e-fcd8af28a87e
📒 Files selected for processing (42)
common/client-libs/validator-client/src/client.rscommon/client-libs/validator-client/src/nym_api/mod.rscommon/client-libs/validator-client/src/nyxd/cosmwasm_client/module_traits/feegrant/mod.rscommon/client-libs/validator-client/src/nyxd/cosmwasm_client/module_traits/feegrant/query.rscommon/client-libs/validator-client/src/nyxd/cosmwasm_client/module_traits/mod.rscommon/client-libs/validator-client/src/nyxd/mod.rscommon/topology/src/node.rscommon/verloc/src/measurements/measurer.rsnym-api/nym-api-requests/src/models/described/mod.rsnym-api/nym-api-requests/src/models/described/type_translation.rsnym-api/nym-api-requests/src/models/described/v1.rsnym-api/nym-api-requests/src/models/described/v2.rsnym-api/nym-api-requests/src/models/described/v3.rsnym-api/nym-api-requests/src/models/mod.rsnym-api/nym-api-requests/src/models/network_monitor.rsnym-api/nym-api-requests/src/models/node_status.rsnym-api/nym-api-requests/src/nym_nodes.rsnym-api/nym-api-requests/src/signable.rsnym-api/src/network_monitor/monitor/preparer.rsnym-api/src/node_describe_cache/cache.rsnym-api/src/node_describe_cache/mod.rsnym-api/src/node_describe_cache/query_helpers.rsnym-api/src/node_describe_cache/refresh.rsnym-api/src/node_status_api/cache/config_score.rsnym-api/src/node_status_api/cache/refresher.rsnym-api/src/node_status_api/mod.rsnym-api/src/nym_nodes/handlers/v1.rsnym-api/src/nym_nodes/handlers/v2.rsnym-api/src/nym_nodes/handlers/v3.rsnym-api/src/support/caching/cache.rsnym-api/src/support/cli/run.rsnym-api/src/support/config/mod.rsnym-api/src/support/nyxd/mod.rsnym-api/src/support/storage/models.rsnym-api/src/unstable_routes/v2/nym_nodes/semi_skimmed/mod.rsnym-api/src/unstable_routes/v2/nym_nodes/skimmed/helpers.rsnym-api/src/unstable_routes/v3/nym_nodes/semi_skimmed/mod.rsnym-network-monitor-v3/nym-network-monitor-orchestrator/src/orchestrator/result_submitter.rsnym-network-monitor-v3/nym-network-monitor-orchestrator/src/storage/models.rsnym-node-status-api/nym-node-status-api/src/db/models.rsnym-node/nym-node-requests/src/api/client.rsnym-statistics-api/src/network_view.rs
💤 Files with no reviewable changes (2)
- nym-api/nym-api-requests/src/models/mod.rs
- nym-api/nym-api-requests/src/models/network_monitor.rs
59904d5 to
eaa52f8
Compare
Factor on-chain account capability into node config score
Summary
A node's config score (used for rewarding and active-set selection) now accounts for whether the node's on-chain account can actually pay for transactions, i.e. it holds a sufficient token balance or is the grantee of a feegrant allowance. Nodes now advertise their on-chain address, nym-api queries each node's balance and feegrant status, and that capability flows into the config score and node annotations.
Changes
Nodes advertise their on-chain address
/api/v2/auxiliarynow carries anaddressfield; addedget_auxiliary_details_v2to the client.New
v3described-node model familydescribed::v3whereNymNodeAuxiliaryDetailsV3addsaddress: Option<String>. Describe cache now storesNymNodeDescriptionV3, withV3 -> V2 -> V1conversions so existing v1/v2 endpoints keep working (downcast drops the address).Feegrant query support in
validator-clientFeegrantQueryClienttrait implementing thecosmos.feegrant.v1beta1.Query/AllowancesABCI query (not provided by cosmrs).Chain-capability lookups in the node-status refresher
failed/new nodes are retried next refresh rather than pinned to a stale
false. Entries are pruned as nodes unbond.Config score / annotations
ConfigScoresplit intoConfigScoreV1(unchanged) andConfigScoreV2, which addschain_interaction_capabilities(has_sufficient_tokens+is_fee_grant_grantee).NodeAnnotationV2gainschain_interaction_capabilities(on-chain balance + feegrant flag). V2 -> V1 downcasts provided.New config knobs (
NodeStatusAPIDebug)minimum_on_chain_balance_amount(default 1 NYM)chain_capabilities_retrieval_concurrency(default 8)chain_capabilities_refresh_interval(default 24h)Refactor
models::describedandnetwork_monitor; callers now import from explicitdescribed::{v1,v2,v3}/type_translation/models::v3paths. RenamedAuxiliaryDetailsV1 -> NymNodeAuxiliaryDetailsV1.Touches import sites across validator-client, verloc, topology, node-status-api, statistics-api, and the network-monitor orchestrator.
Notes
ExecuteMsg.Summary by CodeRabbit
New Features
Improvements
Chores