-
Notifications
You must be signed in to change notification settings - Fork 499
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
txnbuild: add SequenceNumber func to Transaction #3616
txnbuild: add SequenceNumber func to Transaction #3616
Conversation
### What Add `SequenceNumber` function to `Transaction`. ### Why Stellar transactions have a sequence number. If a transaction is valid and it is accepted into a ledger the source account of the transaction is updated such that its sequence number becomes the sequence number of the transaction. In the Go SDK a parsed transaction has no sequence number field or function directly on it. For a developer to get the sequence number they must look at the source account object. This is not intuitive and not consistent conceptually because a transaction has a sequence number and it should be a first class attribute of the transaction. In my own development using the Go SDK I spent time trying to figure out where the sequence was stored and how to get at it. I work on Stellar everyday, so if this is not intuitive to me, I suspect it isn't intuitive to others. This is likely to become even less intuitive as we plan to change the sequence number rules where the sequence number on an account does not need to be sequential. Regardless of this, it isn't intuitive today.
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!
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.
Shouldn't the transaction sequence number depend on the IncrementSequenceNumber
flag as well?
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.
Great, this looks really helpful, especially for any non-trivial application (i.e. one that assumes validity, and tracks sequence numbers locally rather than looking up Horizon each time).
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
Add
SequenceNumber
function toTransaction
.Why
Stellar transactions have a sequence number. If a transaction is valid and it is
accepted into a ledger the source account of the transaction is updated such
that its sequence number becomes the sequence number of the transaction.
In the Go SDK a parsed transaction has no sequence number field or function
directly on it. For a developer to get the sequence number they must look at the
source account object. This is not intuitive and not consistent conceptually
because a transaction has a sequence number and it should be a first class
attribute of the transaction.
In my own development using the Go SDK I spent time trying to figure out where
the sequence was stored and how to get at it. I work on Stellar everyday, so if
this is not intuitive to me, I suspect it isn't intuitive to others.
Other Stellar SDKs, such as the JS SDK, expose it as an attribute on a
Transaction.
This is likely to become even less intuitive as we plan to change the sequence
number rules where the sequence number on an account does not need to be
sequential. Regardless of this, it isn't intuitive today.
Known limitations
N/A