Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrate that JSON roundtrip property is not always satisfied for TxMetadataWithSchema. #4646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonathanknowles
Copy link
Member

@jonathanknowles jonathanknowles commented Jun 26, 2024

Related Issue

Description

This PR demonstrates that the JSON roundtrip property does not always hold for values of the TxMetadataWithSchema type, and provides a single counterexample:

TxMetadataWithSchema TxMetadataNoSchema $
Cardano.TxMetadata $
Map.fromList
  [ ( 1
    , Cardano.TxMetaMap
      [ (Cardano.TxMetaText "k", Cardano.TxMetaText "v1")
      , (Cardano.TxMetaText "k", Cardano.TxMetaText "v2")
      ]
    )
  ]

With the following command:

cabal test cardano-wallet-unit --test-options '--match "Broken round trip for TxMetadataWithSchema"'

We see the following failure (link to failure on Buildkite):

Cardano.Wallet.Api.Types
  Broken round trip for TxMetadataWithSchema [x]

Failures:

  test/unit/Cardano/Wallet/Api/TypesSpec.hs:905:47:
  1) Cardano.Wallet.Api.Types Broken round trip for TxMetadataWithSchema
       expected: Just (TxMetadataWithSchema {txMetadataWithSchema_schema = TxMetadataNoSchema, txMetadataWithSchema_metadata = TxMetadata (fromList [(1,TxMetaMap [(TxMetaText "k",TxMetaText "v1"),(TxMetaText "k",TxMetaText "v2")])])})
        but got: Just (TxMetadataWithSchema {txMetadataWithSchema_schema = TxMetadataNoSchema, txMetadataWithSchema_metadata = TxMetadata (fromList [(1,TxMetaMap [(TxMetaText "k",TxMetaText "v2")])])})

  To rerun use: --match "/Cardano.Wallet.Api.Types/Broken round trip for TxMetadataWithSchema/" --seed 321733787

Randomized with seed 321733787

@jonathanknowles jonathanknowles changed the title Show that the JSON roundtrip property does not always hold for TxMetadataWithSchema. JSON roundtrip property not satisfied for TxMetadataWithSchema. Jun 26, 2024
@jonathanknowles jonathanknowles changed the title JSON roundtrip property not satisfied for TxMetadataWithSchema. Demonstrate that JSON roundtrip property is not always satisfied for TxMetadataWithSchema. Jun 26, 2024
@jonathanknowles jonathanknowles self-assigned this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant