-
Notifications
You must be signed in to change notification settings - Fork 304
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
Cosigned assets: NopOp and COAUTHORIZED_FLAG #146
Comments
NopOp
and COAUTHORIZED_FLAG
Maybe a good moment to allow issuers to send back assets that are no longer authorized? Without it, any stats that involve number of assets (shares issued, assets in circulation, etc.) may be inaccurate because holder doesn't want to send it back.
After stellar/stellar-core#1718 offers in accounts that are no longer authorized are deleted.
Why not use Looks good! Would be great to see an example of transactions flow from holder and issuer that authorize a coauthorized trustline and then send a simple payment with issuer signature. |
@bartekn "Maybe a good moment to allow issuers to send back assets that are no longer authorized?" Do you mean allow issuers to remove assets from an account that is no longer authorized? If so that would be great. I think already accounts that hold assets that become unauthorized can send them back to the issuer to "burn" them right? |
Yes, exactly.
This was an issue in our documentation, fixed only a few months ago. The truth is neither unauthorized account nor issuer can move the asset. Source: https://github.com/stellar/stellar-core/blob/c5fc4b13fb52c4b437698271c1a02bbb76bb23d1/src/transactions/PathPaymentOpFrame.cpp#L323-L331 |
Didn't notice #135 until now. Still think it's a bad idea. Keep assets like that on separate accounts. Multi-sig works as-is. As a developer, how do I know if an asset is co-signed, and needs a no-op and being sent off to some arbitrary cosigning service, before I'm able to submit it to the network? How do I even know who the cosigner is? (Is no-op really needed, when you can just use the cosigner as source account for the tx env?) |
Noting that BumpSeq 0 has NoOp semantics, so we may just reuse that presently. Or we may relax BumpSeq authorization to no longer require signers if the BumpSeq is a no-op. |
// update: removed references to deleted comments
The
This is more relevant as feedback for #135, in which it's suggested to add this information to the TOML file of the issuer.
There are ways around a no-op (for example bumpseq as suggest by @JeremyRubin above). Adding the issuer as the source account on an operation allows stellar core to take advantage of the current mechanism of signature collection. As you point out, using the issuer as a source account for the entire transaction can also accomplish that. However, this can lead to concurrency issues as the issuer will also need to provide a correct sequence number. |
I didn't notice #135 until after I had written my first comments. I've seen multi-sig used extensively by ICOs trying to do trading restrictions/vesting, hence my comment. Still thinks it's a bad idea. Again, how to deal with it as a developer? None of the flags are exposed in Horizon as of yet, even after years of complaints. Using no-op, or bumpseq, or tx env source account, we still need to know if/how to do it. Added: wouldn't is make sense to put this as an account flag? |
You get points for consistency.
Right. Horizon is lagging behind and it needs to get fixed. My sources tell me that the SDF is working on it, and that they're open to pull requests ;)
Right. Ideally it should be handled in the SDK level, similarly to federation. These are all valid concerns. However, I suggest that we try to limit the discussion in this repository to the protocol itself. |
It's hard to look at these things in isolation. The protocol affects how you use it. If it's an asset-wide setting it should go into the account setting flags, just like all the other asset-wide settings. |
Since you guys are mum on specifics regarding the background, I'm just guessing here. Looking at this from a security token perspective, a lot of it makes sense, and some things don't. If you want to be able to do compliance checks per transaction, co-signing seems like the best way to get that done. From that PoV, some things leave me wondering what you're targeting. It doesn't seem to be that. Is this a per-asset thing, or a per-trustline thing? Again, I have no clue why you're trying to do this. Looking at it from security token PoV again, you'd probably want the whole asset to be co-signed, and not individual asset holders. So we require an additional signature in co-signing mode. And we add that by including a new No-op op, being a low signing threshold type of operation. Is this really needed though? Can't we just say, if a trust line is co-signed, the issuer has to co-sign the transaction, w/o any new operation? |
These issues are complimentary, #135 addresses the high level, ecosystem support. Which, in theory, can work without this protocol change. The protocol change is there to address the idiosyncrasies of having issuers as co-signers on a holder's account.
Yeah, that's true in most cases. The idea behind using a flag on the trustline and not the issuer account is that issuers can still offer unrestricted access to specific trusted accounts, for example, market makers. It's more generic but still encompasses the base case. Do you see any potential issues here?
That's a good point. I'll defer to David (@stanford-scs) but I think main motivation is to not add complexity to the existing signature weight aggregation system. |
The relationship between this and #135 is that this proposal is a concrete implementation of what #135 calls approach 1. The reason we can't just change the semantics of unauthorized assets is that offers for co-signed assets must remain valid in the order book, while they must be canceled/invalid for unauthorized assets. @JeremyRubin |
(Posting on behalf of David Mazières)
Motivation
A number of Stellar asset issuers need greater control over assets
than simply authorizing particular accounts to hold the asset. As a
result, we are seeing people build solutions in which the asset issuer
is actually a co-signer on asset holders' accounts. This solution has
several drawbacks. In particular, the asset owner cannot unilaterally
withdraw XLM or other assets from his or her account, and it is very
hard to trade one such restricted asset for another (as both issuers
would need to be cosigners on the account, giving one issuer
permission to authorize transactions on the other's asset).
This proposal is a first cut at attempting to address the problem
through minimal stellar-core changes.
Co-signer authorized trust lines
To accommodate asset issuers with restrictions, we propose adding
another mode for trustlines of
AUTH_REQUIRED
assets, called"cosigner authorized," that lies somewhere between being not
authorized and fully authorized. The idea is to allow issuers to
require asset holders to request co-signing of transactions involving
the asset without being cosigners on asset holders' accounts.
There are now three modes for the trustline of an
AUTH_REQUIRED
asset, based on
TrustLineEntry::flags
:If
(flags & 3) == 0
, the source account is not authorized. AnyPAYMENT
,PATH_PAYMENT
,MANAGE_OFFER
, orCREATE_PASSIVE_OFFER
, with the source account causes the wholetransaction to fail, with only two exceptions:
A
PATH_PAYMENT
is allowed to contain the asset inpath
, solong as it does not apear in
sendAsset
ordestAsset
, andA
MANAGE_OFFER
is allowed if it setsamount
to 0 (to deletethe offer).
In addition, any operation with a different (even authorized) source
account will fail if it attempts to send the asset to an account
with
(flags & 3) == 0
. Finally, existing orders on the order bookbelonging to the account with
(flags & 3) == 0
are immediatelyinvalid and cannot be filled. This behavior should be close or
identical to the status quo.
If
(flags & 3) == COAUTHORIZED_FLAG
for an account, then theaccount has certain additional permissions compared to when those
bits are 0. Specifically:
The account's offers in the order book continue to be valid, and
can be filled at any time.
The account can use
MANAGE_OFFER
to reduce theamount
of anoffer involving the asset (including canceling the offer with
and
amount
of 0), but not to increase the offer.The account can receive (but not send) payments and path
payments in the asset, up to the
limit
of the trustline.However, any other operation on the asset requires that the
transaction be co-signed by the asset issuer at low threshold.
Moreover, if the account increases the
limit
on the trustline andthe transaction is not cosigned by the issuer, then the
COAUTHORIZED_FLAG
is cleared so(flags & 3)
goes back to 0.If
(flags & 3) == AUTHORIZED_FLAG
, then the account can performarbitrary transactions on the asset, including sending payments to
accounts with
COAUTHORIZED_FLAG
.Operation changes
Implementing cosigned assets requires changes to two operations.
Because an asset issuer's signature may be out of place on a
transaction requiring asset issuer coauthorization, we add a
NopOp
operation that requires a signature from an arbitrary source account.
Such an operation will be useful in other contexts, too, as currently
pre-authorized transactions sometimes require ugly hacks like having
an account send one Stroup to itself. Second, we have to modify
ALLOW_TRUST
to enable issuers to set the newCOAUTHORIZED_FLAG
.NO_OPERATION
(NopOp
)The
NO_OPERATION
operation does nothing, but requires a validsignature from the operation's source account. Since the default
source account is the source of the transaction, this will always
succeed at low threshold if the operation's
sourceAccount
isNULL
. However, it can be used to require a low threshold signaturefrom an asset issuer.
NopOp
is not strictly necessary, as a redundantALLOW_TRUST
can beused instead, but having
NopOp
is cleaner and has other applicationsto pre-authorized transactions.
ALLOW_TRUST
flagsOnly one small change is required to
AllowTrustOp
. We change theauthorize
field from abool
to auint32
. This provides binarycompatibility with clients that do not know about the
COAUTHORIZED_FLAG
(sinceAUTHORIZED_FLAG == TRUE
in XDR), buthaving a
uint32
provides the additional option of setting it toCOAUTHORIZED_FLAG
.The text was updated successfully, but these errors were encountered: