-
Notifications
You must be signed in to change notification settings - Fork 217
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
Extend hard-coded test blockchain to test collateral inputs and outputs. #3346
Conversation
Great level of explanation 👍 My only comment is that there seems to be a lot of places where we need to update this logic of |
I do agree. I'm planning to make a subsequent PR that removes the duplication, at least within the test suite. |
bors r+ |
3346: Extend hard-coded test blockchain to test collateral inputs and outputs. r=jonathanknowles a=jonathanknowles ## Issue Number ADP-1814 ## Summary This PR extends the hard-coded test blockchain in `ModelSpec` (an excerpt of the mainnet blockchain). It appends a pair of transactions to the end: (and ensures that all tests pass) - Transaction `t0`: - marked as **_failing_** script validation - specifies a single collateral input `cinp_0` - specifies a single collateral output `cout_0` - Transaction `t1`: - marked as **_passing_** script validation - specifies a single ordinary input that refers to `cout_0` of `t0` ## Details The first commit in this PR is marked with `[FAIL]`, as it causes a test failure in "_applyBlock matches the basic model from the specification_". The cause of this failure is that the following **_test_** functions were not updated to account for script validation: - `ModelSpec.updateUTxO` - `ModelSpec.txOutsOurs` Subsequent commits adjust these functions to correctly account for script validation. The first commit to result in a passing test suite is marked with `[PASS]`. Co-authored-by: Jonathan Knowles <[email protected]>
bors cancel |
Canceled. |
@sevanspowell I've added some commits that reduce the duplication within |
bors r+ |
3346: Extend hard-coded test blockchain to test collateral inputs and outputs. r=jonathanknowles a=jonathanknowles ## Issue Number ADP-1814 ## Summary This PR extends the hard-coded test blockchain in `ModelSpec` (an excerpt of the mainnet blockchain). It appends a pair of transactions to the end: (and ensures that all tests pass) - Transaction `t0`: - marked as **_failing_** script validation - specifies a single collateral input `cinp_0` - specifies a single collateral output `cout_0` - Transaction `t1`: - marked as **_passing_** script validation - specifies a single ordinary input that refers to `cout_0` of `t0` ## Details The first commit in this PR is marked with `[FAIL]`, as it causes a test failure in "_applyBlock matches the basic model from the specification_". The cause of this failure is that the following **_test_** functions were not updated to account for script validation: - `ModelSpec.updateUTxO` - `ModelSpec.txOutsOurs` Subsequent commits adjust these functions to correctly account for script validation. The first commit to result in a passing test suite is marked with `[PASS]`. Co-authored-by: Jonathan Knowles <[email protected]>
Build failed: Failure log:
|
…ation. This commit extends the 'ModelSpec' test blockchain (an excerpt of the real mainnet blockchain) with a transaction that is marked as having an invalid script. When processing this transaction, the wallet software should: - spend inputs within the 'collateralInputs' field (i.e., remove entries for "owned" inputs from the wallet's UTxO set) - create outputs within the 'collateralOutput' field (i.e., insert entries for "owned" outputs into the wallet's UTxO set) This commit causes the following test failure: ``` Cardano.Wallet.Primitive.Model Compare Wallet impl. with Specification applyBlock matches the basic model from the specification [x] Failures: test/unit/Cardano/Wallet/Primitive/ModelSpec.hs:221:9: 1) Cardano.Wallet.Primitive.Model, Compare Wallet impl. with Specification, applyBlock matches the basic model from the specification Falsified (after 3 tests and 1 shrink): WalletState { _ourAddresses = fromList [82d81858...aebb3709] , _discoveredAddresses = fromList [] } - input: 1st 39633666 output: address: 82d81858...aebb3709 coin: 3823755.953610 tokens: [] - input: 2nd 74782d63 output: address: 82d81858...aebb3709 coin: 19999.799999 tokens: [] /= [] ```
Previously, the collateral inputs were omitted. This commit does not yet fix the test failure within `ModelSpec`.
We fix the testing function `updateUTxO` to spend the correct set of inputs, based on whether or not the transaction is marked as having failed script validation. On its own, this commit is not enough to fix `ModelSpec` tests that use the test blockchain.
We fix the testing function `txOutsOurs` to create the correct set of outputs, based on whether or not the transaction is marked as having failed script validation. This commit fixes `ModelSpec` tests that use the test blockchain.
This transaction is expected to spend a collateral ouput that was created by a previous transaction, where the previous transaction was marked as having failed script validation.
231177b
to
991063f
Compare
bors r+ |
3346: Extend hard-coded test blockchain to test collateral inputs and outputs. r=jonathanknowles a=jonathanknowles ## Issue Number ADP-1814 ## Summary This PR extends the hard-coded test blockchain in `ModelSpec` (an excerpt of the mainnet blockchain). It appends a pair of transactions to the end: (and ensures that all tests pass) - Transaction `t0`: - marked as **_failing_** script validation - specifies a single collateral input `cinp_0` - specifies a single collateral output `cout_0` - Transaction `t1`: - marked as **_passing_** script validation - specifies a single ordinary input that refers to `cout_0` of `t0` ## Details The first commit in this PR is marked with `[FAIL]`, as it causes a test failure in "_applyBlock matches the basic model from the specification_". The cause of this failure is that the following **_test_** functions were not updated to account for script validation: - `ModelSpec.updateUTxO` - `ModelSpec.txOutsOurs` Subsequent commits adjust these functions to correctly account for script validation. The first commit to result in a passing test suite is marked with `[PASS]`. Co-authored-by: Jonathan Knowles <[email protected]>
Build failed: Lots of cached failures with the same error as #3346 (comment). I'm fairly sure that this PR isn't the cause, because
|
bors r+ |
Build succeeded: |
Issue Number
ADP-1814
Summary
This PR extends the hard-coded test blockchain in
ModelSpec
(an excerpt of the mainnet blockchain).It appends a pair of transactions to the end: (and ensures that all tests pass)
Transaction
t0
:cinp_0
cout_0
Transaction
t1
:cout_0
oft0
Details
The first commit in this PR is marked with
[FAIL]
, as it causes a test failure in "applyBlock matches the basic model from the specification".The cause of this failure is that the following test functions were not updated to account for script validation:
ModelSpec.updateUTxO
ModelSpec.txOutsOurs
Subsequent commits adjust these functions to correctly account for script validation. The first commit to result in a passing test suite is marked with
[PASS]
.