Setting "owner" principal for more than one actor

I found myself, while splitting my too big codebase (WASM code became greater than allowed) into two separate actors, writing the following in both halves after the split.

  func onlyMainOwner(caller: Principal) {
    if (?caller != founder) {
      Debug.trap("not the main owner");

Now, the question is how to (re)implement

  public shared({caller}) func setMainOwner(_founder: Principal) {

    founder := ?_founder;

for it to work for both actors?

Variants that come to my mind:

  1. The “main” actor’s setMainOwner to call the another’s actor’s (await setMainOwner) (what to do if the await happens to produce an error, e.g. because of overloaded network?)
  2. Implement onlyMainOwner for one of the two actors as calling another one? (Bad variant, at least, in terms of efficiency.)
  3. Set owners for both actors separately. If an owner transfer ever happens, then it is not too much work to make two function calls instead of one.

“3” seems the best. How do you think?

3 sounds good to me too, but none of these (apart from maybe 2) really solve the problem if you want the change to be transactional - i.e. either all owner changes succeed or none of them do. But maybe you don’t need that for your application?

Yes, I don’t really need changing owner to be transactional. So, I think, I should choose “3”.