Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Remove runtime from secret_store. #9888

Merged

Conversation

c0gent
Copy link
Contributor

@c0gent c0gent commented Nov 9, 2018

  • Remove the independent runtimes from KeyServerHttpListener and
    KeyServerCore and instead require a parity_runtime::Executor
    to be passed upon creation of each.

  • Remove the threads parameter from both ClusterConfiguration structs.

  • Implement the future::Executor trait for parity_runtime::Executor.

  • Update tests.

    • Update the loop_until function to instead use a oneshot to signal
      completion.
    • Modify the make_key_servers function to create and return a runtime.

@parity-cla-bot
Copy link

It looks like @c0gent signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@grbIzl grbIzl requested a review from svyatonik November 12, 2018 14:05
Copy link
Contributor

@lexfrl lexfrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR makes sense to me, in general, but couldn't you provide the actual use-case (example) also and some more rationale on why it is important to merge essentially?

@lexfrl
Copy link
Contributor

lexfrl commented Nov 22, 2018

BTW, how necessary it is to update the cargo.lock in this PR?

@lexfrl lexfrl requested a review from tomusdrw November 22, 2018 13:10
@niklasad1
Copy link
Collaborator

niklasad1 commented Nov 22, 2018

@fckt basically this PR changes secret_store to use parity_runtime::Executor instead of tokio::Executor so I would say that Cargo.lock must be updated in order to do so!

@c0gent
Copy link
Contributor Author

c0gent commented Nov 22, 2018

... couldn't you provide the actual use-case (example) also and some more rationale on why it is important to merge essentially?

This PR is a follow up to #9657 and simply removes an unnecessary extra runtime. (I had been waiting to submit this until #9807 was resolved.) It's possible that there is a tiny performance benefit but this change primarily falls under the category of simplification.

The only changes to usage are that a parity_runtime::Executor must be passed to secret_store::start and KeyServerHttpListener::start.

In terms of potential impact, by consolidating the runtime usage, secret_store tasks now share threads with other tasks spawned within Parity which is, if anything, a slight optimization.

Copy link
Collaborator

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't compile

$ cargo check --features secretstore
 error[E0412]: cannot find type `Executor` in this scope                                                                                                                                                                                        
   --> parity/secretstore.rs:140:69                                                                                                                                                                                                            
    |                                                                                                                                                                                                                                          
140 |         pub fn new(mut conf: Configuration, deps: Dependencies, executor: Executor) -> Result<Self, String> {                                                                                                                            
    |                                                                           ^^^^^^^^ not found in this scope                                                                                                                               
help: possible candidates are found in other modules, you can import them into scope                                                                                                                                                           
    |                                                                                                                                                                                                                                          
119 |     use futures::executor::Executor;                                                                                                                                                                                                     
    |                                                                                                                                                                                                                                          
119 |     use parity_rpc::informant::Executor;                                                                                                                                                                                                 
    |                                                                                                                                                                                                                                          
119 |     use parity_rpc::ws::tokio::executor::Executor;                                                                                                                                                                                       
    |                                                                                                                                                                                                                                          
119 |     use parity_rpc::ws::tokio::prelude::future::Executor;                                                                                                                                                                                
    |                                                                                                                                                                                                                                          
and 2 other candidates                                                                                                                                                                                                                         
                                                                                                                                                                                                                                               
error: aborting due to previous error    

Please fix by adding
use super::{Configuration, Dependencies, NodeSecretKey, ContractAddress, Executor}; on https://github.com/paritytech/parity-ethereum/blob/master/parity/secretstore.rs#L123

@svyatonik
Copy link
Collaborator

Is this this parameter still actual after this PR? Could you please remove it if not?

@c0gent
Copy link
Contributor Author

c0gent commented Nov 24, 2018

I'll sort out the outstanding issues first thing tomorrow.

@c0gent c0gent force-pushed the c0gent-secret-store-executor branch from c23edcf to 7fa64ea Compare November 24, 2018 23:57
@c0gent
Copy link
Contributor Author

c0gent commented Nov 25, 2018

Updated. All items should be addressed.

I went ahead removed one other extra runtime that I was going to leave for a later PR but it's cleaner to do all at once.

Copy link
Collaborator

@sorpaas sorpaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM. A small grumble.

secret_store/src/key_server.rs Show resolved Hide resolved
@sorpaas sorpaas added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. M4-core ⛓ Core client code / Rust. labels Nov 25, 2018
@sorpaas sorpaas added A8-looksgood 🦄 Pull request is reviewed well. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Nov 25, 2018
* Remove the independent runtimes from `KeyServerHttpListener` and
  `KeyServerCore` and instead require a `parity_runtime::Executor`
  to be passed upon creation of each.

* Remove the `threads` parameter from both `ClusterConfiguration` structs.

* Implement the `future::Executor` trait for `parity_runtime::Executor`.

* Update tests.
  - Update the `loop_until` function to instead use a oneshot to signal
    completion.
  - Modify the `make_key_servers` function to create and return a runtime.
@c0gent c0gent force-pushed the c0gent-secret-store-executor branch from 7fa64ea to 791f855 Compare November 25, 2018 16:53
@c0gent
Copy link
Contributor Author

c0gent commented Nov 25, 2018

Made a minor documentation tweak.

@sorpaas sorpaas merged commit c880716 into openethereum:master Nov 25, 2018
@c0gent c0gent deleted the c0gent-secret-store-executor branch November 25, 2018 18:21
@5chdn 5chdn added this to the 2.3 milestone Nov 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants