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

Support stellar-core protocol 13 (CAP 18) - "Fine-Grained Control of Authorization" #2357

Closed
6 tasks done
abuiles opened this issue Mar 4, 2020 · 7 comments
Closed
6 tasks done
Assignees
Milestone

Comments

@abuiles
Copy link
Contributor

abuiles commented Mar 4, 2020

The upcoming stellar-core protocol 13 release will add support for CAP 18 ("Fine-Grained Control of Authorization").

Horizon

Backward compatibility
Since the binary representation of bool authorize is the same as uint32 authorize for true or false, we can roll this changes in Horizon and SDKS before protocol 13 is deployed to stellar core.
They'll only have problems if they try to set authorize to AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG since it won't be recognize by protocol 12.

Again, if the CAP doesn't go through, we can roll the changes in a safe manner.

@abuiles
Copy link
Contributor Author

abuiles commented Mar 4, 2020

@ire-and-curses @tamirms @bartekn I think this is all we need for cap 18 support. I put a question in the requirements, we could combine both flags or we could expose both flags in the balances payload. I'd prefer to expose the new flag so it's clear for final users what's the actual state of the trust line.

Alternatively, we could also add the attribute flags as an int - what I like about this approach is that we won't have to add new attribute if there are new flag types and then let the SDKs implement helper methods.

cc @jonjove

@abuiles abuiles changed the title Support stellar-core protocol 13 (CAP 18) Support stellar-core protocol 13 (CAP 18) - "Fine-Grained Control of Authorization" Mar 4, 2020
@tomerweller
Copy link
Contributor

I'm not a fan of having the authorization state spread across two booleans. Nor am I a fan of of having a bit masked integer as part of horizon's json api.

I propose:

  • Softly deprecating the is_authorized boolean as it no longer conveys the full state of authorization. This field should only be true if the trustline has the AUTHORIZED_FLAG set.
  • Introduce a new status string field with one of three values: "authorized" | "authorized_to_maintain_liabilities" | "unauthorized" . It's ugly and verbose, but hey that's json :)

@jonjove
Copy link

jonjove commented Mar 20, 2020

@tomerweller If you change to a "status" string field, how would you plan to deal with a future where there are flags that aren't mutually exclusive?

@abuiles
Copy link
Contributor Author

abuiles commented Mar 20, 2020

@tomerweller I agree we should probably start soft deprecating is_authorized - however, as @jonjove pointed out, there might be a scenario where the flags aren't mutually exclusive.

I discussed this briefly with @tamirms and we'll do the following:

  1. Soft deprecate is_authorized and make it be true only if AUTHORIZED_FLAG is true as @tomerweller suggested.
  2. Add the flags attribute and let the SDKs implement helpers around it.

@tomerweller
Copy link
Contributor

tomerweller commented Mar 26, 2020

@jonjove you're right - I was under the assumption that states will be mutually exclusive.

In that case maybe adding multiple boolean fields is indeed the "jsony" way to go.

@abuiles and @tamirms, I'd say that adding fields that require an SDK to understand is a step in the wrong direction. Horizon's query results currently don't require that.

This is not theoretical. When I write tools that query horizon I don't bother bringing in an sdk dependency. It would be great to keep it like that.

@abuiles
Copy link
Contributor Author

abuiles commented Mar 26, 2020

@tomerweller good point! Also if you read the issue, we'll have to do something similar to list effects. So we are back to the original plan.

@abuiles
Copy link
Contributor Author

abuiles commented Mar 30, 2020

Fixed in #2423

@abuiles abuiles closed this as completed Mar 30, 2020
@ire-and-curses ire-and-curses added this to the Horizon 1.1.0 milestone Apr 7, 2020
tamirms added a commit to lightsail-network/java-stellar-sdk that referenced this issue Apr 21, 2020
#274)

The upcoming stellar-core protocol 13 release will add support for CAP 18 ("Fine-Grained Control of Authorization").

Horizon has added a is_authorized_to_maintain_liabilities field to the account balance attributes. Also, there is now a new effect which indicates a trustline was authorized to maintain liabilities.

See stellar/go#2357 for more details.

This PR updates the java SDK so that it's able to parse the new Horizon account balance and effects responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants