-
Notifications
You must be signed in to change notification settings - Fork 47
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
STF Design Enhancement Proposal #269
Comments
We should also consider that our two first client use cases don't make use of the stf. It should be very modular, so we can easily leave away he stf (or replace it with things we used for PolkaDEX or Ternoa) @haerdib can you comment if an abstraction of the stf would be helpful here? In the end, PolkaDEX GW is stateful as well, so it could be an stf. But it was too different from our sgx-runtime setup. |
I think that could be really helpful. First of all, with a stf trait we could do better and simpler unit testing. However, for this to cover all possible use cases of state persistence it needs to be extremely abstract. For PolkaDEX we have implemented several different "caches" to represent the states, but none of it actually uses file sealing within the enclave. If necessary, the actual file storage is done outside of the enclave.
The trusted getter get_balance interacts with the balance storage, the trusted call create_order interacts with the create order cache and so on. Maybe PolkaDex is too extreme of an example.. ? |
what is the status of this now? CC @mullefel |
As far as I know, we have not touched this. |
We have not done any refactoring work on the STF crate yet, this is still open |
Added several '#269' for relevant code that should be considered in this issue. |
I find it cumbersome to make changes to
Stf
andStfState
because it is all entangled with enclave code.This is just a rough idea, but I believe we can improve this greatly:
The
StfState
is mostly intertwined with the enclave concerning serialization, crypto and hashing. In my option we could get rid of this by introducing traits in theStf
crate ;SgxDeSerialize
,StateCrypto
,StateHash
(naming to be improved). These traits are then implemented in the enclave. Then we could make theStf
generic over these traits and even handle stuff concerning these three traits under the hood ofStf
, which saves a lot of boilerplate code in the enclave. It gets even more elegant if we makeStf
a trait.A snipped of the proposed
Stf
code follows to give an idea:The text was updated successfully, but these errors were encountered: