From b042385f9b78a870dacff1f8529930fef984671b Mon Sep 17 00:00:00 2001 From: timurgordon Date: Fri, 27 Jun 2025 12:11:34 +0300 Subject: [PATCH] change context syntax --- src/launcher/README.md | 2 +- src/launcher/examples/confirm_launch.rs | 20 ++++++++++---------- tests/end_to_end_integration.rs | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/launcher/README.md b/src/launcher/README.md index 6035063..666200b 100644 --- a/src/launcher/README.md +++ b/src/launcher/README.md @@ -70,6 +70,6 @@ For each entry in `circles.json`, the launcher will: 1. Generate a new `secp256k1` keypair. The public key becomes the Circle's unique identifier. 2. Spawn the `worker` binary as a child OS process, passing it the public key and Redis URL. 3. Initialize a `server_ws` instance on the specified port. -4. If a `script_path` is provided, it reads the script and submits it as a task to the worker's Redis queue. The `CALLER_PUBLIC_KEY` for this initial script is set to the Circle's own public key. +4. If a `script_path` is provided, it reads the script and submits it as a task to the worker's Redis queue. The `CALLER_ID` for this initial script is set to the Circle's own public key. This makes it an ideal tool for setting up complex, multi-instance development environments or for deploying a full suite of Circle services with strong process isolation. \ No newline at end of file diff --git a/src/launcher/examples/confirm_launch.rs b/src/launcher/examples/confirm_launch.rs index 6c565da..41b2f31 100644 --- a/src/launcher/examples/confirm_launch.rs +++ b/src/launcher/examples/confirm_launch.rs @@ -64,10 +64,10 @@ async fn main() -> Result<(), Box> { let client = RhaiClient::new(REDIS_URL)?; - // Test 1: Verify that CIRCLE_PUBLIC_KEY is set correctly. - println!("--- Test 1: Verifying CIRCLE_PUBLIC_KEY ---"); - let script_circle_pk = r#"CIRCLE_PUBLIC_KEY"#; - println!("Submitting script to verify CIRCLE_PUBLIC_KEY..."); + // Test 1: Verify that CONTEXT_ID is set correctly. + println!("--- Test 1: Verifying CONTEXT_ID ---"); + let script_circle_pk = r#"CONTEXT_ID"#; + println!("Submitting script to verify CONTEXT_ID..."); let task_details_circle_pk = client .submit_script_and_await_result( &public_key, @@ -80,13 +80,13 @@ async fn main() -> Result<(), Box> { println!("Received task details: {:?}", task_details_circle_pk); assert_eq!(task_details_circle_pk.status, "completed"); assert_eq!(task_details_circle_pk.output, Some(public_key.to_string())); - println!("✅ SUCCESS: Worker correctly reported its CIRCLE_PUBLIC_KEY."); + println!("✅ SUCCESS: Worker correctly reported its CONTEXT_ID."); - // Test 2: Verify that CALLER_PUBLIC_KEY is set correctly when the launcher calls. + // Test 2: Verify that CALLER_ID is set correctly when the launcher calls. // We simulate the launcher by passing the circle's own PK as the caller. - println!("\n--- Test 2: Verifying CALLER_PUBLIC_KEY for init scripts ---"); - let script_caller_pk = r#"CALLER_PUBLIC_KEY"#; - println!("Submitting script to verify CALLER_PUBLIC_KEY..."); + println!("\n--- Test 2: Verifying CALLER_ID for init scripts ---"); + let script_caller_pk = r#"CALLER_ID"#; + println!("Submitting script to verify CALLER_ID..."); let task_details_caller_pk = client .submit_script_and_await_result( &public_key, @@ -99,7 +99,7 @@ async fn main() -> Result<(), Box> { println!("Received task details: {:?}", task_details_caller_pk); assert_eq!(task_details_caller_pk.status, "completed"); assert_eq!(task_details_caller_pk.output, Some(public_key.to_string())); - println!("✅ SUCCESS: Worker correctly reported CALLER_PUBLIC_KEY for init script."); + println!("✅ SUCCESS: Worker correctly reported CALLER_ID for init script."); // Gracefully shut down the launcher println!("Shutting down launcher process..."); diff --git a/tests/end_to_end_integration.rs b/tests/end_to_end_integration.rs index a9155ac..3d1d68d 100644 --- a/tests/end_to_end_integration.rs +++ b/tests/end_to_end_integration.rs @@ -197,7 +197,7 @@ async fn test_full_end_to_end_example() -> Result<(), Box // "print(\"Hello from authenticated client!\"); 42", // "let x = 10; let y = 20; x + y", // "print(\"Testing authentication...\"); \"success\"", - // "CALLER_PUBLIC_KEY", + // "CALLER_ID", // ]; // for (i, script) in test_scripts.iter().enumerate() { @@ -206,9 +206,9 @@ async fn test_full_end_to_end_example() -> Result<(), Box // match client.play(script.to_string()).await { // Ok(result) => { // info!("✅ Script {} result: {}", i + 1, result.output); - // if script == &"CALLER_PUBLIC_KEY" { + // if script == &"CALLER_ID" { // assert_eq!(result.output, expected_public_key_hex); - // info!("✅ CALLER_PUBLIC_KEY verification successful!"); + // info!("✅ CALLER_ID verification successful!"); // } // } // Err(e) => {