iroha icon indicating copy to clipboard operation
iroha copied to clipboard

identify trigger as an account?

Open s8sato opened this issue 1 year ago • 1 comments

I guess trigger will be able to be identified as an account.

I don't think it has been broken down into issues yet. If we want to support use cases where a trigger needs different permission than the registrant account (e.g. swap between two accounts, #1212), the trigger should reference its own account (or should be identified as an account). The ideas of system level triggers and technical accounts were suggested in as early as Triggers ADR. Similar concepts include Contract Address and Program Derived Addresses

Originally posted by @s8sato in https://github.com/hyperledger/iroha/pull/4668#discussion_r1620176299

In this way, trigger has authority different from the registrant and can manage transactions involving multiple authorities. Use cases such as locking assets could also be implemented by the trigger taking the assets

s8sato avatar May 30 '24 13:05 s8sato

One of the possible paths is as follows:

  1. as of f12077d35

    struct AccountId {
        domain_id: DomainId,
        signatory: PublicKey,
    }
    
  2. shallow objects #3921 should allow AccountId to be independent of DomainId

    struct AccountId(PublicKey);
    
  3. multisig accounts #4373 should require AccountId to be like enum

    enum AccountId {
        Personal(PublicKey),
        Shared(RawId),
    }
    
    type RawId = Box<[u8; 32]>;
    
  4. add a variant for triggers

    enum AccountId {
        Personal(PublicKey),
        Shared(RawId),
        Trigger(RawId),
    }
    

s8sato avatar May 30 '24 13:05 s8sato