Skip to content

Commit 3c7dce3

Browse files
committed
chore: rust fmt
1 parent 0de78fd commit 3c7dce3

File tree

2 files changed

+24
-17
lines changed
  • packages/sdk-platforms/rust/zksync-sso-erc4337/crates
    • zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/signers
    • zksync-sso-erc4337-ffi-web/src

2 files changed

+24
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1-
use alloy::primitives::{Address, Bytes, FixedBytes};
2-
use alloy::sol_types::SolType;
1+
use alloy::{
2+
primitives::{Address, Bytes, FixedBytes},
3+
sol_types::SolType,
4+
};
35

46
pub fn stub_signature_passkey(validator: Address) -> eyre::Result<Bytes> {
57
// Create a more realistic WebAuthn stub signature for gas estimation
68
// Format: validator_address (20 bytes) + abi_encoded(authenticatorData, clientDataJSON, rs, credentialId)
7-
9+
810
// Minimal valid authenticator data (37 bytes minimum)
911
let authenticator_data = vec![
10-
0x49, 0x96, 0x0d, 0xe5, 0x88, 0x0e, 0x8c, 0x68, 0x74, 0x34,
11-
0x17, 0x0f, 0x64, 0x76, 0x60, 0x5b, 0x8f, 0xe4, 0xae, 0xb9,
12-
0xa2, 0x86, 0x32, 0xc7, 0x99, 0x5c, 0xf3, 0xba, 0x83, 0x1d,
13-
0x97, 0x63, // rpIdHash (32 bytes)
12+
0x49, 0x96, 0x0d, 0xe5, 0x88, 0x0e, 0x8c, 0x68, 0x74, 0x34, 0x17, 0x0f,
13+
0x64, 0x76, 0x60, 0x5b, 0x8f, 0xe4, 0xae, 0xb9, 0xa2, 0x86, 0x32, 0xc7,
14+
0x99, 0x5c, 0xf3, 0xba, 0x83, 0x1d, 0x97,
15+
0x63, // rpIdHash (32 bytes)
1416
0x01, // flags
1517
0x00, 0x00, 0x00, 0x00, // counter (4 bytes)
1618
];
17-
19+
1820
// Minimal client data JSON for gas estimation
19-
let client_data_json = r#"{"type":"webauthn.get","challenge":"AAAAAAAAAAAAAAAAAAAAAA"}"#.to_string();
20-
21+
let client_data_json =
22+
r#"{"type":"webauthn.get","challenge":"AAAAAAAAAAAAAAAAAAAAAA"}"#
23+
.to_string();
24+
2125
// Stub signature components (r and s)
2226
let r_fixed = FixedBytes::<32>::ZERO;
2327
let s_fixed = FixedBytes::<32>::ZERO;
24-
28+
2529
// Stub credential ID
2630
let credential_id = vec![0u8; 16];
27-
31+
2832
// ABI encode the WebAuthn signature: (bytes authenticatorData, string clientDataJSON, bytes32[2] rs, bytes credentialId)
2933
type SignatureParams = (
3034
alloy::sol_types::sol_data::Bytes,
@@ -44,11 +48,11 @@ pub fn stub_signature_passkey(validator: Address) -> eyre::Result<Bytes> {
4448
);
4549

4650
let encoded_signature = SignatureParams::abi_encode_params(&params);
47-
51+
4852
// Prepend validator address (20 bytes) to the encoded signature
4953
let mut result = Vec::with_capacity(20 + encoded_signature.len());
5054
result.extend_from_slice(validator.as_slice());
5155
result.extend_from_slice(&encoded_signature);
52-
56+
5357
Ok(Bytes::from(result))
5458
}

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-ffi-web/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,14 +1343,16 @@ pub fn prepare_passkey_user_operation(
13431343
) = match paymaster_params {
13441344
Some(ref pm) => {
13451345
// Auto-set paymaster_post_op_gas_limit if not provided (default: 1M gas)
1346-
let post_op_gas = pm.post_op_gas_limit.or_else(|| Some(U256::from(1_000_000u64)));
1346+
let post_op_gas = pm
1347+
.post_op_gas_limit
1348+
.or_else(|| Some(U256::from(1_000_000u64)));
13471349
(
13481350
Some(pm.address),
13491351
Some(pm.data.clone()),
13501352
pm.verification_gas_limit,
13511353
post_op_gas,
13521354
)
1353-
},
1355+
}
13541356
None => (None, None, None, None),
13551357
};
13561358

@@ -1361,7 +1363,8 @@ pub fn prepare_passkey_user_operation(
13611363
pre_verification_gas
13621364
);
13631365
if paymaster_addr_opt.is_some() {
1364-
console_log!(" Paymaster gas limits: verification={}, postOp={}",
1366+
console_log!(
1367+
" Paymaster gas limits: verification={}, postOp={}",
13651368
paymaster_ver_gas_opt.unwrap_or(U256::ZERO),
13661369
paymaster_post_gas_opt.unwrap_or(U256::ZERO)
13671370
);

0 commit comments

Comments
 (0)