Skip to main content
added 298 characters in body
Source Link
Ahkilleux
  • 155
  • 1
  • 5

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like, if the authority_info"authority_info" arg is set to owner"owner", then even if delegate isa "delegate" has been set on the account, itthe program will run the "owner is signer" assertion rather than the "delegate is signer" assertion. Meaning, that it appears that, the owner is always authorized to transfer tokens in any amount no matter what is delegated.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights over their delegated amount.

I don't need exclusive rights, as longAs an alternative for my delegation rights are dropped on transferuse case, or closea fallback to the "Delegate" having "exclusive rights" over the delegated amount, and I'm ableif the delegate were to detect that efficiently via a mentionbe mentioned when the total amount on the delegate account drops below the delegate amount, that may suffice.

So aA follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transferwhen their delegated amount is transferred?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So theThe delegate remains set on the account, thereand so does their delegate amount. There is just less quantity in the account for itthe delegate to potentially be granted further authority over. Possibly there is zero quantity"amount" on the account, despite the "delegate amount" being greater than zero.

Although actually, if the non delegate (i.e. the owner) is allowed to transfer a quantity over which the delegate has authority ( i.e. transfer in excess of non delegated quantity ), shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like if the authority_info is set to owner then even if delegate is set, it will run the "owner is signer" assertion rather than the "delegate is signer" assertion.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights.

I don't need exclusive rights, as long my delegation rights are dropped on transfer or close, and I'm able to detect that efficiently via a mention on the delegate account.

So a follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transfer?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So the delegate remains, there is just less quantity in the account for it to potentially be granted further authority over. Possibly zero quantity.

Although actually, if the non delegate (i.e. the owner) is allowed to transfer a quantity over which the delegate has authority ( i.e. transfer in excess of non delegated quantity ), shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like, if the "authority_info" arg is set to "owner", then even if a "delegate" has been set on the account, the program will run the "owner is signer" assertion rather than the "delegate is signer" assertion. Meaning, that it appears that, the owner is always authorized to transfer tokens in any amount no matter what is delegated.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights over their delegated amount.

As an alternative for my use case, or a fallback to the "Delegate" having "exclusive rights" over the delegated amount, if the delegate were to be mentioned when the total amount on the account drops below the delegate amount, that may suffice.

A follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared when their delegated amount is transferred?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. The delegate remains set on the account, and so does their delegate amount. There is just less quantity in the account for the delegate to potentially be granted further authority over. Possibly there is zero "amount" on the account, despite the "delegate amount" being greater than zero.

Although actually, if the non delegate (i.e. the owner) is allowed to transfer a quantity over which the delegate has authority ( i.e. transfer in excess of non delegated quantity ), shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

added 71 characters in body
Source Link
Ahkilleux
  • 155
  • 1
  • 5

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like if the authority_info is set to owner then even if delegate is set, it will run the "owner is signer" assertion rather than the "delegate is signer" assertion.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights.

I don't need exclusive rights, as long my delegation rights are dropped on transfer or close, and I'm able to detect that efficiently via a mention on the delegate account.

So a follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transfer?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So the delegate remains, there is just less quantity in the account for it to potentially be granted further authority over. Possibly zero quantity.

Although actually, if the non delegate (i.e. the owner) is allowed to transfer a quantity over which the delegate has authority ( i.e. transfer in excess of non delegated quantity ), shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like if the authority_info is set to owner then even if delegate is set, it will run the "owner is signer" assertion rather than the "delegate is signer" assertion.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights.

I don't need exclusive rights, as long my delegation rights are dropped on transfer or close, and I'm able to detect that efficiently via a mention on the delegate account.

So a follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transfer?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So the delegate remains, there is just less quantity in the account for it to potentially be granted further authority over. Possibly zero quantity.

Although actually, if the non delegate is allowed to transfer a quantity over which the delegate has authority, shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like if the authority_info is set to owner then even if delegate is set, it will run the "owner is signer" assertion rather than the "delegate is signer" assertion.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights.

I don't need exclusive rights, as long my delegation rights are dropped on transfer or close, and I'm able to detect that efficiently via a mention on the delegate account.

So a follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transfer?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So the delegate remains, there is just less quantity in the account for it to potentially be granted further authority over. Possibly zero quantity.

Although actually, if the non delegate (i.e. the owner) is allowed to transfer a quantity over which the delegate has authority ( i.e. transfer in excess of non delegated quantity ), shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?

Source Link
Ahkilleux
  • 155
  • 1
  • 5

Are SPL Token Delegates **Exclusive** Transfer Authorities?

I'm reading the source here:

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs

But my Rust is not so fluent right now.

Right around here:

match source_account.delegate {
   COption::Some(ref delegate) if Self::cmp_pubkeys(authority_info.key, delegate) {...} 
   _ => Self::validateOwner(...stuff...&source_account.owner)
}

I see the delegate consulted.

It looks like if the authority_info is set to owner then even if delegate is set, it will run the "owner is signer" assertion rather than the "delegate is signer" assertion.

But, I'm kind of hoping I'm wrong here. In my case, it'd be ideal for the delegate to have exclusive rights.

I don't need exclusive rights, as long my delegation rights are dropped on transfer or close, and I'm able to detect that efficiently via a mention on the delegate account.

So a follow up "Plan B" question is, if transfer rights are not exclusive, are the delegates cleared on transfer?

Which I think is technically, no. Because I think what happens is the source account is just depleted of token quantity. So the delegate remains, there is just less quantity in the account for it to potentially be granted further authority over. Possibly zero quantity.

Although actually, if the non delegate is allowed to transfer a quantity over which the delegate has authority, shouldn't that subtract from the delegate's holdings even if the delegate is not the signer?

Or is it possible for the delegate to hold authority over more tokens than what are held by the account?