-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allow offchain worker requests to all TSS nodes in entropy-tss
test environment
#1147
Changes from 15 commits
b503027
e3438ff
2ac5f7f
7fdf274
4f57bde
9346adf
3c4b1a4
fbf1fb5
b1c74b3
53a60d9
18c91cc
c7358c7
0242a97
7168169
990e58b
e6ccb03
473a245
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember there was a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
use crate::{ | ||
chain_api::{get_api, get_rpc, EntropyConfig}, | ||
spawn_testing_validators, | ||
substrate_context::{test_context_stationary, test_node_process_testing_state}, | ||
ChainSpecType, | ||
substrate_context::test_node_process_testing_state, | ||
ChainSpecType, TestNodeProcess, | ||
}; | ||
use entropy_protocol::PartyId; | ||
use rand::{rngs::StdRng, SeedableRng}; | ||
|
@@ -26,31 +26,28 @@ pub use tdx_quote::encode_verifying_key; | |
|
||
/// A helper for setting up tests which starts both a set of TS servers and a chain node and returns | ||
/// the chain API as well as IP addresses and PartyId of the started validators | ||
/// | ||
/// Note that since this function does not reside in entropy-tss, cfg(test) will be false when the | ||
/// TSS nodes are set up, meaning the unsafe API will not be enabled | ||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not introduce a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is a good idea |
||
pub async fn spawn_tss_nodes_and_start_chain( | ||
chain_spec_type: ChainSpecType, | ||
) -> (OnlineClient<EntropyConfig>, LegacyRpcMethods<EntropyConfig>, Vec<String>, Vec<PartyId>) { | ||
) -> ( | ||
Vec<TestNodeProcess<EntropyConfig>>, | ||
OnlineClient<EntropyConfig>, | ||
LegacyRpcMethods<EntropyConfig>, | ||
Vec<String>, | ||
Vec<PartyId>, | ||
Comment on lines
+35
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At this point we should probably move these into a struct, or at least typedef it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thats a good idea. But could turn into quite a big change, because once having a struct we may as well pass it to test helper functions. Generally, we could bundle api and rpc together into a struct and use it in all client functions. The I would maybe do that in a followup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When I was trying to parallelize the tests I was using them because they would change between runs. Ofc if you open a PR with them hardcoded as they are now it won't be a problem, but it would be a bonus if we did provide some flexibility for them. |
||
) { | ||
let (validator_ips, validator_ids) = spawn_testing_validators(chain_spec_type).await; | ||
|
||
let (api, rpc) = match chain_spec_type { | ||
ChainSpecType::Development => { | ||
let substrate_context = test_context_stationary().await; | ||
( | ||
get_api(&substrate_context.node_proc.ws_url).await.unwrap(), | ||
get_rpc(&substrate_context.node_proc.ws_url).await.unwrap(), | ||
) | ||
}, | ||
ChainSpecType::Integration => { | ||
// Here we need to use `--chain=integration-tests` and force authoring otherwise we won't be | ||
// able to get our chain in the right state to be jump started. | ||
let force_authoring = true; | ||
let substrate_context = &&test_node_process_testing_state(force_authoring).await[0]; | ||
( | ||
get_api(&substrate_context.ws_url).await.unwrap(), | ||
get_rpc(&substrate_context.ws_url).await.unwrap(), | ||
) | ||
}, | ||
}; | ||
(api, rpc, validator_ips, validator_ids) | ||
// Here we need to force authoring otherwise we won't be able to get our chain in the right | ||
// state to be jump started. | ||
let force_authoring = true; | ||
let substrate_context = test_node_process_testing_state(chain_spec_type, force_authoring).await; | ||
let api = get_api(&substrate_context[0].ws_url).await.unwrap(); | ||
let rpc = get_rpc(&substrate_context[0].ws_url).await.unwrap(); | ||
|
||
(substrate_context, api, rpc, validator_ips, validator_ids) | ||
} | ||
|
||
/// Get the mock PCK that will be used for a given TSS account ID | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just renamed for clarity