business-partner-agent
business-partner-agent copied to clipboard
Support Multi Tenancy
As this topics tends to pop up in various discussions I started to write down some thoughts on what changes are needed in the BPA to make this happen if we want to.
This brings me to the following somewhat related aspect, which I would like to point out here. We may consider addressing both aspects here.
Summary. We are using AdjudicatorReq for Register and Withdraw, but each of the methods only use part of the AdjudicatorReq and have or will have additional custom parameters. It might be cleaner to use custom request types for each of them instead.
Details. Here is the Adjudicator type for reference.
AdjudicatorReq struct {
Params *Params
Acc wallet.Account
Tx Transaction
Idx Index // Always the own index
Secondary bool // Optimized secondary call protocol
}
Register requires Params and Tx (i.e., State and Sigs) from AdjudicatorReq, plus it will require the same for each of the submitted sub-states after the virtual channel change. It does not use Account and Idx at all. Secondary is for gas optimization.
Withdraw requires the channel identifier from Params, the participant's account address derived from Acc, and the participant's balance contained in Transaction. It additionally requires the states of the sub-channels. It does not use Secondary.
Suggestion.
Use separate Request Types for Register and Withdraw.
- Register Request Type: Consider removing
AccandIdx. Include the Params, State, and Sigs of subchannels. - Withdraw Request Type: Remove
Secondary. Include states of subchannels.