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

Introduce new witness api #763

Merged
merged 12 commits into from
Mar 27, 2025
Merged

Introduce new witness api #763

merged 12 commits into from
Mar 27, 2025

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Feb 25, 2025

Changelog

- description: |
    New witness api
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  - compatible     # the API has changed but is non-breaking
  - refactoring    # QoL changes

Context

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch from 41613bf to ee59574 Compare February 25, 2025 19:35
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 2 times, most recently from 53e997c to 8b9e4cd Compare February 27, 2025 19:22
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 3 times, most recently from 5e14d8f to e00ddf0 Compare February 27, 2025 20:16
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch from e00ddf0 to ad6e828 Compare February 28, 2025 15:54
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 8 times, most recently from b71efce to 3dee118 Compare March 6, 2025 18:37
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 2 times, most recently from 8189957 to b8182e1 Compare March 6, 2025 19:04
@Jimbo4350 Jimbo4350 marked this pull request as ready for review March 6, 2025 19:04
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 2 times, most recently from 7b52a0b to 2bbc191 Compare March 19, 2025 15:36
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch from 2bbc191 to 4227863 Compare March 19, 2025 16:58

instance IsShelleyBasedEra era => Show (Proposal era) where
show (Proposal pp) = do
let ppStr = shelleyBasedEraConstraints (shelleyBasedEra @era) $ show pp
"Proposal {unProposal = " <> ppStr <> "}"
"Proposal " <> ppStr <> "}"
Copy link
Contributor

Choose a reason for hiding this comment

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

lone closing bracket

Suggested change
"Proposal " <> ppStr <> "}"
"(Proposal " <> ppStr <> ")"

Comment on lines 87 to 88
data AnyVoter where
AnyVoter :: Typeable era => Voter era -> AnyVoter
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to delete this.

Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

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

Blocking on WitMint: you can have multiple assets w/ quantities per policy ID.
We can delete AnyVoter too I think.

@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 2 times, most recently from 549cbfe to 50e941e Compare March 26, 2025 17:29
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch 2 times, most recently from 56d34b6 to 5118ac3 Compare March 27, 2025 14:28
This is intended to replace the type `Witness witctx era` but if you
look closely they are similar.

The main difference is we do away with `witctx` type parameter because this only really pertains
to plutus script witnesses. The witness context is now relfected in the purpose type
parameter of the `PlutusScriptWitness` type of the `AnyPlutusScriptWitness`
constructor.
…pt lang` which

wrapped a `ShortByteString` which essentially means if our script it
malformed we will be informed of this upon deserialization in the ledger i.e at
transaction submission or when using transaction build.

`PlutusScriptInEra lan era` wraps cardano-ledger's `PlutusRunnable
lang`. This allows us to fail early as the deserialization to `PlutusRunnable`
will error for malformed scripts.

NB: Before the introduction of the new api we did implement a
`PlutusScriptInEra era lang` in the old api but this simply wrapped
`PlutusScript lang` and utilized the serialization instances of
`PlutusRunnable lang`.
`PlutusScriptWitness lang era` is almost identical to the old api's
notion of plutus script witnesses except:
- It's treated as a separate type to simple script witnesses vs as a constructor of a sum type
- A type family is used to represent the presense of a script datum
  depending on the plutus script language and purpose

The `PlutusScriptDatumF` type family has been introduced to capture what
script type can have a datum and if that datum can be optional.
a key or script witness

Intoduce IndexedPlutusScriptWitness to capture the concept of something
witnessable that is being witnessed by a plutus script.

These types allow us to uniformly treat anything witnessable that is being
witnessed by a plutus script
Introduce collectTxBodyScriptWitnessRequirements
@Jimbo4350 Jimbo4350 force-pushed the jordan/new-scripts-api branch from 5118ac3 to c86846f Compare March 27, 2025 14:34
@Jimbo4350 Jimbo4350 added this pull request to the merge queue Mar 27, 2025
Merged via the queue into master with commit 7269f13 Mar 27, 2025
29 checks passed
@Jimbo4350 Jimbo4350 deleted the jordan/new-scripts-api branch March 27, 2025 19:13
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.

2 participants