-
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
services/horizon: CAP0018 Support #2423
services/horizon: CAP0018 Support #2423
Conversation
services/horizon/internal/expingest/processors/transaction_operation_wrapper_test.go
Outdated
Show resolved
Hide resolved
6cfefc0
to
750cca0
Compare
f2e492d
to
3f819f9
Compare
* Extend operation processor with authorized to mainliabilities details. * Add EffectTrustlineAuthorizedToMaintainLiabilities. * Add EffectTrustlineAuthorizedToMaintainLiabilities to protocol. * Show both authorize and authorize_to_maintain_liabilities in in operation details. * Add test for AllowTrust resource adapter. * Update allow trust details. * Add test for effect resource. * Add is_authorized_to_maintain_liabilities to balance resource. * Always show is_authorized_to_maintain_liabilities. * Always show authorize_to_maintain_liabilities in operation allow trust. * Include all flags in allow trust operation details. * Update changelog.
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.
Sorry for post-merge review, catching up with all the changes.
I found one inconsistency that can be confusing. From CAP-18:
The combination AUTHORIZED_FLAG | AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG is not valid because AUTHORIZED_FLAG implies AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG
The code in operation processor seems to be correctly setting the authorize_to_maintain_liabilities
value:
details["authorize_to_maintain_liabilities"] = xdr.TrustLineFlags(op.Authorize).IsAuthorized() || xdr.TrustLineFlags(op.Authorize).IsAuthorizedToMaintainLiabilitiesFlag()
However the code in db2.history.TrustLine.IsAuthorizedToMaintainLiabilities
doesn't. If I set AUTHORIZED_FLAG
on a trust line, the is_authorized_to_maintain_liabilities
on the Balance
object will be false
however authorize_to_maintain_liabilities
on the operation will be true
.
I guess the question is about the level of abstraction in Horizon:
- If we want to show raw flag values then we should change operation processor code.
- If we want to show the actual interpretation of raw flag values (
AUTHORIZED_FLAG = true then AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = true
) we should change balance object.
This is handled correctly in the balance object, if the authorize flag is Btw, we went back and forth on how to store and show this, check out for more context #2423 (comment) |
@abuiles thanks! I see now that it was actually updated here: da9f526#diff-fa18377d7302ceaa29836017d5030298R261. |
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 initial support for CAP0018.
Why
Horizon needs to support CAP0018. To do this we have to update ingestion and all the JSON related structs.
At the ingestion level the following changes will happen:
Operation Details
We now add both flags to operation details
Before
After
The following is how the JSON response for an operation will look like when the flag is
2
:And the following when it is
1
:Effect Details
We add a new effect
history.EffectTrustlineAuthorizedToMaintainLiabilities
.The JSON representation is the same as
history.EffectTrustlineAuthorized
andhistory.EffectTrustlineDeauthorized
- except for the effect type and type id.Balance resource
Similar to the operation response, we'll show both flags.
Trustline with flag 0 OR 1
Trustline with flag 2
This is part of #2357
Known limitations
[TODO or N/A]