-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add test environment with four TS servers #1029
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
dd6872e
Add 4 node setup to integration test chainspec
ameba23 f393fd0
Add helper to create 4 node test setup
ameba23 92d4c86
Reshare test spawns 4 TS servers
ameba23 40e2570
Add daves constants
ameba23 57f907b
Fix initial chain state for mock reshare
ameba23 ee239e3
Fix reshare test
ameba23 8f081f6
Specify chainspec type when spawning TSS nodes
ameba23 68f32ae
Rm debug logging
ameba23 99c7538
Typo
ameba23 1e9b88f
Fix proactive reshare test
ameba23 15a9386
Merge master
ameba23 d231bf1
Rm comment
ameba23 ff619ba
Add test helper fn
ameba23 590ad89
Merge master
ameba23 6568223
Doccomments
ameba23 bcc9982
Refer to client fns as test_client:: in test
ameba23 3028544
Merge master
ameba23 1cab5f5
Update test following merge
ameba23 5781cbb
Update test following merge
ameba23 b92e438
Fix test
ameba23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (C) 2023 Entropy Cryptography Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use crate::{ | ||
chain_api::{get_api, get_rpc, EntropyConfig}, | ||
spawn_testing_validators, | ||
substrate_context::{test_context_stationary, test_node_process_testing_state}, | ||
ChainSpecType, | ||
}; | ||
use entropy_protocol::PartyId; | ||
use subxt::{backend::legacy::LegacyRpcMethods, OnlineClient}; | ||
|
||
/// 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 | ||
pub async fn spawn_tss_nodes_and_start_chain( | ||
add_parent_key: bool, | ||
chain_spec_type: ChainSpecType, | ||
) -> (OnlineClient<EntropyConfig>, LegacyRpcMethods<EntropyConfig>, Vec<String>, Vec<PartyId>) { | ||
let (validator_ips, validator_ids) = | ||
spawn_testing_validators(add_parent_key, chain_spec_type.clone()).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; | ||
( | ||
get_api(&substrate_context.ws_url).await.unwrap(), | ||
get_rpc(&substrate_context.ws_url).await.unwrap(), | ||
) | ||
}, | ||
}; | ||
(api, rpc, validator_ips, validator_ids) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 isn't strictly related to this PR, but since adding a way to specify which chainspec you want to use, i also added this helper which could slightly reduce boilerplate in our tests.
So this would go at the beginning of most of our tests. I haven't actually called this anywhere yet though - i wanted to run it by yous first.
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.
I like this for sure 👍