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

Add CLI option for transaction TTL #2267

Merged
merged 8 commits into from
Nov 17, 2020
Merged

Add CLI option for transaction TTL #2267

merged 8 commits into from
Nov 17, 2020

Conversation

rvl
Copy link
Contributor

@rvl rvl commented Oct 26, 2020

Issue Number

ADP-93 / #1840

Overview

Comments

@rvl rvl self-assigned this Oct 26, 2020
@rvl rvl added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Oct 26, 2020
@rvl rvl added this to the (ADP-93) Transaction scheduler milestone Oct 26, 2020
<> metavar "SECONDS"
<> help "Time-to-live value in seconds. Default is 2 hours."
where
diffTime = fromIntegral <$> (auto :: ReadM Int)
Copy link
Member

Choose a reason for hiding this comment

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

This is slightly inconsistent with the --sync-tolerance option that is already parsing time. This option requires an explicit suffix to disambiguate the argument: 14s.

It relies on the FromText instance of SyncTolerance to do so, what about re-using that logic here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I doubt that users would particularly like having to add s when no other units are supported, but I have changed it anyway.

@@ -685,16 +687,17 @@ cmdWalletGetUtxoStatistics mkClient =
-- | cardano-wallet transaction
cmdTransaction
:: ToJSON wallet
=> TransactionClient
=> Bool -- ^ Enable Shelley transaction features
Copy link
Member

Choose a reason for hiding this comment

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

May I suggest a sum-type: Era = Byron | Shelley (Goguen Voltaire) and a possible isShelley :: Era -> Bool derived from it? This would be less cryptic at the call-site when reading: cmdTransaction True client ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I have added a sum type but kept it hidden in the CLI module.

@rvl rvl mentioned this pull request Oct 26, 2020
8 tasks
iohk-bors bot added a commit that referenced this pull request Oct 27, 2020
2167: Add transaction TTL to payments API r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Add transaction TTL to swagger spec. User provides the value in seconds.
- [x] Add transaction TTL to API types
- [x] Add TTL slot calculation to API handler function
- [x] Adjust mkStdTx to make ttl easier - it now takes the expiry slot directly.
- [x] Integration tests

### Comments

Next PRs
- [x] Allow deleting expired transactions ⇒ #2262
- [x] Add CLI option `cardano-wallet transaction create [--ttl=SECONDS]` ⇒ #2267
- [ ] Perhaps clean up the large number of function arguments and return values in transaction layer functions.


Co-authored-by: Rodney Lorrimar <[email protected]>
[ "Cannot parse given time duration."
, "Values must be given as whole positive seconds,"
, "and must finish with \"s\". For example: \"3s\", \"3600s\", \"42s\"."
]
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, could be declared in the text-class package directly to avoid the orphan instance?

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.

@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch from dae32f5 to 4e9c8a9 Compare October 27, 2020 09:52
iohk-bors bot added a commit that referenced this pull request Oct 28, 2020
2167: Add transaction TTL to payments API r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Add transaction TTL to swagger spec. User provides the value in seconds.
- [x] Add transaction TTL to API types
- [x] Add TTL slot calculation to API handler function
- [x] Adjust mkStdTx to make ttl easier - it now takes the expiry slot directly.
- [x] Integration tests

### Comments

Next PRs
- [x] Allow deleting expired transactions ⇒ #2262
- [x] Add CLI option `cardano-wallet transaction create [--ttl=SECONDS]` ⇒ #2267
- [ ] Perhaps clean up the large number of function arguments and return values in transaction layer functions.


Co-authored-by: Rodney Lorrimar <[email protected]>
iohk-bors bot added a commit that referenced this pull request Oct 29, 2020
2167: Add transaction TTL to payments API r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Add transaction TTL to swagger spec. User provides the value in seconds.
- [x] Add transaction TTL to API types
- [x] Add TTL slot calculation to API handler function
- [x] Adjust mkStdTx to make ttl easier - it now takes the expiry slot directly.
- [x] Integration tests

### Comments

Next PRs
- [x] Allow deleting expired transactions ⇒ #2262
- [x] Add CLI option `cardano-wallet transaction create [--ttl=SECONDS]` ⇒ #2267
- [ ] Perhaps clean up the large number of function arguments and return values in transaction layer functions.


Co-authored-by: Rodney Lorrimar <[email protected]>
@rvl rvl force-pushed the rvl/1840/delete-tx-expired branch from 9580b98 to 737ffd3 Compare November 2, 2020 09:24
@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch from 4e9c8a9 to 8de219b Compare November 2, 2020 09:34
@rvl rvl force-pushed the rvl/1840/delete-tx-expired branch from 737ffd3 to 866e53f Compare November 2, 2020 14:37
@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch from 8de219b to b5446ac Compare November 2, 2020 14:38
@rvl rvl force-pushed the rvl/1840/delete-tx-expired branch from 866e53f to eb74e0e Compare November 3, 2020 15:18
@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch 2 times, most recently from afed782 to 61ce155 Compare November 3, 2020 16:19
@rvl rvl force-pushed the rvl/1840/delete-tx-expired branch 2 times, most recently from f61495f to d9da868 Compare November 6, 2020 12:40
@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch from 61ce155 to 7d489fe Compare November 6, 2020 12:43
Base automatically changed from rvl/1840/delete-tx-expired to master November 6, 2020 14:42
@rvl rvl force-pushed the rvl/1840/cli-tx-ttl branch from 7d489fe to 265678d Compare November 9, 2020 09:34
@rvl
Copy link
Contributor Author

rvl commented Nov 9, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Nov 9, 2020
2267: Add CLI option for transaction TTL r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Hide shelley-specific CLI options in `cardano-wallet-jormungandr` (fixes #2169)
- [x] Add option `cardano-wallet transaction create [--ttl=SECONDS]`
- [ ] Update wiki page after merging.

### Comments

- Based on PR #2262 branch - merge that first.


2297: Enable parallel integration tests in hydra r=Anviking a=Anviking

# Issue Number

ADP-466

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Pass in `-j 8` 
- [x] Only run CLI tests in parallel if `CI` env var isn't set
- [x] Clean up some debug printing in tests

# Comments


<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


2302: Fix DB migration tests r=rvl a=piotr-iohk

# Issue Number

<!-- Put here a reference to the issue this PR relates to and which requirements it tackles -->


# Overview

- 098f6e5
  Fix DB migration tests



# Comments

post release


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: Johannes Lund <[email protected]>
Co-authored-by: Piotr Stachyra <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 9, 2020

Build failed (retrying...):

iohk-bors bot added a commit that referenced this pull request Nov 9, 2020
2267: Add CLI option for transaction TTL r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Hide shelley-specific CLI options in `cardano-wallet-jormungandr` (fixes #2169)
- [x] Add option `cardano-wallet transaction create [--ttl=SECONDS]`
- [ ] Update wiki page after merging.

### Comments

- Based on PR #2262 branch - merge that first.


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

@rvl:

$ cardano-wallet transaction create 1ceb45b37a94c7022837b5ca14045f11a5927c65 \
  --ttl 1s \
  --payment 1000000@addr_test1qq6m4v46wc7glh4rcdcq5u49vuqu6m8e3tp5g306chrcxt6rfvtjsyka3nefuhflvhc6pfm0kj3u7xr6c67fjhqzq3rqqtw9xt
Please enter your passphrase: ****************

Error in $['time_to_live']: parsing Quantity failed, expected Object, but encountered Number

@piotr-iohk
Copy link
Contributor

bors r-

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 9, 2020

Canceled.

@rvl
Copy link
Contributor Author

rvl commented Nov 10, 2020

Oops, thanks @piotr-iohk. It works now.

bors r+

iohk-bors bot added a commit that referenced this pull request Nov 10, 2020
2267: Add CLI option for transaction TTL r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Hide shelley-specific CLI options in `cardano-wallet-jormungandr` (fixes #2169)
- [x] Add option `cardano-wallet transaction create [--ttl=SECONDS]`
- [ ] Update wiki page after merging.

### Comments

- Based on PR #2262 branch - merge that first.


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

iohk-bors bot commented Nov 10, 2020

Build failed:

Progress 6/7: cardano-wallet-core-2020.11.3
Timed out after 60 minutes.
    rollback
      Can rollback to any arbitrary known checkpoint
        +++ OK, passed 100 tests.
      Correctly re-construct tx history on rollbacks
        +++ OK, passed 400 tests:
        65.8% rolling back something
        
        34.2% Outgoing tx after point: 0
        15.0% Outgoing tx after point: 1
        11.8% 

#2292

@KtorZ
Copy link
Member

KtorZ commented Nov 10, 2020

bors retry

iohk-bors bot added a commit that referenced this pull request Nov 10, 2020
2267: Add CLI option for transaction TTL r=rvl a=rvl

### Issue Number

ADP-93 / #1840

### Overview

- [x] Hide shelley-specific CLI options in `cardano-wallet-jormungandr` (fixes #2169)
- [x] Add option `cardano-wallet transaction create [--ttl=SECONDS]`
- [ ] Update wiki page after merging.

### Comments

- Based on PR #2262 branch - merge that first.


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

iohk-bors bot commented Nov 10, 2020

Build failed:

Failures:
--
  |  
  | src/Test/Integration/Scenario/API/Shelley/Transactions.hs:642:10:
  | 1) API Specifications, SHELLEY_TRANSACTIONS, TRANS_TTL_01 - Pending transaction expiry
  | predicate failed on: SlotNo 59
  | expected expiry: SlotNo 37701
  | actual expiry: SlotNo 37760
  |  
  | To rerun use: --match "/API Specifications/SHELLEY_TRANSACTIONS/TRANS_TTL_01 - Pending transaction expiry/"
  |  
  | Randomized with seed 1007836544

#2295

@rvl
Copy link
Contributor Author

rvl commented Nov 17, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 17, 2020

Build succeeded:

@iohk-bors iohk-bors bot merged commit a0de704 into master Nov 17, 2020
@iohk-bors iohk-bors bot deleted the rvl/1840/cli-tx-ttl branch November 17, 2020 01:58
rvl added a commit that referenced this pull request Nov 9, 2021
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.

cardano-wallet-jormungandr --metadata option is redundant
3 participants