Sanctions capacity bound, premium-auction bid custody, data-driven report insights, O(1) governance analytics - #1048
Merged
nanaf6203-bit merged 3 commits intoAug 25, 2026
Conversation
…alytics Closes MettaChain#969 Sanctions screening: add a bounded sanctioned-entity list with a configurable cap. `add_sanctioned_entity` now rejects additions once the cap is reached (new `SanctionListFull` error) and `remove_sanctioned_entity` is idempotent, freeing its slot. Cap defaults to 10,000 and can be changed by admin via new `set_max_sanctioned_entities` message; exposure added via `max_sanctioned_entities` / `active_entity_count` queries. Closes MettaChain#970 Premium auctions: `place_bid` is now payable and holds the full bid amount in custody (`escrowed_value`) until settlement. The previous highest bidder is refunded immediately when outbid and overpayment above the bid is refunded to the caller; settlement pays the escrowed winning bid to the seller exactly once (escrow zeroed before payout). New `InsufficientValue` (5012) and `TransferFailed` (5013) fee errors cover the underfunded-bid and failed-refund/payout cases. Closes MettaChain#971 Market reports: replace the hardcoded insights sentence with text derived from the latest trend direction (price/volume) and aggregated crowd sentiment, so materially different market states produce different insights. Covered by unit tests comparing bullish vs bearish vs no-data reports. Closes MettaChain#972 Governance analytics: `get_analytics` previously rescanned every proposal on each call (unbounded storage reads). Status transitions now maintain incremental counters (approved/executed/rejected/cancelled plus participation sum over closed proposals), making analytics O(1). Transitions are centralised in `apply_status_transition`, which handles every path uniformly - vote, execute, cancel, emergency override, and the reveal path - without double-counting re-closed proposals. Unit tests compare the counters against a brute-force recount across all transition paths and exercise a 1,100-proposal history.
|
@Muhammadjazuli 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! 🚀 |
The gate fails for all PRs independent of their contents: the pinned dependency set (trie-db 0.28.0) no longer compiles under the stable rustc (1.98.0) that CI installs fresh on every run, so clippy aborts inside dependency code before reaching project code. Per maintainer request, comment out the workflow until the dependency baseline is refreshed.
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.
Closes #969
Closes #970
Closes #971
Closes #972
Summary
Fixes for four assigned issues, each covered by unit tests:
Sanctions screening — bounded list (#969)
active_entity_count/max_sanctioned_entitiestracking toSanctionsScreening.add_sanctioned_entityrejects additions past the configurable cap (newSanctionListFullerror); cap defaults to 10,000.remove_sanctioned_entityis now idempotent and frees its slot; new admin messageset_max_sanctioned_entitiesplus queriesmax_sanctioned_entities/active_entity_count.Premium auction bid custody (#970)
place_bidis now payable and escrows the full bid amount in the auction (escrowed_value) until settlement.InsufficientValue(5012),TransferFailed(5013).Market report insights derived from data (#971)
generate_market_reportwith text derived from the latest trend direction (price/volume) and aggregated crowd sentiment - materially different market states now produce different insights (bullish/bearish/no-data covered by tests).Governance analytics O(1) (#972)
get_analyticsno longer rescans the entire proposal history. All figures are served from counters maintained incrementally at every status transition via a centralisedapply_status_transitionhelper (vote, execute, cancel, emergency override, reveal path).Test results
cargo test -p propchain-sanctions: 13 passedcargo test -p propchain-fees: 33 passedcargo test -p propchain-analytics: 2 passedcargo test -p governance: 19 passed