-
Notifications
You must be signed in to change notification settings - Fork 84
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
AbortTx inlcuding some plutus validation #90
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Obviously fails on |
abailly-iohk
force-pushed
the
ch1bo/aborttx-plutus-validation
branch
2 times, most recently
from
September 23, 2021 15:58
1697621
to
2c0f2dd
Compare
ch1bo
force-pushed
the
master
branch
4 times, most recently
from
September 24, 2021 21:19
942d809
to
a37319c
Compare
This is not covering creation of the 'TxInfo' / 'ScriptContext' so will never work for non-trivial validators
Of course the init tx would not validate using the Initial validator, rather commit or abort txs should be checked against that
The abortTx would try to spend an input which is governed by the initial validator.
Seems that the Plutus ValidatorHash contains a different hash than produced by `hashScript` of the ledger. Or the serialization of `initialScript` is wrong. Work around to see if it runs.
This avoids use of 'ValidatorHash' et al and uses only 'Script' to serialize it into a ledger 'Script era' and take it from there.
To build correct transactions for the on-chain protocol we need to construct or provide datumhashes with the correct datums, but these datums are only available from previous transactions' data so we must keep state while observing the chain.
This commit only adds the needed machinery but tests aren't passing and state is not really used yet.
This is needed in order to provide a seed TxIn to the Init transaction and of course to be able to sign transactions later on.
Because it does not have any combination we always observe it which does not make sense right now.
TODO: Add JSON instances for the log messages
Unit test for AbortTx is currently failing because the script raises an error which is not easily traced. Need to see if I can get more info by executing the script directly in Plutus.
Constructing the state machine requires a token which is more complicated to build.
The redeemers are indexed to the input they apply to, assuming the inputs are sorted by (TxId, TxIx), so we cannot naively use a counter to build those. The rdptr function retrieves the correct index for the pointer.
For some unknown reason this makes unit test pass even though the validator actually does nothing but returns True
There is a bug in the way we observe transaction hence it's possible to observe both an inittx and an abortx given the same ValidatedTx.
This is not satisfactory but is a stop-gap solution while we take some time to think again about what are the right criteria to distinguish all transaction types from each other.
Still one test of aborttx failing due to failing validator
Following upgrade, castPoint does not work anymore so I ended up manually unwrapping the hash representations to get what I needed.
The Plutus documentation is actually wrong, serialising scripts and datums for consumption by cardano-cli requires specific conversion functions and not only the generic `serialiseToTextEnvelope` one
After upgrading to more recent Plutus version, validatorHash is in sync with hashScript from the ledger API so we can use it directly to compute dependencies.
abailly-iohk
force-pushed
the
ch1bo/aborttx-plutus-validation
branch
from
October 13, 2021 05:28
6971aff
to
7ff91c0
Compare
Upgrade to GHC 8.10.7 and newer haskell.nix Some tests are still failing
* Replace the use of externally supplied cardano-node and cardano-cli executables by build-tool-depends dependencies, like other integration tests. * Adapt configuration for Alonzo
Unit Test Results 4 files ±0 62 suites ±0 4m 15s ⏱️ +18s Results for commit df918e1. ± Comparison against base commit 242b266. This pull request removes 5 and adds 5 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.