Skip to content

Commit 08007ca

Browse files
Add detailed job lifecycle logging to EOA executor send flow (#90)
1 parent 0a4dd4c commit 08007ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+951
-424
lines changed

aa-types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pub mod userop;
22

3-
pub use userop::*;
3+
pub use userop::*;

core/src/rpc_clients/bundler.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,11 @@ impl BundlerClient {
177177
Ok(response)
178178
}
179179

180-
pub async fn tw_get_delegation_contract(&self) -> TransportResult<TwGetDelegationContractResponse> {
181-
let response: TwGetDelegationContractResponse = self.inner.request("tw_getDelegationContract", ()).await?;
180+
pub async fn tw_get_delegation_contract(
181+
&self,
182+
) -> TransportResult<TwGetDelegationContractResponse> {
183+
let response: TwGetDelegationContractResponse =
184+
self.inner.request("tw_getDelegationContract", ()).await?;
182185
Ok(response)
183186
}
184187
}

core/src/signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ impl SolanaSigner {
621621
solana_sdk::signature::Signature::default(),
622622
);
623623
};
624-
624+
625625
transaction.signatures[signer_index] = signature;
626626

627627
Ok(transaction)

eip7702-core/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
pub const EIP_7702_DELEGATION_PREFIX: [u8; 3] = [0xef, 0x01, 0x00];
33

44
/// EIP-7702 delegation code length (prefix + address)
5-
pub const EIP_7702_DELEGATION_CODE_LENGTH: usize = 23;
5+
pub const EIP_7702_DELEGATION_CODE_LENGTH: usize = 23;

eip7702-core/src/delegated_account.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ impl<C: Chain> DelegatedAccount<C> {
2828
}
2929

3030
/// Check if the EOA has EIP-7702 delegation to the minimal account implementation
31-
pub async fn is_minimal_account(&self, delegation_contract: Option<Address>) -> Result<bool, EngineError> {
31+
pub async fn is_minimal_account(
32+
&self,
33+
delegation_contract: Option<Address>,
34+
) -> Result<bool, EngineError> {
3235
// Get the bytecode at the EOA address using eth_getCode
3336
let code = self
3437
.chain
@@ -65,12 +68,8 @@ impl<C: Chain> DelegatedAccount<C> {
6568

6669
// Compare with the minimal account implementation address
6770
let is_delegated = match delegation_contract {
68-
Some(delegation_contract) => {
69-
target_address == delegation_contract
70-
}
71-
None => {
72-
true
73-
}
71+
Some(delegation_contract) => target_address == delegation_contract,
72+
None => true,
7473
};
7574

7675
tracing::debug!(

eip7702-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pub mod constants;
22
pub mod delegated_account;
3-
pub mod transaction;
3+
pub mod transaction;

eip7702-core/src/transaction.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,18 @@ impl<C: Chain> MinimalAccountTransaction<C> {
195195
credentials: &SigningCredential,
196196
delegation_contract: Address,
197197
) -> Result<Self, EngineError> {
198-
if self.account.is_minimal_account(Some(delegation_contract)).await? {
198+
if self
199+
.account
200+
.is_minimal_account(Some(delegation_contract))
201+
.await?
202+
{
199203
return Ok(self);
200204
}
201205

202-
let authorization = self.account.sign_authorization(signer, credentials, delegation_contract).await?;
206+
let authorization = self
207+
.account
208+
.sign_authorization(signer, credentials, delegation_contract)
209+
.await?;
203210
self.authorization = Some(authorization);
204211
Ok(self)
205212
}

eip7702-core/tests/integration_tests.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,9 @@ impl TestSetup {
657657
async fn test_eip7702_integration() -> Result<(), Box<dyn std::error::Error>> {
658658
// Set up test environment
659659
let mut setup = TestSetup::new().await?;
660-
let delegation_contract = setup.delegation_contract.expect("Delegation contract should be set");
660+
let delegation_contract = setup
661+
.delegation_contract
662+
.expect("Delegation contract should be set");
661663

662664
// Step 1: Fetch and set bytecode from Base Sepolia
663665
setup.fetch_and_set_bytecode().await?;
@@ -667,11 +669,15 @@ async fn test_eip7702_integration() -> Result<(), Box<dyn std::error::Error>> {
667669

668670
// Step 3: Test is_minimal_account - all should be false initially
669671
assert!(
670-
!developer_account.is_minimal_account(Some(delegation_contract)).await?,
672+
!developer_account
673+
.is_minimal_account(Some(delegation_contract))
674+
.await?,
671675
"Developer should not be minimal account initially"
672676
);
673677
assert!(
674-
!user_account.is_minimal_account(Some(delegation_contract)).await?,
678+
!user_account
679+
.is_minimal_account(Some(delegation_contract))
680+
.await?,
675681
"User should not be minimal account initially"
676682
);
677683
println!("✓ All accounts are not minimal accounts initially");
@@ -696,9 +702,11 @@ async fn test_eip7702_integration() -> Result<(), Box<dyn std::error::Error>> {
696702
.clone()
697703
.owner_transaction(&[mint_transaction])
698704
.add_authorization_if_needed(
699-
&setup.signer,
705+
&setup.signer,
700706
&setup.developer_credentials,
701-
setup.delegation_contract.expect("Delegation contract should be set")
707+
setup
708+
.delegation_contract
709+
.expect("Delegation contract should be set"),
702710
)
703711
.await?;
704712

@@ -732,17 +740,21 @@ async fn test_eip7702_integration() -> Result<(), Box<dyn std::error::Error>> {
732740
);
733741

734742
assert!(
735-
developer_account.is_minimal_account(Some(delegation_contract)).await?,
743+
developer_account
744+
.is_minimal_account(Some(delegation_contract))
745+
.await?,
736746
"Developer should be minimal account after minting"
737747
);
738748

739749
// Step 8: Delegate user account (session key granter)
740750
// User signs authorization but executor broadcasts it (user has no funds)
741751
let user_authorization = user_account
742752
.sign_authorization(
743-
&setup.signer,
753+
&setup.signer,
744754
&setup.user_credentials,
745-
setup.delegation_contract.expect("Delegation contract should be set")
755+
setup
756+
.delegation_contract
757+
.expect("Delegation contract should be set"),
746758
)
747759
.await?;
748760

@@ -752,14 +764,18 @@ async fn test_eip7702_integration() -> Result<(), Box<dyn std::error::Error>> {
752764
.await?;
753765

754766
assert!(
755-
user_account.is_minimal_account(Some(delegation_contract)).await?,
767+
user_account
768+
.is_minimal_account(Some(delegation_contract))
769+
.await?,
756770
"User (session key granter) should be minimal account after delegation"
757771
);
758772
println!("✓ User (session key granter) is now a minimal account (delegated by executor)");
759773

760774
// Step 9: Developer is already delegated via add_authorization_if_needed in owner_transaction
761775
assert!(
762-
developer_account.is_minimal_account(Some(delegation_contract)).await?,
776+
developer_account
777+
.is_minimal_account(Some(delegation_contract))
778+
.await?,
763779
"Developer (session key grantee) should already be minimal account from earlier delegation"
764780
);
765781
println!("✓ Developer (session key grantee) was already delegated in previous step");
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pub mod send;
21
pub mod confirm;
3-
pub mod delegation_cache;
2+
pub mod delegation_cache;
3+
pub mod send;

executors/src/eoa/store/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ impl EoaExecutorStore {
582582
let mut pending_transactions: Vec<PendingTransaction> = Vec::new();
583583
let mut deletion_pipe = twmq::redis::pipe();
584584

585-
for ((transaction_id, queued_at), user_request) in transaction_ids.into_iter().zip(user_requests) {
585+
for ((transaction_id, queued_at), user_request) in
586+
transaction_ids.into_iter().zip(user_requests)
587+
{
586588
match user_request {
587589
Some(user_request) => {
588590
let user_request_parsed = serde_json::from_str(&user_request)?;

0 commit comments

Comments
 (0)