Skip to content

Commit ca03a20

Browse files
authored
feat: add omni_exportBundlerPrivateKey RPC method (#3746)
1 parent 1140825 commit ca03a20

File tree

12 files changed

+587
-0
lines changed

12 files changed

+587
-0
lines changed

tee-worker/omni-executor/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ OE_WILDMETA_API_URL=
6363
# Wildmeta Backend ECDSA Public Key (for WildmetaBackend auth signature verification)
6464
OE_WILDMETA_BACKEND_ECDSA_PUBKEY=020000000000000000000000000000000000000000000000000000000000000000
6565

66+
# Bundler Key Export Authorized Public Key (for bundler key export authorization)
67+
OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY=020000000000000000000000000000000000000000000000000000000000000000
68+
6669
# Solana
6770
OE_SOLANA_URL=
6871

tee-worker/omni-executor/.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ OE_OMNI_FACTORY_ADDRESS=0x0000000000000000000000000000000000000000
2626
OE_ENTRY_POINT_ADDRESS=0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
2727
OE_WILDMETA_API_URL=http://127.0.0.1:3456/wildmeta
2828
OE_WILDMETA_BACKEND_ECDSA_PUBKEY=020000000000000000000000000000000000000000000000000000000000000000
29+
OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY=020000000000000000000000000000000000000000000000000000000000000000

tee-worker/omni-executor/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ FROM gramineproject/gramine:1.9-jammy AS sgx-builder
4848
ARG OE_WILDMETA_BACKEND_ECDSA_PUBKEY="020000000000000000000000000000000000000000000000000000000000000000"
4949
ENV OE_WILDMETA_BACKEND_ECDSA_PUBKEY=$OE_WILDMETA_BACKEND_ECDSA_PUBKEY
5050

51+
ARG OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY="020000000000000000000000000000000000000000000000000000000000000000"
52+
ENV OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY=$OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY
53+
5154
RUN apt-get update
5255

5356
RUN apt-get install -y \
@@ -78,6 +81,12 @@ RUN make SGX=1 SGX_DEBUG=0 SOURCE_DATE_EPOCH=1700000000 CARGO_PROFILE_RELEASE_DE
7881
FROM gramineproject/gramine:1.9-jammy AS release
7982
LABEL maintainer="Trust Computing GmbH <info@litentry.com>"
8083

84+
ARG OE_WILDMETA_BACKEND_ECDSA_PUBKEY="020000000000000000000000000000000000000000000000000000000000000000"
85+
ENV OE_WILDMETA_BACKEND_ECDSA_PUBKEY=$OE_WILDMETA_BACKEND_ECDSA_PUBKEY
86+
87+
ARG OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY="020000000000000000000000000000000000000000000000000000000000000000"
88+
ENV OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY=$OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY
89+
8190
ENV HOME=/home/ubuntu
8291
ENV BUILD_DIR=$HOME/tee-worker/omni-executor
8392
ENV BIN_DIR=/wkdir

tee-worker/omni-executor/config-loader/src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const DEFAULT_ENTRY_POINT_ADDRESS: &str = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026
6262
const DEFAULT_WILDMETA_API_URL: &str = "https://test-dex-api.heima.network";
6363
const DEFAULT_WILDMETA_BACKEND_ECDSA_PUBKEY: &str =
6464
"020000000000000000000000000000000000000000000000000000000000000000";
65+
const DEFAULT_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY: &str =
66+
"020000000000000000000000000000000000000000000000000000000000000000";
6567

6668
#[derive(Debug, Clone)]
6769
pub struct MailerConfig {
@@ -108,6 +110,7 @@ pub struct ConfigLoader {
108110
pub entry_point_address: String,
109111
pub wildmeta_api_url: String,
110112
pub wildmeta_backend_ecdsa_pubkey: String,
113+
pub bundler_key_export_authorized_pubkey: String,
111114
}
112115

113116
struct EnvVar {
@@ -323,6 +326,15 @@ impl ConfigLoader {
323326
optional: false,
324327
},
325328
),
329+
(
330+
"bundler_key_export_authorized_pubkey",
331+
EnvVar {
332+
env_key: "OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY",
333+
default: DEFAULT_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY,
334+
sensitive: false,
335+
optional: false,
336+
},
337+
),
326338
]);
327339

328340
let alchemy_key = std::env::var("OE_ALCHEMY_KEY").unwrap_or_default();
@@ -362,6 +374,7 @@ impl ConfigLoader {
362374
entry_point_address: get("entry_point_address"),
363375
wildmeta_api_url: get("wildmeta_api_url"),
364376
wildmeta_backend_ecdsa_pubkey: get("wildmeta_backend_ecdsa_pubkey"),
377+
bundler_key_export_authorized_pubkey: get("bundler_key_export_authorized_pubkey"),
365378
}
366379
}
367380

tee-worker/omni-executor/executor-worker/src/main.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,26 @@ async fn main() -> Result<(), ()> {
494494
pubkey_array
495495
};
496496

497+
let bundler_key_export_authorized_pubkey =
498+
{
499+
use executor_primitives::utils::hex::decode_hex;
500+
let pubkey_hex = &config_loader.bundler_key_export_authorized_pubkey;
501+
let pubkey_bytes =
502+
decode_hex(pubkey_hex).map_err(|e| {
503+
error!("Failed to decode bundler key export authorized ECDSA public key: {:?}", e);
504+
})?;
505+
if pubkey_bytes.len() != 33 {
506+
error!(
507+
"Invalid bundler key export authorized ECDSA public key length: expected 33 bytes, got {}",
508+
pubkey_bytes.len()
509+
);
510+
return Err(());
511+
}
512+
let mut pubkey_array = [0u8; 33];
513+
pubkey_array.copy_from_slice(&pubkey_bytes);
514+
pubkey_array
515+
};
516+
497517
start_rpc_server(
498518
worker_url.port().expect("Missing worker port"),
499519
shielding_key,
@@ -506,6 +526,8 @@ async fn main() -> Result<(), ()> {
506526
wildmeta_api,
507527
wildmeta_timestamp_storage,
508528
wildmeta_backend_ecdsa_pubkey,
529+
evm_accounting_ecdsa_signer_key,
530+
bundler_key_export_authorized_pubkey,
509531
Arc::new(ethereum_intent_executor),
510532
Arc::new(solana_intent_executor),
511533
Arc::new(cross_chain_intent_executor),

tee-worker/omni-executor/omni-executor.manifest.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ loader.env.OE_OMNI_FACTORY_ADDRESS = { passthrough = true }
8787
loader.env.OE_ENTRY_POINT_ADDRESS = { passthrough = true }
8888
loader.env.OE_WILDMETA_API_URL = { passthrough = true }
8989
loader.env.OE_WILDMETA_BACKEND_ECDSA_PUBKEY = "{{ env.get('OE_WILDMETA_BACKEND_ECDSA_PUBKEY', '020000000000000000000000000000000000000000000000000000000000000000') }}"
90+
loader.env.OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY = "{{ env.get('OE_BUNDLER_KEY_EXPORT_AUTHORIZED_PUBKEY', '020000000000000000000000000000000000000000000000000000000000000000') }}"
9091

9192
# This key is a workaround because gramine-direct doesn't provide _sgx_mrsigner key
9293
{{'' if env.get('SGX', '0') == '1' else 'fs.insecure__keys.fake_sgx_mrsigner = "ffeeddccbbaa99887766554433221100"'}}

0 commit comments

Comments
 (0)