Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contracts/opl: Host requires Encave address, Enclave requires Host address? #148

Open
CedarMist opened this issue Jul 5, 2023 · 3 comments

Comments

@CedarMist
Copy link
Member

There is a permanent 1:1 pairing between the two contracts on either side of the MessageBus, and the constructor for either requires the others contract address.

The address can be predicted using const newContractAddress = ethers.utils.getContractAddress({ from: signerAddr, nonce });

However, this could make building OPL contracts difficult when using @oasisprotocol/sapphire-contracts/contracts/OPL.sol as the remote variable of BaseEndpoint is private so it can't be changed after creation so the contracts must be deployed together.

Additionally, the 1:1 relationship between contracts limits the use cases.

Need to document this, and recommend using the Celer IM SDK for more complex use cases.

@nhynes
Copy link
Contributor

nhynes commented Jul 5, 2023

recommend using the Celer IM SDK

The reason it's not like that is because giving up your primary interaction surface (i.e. API) to a third party is bad for the longevity of your business.

And the reason it's "circular" is to avoid making calls to the expensive home chain. I'm also not aware of any concrete use-cases that require octopus messaging. I'd suggest making a separate or extension library for that before making the common case (additionally?) difficult.

@CedarMist
Copy link
Member Author

I agree that OPL can be very neat when the contracts are deployed 1:1 together, with one endpoint on Sapphire and another on a foreign chain, and we should keep it simple.

That being said, I'm sure people will come up with interesting octopus (1:N or N:1) & graph (N:M) patterns, although these can be made with the current pattern by deploying a factory on each chain, or just one pair of contracts for each chain<->chain connection.

@CedarMist CedarMist reopened this Jul 5, 2023
@CedarMist
Copy link
Member Author

CedarMist commented Jul 5, 2023

One suggestion would just be to let the remote address & chainID to be set whenever the contract wants, so just making them internal rather than private, giving a bit of extra flexibility and options versus the strict 1:1 paired constructors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants