Encapsulate access to the client for secret store#11232
Conversation
This one could be pretty involved I think. Do you have any thoughts on it (yet)? |
svyatonik
left a comment
There was a problem hiding this comment.
Thanks! LGTM, though most of introduced traits will be replaced by higher-level traits later. Like some new concepts are still ethereum-specific and won't allow us to use SS in other projects. E.g. contracts are still call Blockchain::retrieve_last_logs() and manually parse ethereum logs. But imo this should be merged as is, because it allows us to extract SS to separate repo (which is, again a necessary step to use it in other projects).
ordian
left a comment
There was a problem hiding this comment.
Merge conflicts need to be resolved and I thought paritytech/parity-common#271 needs to be merged first?
We discussed it @dvdplm and decided to try to separate secret store code into the new repository locally, in order to make sure, that we don't need anything except runtime (that is in PR 271). But in order to proceed to this, I need this preparation PR to be merged. |
dvdplm
left a comment
There was a problem hiding this comment.
Left a few comments, but I'm too unfamiliar with the secretstore code to do a proper review. I am also a bit unsure of what the path looks like from this to a stand-alone secretstore; maybe you can extend the PR description to help reviewers?
| fn block_number(&self, id: BlockId) -> Option<BlockNumber>; | ||
|
|
||
| /// Retrieve last blockchain logs for the filter | ||
| fn retrieve_last_logs(&self, filter: Filter) -> Option<Vec<RawLog>>; |
There was a problem hiding this comment.
To @svyatonik's point about avoiding "ethereum-isms": should we provide a default impl here?
79bae63 to
df7dc81
Compare
Hopefully it's the last step, that will allow to separate SecretStore to its own repository.
Currently Secret Store uses Client in order to retrieve information from the chain, mostly for its service contracts (like check of permissions). This functionality should be hidden behind abstract trait, that should be implemented inside ethcore.
Details about the solution:
Before this change:
pub fn start(client: Arc<Client>, sync: Arc<dyn SyncProvider>, miner: Arc<Miner>, self_key_pair: Arc<dyn NodeKeyPair>, mut config: ServiceConfiguration, db: Arc<dyn KeyValueDB>, executor: Executor) -> Result<Box<dyn KeyServer>, Error>After this change:
pub fn start(trusted_client: Arc<dyn SecretStoreChain>, self_key_pair: Arc<dyn SigningKeyPair>, mut config: ServiceConfiguration, db: Arc<dyn KeyValueDB>, executor: Executor) -> Result<Box<dyn KeyServer>, Error>Tasks: