From 79f51d622d1fc0d5061fa1f736954df80be38186 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Thu, 28 Nov 2024 23:37:11 +0100 Subject: [PATCH] fix: looser validation for cost model size --- CHANGELOG.md | 4 ++++ src/utils/cost-models-map.ts | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81fcfa7c..23eb48f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- looser validation for cost model size + ## [2.4.0] - 2024-11-20 ### Added diff --git a/src/utils/cost-models-map.ts b/src/utils/cost-models-map.ts index dc4ca61d..69f224ed 100644 --- a/src/utils/cost-models-map.ts +++ b/src/utils/cost-models-map.ts @@ -665,16 +665,16 @@ export const costModelsMap = (costModels: any) => { costModels = sortKeysInObject(costModels); - if ('PlutusV1' in costModels && Object.keys(costModels.PlutusV1).length !== plutusV1Names.length) + if ('PlutusV1' in costModels && Object.keys(costModels.PlutusV1).length < plutusV1Names.length) throw new Error('The size of the Plutus V1 cost model mismatched'); - if ('PlutusV2' in costModels && Object.keys(costModels.PlutusV2).length !== plutusV2Names.length) + if ('PlutusV2' in costModels && Object.keys(costModels.PlutusV2).length < plutusV2Names.length) throw new Error('The size of the Plutus V2 cost model mismatched'); if ( 'PlutusV3' in costModels && Object.keys(costModels.PlutusV3).length !== plutusV3Names.length && - Object.keys(costModels.PlutusV3).length !== plutusV3NamesChangPlus1.length + Object.keys(costModels.PlutusV3).length < plutusV3NamesChangPlus1.length ) throw new Error('The size of the Plutus V3 cost model mismatched');