test: pin prediction-market resolution, insurance premium engine, factory and sanctions threshold paths - #1056
Merged
Conversation
…tory admin and sanctions threshold paths - Prediction market (MettaChain#1017): resolution-flow coverage — admin gate, resolve before deadline rejected, staking after the resolution deadline rejected, long side wins when resolved value equals target, double resolution rejected, winner claim pays the proportional payout minus the protocol fee (balance delta + RewardClaimed event asserted), loser claim yields nothing with a reputation penalty, double claim and non-participant claims rejected, claim-before-resolution rejected. - Insurance premium engine (MettaChain#1018): direct tests of calculate_premium / calculate_premium_with_modifiers through the public messages with fixed inputs asserting exact values: baseline fire/one-year across all seven multipliers (annual/monthly/deductible/breakdown), each modifier branch (multiple-policy discount, claim-free years, safety features + deductible, loyalty, recent-claims surcharge incl. per-event cap at five), total-discount cap at forty percent, duration proration (half-year / one-month buckets), rounding truncation, and the PropertyNotInsurable / pool-not-found error paths. - Factory (MettaChain#1019): deploy_contract without a registered code hash fails with CodeHashNotSet; change_admin transfers rights and revokes the old admin; non-admin change rejected; deployment getters reflect recorded deployments. - Sanctions (MettaChain#1020): set_screening_threshold non-admin rejection (value stays 90), admin update to 30 with round-trip via screening_threshold, and SanctionThresholdUpdated event emission asserted. No business logic changed — tests only. All green: prediction-market 20, insurance 109, factory 14, sanctions 13 passed. Closes MettaChain#1017 Closes MettaChain#1018 Closes MettaChain#1019 Closes MettaChain#1020
|
@Hassan-oladipupo 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! 🚀 |
…ce-factory-sanctions
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
Pins four previously untested paths with unit tests: prediction-market resolution (#1017), insurance premium engine (#1018), factory deployment/admin (#1019) and sanctions screening threshold (#1020).
What's covered
RewardClaimedevent), loser gets nothing + reputation penalty, double/non-participant/pre-resolution claim rejectionscalculate_premium/calculate_premium_with_modifierstests with fixed inputs asserting exact values: baseline across all seven multipliers, every modifier branch (multi-policy, claim-free, safety+deductible, loyalty, recent-claims surcharge incl. cap-at-5), 40% total-discount cap, duration proration buckets, rounding truncation,PropertyNotInsurable/pool-not-found errorsdeploy_contractwithout registered hash →CodeHashNotSet;change_admintransfers rights & revokes old admin; non-admin rejection; deployment getters reflect recorded deploymentsset_screening_thresholdnon-admin rejection (value stays 90), admin update + round-trip via getter,SanctionThresholdUpdatedevent assertedNo business logic changed — tests only.
Testing
cargo test -p propchain-prediction-market→ 20 passedcargo test -p propchain-insurance→ 109 passedcargo test -p propchain-factory→ 14 passedcargo test -p propchain-sanctions→ 13 passedCloses #1017
Closes #1018
Closes #1019
Closes #1020