Skip to content

Parsing of Value disagrees with its deserialization #7791

Description

@effectfully

PlutusCore.Parser.Builtin.conValue performs Value.fromList which is defined as

fromList :: [(K, [(K, Quantity)])] -> BuiltinResult Value
fromList xs = do
  -- Use unchecked addition during construction
  let outerMap =
        Map.fromListWith
          (Map.unionWith unsafeAddQuantity) -- combine inner maps with unchecked addition
          (second (Map.fromListWith unsafeAddQuantity) <$> xs)
  -- Validate all quantities are within bounds
  pack <$> validateQuantities outerMap

i.e. does unsafeAddQuantity instead of what buildValueWith (the worker of the deserializer) does with Map.fromDistinctDescList and whatnot.

Just use buildValueWith consistently.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions