-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add collateral return outputs to the API and DB #3251
Conversation
7ec8948
to
6e870c3
Compare
6e870c3
to
2bf1a58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with the caveat that someone with more experience takes a look at the database changes. It looks sensible to me but just to be sure.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
fa9d678
to
4d5664f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bdb04fe
to
b2a5ec6
Compare
b2a5ec6
to
3a95baa
Compare
- no trailing whitespace at the end of lines. - use 4-space indents. - avoid variable-length indentation. - limit line lengths to 80 characters where practical. - use only a single blank line between top-level definitions. https://input-output-hk.github.io/adrestia/code/Coding-Standards
Instead of using `Proxy`, we can just use type applications. We also sort the list into alphabetical order to make it easier to spot if an existing item is already there. It would be nice if we could generate this list automatically.
To keep the size of the golden file small, we pick a type for `t` with a simple serialization that is unlikely to change.
In the API specification we use an array type for `collateral_outputs`, for consistency with the encoding of ordinary transaction outputs, and enabling forward compatibility if in future more than one collateral output is allowed in a transaction. But we clearly mark the fact that there can only be zero or one collateral output. Attempting to parse an `ApiTransaction` with more than one collateral output will fail with an error. For the moment, we populate this field with `Nothing`.
In this commit, we simply add the field, and fix up all places that the compiler requires us to fix. In many cases, we can simply assign `Nothing` to the field. In places where we need to assign something other than `Nothing`, we add a `TODO`.
Important: This commit breaks the DB tests, because it provides no way to write or read collateral outputs to or from the DB. A further commit will provide proper DB persistence for collateral outputs. Instead, in this commit, we simply add the field, and fix up all places that the compiler requires us to fix. In places where we are providing mock data for tests of transactions belonging to previous eras, we can simply assign `Nothing` to the field. In places where we will eventually need to assign something other than `Nothing`, we add a `TODO`, with a link to an appropriate ticket number.
This commit ensures that all DB tests pass.
3a95baa
to
d79ab96
Compare
bors r+ |
3251: Add collateral return outputs to the API and DB r=jonathanknowles a=jonathanknowles ## Tasks Implemented ADP-1715 (_Update API to support collateral return outputs_) ADP-1716 (_Update DB schema to support collateral return outputs_) ADP-1717 (_Update primitive types to support collateral return outputs_) ## Summary This PR tackles the "edges" of support for collateral return outputs: - adjusting API types; - adjusting primitive types; - adjusting the DB schema; - adjusting the DB persistence layer. The approach used for every commit (except where indicated) in this PR is to: - first make an adjustment; - then make the minimal possible number of changes to: - get the code to compile; - get the tests to pass. This PR does **_not_** update our UTxO transition function to account for collateral outputs. Therefore, when reading blocks with transactions containing collateral outputs that affect a wallet, these outputs will currently be ignored. Updating the UTxO transition function will be handled by ADP-1718. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Build failed: This was caused by this PR. One of the commits accidentally swapped two positional arguments that share the same type. I've now replaced the positional pattern match with a record-syntax-based pattern match, to avoid this problem. |
We now have two fields relating to collateral within a `Tx`. To disambiguate them, we now use the following naming scheme everywhere (where practical): - inputs - outputs - collateral inputs - collateral outputs We also change some construction/pattern match sites that use positional arguments to instead use record syntax. This lowers the risk that fields with identical types are accidentally juxtaposed.
fbb95b3
to
f7b1137
Compare
bors r+ |
3251: Add collateral return outputs to the API and DB r=jonathanknowles a=jonathanknowles ## Tasks Implemented ADP-1715 (_Update API to support collateral return outputs_) ADP-1716 (_Update DB schema to support collateral return outputs_) ADP-1717 (_Update primitive types to support collateral return outputs_) ## Summary This PR tackles the "edges" of support for collateral return outputs: - adjusting API types; - adjusting primitive types; - adjusting the DB schema; - adjusting the DB persistence layer. The approach used for every commit (except where indicated) in this PR is to: - first make an adjustment; - then make the minimal possible number of changes to: - get the code to compile; - get the tests to pass. This PR does **_not_** update our UTxO transition function to account for collateral outputs. Therefore, when reading blocks with transactions containing collateral outputs that affect a wallet, these outputs will currently be ignored. Updating the UTxO transition function will be handled by ADP-1718. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Build failed: Yet another instance of:
|
bors r+ |
3251: Add collateral return outputs to the API and DB r=jonathanknowles a=jonathanknowles ## Tasks Implemented ADP-1715 (_Update API to support collateral return outputs_) ADP-1716 (_Update DB schema to support collateral return outputs_) ADP-1717 (_Update primitive types to support collateral return outputs_) ## Summary This PR tackles the "edges" of support for collateral return outputs: - adjusting API types; - adjusting primitive types; - adjusting the DB schema; - adjusting the DB persistence layer. The approach used for every commit (except where indicated) in this PR is to: - first make an adjustment; - then make the minimal possible number of changes to: - get the code to compile; - get the tests to pass. This PR does **_not_** update our UTxO transition function to account for collateral outputs. Therefore, when reading blocks with transactions containing collateral outputs that affect a wallet, these outputs will currently be ignored. Updating the UTxO transition function will be handled by ADP-1718. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Timed out. This build seems to have completely succeeded: https://hydra.iohk.io/build/14079546#tabs-summary But it still timed out. 😕 |
bors r+ |
3251: Add collateral return outputs to the API and DB r=jonathanknowles a=jonathanknowles ## Tasks Implemented ADP-1715 (_Update API to support collateral return outputs_) ADP-1716 (_Update DB schema to support collateral return outputs_) ADP-1717 (_Update primitive types to support collateral return outputs_) ## Summary This PR tackles the "edges" of support for collateral return outputs: - adjusting API types; - adjusting primitive types; - adjusting the DB schema; - adjusting the DB persistence layer. The approach used for every commit (except where indicated) in this PR is to: - first make an adjustment; - then make the minimal possible number of changes to: - get the code to compile; - get the tests to pass. This PR does **_not_** update our UTxO transition function to account for collateral outputs. Therefore, when reading blocks with transactions containing collateral outputs that affect a wallet, these outputs will currently be ignored. Updating the UTxO transition function will be handled by ADP-1718. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Build failed: Failure:
|
bors r+ |
Build succeeded: |
Tasks Implemented
ADP-1715 (Update API to support collateral return outputs)
ADP-1716 (Update DB schema to support collateral return outputs)
ADP-1717 (Update primitive types to support collateral return outputs)
Summary
This PR tackles the "edges" of support for collateral return outputs:
The approach used for every commit (except where indicated) in this PR is to:
This PR does not update our UTxO transition function to account for collateral outputs. Therefore, when reading blocks with transactions containing collateral outputs that affect a wallet, these outputs will currently be ignored. Updating the UTxO transition function will be handled by ADP-1718.