Skip to content

Commit 6cad8e8

Browse files
committed
fix: clean up secure signing.
1 parent aded743 commit 6cad8e8

File tree

23 files changed

+1766
-51
lines changed

23 files changed

+1766
-51
lines changed

Cargo.lock

Lines changed: 1032 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ members = [
1010
"protocol-units/post-confirmations/*",
1111
"protocol-units/fast-confirmations/*",
1212
"protocol-units/ffs/*",
13+
"util/signing/eth",
14+
"util/environment",
1315
]
1416

1517
[workspace.package]
@@ -65,11 +67,19 @@ tracing-test = "0.2.5"
6567
tokio = { version = "1.35.1", features = ["full", "tracing"] }
6668
tokio-stream = "0.1.15"
6769

70+
# secure-signing
71+
secure-signer = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "62d9ae5fd098d2c0d2a2da2004ada91681e0df53" }
72+
secure-signer-loader = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "62d9ae5fd098d2c0d2a2da2004ada91681e0df53" }
73+
secure-signer-aws-kms = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "62d9ae5fd098d2c0d2a2da2004ada91681e0df53" }
74+
6875
# internal
6976
## mcr
7077
mcr-types = { path = "protocol-units/mcr/util/types" }
78+
mcr-config = { path = "protocol-units/mcr/util/config" }
7179
mcr-client-util = { path = "protocol-units/mcr/clients/util" }
7280
mcr-settlement-client = { path = "protocol-units/mcr/client" }
81+
secure-signing-eth = { path = "util/signing/eth" }
82+
ffs-environment = { path = "util/environment" }
7383

7484
[workspace.lints.clippy]
7585
debug_assert_with_mut_call = "deny"

protocol-units/mcr/client/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ tokio = { workspace = true }
4343
tokio-stream = { workspace = true }
4444
tracing = { workspace = true }
4545
serde = { workspace = true }
46-
46+
secure-signer = { workspace = true }
47+
secure-signer-loader = { workspace = true }
48+
secure-signing-eth = { workspace = true }
4749

4850
alloy-rpc-types = { workspace = true }
4951
futures = { workspace = true }
5052
tracing-subscriber = { workspace = true }
5153

54+
mcr-types = { workspace = true }
55+
mcr-config = { workspace = true }
56+
5257
[features]
5358
default = ["eth"]
5459
e2e = ["eth"]

protocol-units/mcr/client/src/bin/e2e/test_client_settlement.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use alloy_network::EthereumWallet;
44
use alloy_primitives::Address;
55
use alloy_primitives::U256;
66
use anyhow::Context;
7-
use godfig::{backend::config_file::ConfigFile, Godfig};
7+
use ffs_environment::{backend::config_file::ConfigFile, ffs_environment};
8+
use mcr_config::Config;
89
use mcr_settlement_client::eth_client::Client;
910
use mcr_settlement_client::eth_client::{MOVEToken, MovementStaking, MCR};
1011
use mcr_settlement_client::McrSettlementClientOperations;
11-
use mcr_settlement_config::Config;
12-
use movement_types::block::{BlockCommitment, Commitment, Id};
12+
use mcr_types::block_commitment::{BlockCommitment, Commitment, Id};
1313
use std::str::FromStr;
1414
use tokio_stream::StreamExt;
1515
use tracing::info;
@@ -219,10 +219,10 @@ pub async fn main() -> Result<(), anyhow::Error> {
219219
let dot_movement = dot_movement::DotMovement::try_from_env()?;
220220
let config_file = dot_movement.try_get_or_create_config_file().await?;
221221

222-
// get a matching godfig object
223-
let godfig: Godfig<Config, ConfigFile> =
224-
Godfig::new(ConfigFile::new(config_file), vec!["mcr_settlement".to_string()]);
225-
let config: Config = godfig.try_wait_for_ready().await?;
222+
// get a matching ffs_environment object
223+
let ffs_environment: ffs_environment<Config, ConfigFile> =
224+
ffs_environment::new(ConfigFile::new(config_file), vec!["mcr_settlement".to_string()]);
225+
let config: Config = ffs_environment.try_wait_for_ready().await?;
226226
let rpc_url = config.eth_rpc_connection_url();
227227

228228
let testing_config = config.testing.as_ref().context("Testing config not defined.")?;
@@ -239,7 +239,7 @@ pub async fn main() -> Result<(), anyhow::Error> {
239239
// Build client 1 and send the first commitment.
240240
//let settlement_config =
241241
let config1 = Config {
242-
settle: mcr_settlement_config::common::settlement::Config {
242+
settle: mcr_config::common::settlement::Config {
243243
signer_private_key: testing_config
244244
.well_known_account_private_keys
245245
.get(1)
@@ -265,7 +265,7 @@ pub async fn main() -> Result<(), anyhow::Error> {
265265

266266
// Build client 2 and send the second commitment.
267267
let config2 = Config {
268-
settle: mcr_settlement_config::common::settlement::Config {
268+
settle: mcr_config::common::settlement::Config {
269269
signer_private_key: testing_config
270270
.well_known_account_private_keys
271271
.get(2)

protocol-units/mcr/client/src/eth_client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use alloy_sol_types::sol;
2020
use alloy_transport::BoxTransport;
2121
use alloy_transport_ws::WsConnect;
2222
use anyhow::Context;
23-
use mcr_settlement_config::Config;
24-
use movement_signer::cryptography::secp256k1::Secp256k1;
25-
use movement_signer_loader::Load;
26-
use movement_signing_eth::HsmSigner;
27-
use movement_types::block::{BlockCommitment, Commitment, Id};
23+
use mcr_config::Config;
24+
use mcr_types::block_commitment::{BlockCommitment, Commitment, Id};
25+
use secure_signer::cryptography::secp256k1::Secp256k1;
26+
use secure_signer_loader::Load;
27+
use secure_signing_eth::HsmSigner;
2828
use serde_json::Value as JsonValue;
2929
use std::array::TryFromSliceError;
3030
use std::fs;

protocol-units/mcr/client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use movement_types::block::BlockCommitment;
1+
use mcr_types::block_commitment::BlockCommitment;
22
use tokio_stream::Stream;
33
pub mod mock;
44

protocol-units/mcr/client/src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{CommitmentStream, McrSettlementClientOperations};
2-
use mcr_settlement_config::Config;
3-
use movement_types::block::BlockCommitment;
2+
use mcr_config::Config;
3+
use mcr_types::block_commitment::BlockCommitment;
44
use std::collections::BTreeMap;
55
use std::sync::{Arc, Mutex};
66
use tokio::sync::{mpsc, RwLock};
@@ -153,7 +153,7 @@ impl McrSettlementClientOperations for McrSettlementClient {
153153
pub mod test {
154154

155155
use super::*;
156-
use movement_types::block::Commitment;
156+
use mcr_types::block_commitment::Commitment;
157157

158158
use futures::future;
159159
use tokio::select;

protocol-units/mcr/manager/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ futures = { workspace = true }
2121
tokio = { workspace = true }
2222
tokio-stream = { workspace = true }
2323
serde_json = { workspace = true }
24-
25-
[dev-dependencies]
26-
mcr-settlement-client = { workspace = true, features = ["mock"] }
24+
mcr-types = { workspace = true }
25+
mcr-config = { workspace = true }
2726

2827
[features]
2928
default = ["stub"]

protocol-units/mcr/manager/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use movement_types::block::{BlockCommitment, BlockCommitmentEvent};
1+
use mcr_types::block_commitment::{BlockCommitment, BlockCommitmentEvent};
22
use tokio_stream::Stream;
33

44
mod manager;

protocol-units/mcr/manager/src/manager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{BlockCommitmentEvent, CommitmentEventStream, McrSettlementManagerOperations};
22

3+
use mcr_config::Config;
34
use mcr_settlement_client::McrSettlementClientOperations;
4-
use mcr_settlement_config::Config;
5-
use movement_types::block::{BlockCommitment, BlockCommitmentRejectionReason};
5+
use mcr_types::block_commitment::{BlockCommitment, BlockCommitmentRejectionReason};
66

77
use async_stream::stream;
88
use async_trait::async_trait;
@@ -147,7 +147,7 @@ fn process_commitments<C: McrSettlementClientOperations + Send + 'static>(
147147
mod tests {
148148
use super::*;
149149
use mcr_settlement_client::mock::McrSettlementClient;
150-
use movement_types::block::{BlockCommitment, Commitment};
150+
use mcr_types::block_commitment::{BlockCommitment, Commitment};
151151

152152
#[tokio::test]
153153
async fn test_block_commitment_accepted() -> Result<(), anyhow::Error> {

0 commit comments

Comments
 (0)