iroha icon indicating copy to clipboard operation
iroha copied to clipboard

Consider removing `source` from `Transfer` instructions

Open dima74 opened this issue 10 months ago • 1 comments

Consider transfer instruction, e.g. Transfer<Account, DomainId, Account>. It checks that source (provided by ISI) equals domain owner (as stored in blockchain):

https://github.com/hyperledger-iroha/iroha/blob/e0ff84276bb5ff41786f6886aaa8225e70d686ce/crates/iroha_core/src/smartcontracts/isi/domain.rs#L362-L366

Consider removing source from ISI and using domain owner directly. Also applicable for CLI (e.g. even if we will keep source in ISI, we can remove source in CLI)


To update the ownership of an object, the object id and the new owner id should be sufficient arguments. So struct Transfer<S, O, D> enforces unnecessary invariant checks for ownership changes

Originally posted by @s8sato in https://github.com/hyperledger-iroha/iroha/pull/5308#discussion_r1948387955

dima74 avatar Feb 11 '25 11:02 dima74

Yeah, every Transfer<S, O, D> can change into Transfer<O, D>, including numeric asset transfers, which can be considered ownership changes for partial balances (O = Asset)

s8sato avatar Feb 12 '25 07:02 s8sato