Skip to content
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

Moved multisig to its own crate #3147

Merged
merged 14 commits into from
May 2, 2023
Merged

Moved multisig to its own crate #3147

merged 14 commits into from
May 2, 2023

Conversation

j4m1ef0rd
Copy link
Contributor

@j4m1ef0rd j4m1ef0rd commented Apr 27, 2023

Pull Request

Closes: PRO-101
Closes: #3022

Checklist

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

  • Moved multisig to a new crate.
  • Moved a few things into multisig:
    • moved pubkey_to_eth_addr to multisig crate
    • moved logging tags to failure reason
    • moved OutgoingMultisigStageMessages && ProtocolVersion to multisig::p2p
  • Moved a few things out of multisig
    • moved CEREMONY_ID_WINDOW to client
    • moved test logger to utilities crate so it can be used in the multisig crate
  • Changed a few things to be in feature flag "test" instead of cfg test so they could be used in the engine crate
    • movedget_key_data_for_test from helpers to keygen_detail. (because helpers is cfg test)

Result

  • The build time of the engine seems to be unaffected, around 10sec before and after this PR.
  • Making changes to the multisig files will cause an incremental test build time of around 4sec instead of 10sec before this PR.
    image
    Note: build times in the above image are taken using cargo build --timing with the selected package. So the times are different from my quoted test build times that are from cargo test ...

@j4m1ef0rd j4m1ef0rd added the CFE label Apr 27, 2023
@j4m1ef0rd j4m1ef0rd self-assigned this Apr 27, 2023
@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #3147 (7bf7e05) into main (6e972c1) will increase coverage by 0.00%.
The diff coverage is 45.32%.

@@           Coverage Diff           @@
##             main    #3147   +/-   ##
=======================================
  Coverage   68.52%   68.53%           
=======================================
  Files         314      314           
  Lines       48807    48816    +9     
  Branches    48807    48816    +9     
=======================================
+ Hits        33445    33454    +9     
  Misses      10602    10602           
  Partials     4760     4760           
Impacted Files Coverage Δ
...gine/multisig/src/client/ceremony_manager/tests.rs 97.46% <ø> (ø)
engine/multisig/src/client/ceremony_runner.rs 82.10% <ø> (ø)
...ngine/multisig/src/client/ceremony_runner/tests.rs 90.71% <ø> (ø)
engine/multisig/src/client/common/broadcast.rs 85.82% <ø> (ø)
...ltisig/src/client/common/broadcast_verification.rs 99.14% <ø> (ø)
...ngine/multisig/src/client/common/ceremony_stage.rs 100.00% <ø> (ø)
...ngine/multisig/src/client/common/failure_reason.rs 28.57% <ø> (ø)
engine/multisig/src/client/key_store_api.rs 50.00% <ø> (ø)
engine/multisig/src/client/keygen/keygen_data.rs 76.54% <ø> (ø)
...ne/multisig/src/client/keygen/keygen_data/tests.rs 100.00% <ø> (ø)
... and 49 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@linear
Copy link

linear bot commented Apr 27, 2023

PRO-101 Investigate putting multisig in its own create

Description

See if compile time when only making changes to the multisig stuff is faster.
THis would be nice because we often make small changes to unit tests and then run them.

@kylezs
Copy link
Contributor

kylezs commented Apr 27, 2023

Making changes to the multisig files will cause an incremental build time of around 4sec instead of 10sec before this PR.

Would be nice to describe how exactly these times were measured for posterity's sake.

}

#[derive(Debug)]
pub struct VersionedCeremonyMessage {
Copy link
Contributor

Choose a reason for hiding this comment

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

This one probably doesn't belong in multisig, but I see that it is needed for tests, so I'm fine this leaving it here for now.

Copy link
Contributor

@AlastairHolmes AlastairHolmes left a comment

Choose a reason for hiding this comment

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

The only thing I'm really concerned with it the cfg feature = test thing. What do you mean it will may cascade? Merge now without any further changes if you like. But all the comments should be responded to.

}
}

use std::{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not put the imports at the top of the file?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same above

@@ -5,9 +5,10 @@ mod keygen_stages;
#[cfg(test)]
mod tests;

#[cfg(test)]
#[cfg(feature = "test")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use this instead of cfg(test)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't share cfg test stuff to other crates.
rust-lang/cargo#8379

pub const ETH_STREAM_BEHIND: &str = "eth-stream-behind";

use tracing::{metadata::LevelFilter, Level};
use tracing_subscriber::{EnvFilter, Layer};
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest moving the entire logger (Whenever you like), I'm guessing the api and other tools will need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not much left in the file, so i moved them out and deleted the file.

j4m1ef0rd added 2 commits May 2, 2023 10:16
fix: multisig use error from merge.
chore: removed unneeded pub use of init_test_logger
@j4m1ef0rd j4m1ef0rd merged commit cf746d0 into main May 2, 2023
@j4m1ef0rd j4m1ef0rd deleted the feat/multisig-crate2 branch May 2, 2023 02:16
syan095 added a commit that referenced this pull request May 4, 2023
* origin/main:
  feat: witness XCallNative and XCallToken (#3171)
  Additional Key Handover Tests (#3165)
  refactor/chore: remove db migration from 0 to 1 (#3166)
  fix: use correct stage name for PubkeyShares0 PRO-259 (#3167)
  ci: add timeout to post-checks ⏳ (#3169)
  chore: parallel post-check and publish (#3168)
  fix: add missing features on dep in utils (#3164)
  Moved multisig to its own crate (#3147)
  Refactor/database (#3150)
  fix: correct addresses for localnets (#3162)
  refactor/scc (#3078)
  fix: remove cancel workflow (#3160)
  refactor: remove epoch authority count (#3154)
  chore: remove mentions of sui (#3158)
  fix: remove duplicate role check (#3157)
  chore: remove unused quickcheck dep (#3156)
  feat: refactor Chainflip trait (#3144)
  chore: remove unused CFE deps (#3152)

# Conflicts:
#	state-chain/pallets/cf-swapping/src/mock.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate putting multisig in its own create
4 participants