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

Fix datum in tx and ref scripts #3882

Merged
merged 4 commits into from
May 24, 2022

Conversation

ch1bo
Copy link
Contributor

@ch1bo ch1bo commented May 22, 2022

(Couldn't reopen #3881, so created this one)

❄️ Add a roundtrip property TxBodyContent -> TxBody -> TxBodyContent

This helped in fixing the 🐛 and uncover the two additional gaps in the code. I'm not 100% happy with the current implementation of the property though! I needed to accept two exceptions to the general ===:

  1. SimpleScriptV1 reference scripts may become SimpleScriptV2
  2. A TxOutDatumHash + a matching ScriptData may become a TxOutDatumTx

❄️ Resolve datum hash + matching datum in transaction to TxOutDatumInTx, fixes #3866

❄️ Add missing script languages to scriptLanguageSupportedInEra for BabbageEra

❄️ Allow scripts in any language as refeference scripts

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

Thanks a lot @ch1bo. Just one comment.

upgradeSimpleScripts sbe content@TxBodyContent{txOuts} =
content{txOuts = map (upgradeSimpleRefScript sbe) txOuts }

upgradeSimpleRefScript sbe (TxOut address value datum refScript) =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a type signature here?

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'm sorry, but I changed the implementation to something else after opening the PR on friday. You seem to have reviewed the first implementation. The current one is less hacky.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ch1bo ch1bo force-pushed the ch1bo/fix-datum-in-tx-and-ref-scripts branch from 5ea5dea to e4b8305 Compare May 23, 2022 17:02
ch1bo added 4 commits May 23, 2022 19:03
The property accepts two exceptions:

- SimpleScriptV1 reference scripts may become SimpleScriptV2
- TxOutDatumHash may become TxOutDatumInTx
…xOuts

This behavior was the only way to resolve full datums from Alonzo
TxOuts. In Babbage, there are also inline datums, which were incorrectly
"observed" when a transaction had outputs with datum hashes and full
datums attached. These cases yield now a 'TxOutDatumInTx'.

Fixes #3866
@ch1bo ch1bo force-pushed the ch1bo/fix-datum-in-tx-and-ref-scripts branch from e4b8305 to cf150b4 Compare May 23, 2022 17:03
@ch1bo
Copy link
Contributor Author

ch1bo commented May 23, 2022

@Jimbo4350 squashed commits correctly and added type signatures to all functions in where clauses. Might want to have another look if this is good to go.

@Jimbo4350
Copy link
Contributor

bors merge

iohk-bors bot added a commit that referenced this pull request May 23, 2022
3852: cardano-tracer: init RTView r=denisshevchenko a=denisshevchenko

This is pre-MVP for RTView.

3882: Fix datum in tx and ref scripts r=Jimbo4350 a=ch1bo

(Couldn't reopen #3881, so created this one)

:snowflake: Add a roundtrip property `TxBodyContent -> TxBody -> TxBodyContent`

This helped in fixing the :bug: and uncover the two additional gaps in the code. I'm not 100% happy with the current implementation of the property though! I needed to accept two exceptions to the general `===`:

  1. `SimpleScriptV1` reference scripts may become `SimpleScriptV2`
  2. A `TxOutDatumHash` + a matching `ScriptData` may become a `TxOutDatumTx`

:snowflake: Resolve datum hash + matching datum in transaction to `TxOutDatumInTx`, fixes #3866 

❄️ Add missing script languages to `scriptLanguageSupportedInEra` for `BabbageEra`

❄️ Allow scripts in any language as refeference scripts

Co-authored-by: Denis Shevchenko <denis.shevchenko@iohk.io>
Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
Co-authored-by: Sebastian Nagel <sebastian.nagel@ncoding.at>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 23, 2022

This PR was included in a batch that successfully built, but then failed to merge into master. It will not be retried.

Additional information:

{"message":"Waiting on code owner review from DavidEichmann, JaredCorduan, Jimbo4350, dcoutts, erikd, nc6, and/or newhoggy.","documentation_url":"https://docs.github.com/articles/about-protected-branches"}

@Jimbo4350
Copy link
Contributor

bors r+

iohk-bors bot added a commit that referenced this pull request May 23, 2022
3852: cardano-tracer: init RTView r=deepfire a=denisshevchenko

This is pre-MVP for RTView.

3880: Old peers tracing was erroneously called in new tracing r=deepfire a=jutaro

/nix/store/qaplqccmisqy8n7ai65nssafzkxyyc7p-cabal-install-exe-cabal-3.6.2.0/bin/cabal --project-file=/home/deepfire/cardano-node/.nix-shell-cabal.project run exe:cardano-node -- +RTS -sghc-rts-report.txt -RTS run --config config.json --database-path run/current/node-0/db-testnet --topology topology.json --host-addr 127.0.0.1 --port 30000 --socket-path node.socket +RTS -N2 -I0 -A16m -qg -qb --disable-delayed-os-memory-return -RTS
cardano-node: ExceptionInLinkedThread (ThreadId 11) The name ""peersFromNodeKernel"" is already taken by a metric.
CallStack (from HasCallStack):
  error, called at ./System/Metrics.hs:214:5 in ekg-core-0.1.1.7-FjoslY1tzknIAl90c73kOZ:System.Metrics

3882: Fix datum in tx and ref scripts r=Jimbo4350 a=ch1bo

(Couldn't reopen #3881, so created this one)

:snowflake: Add a roundtrip property `TxBodyContent -> TxBody -> TxBodyContent`

This helped in fixing the :bug: and uncover the two additional gaps in the code. I'm not 100% happy with the current implementation of the property though! I needed to accept two exceptions to the general `===`:

  1. `SimpleScriptV1` reference scripts may become `SimpleScriptV2`
  2. A `TxOutDatumHash` + a matching `ScriptData` may become a `TxOutDatumTx`

:snowflake: Resolve datum hash + matching datum in transaction to `TxOutDatumInTx`, fixes #3866 

❄️ Add missing script languages to `scriptLanguageSupportedInEra` for `BabbageEra`

❄️ Allow scripts in any language as refeference scripts

Co-authored-by: Denis Shevchenko <denis.shevchenko@iohk.io>
Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
Co-authored-by: Yupanqui <jnf@arcor.de>
Co-authored-by: Sebastian Nagel <sebastian.nagel@ncoding.at>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 24, 2022

This PR was included in a batch that successfully built, but then failed to merge into master. It will not be retried.

Additional information:

{"message":"Waiting on code owner review from DavidEichmann, JaredCorduan, Jimbo4350, dcoutts, erikd, nc6, and/or newhoggy.","documentation_url":"https://docs.github.com/articles/about-protected-branches"}

Copy link
Contributor

@nc6 nc6 left a comment

Choose a reason for hiding this comment

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

LGTM

@nc6
Copy link
Contributor

nc6 commented May 24, 2022

bors merge

iohk-bors bot added a commit that referenced this pull request May 24, 2022
3882: Fix datum in tx and ref scripts r=nc6 a=ch1bo

(Couldn't reopen #3881, so created this one)

:snowflake: Add a roundtrip property `TxBodyContent -> TxBody -> TxBodyContent`

This helped in fixing the :bug: and uncover the two additional gaps in the code. I'm not 100% happy with the current implementation of the property though! I needed to accept two exceptions to the general `===`:

  1. `SimpleScriptV1` reference scripts may become `SimpleScriptV2`
  2. A `TxOutDatumHash` + a matching `ScriptData` may become a `TxOutDatumTx`

:snowflake: Resolve datum hash + matching datum in transaction to `TxOutDatumInTx`, fixes #3866 

❄️ Add missing script languages to `scriptLanguageSupportedInEra` for `BabbageEra`

❄️ Allow scripts in any language as refeference scripts

Co-authored-by: Sebastian Nagel <sebastian.nagel@ncoding.at>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 24, 2022

Timed out.

@Jimbo4350 Jimbo4350 merged commit ec84a30 into master May 24, 2022
@iohk-bors iohk-bors bot deleted the ch1bo/fix-datum-in-tx-and-ref-scripts branch May 24, 2022 14: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.

Bug in resolving TxOutDatumInTx in BabbageEra
3 participants