#How auth with source account

23 messages · Page 1 of 1 (latest)

grave dawn
#

I'm struggling to figure out what AuthContract should be set for a source account auth, and what to specify for the "signatures". Do we still support source account auth? What goes for the signatures with that type of auth?

#

cc @barren flame

barren flame
#

I believe the doc describes this, but the answers are 'yes' and 'nothing'

grave dawn
#

Oh, I see, addressWithNonce is supposed to be None in that case.

#

Maybe we shouldn't use Option for that field, and instead use a different enum with values SourceAccount or Address.

#

It's make it a little clearer. None address with nonce == Source Account is logical, but it is not intuitive/obvious.

barren flame
#

yeah, maybe

grave dawn
#

On the surface if you think that change might be reasonable I can open a PR with it and we can evaluate if it's good in a PR.

barren flame
#

that's reasonable, but I'd like to postpone it until after the preview release in order to not accumulate more xdr changes that need to be propagated everywhere

grave dawn
#

For next release.

grave dawn
#

Hmm, actually, is it accurate for the default case to be "SourceAccount"? Can this invoker auth be used for contracts as well, so should it be Invoker?

barren flame
#

if you mean whether default should be source account or an address - I don't really care much; I'm not sure if there are any conventions on default in xdr (it would probably safer if by default the address was filled and invoker was used explicitly - this way there is always something set explicitly)

#

I think we shouldn't use the 'invoker' term to not introduce more confusion; this is strictly a special case of the source account signature being effectively 'forwarded' to the host

grave dawn
#

Is setting addressWithNonce to None also how a contract can be the invoker for auth?

barren flame
#

ideally it wouldn't be needed at all, but that might make things even more confusing

#

it can't (in transaction)

grave dawn
#

How does a contract auth with another contract?

barren flame
#

for the subcontract calls contract is considered to have authorized anything on its behalf; authorizing the trees from a contract is still not supported (There is an issue for that though)

grave dawn
#

for the subcontract calls contract is considered to have authorized anything on its behalf
Do I need to construct a ContractAuth for this case?

#

When I do, do I set addressWithNonce to None?

barren flame
#

no, you don't need to. doing a subcontract call automatically provides authorization