hyperledger / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
434 stars 277 forks source link

Refine store asset transfers #4782

Closed nxsaken closed 1 month ago

nxsaken commented 3 months ago

Currently, transferring a store asset removes the whole asset from the source account, and tries to insert it into the target account, with no effect if the target account already has an asset of that definition. This is surprising: I would expect the target asset to be replaced or merged with the source.

Because two store assets of the same definition could have different KV-pairs, I think Transfer(Store, Source, Target) should result in a merge of the two assets, with the source key-value pairs replacing those in the target, while leaving other key-value pairs in the target alone. The KV-pairs supported by a store asset could be part of the asset definition to avoid this altogether.

Alternatively, we could introduce a separate Transfer(Store, Key, Source, Target) instruction that only transfers a single key-value pair from the source asset to the destination.

nxsaken commented 3 months ago

Related: https://github.com/hyperledger/iroha/issues/4353#issuecomment-2146573078

mversic commented 1 month ago

closing in favor of #4087