Skip to content

[FEAT] - More thorough CDDL and Golden testing #1430

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

Open
jasagredo opened this issue Mar 24, 2025 · 0 comments
Open

[FEAT] - More thorough CDDL and Golden testing #1430

jasagredo opened this issue Mar 24, 2025 · 0 comments

Comments

@jasagredo
Copy link
Contributor

jasagredo commented Mar 24, 2025

Internal

Describe the feature you'd like
With #1422 we have CDDL definitions for all data that consensus emits:

  • Disk
    • snapshot
    • block
  • Node-to-node
    • Header
    • Block
    • Point
    • Tip
    • Tx
    • TxId
    • TicketNo
  • Node-to-client
    • Tx
    • TxId
    • SlotNo
    • Local state queries

We should implement the following tests based on them:

Is Haskell serialization stable?

flowchart LR
    A[Haskell datatype] -->|define| B[Haskell Example]
    B -->|encode| C[CBOR file]
    C --> D{are equal}
    E[Golden file] --> D
    D --> Ok
    D --> Fail
Loading

Do Haskell serializers roundtrip?

flowchart LR
    A[Haskell datatype] -->|generate| B[Haskell value 1]
    B -->|encode| C[CBOR file 1]
    C -->|decode| D[Haskell value 2]
    B --> E{are equal}
    D --> E
    E --> Ok1[Ok]
    E --> Fail1[Fail]
    D -->|encode| F[CBOR file 2]
    F --> G{are equal}
    C --> G
    G --> Ok
    G --> Fail
Loading

Are Haskell serializers and deserializers compliant with CDDL?

flowchart LR
    A[Haskell datatype] -->|generate| B[Haskell value]
    B -->|encode| C[CBOR file]
    C --> D{\`cddl validate\`}
    D --> Ok
    D --> Fail

    M[CDDL definition] --> D
    M -->|\`cddl generate\`| N[CBOR file]
    N --> O{decode}
    O --> Ok2[Ok]
    O --> Fail2[Fail]
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant