-
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
Reshare e2e test #1254
Reshare e2e test #1254
Changes from 5 commits
81f8bbb
3ca4b2a
af6a337
c283b0d
5db22d1
0ff85ea
cde51dc
a83bc40
fdab7fd
3b22b93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ tagged as the final release. | |
|
||
## Pre-Prep | ||
- [ ] Inform relevant parties that you're preparing a release (e.g, by posting on Discord) | ||
- [ ] Manually run e2e reshare test | ||
(first compile node with features=reshare-test and then run | ||
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 took this to mean do this:
but this gives me:
How are you compiling the runtime with this feature flag without having it present in 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. gonna add based on the other comment, but weird I don't see it locally or on CI |
||
```cargo test --release --features=reshare-test -- --test test_reshare_e2e```) | ||
JesseAbram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [ ] Create a release branch, e.g., for release candidate `1`: `release/vX.Y.Z-rc.1`. | ||
|
||
## Prep the Runtime and Node | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,4 +113,5 @@ alice =[] | |
bob =[] | ||
# Enable this feature to run the integration tests for the wasm API of entropy-protocol | ||
# This requires the entropy-protocol node-js module to be built and so is not run by default | ||
wasm_test=[] | ||
wasm_test =[] | ||
reshare-test=[] | ||
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. We should add some comments explaining the feature here and in the other TOML files |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,6 +239,64 @@ async fn test_reshare_basic() { | |
clean_tests(); | ||
} | ||
|
||
#[cfg(feature = "reshare-test")] | ||
#[tokio::test] | ||
#[serial] | ||
async fn test_reshare_e2e() { | ||
initialize_test_logger().await; | ||
clean_tests(); | ||
|
||
let (_validator_ips, _validator_ids) = | ||
spawn_testing_validators(crate::helpers::tests::ChainSpecType::IntegrationJumpStarted) | ||
.await; | ||
|
||
let force_authoring = true; | ||
let context = | ||
test_node_process_testing_state(ChainSpecType::IntegrationJumpStarted, force_authoring) | ||
.await; | ||
let api = get_api(&context[0].ws_url).await.unwrap(); | ||
let rpc = get_rpc(&context[0].ws_url).await.unwrap(); | ||
let client = reqwest::Client::new(); | ||
Comment on lines
+249
to
+259
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. We can replace this with |
||
|
||
// Get current signers | ||
let signer_query = entropy::storage().staking_extension().signers(); | ||
let signer_stash_accounts = query_chain(&api, &rpc, signer_query, None).await.unwrap().unwrap(); | ||
let old_signer_ids: HashSet<[u8; 32]> = | ||
HashSet::from_iter(signer_stash_accounts.clone().into_iter().map(|id| id.0)); | ||
let key_share_before = unsafe_get(&client, hex::encode(NETWORK_PARENT_KEY), 3002).await; | ||
|
||
let mut i = 0; | ||
// Wait up to 2min for reshare to complete: check once every second if we have a new set of signers. | ||
let _ = loop { | ||
let new_signer_ids: HashSet<[u8; 32]> = { | ||
let signer_query = entropy::storage().staking_extension().signers(); | ||
let signer_ids = query_chain(&api, &rpc, signer_query, None).await.unwrap().unwrap(); | ||
HashSet::from_iter(signer_ids.into_iter().map(|id| id.0)) | ||
}; | ||
if new_signer_ids != old_signer_ids { | ||
break Ok(new_signer_ids); | ||
} | ||
if i > 240 { | ||
break Err("Timed out waiting for reshare"); | ||
} | ||
i += 1; | ||
tokio::time::sleep(std::time::Duration::from_secs(1)).await; | ||
} | ||
.unwrap(); | ||
|
||
// wait for rotate keyshare | ||
tokio::time::sleep(std::time::Duration::from_secs(10)).await; | ||
|
||
let key_share_after = unsafe_get(&client, hex::encode(NETWORK_PARENT_KEY), 3002).await; | ||
assert_ne!(key_share_before, key_share_after); | ||
|
||
// wait for rotate keyshare 2 | ||
tokio::time::sleep(std::time::Duration::from_secs(80)).await; | ||
|
||
let key_share_after_2 = unsafe_get(&client, hex::encode(NETWORK_PARENT_KEY), 3002).await; | ||
assert_ne!(key_share_after, key_share_after_2); | ||
} | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn test_reshare_none_called() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,10 @@ pub mod time { | |
|
||
// NOTE: Currently it is not possible to change the epoch duration after the chain has started. | ||
// Attempting to do so will brick block production. | ||
#[cfg(not(feature = "reshare-test"))] | ||
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 4 * HOURS; | ||
#[cfg(feature = "reshare-test")] | ||
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 15 / (SECS_PER_BLOCK as BlockNumber); | ||
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 define this in terms of 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. because I want it less than one minuet and I I get an overflow problem that way |
||
pub const EPOCH_DURATION_IN_SLOTS: u64 = { | ||
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64; | ||
|
||
|
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 would try and avoid running this manually and instead make it a part of the release CI job. We have an
on > push > release/...
stage where we can add an extra testing stage which encompasses this.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.
should be doable but let me do in another PR so I can work with zach of vi on that
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.
#1270