|
1 | 1 | use std::path::PathBuf;
|
2 | 2 |
|
3 | 3 | use serde::{Deserialize, Serialize};
|
| 4 | +use tempfile::TempDir; |
| 5 | + |
| 6 | +use crate::config::{BitcoinConfig, BitcoinServiceConfig}; |
4 | 7 |
|
5 | 8 | /// Runner configuration.
|
6 | 9 | #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
@@ -121,6 +124,74 @@ pub struct FullNodeConfig<BitcoinServiceConfig> {
|
121 | 124 | pub public_keys: RollupPublicKeys,
|
122 | 125 | }
|
123 | 126 |
|
| 127 | +impl Default for FullNodeConfig<BitcoinServiceConfig> { |
| 128 | + fn default() -> Self { |
| 129 | + Self { |
| 130 | + rpc: RpcConfig { |
| 131 | + bind_host: "127.0.0.1".into(), |
| 132 | + bind_port: 0, |
| 133 | + max_connections: 100, |
| 134 | + max_request_body_size: 10 * 1024 * 1024, |
| 135 | + max_response_body_size: 10 * 1024 * 1024, |
| 136 | + batch_requests_limit: 50, |
| 137 | + enable_subscriptions: true, |
| 138 | + max_subscriptions_per_connection: 100, |
| 139 | + }, |
| 140 | + storage: StorageConfig { |
| 141 | + path: TempDir::new() |
| 142 | + .expect("Failed to create temporary directory") |
| 143 | + .into_path(), |
| 144 | + db_max_open_files: None, |
| 145 | + }, |
| 146 | + runner: None, |
| 147 | + da: BitcoinServiceConfig { |
| 148 | + node_url: String::new(), |
| 149 | + node_username: String::from("user"), |
| 150 | + node_password: String::from("password"), |
| 151 | + network: bitcoin::Network::Regtest, |
| 152 | + da_private_key: None, |
| 153 | + tx_backup_dir: TempDir::new() |
| 154 | + .expect("Failed to create temporary directory") |
| 155 | + .into_path() |
| 156 | + .display() |
| 157 | + .to_string(), |
| 158 | + }, |
| 159 | + public_keys: RollupPublicKeys { |
| 160 | + sequencer_public_key: vec![ |
| 161 | + 32, 64, 64, 227, 100, 193, 15, 43, 236, 156, 31, 229, 0, 161, 205, 76, 36, 124, |
| 162 | + 137, 214, 80, 160, 30, 215, 232, 44, 171, 168, 103, 135, 124, 33, |
| 163 | + ], |
| 164 | + // private key [4, 95, 252, 129, 163, 193, 253, 179, 175, 19, 89, 219, 242, 209, 20, 176, 179, 239, 191, 127, 41, 204, 156, 93, 160, 18, 103, 170, 57, 210, 199, 141] |
| 165 | + // Private Key (WIF): KwNDSCvKqZqFWLWN1cUzvMiJQ7ck6ZKqR6XBqVKyftPZtvmbE6YD |
| 166 | + sequencer_da_pub_key: vec![ |
| 167 | + 3, 136, 195, 18, 11, 187, 25, 37, 38, 109, 184, 237, 247, 208, 131, 219, 162, |
| 168 | + 70, 35, 174, 234, 47, 239, 247, 60, 51, 174, 242, 247, 112, 186, 222, 30, |
| 169 | + ], |
| 170 | + // private key [117, 186, 249, 100, 208, 116, 89, 70, 0, 54, 110, 91, 17, 26, 29, 168, 248, 107, 46, 254, 45, 34, 218, 81, 200, 216, 33, 38, 160, 252, 172, 114] |
| 171 | + // Private Key (WIF): L1AZdJXzDGGENBBPZGSL7dKJnwn5xSKqzszgK6CDwiBGThYQEVTo |
| 172 | + prover_da_pub_key: vec![ |
| 173 | + 2, 138, 232, 157, 214, 46, 7, 210, 235, 33, 105, 239, 71, 169, 105, 233, 239, |
| 174 | + 84, 172, 112, 13, 54, 9, 206, 106, 138, 251, 218, 15, 28, 137, 112, 127, |
| 175 | + ], |
| 176 | + }, |
| 177 | + } |
| 178 | + } |
| 179 | +} |
| 180 | + |
| 181 | +impl From<BitcoinConfig> for BitcoinServiceConfig { |
| 182 | + fn from(v: BitcoinConfig) -> Self { |
| 183 | + let ip = v.docker_ip.unwrap_or(String::from("127.0.0.1")); |
| 184 | + Self { |
| 185 | + node_url: format!("{}:{}", ip, v.rpc_port), |
| 186 | + node_username: v.rpc_user, |
| 187 | + node_password: v.rpc_password, |
| 188 | + network: v.network, |
| 189 | + da_private_key: None, |
| 190 | + tx_backup_dir: String::new(), |
| 191 | + } |
| 192 | + } |
| 193 | +} |
| 194 | + |
124 | 195 | /// A configuration type to define the behaviour of the pruner.
|
125 | 196 | #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
126 | 197 | pub struct PruningConfig {
|
|
0 commit comments