Skip to content

change executor cli #3385

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

Merged
merged 3 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tee-worker/omni-executor/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
heima-node:
condition: service_healthy
restart: true
command: ["executor-worker", "run", "ws://heima-node:9944", "http://ethereum-node:8545", "https://api.devnet.solana.com", "bsc-url", "bsc-testnet-url", "pumpx-signer-url", "ws://omni-executor:2100"]
command: ["executor-worker", "run", "ws://heima-node:9944", "http://ethereum-node:8545", "https://api.devnet.solana.com", "pumpx-signer-url", "ws://omni-executor:2100", "bsc-url", "bsc-testnet-url",]
privileged: true
restart: unless-stopped
networks:
Expand Down
63 changes: 6 additions & 57 deletions tee-worker/omni-executor/executor-worker/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,76 +19,25 @@ pub struct RunArgs {
pub parentchain_url: String,
pub ethereum_url: String,
pub solana_url: String,
pub bsc_url: Option<String>,
pub bsc_testnet_url: Option<String>,
pub pumpx_signer_url: String,
pub worker_url: String,
pub bsc_url: Option<String>,
pub bsc_testnet_url: Option<String>,
#[arg(long, short = 'b', default_value = "0", help = "Start block to sync from parentchain")]
pub start_block: u64,
#[arg(
short,
long,
default_value = "local/keystore/substrate_alice.bin",
value_name = "keystore file path"
)]
pub substrate_keystore_path: String,
#[arg(
short,
long,
default_value = "local/keystore/aes_256_key.bin",
value_name = "Aes256 keystore file path"
)]
pub aes256_key_store_path: String,
#[arg(
long,
default_value = "local/keystore/auth_token_key.bin",
value_name = "Auth token (JWT) keystore file path"
)]
pub auth_token_key_store_path: String,
#[arg(
short,
long,
default_value = "local/keystore/pumpx_auth_key.bin",
value_name = "PumpX auth keystore file path"
)]
pub pumpx_auth_key_store_path: String,
#[arg(
short,
long,
default_value = "local/log/parentchain_last_log.bin",
value_name = "log file path"
)]
pub log_path: String,
#[arg(short, long, default_value = "local", value_name = "local directory path")]
pub local_directory_path: String,
#[arg(
short,
long,
default_value = "0xc07cb79754cf3b252038e2713a138363d55df9e0",
value_name = "delegation contract address"
)]
pub delegation_contract_address: String,
#[arg(
short,
long,
default_value = "local/keystore/shielding_key.bin",
value_name = "Shielding key store file path"
)]
pub shielding_key_store_path: String,
#[arg(
short,
long,
default_value = "local/untrusted-keystore/accounting_ecdsa_signer_key.bin",
value_name = "Accounting contract ecdsa keystore file path"
)]
pub accounting_ecdsa_signer_key_store_path: String,
}

#[derive(Args)]
pub struct GenKeyArgs {
#[arg(
short,
long,
default_value = "local/keystore/substrate_alice.bin",
value_name = "keystore file path"
)]
pub substrate_keystore_path: String,
#[arg(short, long, default_value = "local", value_name = "local directory path")]
pub local_directory_path: String,
}
67 changes: 55 additions & 12 deletions tee-worker/omni-executor/executor-worker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use solana::SolanaClient;
use solana_intent_executor::SolanaIntentExecutor;
use std::env;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::thread;
use std::thread::JoinHandle;
Expand Down Expand Up @@ -80,21 +81,36 @@ async fn main() -> Result<(), ()> {

match cli.cmd {
Commands::Run(args) => {
let auth_token_key_store =
AuthTokenKeyStore::new(args.auth_token_key_store_path.clone());
let auth_token_key_store = AuthTokenKeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/auth_token_key.bin")
.into_os_string()
.into_string()
.unwrap(),
);
let jwt_rsa_private_key = auth_token_key_store.read().expect("Could not read jwt key");

let pumpx_auth_key_store =
pumpx::auth_key_store::AuthKeyStore::new(args.pumpx_auth_key_store_path.clone());
let pumpx_auth_key_store = pumpx::auth_key_store::AuthKeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/pumpx_auth_key.bin")
.into_os_string()
.into_string()
.unwrap(),
);

let pumpx_signer_key =
pumpx_auth_key_store.read().expect("Could not read PumpX signer key");

let pumpx_signer_pair = ecdsa::Pair::from_seed_slice(&pumpx_signer_key).unwrap();
info!("PumpX auth public key: {:?}", pumpx_signer_pair.public());

let accounting_ecdsa_signer_key =
EcdsaKeyStore::new(args.accounting_ecdsa_signer_key_store_path.clone());
let accounting_ecdsa_signer_key = EcdsaKeyStore::new(
Path::new(&args.local_directory_path)
.join("untrusted-keystore/accounting_ecdsa_signer_key.bin")
.into_os_string()
.into_string()
.unwrap(),
);

let accounting_ecdsa_signer_key =
accounting_ecdsa_signer_key.read().expect("Could not read accounting ecsa key");
Expand All @@ -113,8 +129,13 @@ async fn main() -> Result<(), ()> {
let metadata_provider = Arc::new(SubxtMetadataProvider::new(client_factory.clone()));
let parentchain_rpc_client_factory = Arc::new(client_factory);

let substrate_key_store =
Arc::new(SubstrateKeyStore::new(args.substrate_keystore_path.clone()));
let substrate_key_store = Arc::new(SubstrateKeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/substrate_alice.bin")
.into_os_string()
.into_string()
.unwrap(),
));
let parentchain_signer = parentchain_signer::get_signer(substrate_key_store.clone());
let signer_account_id: AccountId =
parentchain_signer.public_key().to_account_id().to_primitive_type();
Expand All @@ -133,7 +154,13 @@ async fn main() -> Result<(), ()> {
parentchain_signer.clone(),
signer_account_nonce,
));
let aes256_key_store = Aes256KeyStore::new(args.aes256_key_store_path.clone());
let aes256_key_store = Aes256KeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/aes_256_key.bin")
.into_os_string()
.into_string()
.unwrap(),
);
let aes256_key = aes256_key_store.read().expect("Could not read aes256 key");

let pumpx_signer_client: Arc<Box<dyn SignerClient>> =
Expand Down Expand Up @@ -221,7 +248,13 @@ async fn main() -> Result<(), ()> {
log::info!("worker url: {:?}", args.worker_url);
let worker_url = url::Url::parse(&args.worker_url).expect("Invalid worker url");

let shielding_key_store = ShieldingKeyStore::new(args.shielding_key_store_path.clone());
let shielding_key_store = ShieldingKeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/shielding_key.bin")
.into_os_string()
.into_string()
.unwrap(),
);

let shielding_key = shielding_key_store.read().expect("Could not read shielding key");
let shielding_pubkey = shielding_key.public_key();
Expand Down Expand Up @@ -269,7 +302,13 @@ async fn main() -> Result<(), ()> {
}
},
Commands::GenKey(args) => {
let key_store = Arc::new(SubstrateKeyStore::new(args.substrate_keystore_path));
let key_store = Arc::new(SubstrateKeyStore::new(
Path::new(&args.local_directory_path)
.join("keystore/substrate_alice.bin")
.into_os_string()
.into_string()
.unwrap(),
));
let _ = parentchain_signer::get_signer(key_store);
},
}
Expand All @@ -289,7 +328,11 @@ async fn listen_to_parentchain(
&args.parentchain_url,
sub_stop_receiver,
storage_db,
&args.log_path,
&Path::new(&args.local_directory_path)
.join("log/parentchain_last_log.bin")
.into_os_string()
.into_string()
.unwrap(),
)
.await?;

Expand Down