anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 948 forks source link

Transfer to self #3465

Closed murisi closed 1 month ago

murisi commented 3 months ago

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.

cwgoes commented 3 months ago

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

murisi commented 3 months ago

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...

cwgoes commented 1 month ago

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

brentstone commented 1 month ago

Is this completely fixed by #3675?

cwgoes commented 1 month ago

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