Harden access control (analytics/ipfs-metadata), wire quorum_guard, document third-party API - #1046
Merged
nanaf6203-bit merged 1 commit intoAug 25, 2026
Conversation
- analytics (MettaChain#967): replace panicking `assert_eq!` in `ensure_admin` with a typed `Result<(), AnalyticsError>` check. All eight admin-gated messages now return `Result` (including `add_market_trend`, which previously returned `()`), so unauthorized callers get `AnalyticsError::Unauthorized` instead of a revert-by-panic. Added tests asserting the typed error for every gated message plus an admin success-path test. - ipfs-metadata (MettaChain#966): `validate_and_register_metadata` no longer grants `AccessLevel::Admin` (or overwrites stored metadata) for arbitrary callers. Callers must already hold Write/Admin access on the property; the contract admin remains the bootstrap path and receives persistent Admin access on the property. Tests prove an unauthenticated caller is rejected and cannot afterwards register documents. - monitoring (MettaChain#968): wire the previously dead `quorum_guard.rs` into the crate via `pub mod quorum_guard;` so its logic compiles and its four unit tests now run under `cargo test -p propchain-monitoring`. Automatic recording hooks into governance events are out of scope for this crate and documented as such in the module docs. - third-party (MettaChain#965): document the three previously undocumented query messages (`get_service_config`, `get_kyc_record`, `get_payment_request`) covering behavior, caller requirements and None-vs-error semantics, and expand `is_kyc_verified` docs with the verification-level ladder and expiry/activeness rules. Closes MettaChain#968 Closes MettaChain#967 Closes MettaChain#966 Closes MettaChain#965
|
@phertyameen Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens access control across two contracts, wires a dead module back into the build, and completes the third-party API documentation. One commit, four assigned issues.
analytics — typed admin authorization (#967)
ensure_adminused a panickingassert_eq!, so unauthorized calls to admin-gated messages reverted without a typed error and were indistinguishable from any other failure. It now returnsErr(AnalyticsError::Unauthorized). All eight admin-gated messages (update_market_metrics,batch_update_metrics,batch_add_trends,add_market_trend,update_market_sentiment,set_portfolio_positions,update_property_type_trend,update_benchmark_index) returnResult<_, AnalyticsError>;add_market_trendgains an error surface it previously lacked entirely.ipfs-metadata — metadata/document-store takeover fix (#966)
validate_and_register_metadatalet any caller overwrite any property's stored metadata and grant themselvesAccessLevel::Admin, which then satisfiedcheck_write_accessforregister_ipfs_document/update_document/remove_document. Now:WriteorAdminon the property (check_write_access);Adminon the property;monitoring — compile the dead
quorum_guardmodule (#968)quorum_guard.rswas never declared inlib.rs, so its quorum-regression tracking existed only on disk (its own tests never ran). Wired aspub mod quorum_guard;with a doc note that automatic recording hooks into governance events are out of scope for this crate. Its four tests now run undercargo test -p propchain-monitoring.third-party — complete public-API docs (#965)
Documented the three undocumented messages (
get_service_config,get_kyc_record,get_payment_request) with behavior, caller requirements, and None-vs-error semantics, and expandedis_kyc_verifieddocs with the verification-level ladder plus activeness/expiry rules.cargo doc -p propchain-third-party --no-depsbuilds cleanly.Test results
cargo test -p propchain-monitoring: 22 passed (18 existing + 4 quorum_guard)cargo test -p propchain-analytics: 9 passed (new suite)cargo test -p ipfs-metadata: 6 passed (3 existing + 3 new)cargo test -p propchain-third-party: passes (0 tests; coverage tracked separately)Closes #968
Closes #967
Closes #966
Closes #965