Verify negative-risk conversions on chain

This commit is contained in:
Theodore Song
2026-08-22 19:55:15 -04:00
parent c15dc12323
commit 6853821dc9
5 changed files with 201 additions and 59 deletions
+16
View File
@@ -81,12 +81,19 @@ assert.match(index, /const NEG_RISK_EVENT_SCAN_LIMIT=1000;/);
assert.match(index, /bundleOpportunityTelemetry:true/);
assert.match(index, /const BUNDLE_DEPTH_CANDIDATE_LIMIT=80;/);
assert.match(index, /const BINARY_COMPLEMENT_DEPTH_RESERVE=20;/);
assert.match(index, /const NEG_RISK_CONVERSION_DEPTH_RESERVE=20;/);
assert.match(index, /bundleRequiresDepthVerification:true/);
assert.match(index, /bundleRequiresClobFeeVerification:true/);
assert.match(index, /function bundleExecutableLeg\(book,units,feeSchedule\)/);
assert.match(index, /function generalAdaptiveLearningExclusion\(trade\)/);
assert.match(index, /specializedUnsafeTradesCannotBiasDirectionalLearning:/);
assert.match(index, /function fetchBundleFeeSchedules\(conditionIds\)/);
assert.match(index, /function fetchNegativeRiskConversionTerms\(marketIds\)/);
assert.match(index, /const NEG_RISK_ADAPTER_ADDRESS="0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296";/);
assert.match(index, /const NEG_RISK_FEE_BIPS_SELECTOR="0x2582cb5e";/);
assert.match(index, /const NEG_RISK_QUESTION_COUNT_SELECTOR="0xb7f75d2c";/);
assert.match(index, /const NEG_RISK_RPC_BATCH_CALL_LIMIT=10;/);
assert.match(index, /function applyNegativeRiskConversionTerms\(candidate,terms\)/);
assert.match(index, /function bundleFeeSchedulesMatch\(expected,reported\)/);
assert.match(index, /rejectsMismatchedClobFeeCurve:/);
assert.doesNotMatch(index, /\/fee-rate\?token_id=/);
@@ -102,14 +109,23 @@ assert.match(index, /rejectsCrossMarketBinaryMerge:/);
assert.match(index, /immediateMergeMetadataSurvivesSync:/);
assert.match(api, /bundle_immediate_merge: s\.bundle_immediate_merge/);
assert.match(index, /function convertCompleteNegativeRiskNoBundle\(p,bundleId\)/);
assert.match(index, /function negativeRiskBundleSuggestions\(event,\{includeUnprofitable=false,conversionTerms=null\}=\{\}\)/);
assert.match(index, /preservesBothCompleteSidesThroughAudit:/);
assert.match(index, /discoversExactCompleteNoConversion:/);
assert.match(index, /deductsAdapterFeeFromConversionPayout:/);
assert.match(index, /atomicallyConvertsCompleteNoSet:/);
assert.match(index, /blocksImmediateConversionOnMismatchedMetadata:/);
assert.match(index, /blocksImmediateConversionOnQuestionCountMismatch:/);
assert.match(index, /blocksImmediateConversionOnMetadataFeeMismatch:/);
assert.match(index, /doesNotInventConversionWithoutAdapterMetadata:/);
assert.match(index, /conversion_structures:conversions\.length/);
assert.match(index, /conversion_candidates_scanned:audited\.filter\(candidate=>candidate\.bundle_conversion_candidate\)\.length/);
assert.match(index, /actionable_conversions:unique\.filter\(candidate=>candidate\.bundle_immediate_convert\)\.length/);
assert.match(index, /Exact complete-NO conversion:/);
assert.match(api, /bundle_immediate_convert: s\.bundle_immediate_convert/);
assert.match(api, /neg_risk_market_id: s\.neg_risk_market_id, neg_risk_fee_bips: s\.neg_risk_fee_bips/);
assert.match(index, /reservesBinaryComplementDepthChecks:/);
assert.match(index, /reservesExactConversionDepthChecks:/);
assert.match(index, /function bundleVerificationShortlist\(candidates\)/);
assert.match(index, /function prioritizeIndependentBundles\(candidates,limit=Infinity\)/);
assert.match(index, /prioritizesIndependentEventsBeforeAlternates:/);