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

CAP-0021 updates #1155

Merged
merged 7 commits into from
Apr 7, 2022
Merged

CAP-0021 updates #1155

merged 7 commits into from
Apr 7, 2022

Conversation

sisuresh
Copy link
Contributor

There are two CAP-0021 updates in this PR-

  1. Duration is updated from int64 to uint64 because a negative minSeqAge doesn't make sense. We also removed all ClaimPredicate changes because they added additional implementation work with providing any functional benefits.
  2. Added a new error code txBAD_MIN_SEQ_AGE_OR_GAP in response to this PR comment - Protocol 19 - CAP-0021 and CAP-0040 stellar-core#3377 (comment).

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

@sisuresh Two small changes needed. Otherwise looks good.

@MonsieurNicolas Your explanation for why we can't use txTOO_EARLY makes sense, but from the POV of a client interacting with it, it is unfortunate, as the edge case obscures the common case, since in practice an error caused by those fields will almost always indicate too early. But I get it.

core/cap-0021.md Outdated Show resolved Hide resolved
core/cap-0021.md Outdated Show resolved Hide resolved
@sisuresh
Copy link
Contributor Author

sisuresh commented Apr 4, 2022

I added a couple more changes to this PR based on previous discussions in stellar/stellar-core#3377.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

This looks good to me, couple suggestions inline.

core/cap-0040.md Outdated
Comment on lines 209 to 210
This CAP allows the signer to use an empty payload. There are no issues with
signing an empty payload, so we see no need to special case this scenario.
Copy link
Member

Choose a reason for hiding this comment

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

We could be more specific as to who/what "There" is:

Suggested change
This CAP allows the signer to use an empty payload. There are no issues with
signing an empty payload, so we see no need to special case this scenario.
This CAP allows the signer to use an empty payload. Ed25519 specifies no issues with
signing an empty payload, so we see no need to special case this scenario.

Copy link
Contributor Author

@sisuresh sisuresh Apr 7, 2022

Choose a reason for hiding this comment

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

I removed this section now that we switched to not allowing empty payloads.

neither of the above conditions holds (`txTOO_EARLY` and `txTOO_LATE`
do not apply), but one of the `extraSigners` is unsatisfied, then the
transaction fails with `txBAD_AUTH`.
Because `PreconditionsV2` specifies multiple pre-conditions, there may be
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we specify this, but I assume txBAD_SEQ takes precedence over any of these failure conditions. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

txBAD_SEQ is before txBAD_MIN_SEQ_AGE_OR_GAP and txBAD_AUTH but after the others.

core/cap-0021.md Outdated
Comment on lines 307 to 309
preconditions are based on values that could later be valid (the `minTime` or
`minLedger` have not been reached yet), then the transaction is rejected with
`txTOO_EARLY`. If the failure is due to `minSeqAge` or `minSeqLedgerGap`, then
Copy link
Member

Choose a reason for hiding this comment

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

We should specify what happens if minSeqNum isn't reached yet, which I assume would still be txBAD_SEQ. On read of this it sort of implies it might be txTOO_EARLY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

core/cap-0021.md Outdated
preconditions are based on values that could later be valid (the `minTime` or
`minLedger` have not been reached yet), then the transaction is rejected with
`txTOO_EARLY`. If the failure is due to `minSeqAge` or `minSeqLedgerGap`, then
the transaction is rejected with the new `txBAD_MIN_SEQ_AGE_OR_GAP` error code.
Copy link
Member

Choose a reason for hiding this comment

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

It seems somewhat odd that the min seq errors are bundled. I can't think of an issue with this though. Would there be an advantage to specifying separate errors for age and gap? e.g.:

  • txBAD_MIN_SEQ_AGE
  • txBAD_MIN_SEQ_LEDGER_GAP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They fail for the same simple reason, so separating them seems unnecessary to me.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Looks great. 🎉

@leighmcculloch leighmcculloch merged commit 70cb144 into stellar:master Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants