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

feat: add tx set #1760

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft

feat: add tx set #1760

wants to merge 24 commits into from

Conversation

willemneal
Copy link
Contributor

@willemneal willemneal commented Nov 26, 2024

Currently allows updating fields on Transactions V1 only.

Close #1643

  • stellar tx edit source-account set <SOURCE_ACCOUNT>
  • stellar tx edit sequence-number set <SEQUENCE_NUMBER>
  • stellar tx edit fee set
  • stellar tx edit memo clear
  • stellar tx edit memo set text <MEMO_TEXT>
  • stellar tx edit memo set id <MEMO_ID>
  • stellar tx edit memo set hash <MEMO_HASH>
  • stellar tx edit memo set return <MEMO_RETURN>
  • stellar tx edit time-bound clear
  • stellar tx edit time-bound clear max
  • stellar tx edit time-bound set max <MAX_TIME_BOUND>
  • stellar tx edit time-bound clear min
  • stellar tx edit time-bound set min <MIN_TIME_BOUND>
  • stellar tx edit ledger-bound clear
  • stellar tx edit ledger-bound min clear
  • stellar tx edit ledger-bound min set <MIN_LEDGER>
  • stellar tx edit ledger-bound max clear
  • stellar tx edit ledger-bound max set <MAX_LEDGER>
  • stellar tx edit min-seq-num clear
  • stellar tx edit min-seq-num set <MIN_SEQ_NUM>
  • stellar tx edit min-seq-age clear
  • stellar tx edit min-seq-age set <MIN_SEQ_AGE>
  • stellar tx edit min-seq-ledger-gap clear
  • stellar tx edit min-seq-ledger-gap set <MIN_SEQ_LEDGER_GAP>
  • stellar tx edit extra-signers clear
  • stellar tx edit extra-signers add <EXTRA_SIGNER>

Currently allows updating fields on Transactions V1 only.
@willemneal willemneal self-assigned this Nov 26, 2024
@willemneal willemneal marked this pull request as ready for review November 26, 2024 21:00
@sagpatil sagpatil linked an issue Nov 26, 2024 that may be closed by this pull request
Comment on lines 22 to 29
/// Send a transaction envelope to the network
Send(send::Cmd),
/// Set various options for a transaction
Set(set::Cmd),
/// Simulate a transaction envelope from stdin
Simulate(simulate::Cmd),
/// Sign a transaction envelope appending the signature to the envelope
Sign(sign::Cmd),
Copy link
Member

Choose a reason for hiding this comment

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

Can we organise these commands by order of likely to use next? i.e.:

  • New
  • Set
  • Simulate
  • Sign
  • Send

Comment on lines +12 to +14
XdrStdin(#[from] super::xdr::Error),
#[error(transparent)]
Xdr(#[from] xdr::Error),
Copy link
Member

Choose a reason for hiding this comment

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

Why are there two distinct xdr error types in use here? There should only ever be one in the cli in use.

Comment on lines 1767 to 1790
## `stellar tx set`

Set various options for a transaction

**Usage:** `stellar tx set [OPTIONS]`

###### **Options:**

* `--sequence-number <SEQUENCE_NUMBER>` — Set the transactions sequence number
* `--fee <FEE>` — Set the transactions fee
* `--memo-text <MEMO_TEXT>` — Set the transactions memo text
* `--memo-id <MEMO_ID>` — Set the transactions memo id
* `--memo-hash <MEMO_HASH>` — Set the transactions memo hash
* `--memo-return <MEMO_RETURN>` — Set the transactions memo return
* `--source-account <SOURCE_ACCOUNT>` — Change the source account for the transaction
* `--max-time-bound <MAX_TIME_BOUND>` — Set the transactions max time bound
* `--min-time-bound <MIN_TIME_BOUND>` — Set the transactions min time bound
* `--min-ledger <MIN_LEDGER>` — Set the minimum ledger that the transaction is valid
* `--max-ledger <MAX_LEDGER>` — Set the max ledger that the transaction is valid. 0 or not present means to max
* `--min-seq-num <MIN_SEQ_NUM>` — set mimimum sequence number
* `--min-seq-age <MIN_SEQ_AGE>`
* `--min-seq-ledger-gap <MIN_SEQ_LEDGER_GAP>` — min sequeence ledger gap
* `--extra-signers <EXTRA_SIGNERS>` — Extra signers
* `--no-preconditions` — Set precondition to None
Copy link
Member

Choose a reason for hiding this comment

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

Playing around with this interface I think some design discussion is required for this sub-command.

When we previously discussed this (#1643 (comment)) I had suggested we could have one sub-command per field to set, but I think this arrangement is also reasonable, but looks like there's missing functionality as it is, so we need that design to flesh out all the use cases.

For example, it looks like we can clear all the preconditions with 'no-preconditions', but it's not obvious to a user which fields are being cleared because the options are bundled in a single command the relationship between all the options appear equal / related, when they are not.

Another example, there's no way to remove a memo, or some precondition fields without clearing all preconditions.

I've started a design discussion on the issue:

Copy link
Contributor

Choose a reason for hiding this comment

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

@leighmcculloch I've pushed up some changes that I think align with the updated design discussion from #1643 - is this in line with what you had in mind? I have some ideas for refactoring things to DRY them up, but wanted to get some feedback on the UI before I cleaned up.

@fnando @Ifropc would love your feedback on this too.

Copy link
Contributor

github-actions bot commented Jan 2, 2025

This pull request is stale because it has been open for 30 days with no activity. It will be closed in 30 days unless the stale label is removed.

Copy link
Contributor

This pull request is stale because it has been open for 30 days with no activity. It will be closed in 90 days unless the stale label is removed.

@@ -1517,6 +1517,8 @@ Sign, Simulate, and Send transactions

* `hash` — Calculate the hash of a transaction envelope
* `new` — Create a new transaction
* `edit` —
* `set` — Set various options for a transaction
Copy link
Contributor

Choose a reason for hiding this comment

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

planning to remove this command once the transition to being nested under edit is complete

Copy link
Member

@fnando fnando Mar 5, 2025

Choose a reason for hiding this comment

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

I'm currently using tx edit to do interactive editing on #1893, but we can discuss how we can make both of our ideas work together (I'll add this as discussion topic for today).

It'd be nice if prs were scoped by the actual feature you're working on, in this case tx set. Can you please keep a separate branch with your tx edit version in draft mode, and only put the tx set changes up for review?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm currently using tx edit to do interactive editing on #1893, but we can discuss how we can make both of our ideas work together (I'll add this as discussion topic for today).

Sounds great!

It'd be nice if prs were scoped by the actual feature you're working on, in this case tx set. Can you please keep a separate branch with your tx edit version in draft mode, and only put the tx set changes up for review?

I agree—based on the discussion in #1643, it sounded like there was interest in moving tx set under tx edit rather than keeping it as a separate command. With that in mind, I was viewing this PR as implementing tx edit set.

This PR should definitely still be in draft—nice catch! Would it make sense to close this one and start a new PR for clarity? Happy to discuss further in the meeting later as well!

@elizabethengelman elizabethengelman force-pushed the feat/tx_set branch 2 times, most recently from d3a8578 to f5ef919 Compare March 5, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo (Ready for Dev)
Development

Successfully merging this pull request may close these issues.

How to set fields on Transactions
5 participants