namada icon indicating copy to clipboard operation
namada copied to clipboard

Transfer to self

Open murisi opened this issue 1 year ago • 2 comments

It seems like calling token::transfer with parameters such that source is equal the destination would cause an attempt to increase the balance of destination by the amount being transferred because of the instruction ordering at https://github.com/anoma/namada/blob/5cc23b4f43b12ecfc70eeca8d04cbe15f4b11a3a/crates/trans_token/src/storage.rs#L247 We should clarify whether the source and destination of a valid transfer call can be the same. If it is valid, I would expect the balance of destination (or equivalently, the source) to be left unchanged. If it is not valid, then returning an error might be better.

murisi avatar Jun 28 '24 20:06 murisi

In this case, at the moment, the transaction would fail, right?

cwgoes avatar Jul 01 '24 08:07 cwgoes

In this case, at the moment, the transaction would fail, right?

Yes, I think the token VPs would reject this transaction. But I'll test this later...

murisi avatar Jul 01 '24 08:07 murisi

We should reject self-to-self transfers, regardless of anything else.

cwgoes avatar Aug 20 '24 09:08 cwgoes

Is this completely fixed by #3675?

brentstone avatar Aug 22 '24 03:08 brentstone

Closed by https://github.com/anoma/namada/pull/3675

cwgoes avatar Aug 22 '24 07:08 cwgoes