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

Get TxMetadata from blocks on chain #2079

Merged
merged 2 commits into from
Sep 1, 2020
Merged

Get TxMetadata from blocks on chain #2079

merged 2 commits into from
Sep 1, 2020

Conversation

rvl
Copy link
Contributor

@rvl rvl commented Aug 26, 2020

Issue Number

ADP-307 / #2077

Overview

  • Initial types, etc.

Comments

  • I don't have any serialized block data to make golden tests. But the testing can be done with integration tests.

@rvl rvl added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Aug 26, 2020
@rvl rvl added this to the (ADP-307) Transaction metadata milestone Aug 26, 2020
@rvl rvl self-assigned this Aug 26, 2020
, metadata
:: !(Maybe TxMetadata)
-- ^ Semi-structured application-specific extension data stored in the
-- transaction on chain.
Copy link
Member

Choose a reason for hiding this comment

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

👍


-- Compare metadatas by json encoding
instance Ord TxMetadata where
compare = comparing (Aeson.encode . unTxMetadata)
Copy link
Member

Choose a reason for hiding this comment

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

What's the rationale here ? Why not rely on the existing Ord instance for Value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Value has no Ord ... nor does Cardano.Api.TxMetadata.
I define it by string encoding so that other types can keep their Ord constraint.

@rvl rvl force-pushed the rvl/2077/tx-metadata branch from 59d4386 to 95aac1f Compare August 27, 2020 06:21
@@ -555,6 +558,9 @@ data ApiTransaction (n :: NetworkDiscriminant) = ApiTransaction
, outputs :: ![AddressAmount (ApiT Address, Proxy n)]
, withdrawals :: ![ApiWithdrawal n]
, status :: !(ApiT TxStatus)
-- fixme: #2073 not sure whether empty metadata should be null or missing
-- key.
, metadata :: !(Maybe (ApiT TxMetadata))
Copy link
Member

Choose a reason for hiding this comment

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

My own preference is to have a null value so that it is more explicit client side but I admit not being 100% sure about how the default aeson generic options treat this in our API at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is also my preference actually. But when submitting a transaction, it is more convenient for users if they can omit the key. Our default generic options are to omit Nothing fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will sort it out in #2089.

@@ -60,7 +60,7 @@ packages:
- Win32-2.6.2.0

- git: https://github.com/input-output-hk/cardano-base
commit: df8687488449f71dce3d881800c21e41fe1b7fc1
commit: 3e2d92b25c675fd923a07237eb1d0859b29a79d3
Copy link
Member

Choose a reason for hiding this comment

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

Damn. This completely breaks the linker when building with stack for me. I am trying on a completely clean stack root now because It reminds me of a past issue with stack not correctly figuring out links between same packages of different snapshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think the YAML filename needs to be different so that stack knows that something's changed. But I couldn't think of a good name for a version somewhere between 1.19.0 and 1.20.0.

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 needed to bump this library so that the shelley-spec-ledger-test package would build. This was just to get access to the TxMetadata test generators. But that has caused more problems with multiple Arbitrary instances of other types. It's just not worth it. I will copy&paste the Arbitrary instance.

@rvl rvl force-pushed the rvl/2077/tx-metadata branch 2 times, most recently from dcd6bfe to 9660fd1 Compare August 28, 2020 10:17
@rvl rvl marked this pull request as ready for review August 28, 2020 10:18
-- transaction on chain.
--
-- This is not to be confused with 'TxMeta', which is information about
-- a transaction derived from the ledger.
Copy link
Member

Choose a reason for hiding this comment

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

yeah, we might want to rename TxMeta at some point indeed.

, " - \"v1\""
, " - key: 0"
, " - val: \"value\""
]
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

OK

@KtorZ KtorZ force-pushed the rvl/2077/tx-metadata branch from 9660fd1 to c003df8 Compare August 31, 2020 07:58
@rvl
Copy link
Contributor Author

rvl commented Aug 31, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Aug 31, 2020
2079: Get TxMetadata from blocks on chain r=rvl a=rvl

### Issue Number

ADP-307 / #2077

### Overview

- Initial types, etc.

### Comments

- I don't have any serialized block data to make golden tests. But the testing can be done with integration tests.


2088: Bump cardano-base so that shelley-spec-ledger-test compiles r=rvl a=rvl

### Issue Number

Found during #2077.

### Overview

If you are keen enough to build the test suites of all our dependencies, you would have found `shelley-spec-ledger-test` failing to compile, because it needs a later revision of `cardano-base`. This will fix it.


2092: Fix stack build on windows r=rvl a=rvl

### Issue Number

None

### Overview

On windows, the stack build would fail with some missing dependencies. There is some stack issue with GHC boot packages. The recommended course of action is to add them as `extra-deps` in `stack.yaml`. This fixes the build.

### Comments

Since the libsodium VRF was added, there is now an extra step to get stack builds working on windows. I have updated our [iohk-setup.ps1](https://github.com/input-output-hk/adrestia/wiki/scripts/iohk-setup.ps1) script to install libsodium and configure stack to use it.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: IOHK <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Aug 31, 2020

Build failed (retrying...)

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Aug 31, 2020

Canceled

@rvl rvl force-pushed the rvl/2077/tx-metadata branch from b0c33cf to b9d1b1a Compare August 31, 2020 14:52
@rvl rvl force-pushed the rvl/2077/tx-metadata branch from b9d1b1a to d7ca998 Compare September 1, 2020 02:28
@rvl
Copy link
Contributor Author

rvl commented Sep 1, 2020

Since we have added shelley libs as dependencies to the core library, all executables now link with libsodium. So the nix needed to be updated so that libsodium-23.dll was copied for all windows exes.

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 1, 2020

Build succeeded

@iohk-bors iohk-bors bot merged commit 3aa7d52 into master Sep 1, 2020
@iohk-bors iohk-bors bot deleted the rvl/2077/tx-metadata branch September 1, 2020 04:12
iohk-bors bot added a commit that referenced this pull request Sep 2, 2020
2091: Add tx metadata to sqlite database r=rvl a=rvl

### Issue Number

ADP-307 / #2072 

### Overview

Includes transaction metadata in the sqlite database transaction history.

### Comments

- Based on PR #2079 branch
- DB state machine tests fail. Possibly due to mutations during the TxMetadata json round-trip.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants