Summary:
When set-node is called to change the domain of an existing operator, then the previous domain can no longer be used.
Explanation of root cause:
The OCN Registry smart contract keeps a private variable that tracks the domain which have been used:
mapping(string => bool) private uniqueDomains;
When a set-node is called, there is a check that the domain isn't true in the uniqueDomains mapping:
// check for domain uniqueness
require(uniqueDomains[domain] == false, "Domain name already registered.");
uniqueDomains[domain] = true;
So when set-node is called, both the previous domain and the new domain are true in the uniqueDomains mapping
This is the relevant code of delete-node:
string memory domain = nodeOf[operator];
require(bytes(domain).length > 0, "Cannot delete node that does not exist.");// delete node and log
uniqueDomains[domain] = false;
So first, it is getting the current domain of the operator. And then it is setting that to false in the uniqueDomains mapping
So only the current domain is "released" from the uniqueDomains mapping. The previous domain remains set to true in the uniqueDomains and is therefore unusable
As a medium term solution (aside from the documentation you have written - thanks btw!), we might consider the following alternatives on the TS/Kt library/CLI level:
“deprecate” current
set-nodecommand and create a new command that:set-node; if update it callsdelete-nodebeforeset-node.modify
set-nodeto check if the command is create or update: if create continue as normal; if update return an error message that telling the user to first rundelete-node.