integritee-network / worker

Integritee off-chain worker and sidechain validateer
Apache License 2.0
89 stars 46 forks source link

Make `TrustedOperation|TrustedCall` a sgx-runtime type #1302

Closed Kailai-Wang closed 1 year ago

Kailai-Wang commented 1 year ago

Is it possible to make them an sgx-runtime type so that they are included in the sgx-metadata, which can be used to generate types for F/E usage (e.g. when they need to construct a trustedCall for direct invocation)?

Adding derived trait bounds (TypeInfo, MaxEncodeLen) won't be an issue, the real problem is the dependency: ita-stf depends on ita-sgx-runtime, if we introduce TrustedCall into the runtime, ita-sgx-runtime would in turn depend on ita-stf again, which creates a cyclic dependency.

Moving only the definition of those enums to a place both crates depend on, or simply to sgx-runtime won't work because of the orphan rule.

Moving trait impl along won't work because of no_std of runtime

Is there any other way to easily do it?

clangenb commented 1 year ago

I can see why we want this, and I can see the problems.

However, we could move the trait implementation along - I don't see a no std issue, the trait implementation and the sgx-runtime have to work in the enclave, which they do. But I am uncertain if merging all in into one crate is the nice solution.

Kailai-Wang commented 1 year ago

I'm also feeling reluctant to move all into one crate - looks like there's no easy way out. I'll close this issue, thanks!