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

Witnesses for native scripts in reference inputs #626

Open
lehins opened this issue Dec 11, 2024 · 1 comment · May be fixed by #631
Open

Witnesses for native scripts in reference inputs #626

lehins opened this issue Dec 11, 2024 · 1 comment · May be fixed by #631
Assignees

Comments

@lehins
Copy link

lehins commented Dec 11, 2024

It looks like there was deviation in the ledger implementation from specification in the Babbage era. Specification required witnesses for native (phase1) scripts present in reference inputs.
image
This was never implemented in this way and we only discovered this recently thanks to the conformance tests.

This is not a very important feature for two reasons:

  1. Native scripts aren't really used that much in reference inputs
  2. There is a CIP-112 that is planned for implementation for the next era, which will provide a proper solution for enforcing arbitrary script execution.

So we need to:

  1. Stop requiring witnesses for reference scripts in the conway formal specification defined in this repo
  2. Fix Babbage specification to reflect the reality.

The last point could benefit from other fixes that probably lead to this discrepancy to begin with:

The predicate passes neededHashes as the argument to txscripts, which would imply that it filters out only the scripts that were used in the transaction:
image

But the implementation of txscripts totally ignores the argument. In fact it doesn't even use the correct type, it should have been a set and it also accepts a Tx as its first argument, while its usage supplies tx witnesses: txw.
image

@WhatisRT
Copy link
Collaborator

WhatisRT commented Dec 17, 2024

On the Agda side, this is pretty easy:

∙  ∀[ s ∈ mapPartial isInj₁ (txscripts tx utxo) ] validP1Script witsKeyHashes txvldt s

needs to be changed to

∙  ∀[ s ∈ mapPartial isInj₁ (txscripts tx utxo) ] (hash s ∈ neededHashes → validP1Script witsKeyHashes txvldt s)

and then whatever type errors appear need to be fixed. Alternatively, if this turns out to be too difficult because of the implication it could also be filtered within the binder.

In the Babbage spec this needs to be handled more carefully. This is a semantic difference that affects script validity, so it shouldn't just be silently adjusted. The Shelley spec has a bunch of errata, and I suggest to do the same here. So the logic should be changed and this situation should be documented in the erratum.

williamdemeo added a commit that referenced this issue Dec 20, 2024
@williamdemeo williamdemeo linked a pull request Dec 20, 2024 that will close this issue
4 tasks
@williamdemeo williamdemeo linked a pull request Dec 20, 2024 that will close this issue
4 tasks
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 a pull request may close this issue.

3 participants