@@ -9,9 +9,8 @@ use crate::cli::{
99} ;
1010use crate :: constants:: DEFAULT_MPC_DOCKER_IMAGE ;
1111use crate :: devnet:: OperatingDevnetSetup ;
12- use crate :: types:: { near_crypto_compatible_serialization , MpcNetworkSetup , ParsedConfig } ;
12+ use crate :: types:: { MpcNetworkSetup , ParsedConfig } ;
1313use describe:: TerraformInfraShowOutput ;
14- use ed25519_dalek:: { SigningKey , VerifyingKey } ;
1514use near_account_id:: AccountId ;
1615use serde:: Serialize ;
1716use std:: path:: PathBuf ;
@@ -72,52 +71,13 @@ async fn export_terraform_vars(
7271 name : & str ,
7372 accounts : & OperatingAccounts ,
7473 mpc_setup : & MpcNetworkSetup ,
75- not_legacy : bool ,
7674 docker_image : Option < String > ,
7775) -> PathBuf {
7876 let contract = mpc_setup
7977 . contract
8078 . clone ( )
8179 . expect ( "Contract is not deployed" ) ;
82- let terraform_file = if !not_legacy {
83- // todo: eventually remove [(#710)](https://github.com/near/mpc/issues/710)
84- let mut mpc_nodes = Vec :: new ( ) ;
85- for ( i, account_id) in mpc_setup. participants . iter ( ) . enumerate ( ) {
86- let account = accounts. account ( account_id) ;
87- let participant = account
88- . get_mpc_participant ( )
89- . expect ( "Not an MPC participant" ) ;
90- let responding_account = accounts. account ( & participant. responding_account_id ) ;
91- let respond_config = RespondConfigFile {
92- account_id : participant. responding_account_id . clone ( ) ,
93- access_keys : responding_account
94- . all_access_keys ( )
95- . await
96- . into_iter ( )
97- . map ( |k| k. secret_key ( ) )
98- . collect ( ) ,
99- } ;
100-
101- let account_sk = account. any_access_key ( ) . await . secret_key ( ) ;
102- let mpc_node = LegacyTerraformMpcNode {
103- account : account_id. clone ( ) ,
104- account_pk : account_sk. verifying_key ( ) ,
105- account_sk,
106- sign_sk : participant. p2p_private_key . clone ( ) ,
107- sign_pk : participant. p2p_private_key . verifying_key ( ) ,
108- url : format ! ( "http://mpc-node-{}.service.mpc.consul:3000" , i) ,
109- respond_yaml : serde_yaml:: to_string ( & respond_config) . unwrap ( ) ,
110- } ;
111- mpc_nodes. push ( mpc_node) ;
112- }
113- let terraform_file = LegacyTerraformFile {
114- cluster_prefix : name. to_string ( ) ,
115- legacy_mpc_nodes : mpc_nodes,
116- mpc_contract_signer : contract,
117- ssd : mpc_setup. ssd ,
118- } ;
119- serde_json:: to_string_pretty ( & terraform_file) . unwrap ( )
120- } else {
80+ let terraform_file = {
12181 let mut mpc_nodes = Vec :: new ( ) ;
12282 for ( i, account_id) in mpc_setup. participants . iter ( ) . enumerate ( ) {
12383 let responding_account_id = accounts
@@ -164,29 +124,6 @@ struct TerraformDeployInfraFile {
164124 ssd : bool ,
165125}
166126
167- #[ derive( Serialize ) ]
168- struct LegacyTerraformFile {
169- cluster_prefix : String ,
170- legacy_mpc_nodes : Vec < LegacyTerraformMpcNode > ,
171- mpc_contract_signer : AccountId ,
172- ssd : bool ,
173- }
174-
175- #[ derive( Serialize ) ]
176- struct LegacyTerraformMpcNode {
177- account : AccountId ,
178- #[ serde( with = "near_crypto_compatible_serialization::verifying_key" ) ]
179- account_pk : VerifyingKey ,
180- #[ serde( with = "near_crypto_compatible_serialization::signing_key" ) ]
181- account_sk : SigningKey ,
182- #[ serde( with = "near_crypto_compatible_serialization::verifying_key" ) ]
183- sign_pk : VerifyingKey ,
184- #[ serde( with = "near_crypto_compatible_serialization::signing_key" ) ]
185- sign_sk : SigningKey ,
186- url : String ,
187- respond_yaml : String ,
188- }
189-
190127#[ derive( Serialize ) ]
191128struct TerraformFile {
192129 cluster_prefix : String ,
@@ -205,14 +142,6 @@ struct TerraformMpcNode {
205142 near_responder_account_id : AccountId ,
206143}
207144
208- // From MPC code.
209- #[ derive( Serialize ) ]
210- pub struct RespondConfigFile {
211- pub account_id : AccountId ,
212- #[ serde( with = "near_crypto_compatible_serialization::signing_keys" ) ]
213- pub access_keys : Vec < SigningKey > ,
214- }
215-
216145impl MpcTerraformDeployInfraCmd {
217146 pub async fn run ( & self , name : & str , config : ParsedConfig ) {
218147 println ! (
@@ -294,14 +223,9 @@ impl MpcTerraformDeployNomadCmd {
294223 . mpc_setups
295224 . get ( name)
296225 . expect ( & format ! ( "MPC network {} does not exist" , name) ) ;
297- let terraform_vars_file = export_terraform_vars (
298- name,
299- & setup. accounts ,
300- mpc_setup,
301- self . not_legacy ,
302- self . docker_image . clone ( ) ,
303- )
304- . await ;
226+ let terraform_vars_file =
227+ export_terraform_vars ( name, & setup. accounts , mpc_setup, self . docker_image . clone ( ) )
228+ . await ;
305229 let nomad_server_url = mpc_setup
306230 . nomad_server_url
307231 . clone ( )
0 commit comments