@@ -5,8 +5,10 @@ use crate::executor::EXECUTOR_CHANNEL_SIZE;
5
5
use crate :: { bootstrap, Context } ;
6
6
use anyhow:: Context as _;
7
7
use aptos_config:: config:: NodeConfig ;
8
+ #[ cfg( test) ]
8
9
use aptos_crypto:: ed25519:: Ed25519PrivateKey ;
9
10
use aptos_crypto:: ed25519:: Ed25519PublicKey ;
11
+ #[ cfg( test) ]
10
12
use aptos_crypto:: ValidCryptoMaterialStringExt ;
11
13
use aptos_executor:: block_executor:: BlockExecutor ;
12
14
use aptos_mempool:: MempoolClientRequest ;
@@ -19,21 +21,6 @@ use movement_signer::Signing;
19
21
#[ cfg( test) ]
20
22
use movement_signer_loader:: identifiers:: { local:: Local , SignerIdentifier } ;
21
23
use movement_signer_loader:: { Load , LoadedSigner } ;
22
- //=======
23
- //use aptos_types::transaction::SignedTransaction;
24
- //use maptos_execution_util::config::Config;
25
-
26
- //use movement_signer_loader::identifiers::{local::Local, SignerIdentifier};
27
-
28
- //use anyhow::Context as _;
29
- //use aptos_crypto::Uniform;
30
- //use futures::channel::mpsc as futures_mpsc;
31
- //use movement_collections::garbage::{counted::GcCounter, Duration};
32
- //use tokio::sync::mpsc;
33
-
34
- //use tempfile::TempDir;
35
-
36
- //>>>>>>> main
37
24
use std:: net:: ToSocketAddrs ;
38
25
use std:: sync:: { Arc , RwLock } ;
39
26
use tempfile:: TempDir ;
@@ -45,6 +32,10 @@ impl Executor {
45
32
public_key : Ed25519PublicKey ,
46
33
mempool_tx_exec_result_sender : UnboundedSender < Vec < TxExecutionResult > > ,
47
34
) -> Result < Self , anyhow:: Error > {
35
+ // get dot movement
36
+ // todo: this is a slight anti-pattern, but it's fine for now
37
+ let dot_movement = DotMovement :: try_from_env ( ) ?;
38
+
48
39
// set up the node config
49
40
let mut node_config = NodeConfig :: default ( ) ;
50
41
@@ -109,8 +100,7 @@ impl Executor {
109
100
110
101
// indexer table info config
111
102
node_config. indexer_table_info . enabled = true ;
112
- let db_dir = maptos_config. chain . maptos_db_path . as_ref ( ) . context ( "No db path provided." ) ?;
113
- node_config. storage . dir = db_dir. join ( "maptos-storage" ) ;
103
+ node_config. storage . dir = dot_movement. get_path ( ) . join ( "maptos-storage" ) ;
114
104
node_config. storage . set_data_dir ( node_config. storage . dir . clone ( ) ) ;
115
105
116
106
let known_release = aptos_framework_known_release:: KnownRelease :: try_new (
@@ -203,35 +193,35 @@ impl Executor {
203
193
Ok ( ( executor, tempdir) )
204
194
}
205
195
206
- pub async fn try_generated ( ) -> Result <
207
- (
208
- Self ,
209
- TempDir ,
210
- Ed25519PrivateKey ,
211
- futures:: channel:: mpsc:: Receiver < Vec < TxExecutionResult > > ,
212
- ) ,
213
- anyhow:: Error ,
214
- > {
215
- // generate a random private key
216
- let private_key = Ed25519PrivateKey :: generate_for_testing ( ) ;
217
-
218
- // generate a sender
219
- let ( mempool_tx_exec_result_sender, receiver) =
220
- futures_mpsc:: channel :: < Vec < TxExecutionResult > > ( EXECUTOR_CHANNEL_SIZE ) ;
221
- let tempdir = tempfile:: tempdir ( ) ?;
222
-
223
- let mut maptos_config = Config :: default ( ) ;
224
- let raw_private_key_hex = private_key. to_encoded_string ( ) ?. to_string ( ) ;
225
- let prefix_stripped =
226
- raw_private_key_hex. strip_prefix ( "0x" ) . unwrap_or ( & raw_private_key_hex) ;
227
- maptos_config. chain . maptos_private_key_signer_identifier =
228
- SignerIdentifier :: Local ( Local { private_key_hex_bytes : prefix_stripped. to_string ( ) } ) ;
229
-
230
- // replace the db path with the temporary directory
231
- maptos_config. chain . maptos_db_path . replace ( tempdir. path ( ) . to_path_buf ( ) ) ;
232
- let executor = Self :: try_from_config ( maptos_config, mempool_tx_exec_result_sender) . await ?;
233
- Ok ( ( executor, tempdir, private_key, receiver) )
234
- }
196
+ // pub async fn try_generated() -> Result<
197
+ // (
198
+ // Self,
199
+ // TempDir,
200
+ // Ed25519PrivateKey,
201
+ // futures::channel::mpsc::Receiver<Vec<TxExecutionResult>>,
202
+ // ),
203
+ // anyhow::Error,
204
+ // > {
205
+ // // generate a random private key
206
+ // let private_key = Ed25519PrivateKey::generate_for_testing();
207
+
208
+ // // generate a sender
209
+ // let (mempool_tx_exec_result_sender, receiver) =
210
+ // futures_mpsc::channel::<Vec<TxExecutionResult>>(EXECUTOR_CHANNEL_SIZE);
211
+ // let tempdir = tempfile::tempdir()?;
212
+
213
+ // let mut maptos_config = Config::default();
214
+ // let raw_private_key_hex = private_key.to_encoded_string()?.to_string();
215
+ // let prefix_stripped =
216
+ // raw_private_key_hex.strip_prefix("0x").unwrap_or(&raw_private_key_hex);
217
+ // maptos_config.chain.maptos_private_key_signer_identifier =
218
+ // SignerIdentifier::Local(Local { private_key_hex_bytes: prefix_stripped.to_string() });
219
+
220
+ // // replace the db path with the temporary directory
221
+ // maptos_config.chain.maptos_db_path.replace(tempdir.path().to_path_buf());
222
+ // let executor = Self::try_from_config(maptos_config, mempool_tx_exec_result_sender).await?;
223
+ // Ok((executor, tempdir, private_key, receiver))
224
+ // }
235
225
236
226
/// Creates an instance of [`Context`] and the background [`TransactionPipe`]
237
227
/// task to process transactions. If the configuration is for a read-only node,
0 commit comments