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

Add Conformance.Imp: imptests with conformance #4748

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

aniketd
Copy link
Contributor

@aniketd aniketd commented Nov 12, 2024

Description

With a new iteExpectLedgerRuleConformance field added to ImpTestEnv,
we get an overridable function that can be executed within trySubmitTx
for every submitted transaction. To override this hook we have
modifyImpInitExpectLedgerRuleConformance the function. We add a new
Conformance.Imp module to cardano-ledger-conformance package, to
import Conway.Imp and run those tests with a modified "hook" that
runs the LEDGER rule from Agda on the Tx and checkConformance on
the results.

Additions:

  • iteExpectLedgerRuleConformance field to ImpTestEnv.
  • modifyImpInitExpectLedgerRuleConformance function to override the
    hook.
  • Add lenses for all fields of LedgerEnv.

Changes:

  • Change trySubmitTx to run the iteExpectLedgerRuleConformance for
    every submitted Tx.

The Problem

We get a failure from the Agda side, telling us that the witsVKeyNeeded utxo txb is not a subset of witsKeyHashes as it should be. We have isolated the issue to be with the translation of spendableInputs, since it is most likely that those aren't being handled in a manner that fits into the problem we are trying to solve with this conformance.

This PR can be merged as it is, since @Soupstraw and I want to work in parallel on related issues.

Closes #4725

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages.
    New section is never added with the code changes. (See RELEASING.md)
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated.
    If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@aniketd aniketd force-pushed the aniketd/tx-imptest-conformance branch from 64aa141 to a2c1460 Compare November 12, 2024 13:48
@aniketd aniketd changed the title Make ConwayImp run with conformance checks Add Conformance.Imp: imptests with conformance Nov 12, 2024
@aniketd aniketd force-pushed the aniketd/tx-imptest-conformance branch 3 times, most recently from 6f49a26 to f51847a Compare November 13, 2024 13:14
@lehins
Copy link
Collaborator

lehins commented Nov 14, 2024

@aniketd #4745 was merged yesterday. You can rebase this one on master and finish it up

@aniketd aniketd force-pushed the aniketd/tx-imptest-conformance branch 5 times, most recently from d72129e to d7c9778 Compare November 19, 2024 11:42
@aniketd aniketd marked this pull request as ready for review November 19, 2024 11:42
@aniketd aniketd requested a review from a team as a code owner November 19, 2024 11:42
@aniketd aniketd requested review from lehins and Soupstraw November 19, 2024 11:42
Copy link
Contributor

@Soupstraw Soupstraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but a few minor changes are still needed before we can merge it

libs/ImpSpec/src/Test/ImpSpec/Internal.hs Outdated Show resolved Hide resolved
libs/ImpSpec/ImpSpec.cabal Outdated Show resolved Hide resolved
@aniketd aniketd force-pushed the aniketd/tx-imptest-conformance branch 2 times, most recently from c8d3e8b to 5065734 Compare November 20, 2024 12:47
With a new `iteExpectLedgerRuleConformance` field added to `ImpTestEnv`,
we get an overridable function that can be executed within `trySubmitTx`
for every submitted transaction. To override this hook we have
`modifyImpInitExpectLedgerRuleConformance` the function. We add a new
`Conformance.Imp` module to `cardano-ledger-conformance` package, to
import `Conway.Imp` and run those tests with a modified "hook" that
runs the `LEDGER` rule from Agda on the Tx and `checkConformance` on
the results.

Additions:
- `iteExpectLedgerRuleConformance` field to `ImpTestEnv`.
- `modifyImpInitExpectLedgerRuleConformance` function to override the
hook.
- Add lenses for all fields of `LedgerEnv`.

Changes:
- Change `trySubmitTx` to run the `iteExpectLedgerRuleConformance` for
every submitted Tx.
@aniketd aniketd force-pushed the aniketd/tx-imptest-conformance branch from 5065734 to ec616f1 Compare November 21, 2024 12:56
@aniketd aniketd requested a review from lehins November 21, 2024 12:57
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. I've made couple suggestions, but neither one is a blocking suggestion, so in order not to block the follow up work I am gonna resolve them and merge the PR.

@lehins lehins enabled auto-merge November 21, 2024 21:02
@lehins lehins merged commit 361e70c into master Nov 21, 2024
154 checks passed
@lehins lehins deleted the aniketd/tx-imptest-conformance branch November 21, 2024 21:02
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

Successfully merging this pull request may close these issues.

trySubmitTx_ from ImpTest should also optionally run conformance
4 participants