-
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
Fix how pre-generated keyshares are added for tests #1061
Conversation
crates/testing-utils/src/helpers.rs
Outdated
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 (validator_ips, validator_ids) = spawn_testing_validators(chain_spec_type.clone()).await; |
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.
Maybe just make ChainSpecType
be Copy
(as per https://doc.rust-lang.org/stable/std/marker/trait.Copy.html#when-should-my-type-be-copy)?
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.
Ty
let port = match validator_name { | ||
ValidatorName::Alice => 3001, | ||
ValidatorName::Bob => 3002, | ||
ValidatorName::Charlie => 3003, | ||
ValidatorName::Dave => 3004, | ||
_ => panic!("Unexpected validator name"), | ||
}; |
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.
If the ValidatorName
enum is just for testing, you could use the discriminant to calculate the port:
let port = ValidatorName::Bob as usize + 2
You can also just set the enum variant discriminant directly if you want.
_ => panic!("Unexpected validator name"), | ||
}; | ||
|
||
// let port = 3001 + (validator_name as usize); |
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.
Oh, missed this. Why not do 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.
Gonna do this 👍
.is_ok() | ||
{ | ||
put_keyshares_in_db(keyshare_index, validator_name).await; | ||
keyshare_index += 1; | ||
} |
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.
Would this work here to get rid of the if
?
…
.await
.and_then(|| {
put_keyshares_in_db(keyshare_index, validator_name).await;
keyshare_index += 1;
}
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.
The problem is the await
. Do you know how to do that async?
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'm terrible at async rust but it feels like it should be possible. :/
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.
it should be ok to do a .and_then(|| async { should be maybe probably
Converting to draft as two tests are failing locally (And CI is stuck: https://github.com/entropyxyz/devops-infrastructure/issues/66 ) |
I am a little bit stuck on getting the reshare test to pass. There are some issues with the block number having 1 subtracted from it which were not made clear before, because the OcwMessage which actually got passed from the chain was not needed since alice was no longer a signer, and the other OcwMessages which were mocked worked correctly. Now we do need alice to participate in the reshare, and things are not working. |
* master: Bump clap from 4.5.18 to 4.5.19 in the patch-dependencies group (#1091) Avoid panic by checking that we have a non-signing validator before selecting one (#1083) Fix master build (#1088) Small fixes to `test-cli` (#1084) Pregenerate keyshares sets for all possible initial signer comittees (#1073) Fix master build (#1079) Bump reqwest from 0.12.7 to 0.12.8 in the patch-dependencies group (#1082) Block tss chain when signer (#1078) Run multiple test validator (#1074) Bump tempfile from 3.12.0 to 3.13.0 (#1076) Bump axum from 0.7.6 to 0.7.7 in the patch-dependencies group (#1075) Unignore register and sign integration test, and do a non-mock jumpstart (#1070) No unbonding when signer or next signer (#1031) Add `/relay_tx` endpoint (#1050) Fix how pre-generated keyshares are added for tests (#1061) Handle Provisioning Certification Keys (PCKs) (#1051) Bump async-trait from 0.1.82 to 0.1.83 in the patch-dependencies group (#1067)
#1053 introduced random selection of initial signing set on jumpstart, but our pre-generated keyshares were always being added to alice, bob and charlies kvdbs, regardless of whether they were selected as initial signers.
This fixes that - the pre-generated keyshares are given to whoever is initially selected to be a signer.