Difference between map 'owner' and 'permissions'

In this snippet:

// ... owner or owners ...
is it possible to have multiple public keys? Or is this a reference to bls multisig?

// ... enforce that a mutation request has a valid signature of the owner
is it a dual check, firstly for the owner signature secondly the appropriate permission exists?


Mostly unrelated, but it seems that transfer.rs is a wallet action since it involves money, but the only mention of a wallet is very indirectly in messaging/network.rs (seems to me like wallet is a noun so I would anticipate a Wallet struct or even a separate file dedicated to it but neither of things are there).

Transfer is (to my current understanding) a verb but the implementation of Transfer seems to be a noun. Maybe Transaction is more appropriate?

Just trying to see if I understand this, not trying to suggest a change in the code.


Maybe some context might help here. I’m investigating the potential for adding scripting for mutations, just for my own interest, to open up more options for smart contracts, reward puzzles, possibly distributed compute. So I’ve been looking at how mutations are verified and am hoping to refactor that part. The refactor would keep the exact same behavior as the current implementation but within a scripting paradigm rather than the implied-from-structs-and-implementation system currently being used.

After that refactor it would be possible to extend the scripting language so mutations could be done under more complex scenarios than just ‘verify signature’. But the extension of the scripting language is not something I’m looking to do just yet.

I had anticipated that money transactions would have been a type of map mutation but it looks like that may not be the case. Is my understanding correct?

It’s not possible as yet. Eventually BLS or even a vec of keys could be used here I think.


In general, once we’ve gotten something new into the hands of folks, we’ll be replacing the current map types w/ a CRDT implementation. I’ve started a POC of that over here: GitHub - joshuef/sn_data_types at Feat-MapCRDT which may be of interest. (Still very much WIP. MVReg is purely a placeholder there, I think LWWreg is perhaps better. Perms needs to be pulled in from the Seq CRDT impl we currently have).

In terms of the check we have in Seq / CRDT (which is where we’re going and I’m a bit more familiar with), owner is the owner of the current data replica. It’s not wholly linked to ownership of the data on the network. It is the PK of the signer of the ops. So ensures that data is signed for insertion by a valid entity (and that entity exists in the permission tree for the current data). So there, you can be an owner, and NOT have permission to edit the data on the network. (Or indeed locally once an owner has been set.)

I hope that makes some sense? I’m pretty fresh into that bit of the codebase, so may be off here (cc @bochaco corret me if I’m wrong).


Wallet as a concept we have more as a data struct which could have/manage various keys. So we’ve been actively avoiding using it inside transfers. Where we (currently ; naming is still a bit in flux) have and act upon our balances…

Transfer vs Transaction … I think they both work for moving of money. I initiate a bank transfer myself (where I’m from I mean), so seems nouny to me. (FYI previously had Transaction, @oetyng may have more to say on naming here).


I’d look at mutating Sequence data if it fits your purpose. As I said above, we’re intending to get Maps CRDT compliant, but there’s still a bit to be doing there.


Yup that’s correct. Transfers are handled separately from key management with wallets (which is atm app layer in the CLI). In case you’re not familiar: GitHub - maidsafe/sn_transfers: Implementation of Transfers in the SAFE Network. has all the logic for transfers.

2 Likes

Thanks this is great to know about WIP, really helps know where to focus or not focus.

Yeah I can see how Transfer could be a noun too, thanks for the clarification.

Ah I had forgotten about this, thanks for highlighting it! Really appreciate your response, I will dig in deeper now my initial impressions have been clarified.

2 Likes

That comment was originally made in reference to BLS, so you can have many owners by having BLS key shares.

The owner is the actual owner of the data, and the user can be the owner, and/or have perms to mutate/access the data. This is an example of how currently Map does this check: sn_data_types/src/map.rs at master · maidsafe/sn_data_types · GitHub, or here we do it for a public Sequence data: sn_data_types/src/sequence/metadata.rs at master · maidsafe/sn_data_types · GitHub

2 Likes