Closed brenzi closed 3 years ago
Does ethereum also provide the possibility to register to events and get the payload of such an event? This is currently the solution for substraTEE (indirect invocation), but could also be replaced with direct invocation (the client talks directly to the worker).
The separation and re-factoring of the substraTEE codebase may be a painful process. The current solution looks pretty much like an Italien pasta dish (see section Strategy) and a clear architecture must be established before starting the refactoring.
@electronix Yes, the web3 library allows you to listen to events. About the refactoring: yes, there is architectural work to be done before jumping into the hacking.
substrate now supports secp256k1 in master. some problems resolve themselves just like that ;-)
SubstraTEE-worker could be abstracted from substrate and used with ethereum. Working title: eTEEreum. This issue lists the main steps.
The substrate blockchain serves two purposes for substraTEE:
Key Differences between chains
Differences substrate -> ethereum
expected difficulties
Without further investigation, I'd expect the following obstacles and cost-drivers:
no_std
support for ethereum-specific crates like rust-web3no_std
or in rust-sgx-sdk forks (i.e. https://github.com/mesalock-linux/ring-sgx or https://github.com/mesalock-linux/rust-crypto-sgxStrategy
In order to minimize maintenance for both SubstraTEE-worker and eTEEreum-worker we should start with refactoring the code to have better abstraction from the underlying chain. Then we can replace substrate-specific interfaces with ethereum ones.
Here are a few seleceted dependencies showing that our current architecture is very much entangled with substrate and needs some refactoring:
crypto primitives
substrate already features abstraction of ecc curve as well as hashes. It should be straight-forward to support ethereum primitives within substrate crate-forks (patching paritytech/substrate crates). I'd even expect parity to accept a PR with additional primitives support
See: https://github.com/paritytech/substrate/blob/0cfe7438b6cf2a2a3cb1f4ba98a83a17d3fe866c/core/primitives/src/crypto.rs#L570
tasks
The following tasks are a preliminary plan, TBD.
chain_api-client
), to be implemented either for substrate or ethereum. (introduce traitchain_interface
?)code pointers
enclave key generation
untrusted side key generation
creating extrinsics/transactions with substrate-api-client
compose_extrinsic
andcompose_extrinsic_offline