-
Notifications
You must be signed in to change notification settings - Fork 7
Compute eoa worker ID independent of twmq lease token #38
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
Changes from 7 commits
8d8ccb1
987515d
fc0e88a
2386c9f
da71664
cc9bb23
236b1ea
20b52bf
a2a7561
1547da0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,7 @@ pub struct ConfirmedTransactionWithRichReceipt { | |||||||||
|
|
||||||||||
| impl<C: Chain> EoaExecutorWorker<C> { | ||||||||||
| // ========== CONFIRM FLOW ========== | ||||||||||
| #[tracing::instrument(skip_all)] | ||||||||||
| #[tracing::instrument(skip_all, fields(worker_id = self.store.worker_id))] | ||||||||||
| pub async fn confirm_flow(&self) -> Result<CleanupReport, EoaExecutorWorkerError> { | ||||||||||
|
Comment on lines
+30
to
31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix tracing field: call the accessor and format properly Same as send flow: use the accessor and - #[tracing::instrument(skip_all, fields(worker_id = self.store.worker_id))]
+ #[tracing::instrument(skip_all, fields(worker_id = %self.store.worker_id()))]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| // Get fresh on-chain transaction count | ||||||||||
| let current_chain_transaction_count = self | ||||||||||
|
|
@@ -53,6 +53,10 @@ impl<C: Chain> EoaExecutorWorker<C> { | |||||||||
| let cached_transaction_count = match self.store.get_cached_transaction_count().await { | ||||||||||
| Err(e) => match e { | ||||||||||
| TransactionStoreError::NonceSyncRequired { .. } => { | ||||||||||
| tracing::warn!( | ||||||||||
| cached_transaction_count = current_chain_transaction_count, | ||||||||||
| "Nonce sync required, store was uninitialized, updating cached transaction count with current chain transaction count" | ||||||||||
| ); | ||||||||||
| self.store | ||||||||||
| .update_cached_transaction_count(current_chain_transaction_count) | ||||||||||
| .await?; | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,9 @@ use crate::eoa::authorization_cache::EoaAuthorizationCache; | |
| use crate::eoa::store::{ | ||
| AtomicEoaExecutorStore, EoaExecutorStore, EoaExecutorStoreKeys, EoaHealth, SubmissionResult, | ||
| }; | ||
| use crate::metrics::{calculate_duration_seconds, calculate_duration_seconds_from_twmq, current_timestamp_ms, record_eoa_job_processing_time}; | ||
| use crate::metrics::{ | ||
| calculate_duration_seconds, current_timestamp_ms, record_eoa_job_processing_time, | ||
| }; | ||
| use crate::webhook::WebhookJobHandler; | ||
|
|
||
| pub mod confirm; | ||
|
|
@@ -148,20 +150,22 @@ where | |
| }) | ||
| .map_err_nack(Some(Duration::from_secs(10)), RequeuePosition::Last)?; | ||
|
|
||
| let worker_id = format!("{}:{}", uuid::Uuid::new_v4(), job.lease_token); | ||
|
|
||
|
Comment on lines
+153
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAlign worker_id with PR objective: remove dependency on twmq lease_token PR title: “Compute eoa worker ID independent of twmq lease token.” Current code still concatenates Minimal fix: - let worker_id = format!("{}:{}", uuid::Uuid::new_v4(), job.lease_token);
+ let worker_id = uuid::Uuid::new_v4().to_string();Alternative (better observability): - let worker_id = format!("{}:{}", uuid::Uuid::new_v4(), job.lease_token);
+ let worker_id = format!("{}:{}:{}", data.chain_id, data.eoa_address, uuid::Uuid::new_v4());Verification script to ensure no other lease-token–derived worker IDs remain: 🏁 Script executed: #!/bin/bash
# Find worker_id constructions that include lease_token
rg -n -C2 --type=rust 'worker_id.*lease_token'Length of output: 443 Remove lease_token from The code at Suggested fixes:
Verification confirms this is the only occurrence of $ rg -n -C2 --type=rust 'worker_id.*lease_token'
executors/src/eoa/worker/mod.rs:153: let worker_id = format!("{}:{}", uuid::Uuid::new_v4(), job.lease_token);🤖 Prompt for AI Agents |
||
| // 2. CREATE SCOPED STORE (acquires lock) | ||
| let scoped = EoaExecutorStore::new( | ||
| self.redis.clone(), | ||
| self.namespace.clone(), | ||
| data.eoa_address, | ||
| data.chain_id, | ||
| ) | ||
| .acquire_eoa_lock_aggressively(&job.lease_token) | ||
| .acquire_eoa_lock_aggressively(&worker_id) | ||
| .await | ||
| .map_err(|e| Into::<EoaExecutorWorkerError>::into(e).handle())?; | ||
|
|
||
| let delegated_account = DelegatedAccount::new(data.eoa_address, chain.clone()); | ||
|
|
||
| // if there's an error checking 7702 delegation here, we'll just assume it's not a minimal account for the pursposes of max in flight | ||
| // if there's an error checking 7702 delegation here, we'll just assume it's not a minimal account for the purposes of max in flight | ||
| let is_minimal_account = self | ||
| .authorization_cache | ||
| .is_minimal_account(&delegated_account) | ||
|
|
@@ -192,7 +196,7 @@ where | |
| let job_start_time = current_timestamp_ms(); | ||
| let result = worker.execute_main_workflow().await?; | ||
| if let Err(e) = worker.release_eoa_lock().await { | ||
| tracing::error!(error = ?e, "Error releasing EOA lock"); | ||
| tracing::error!(error = ?e, worker_id = worker_id, "Error releasing EOA lock"); | ||
| } | ||
|
|
||
| // Record EOA job processing metrics | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ const HEALTH_CHECK_INTERVAL: u64 = 300; // 5 minutes in seconds | |||||||||
|
|
||||||||||
| impl<C: Chain> EoaExecutorWorker<C> { | ||||||||||
| // ========== SEND FLOW ========== | ||||||||||
| #[tracing::instrument(skip_all)] | ||||||||||
| #[tracing::instrument(skip_all, fields(worker_id = self.store.worker_id))] | ||||||||||
| pub async fn send_flow(&self) -> Result<u32, EoaExecutorWorkerError> { | ||||||||||
|
Comment on lines
+19
to
20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix tracing field: call the accessor and format properly
Apply: - #[tracing::instrument(skip_all, fields(worker_id = self.store.worker_id))]
+ #[tracing::instrument(skip_all, fields(worker_id = %self.store.worker_id()))]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| // 1. Get EOA health (initializes if needed) and check if we should update balance | ||||||||||
| let mut health = self.get_eoa_health().await?; | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.