diff --git a/.env.example b/.env.example index 24891ad6..c5228ef6 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,7 @@ export RPC_PROXY_PROVIDER_COINBASE_APP_ID="" export RPC_PROXY_PROVIDER_ZERION_API_KEY="" export RPC_PROXY_PROVIDER_ONE_INCH_API_KEY="" export RPC_PROXY_PROVIDER_GETBLOCK_ACCESS_TOKENS='{}' -export RPC_PROXY_PROVIDER_BICONOMY_BUNDLER_TOKEN="" +export RPC_PROXY_PROVIDER_BUNDLER_TOKEN="" # PostgreSQL URI connection string export RPC_PROXY_POSTGRES_URI="postgres://postgres@localhost/postgres" diff --git a/.env.terraform.example b/.env.terraform.example index 5a29b103..2a0cbe81 100644 --- a/.env.terraform.example +++ b/.env.terraform.example @@ -10,7 +10,7 @@ export TF_VAR_coinbase_app_id="" export TF_VAR_zerion_api_key="" export TF_VAR_one_inch_api_key="" export TF_VAR_getblock_access_tokens='{}' -export TF_VAR_biconomy_bundler_token="" +export TF_VAR_bundler_token="" export TF_VAR_grafana_endpoint=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .endpoint') export TF_VAR_registry_api_auth_token="" export TF_VAR_debug_secret="" diff --git a/src/env/mod.rs b/src/env/mod.rs index a0a03032..8936ee31 100644 --- a/src/env/mod.rs +++ b/src/env/mod.rs @@ -154,10 +154,7 @@ mod test { ("RPC_PROXY_PROVIDER_ONE_INCH_API_KEY", "ONE_INCH_API_KEY"), ("RPC_PROXY_PROVIDER_ONE_INCH_REFERRER", "ONE_INCH_REFERRER"), ("RPC_PROXY_PROVIDER_GETBLOCK_ACCESS_TOKENS", "{}"), - ( - "RPC_PROXY_PROVIDER_BICONOMY_BUNDLER_TOKEN", - "BICONOMY_TOKEN", - ), + ("RPC_PROXY_PROVIDER_BUNDLER_TOKEN", "BUNDLER_TOKEN"), ( "RPC_PROXY_PROVIDER_PROMETHEUS_QUERY_URL", "PROMETHEUS_QUERY_URL", @@ -249,7 +246,7 @@ mod test { one_inch_api_key: Some("ONE_INCH_API_KEY".to_owned()), one_inch_referrer: Some("ONE_INCH_REFERRER".to_owned()), getblock_access_tokens: Some("{}".to_owned()), - biconomy_bundler_token: Some("BICONOMY_TOKEN".to_owned()), + bundler_token: Some("BUNDLER_TOKEN".to_owned()), }, rate_limiting: RateLimitingConfig { max_tokens: Some(100), diff --git a/src/error.rs b/src/error.rs index 2a1205f4..cbc9060d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -46,6 +46,9 @@ pub enum RpcError { #[error("Requested chain provider is temporarily unavailable: {0}")] ChainTemporarilyUnavailable(String), + #[error("Invalid chainId format for the requested namespace: {0}")] + InvalidChainIdFormat(String), + #[error("Specified provider is not supported: {0}")] UnsupportedProvider(String), @@ -215,7 +218,7 @@ impl IntoResponse for RpcError { StatusCode::BAD_REQUEST, Json(new_error_response( "".to_string(), - format!("Crypto utils invalid argument: {}", e), + format!("Crypto utils error: {}", e), )), ) .into_response(), @@ -227,6 +230,14 @@ impl IntoResponse for RpcError { )), ) .into_response(), + Self::InvalidChainIdFormat(chain_id) => ( + StatusCode::BAD_REQUEST, + Json(new_error_response( + "chainId".to_string(), + format!("Requested {chain_id} has invalid format for the requested namespace"), + )), + ) + .into_response(), Self::UnsupportedProvider(provider) => ( StatusCode::BAD_REQUEST, Json(new_error_response( diff --git a/src/handlers/identity.rs b/src/handlers/identity.rs index 7ba1ddce..5425fea2 100644 --- a/src/handlers/identity.rs +++ b/src/handlers/identity.rs @@ -466,8 +466,7 @@ impl JsonRpcClient for SelfProvider { let id = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Time should't go backwards") - .as_millis() - .to_string(); + .as_secs(); let response = rpc_call( self.state.clone(), diff --git a/src/handlers/sessions/cosign.rs b/src/handlers/sessions/cosign.rs index 7202af80..64bbea51 100644 --- a/src/handlers/sessions/cosign.rs +++ b/src/handlers/sessions/cosign.rs @@ -6,7 +6,8 @@ use { storage::irn::OperationType, utils::crypto::{ abi_encode_two_bytes_arrays, call_get_signature, call_get_user_op_hash, - disassemble_caip10, send_user_operation_to_bundler, CaipNamespaces, + disassemble_caip10, pack_signature, send_user_operation_to_bundler, to_eip191_message, + CaipNamespaces, ChainId, }, }, axum::{ @@ -16,14 +17,14 @@ use { }, base64::prelude::*, ethers::{ - core::k256::{ - ecdsa::{signature::Signer, Signature, SigningKey}, - pkcs8::DecodePrivateKey, - }, - types::{Bytes, H160}, + core::k256::ecdsa::SigningKey, + signers::LocalWallet, + types::{H160, H256}, + utils::keccak256, }, serde::{Deserialize, Serialize}, std::{sync::Arc, time::SystemTime}, + tracing::info, wc::future::FutureExt, }; @@ -48,14 +49,23 @@ pub async fn handler( #[tracing::instrument(skip(state), level = "debug")] async fn handler_internal( state: State>, - Path(address): Path, + Path(caip10_address): Path, request_payload: CoSignRequest, ) -> Result { // Checking the CAIP-10 address format - let (namespace, chain_id, address) = disassemble_caip10(&address)?; + let (namespace, chain_id, address) = disassemble_caip10(&caip10_address)?; if namespace != CaipNamespaces::Eip155 { return Err(RpcError::UnsupportedNamespace(namespace)); } + + // ChainID validation + let chain_id_uint = chain_id + .parse::() + .map_err(|_| RpcError::InvalidChainIdFormat(chain_id.clone()))?; + if !ChainId::is_supported(chain_id_uint) { + return Err(RpcError::UnsupportedChain(chain_id.clone())); + } + let h160_address = address .parse::() .map_err(|_| RpcError::InvalidAddress)?; @@ -86,12 +96,13 @@ async fn handler_internal( user_op.clone(), ) .await?; + let eip191_user_op_hash = to_eip191_message(&user_op_hash); // Get the PCI object from the IRN let irn_client = state.irn.as_ref().ok_or(RpcError::IrnNotConfigured)?; let irn_call_start = SystemTime::now(); let storage_permissions_item = irn_client - .hget(address.clone(), request_payload.pci.clone()) + .hget(caip10_address.clone(), request_payload.pci.clone()) .await? .ok_or_else(|| RpcError::PermissionNotFound(request_payload.pci.clone()))?; state @@ -105,27 +116,42 @@ async fn handler_internal( .context .clone() .ok_or_else(|| RpcError::PermissionContextNotUpdated(request_payload.pci.clone()))?; - let permission_context = hex::decode(permission_context_item.context.permissions_context) - .map_err(|e| RpcError::WrongHexFormat(e.to_string()))?; + let permission_context = hex::decode( + permission_context_item + .context + .permissions_context + .clone() + .trim_start_matches("0x"), + ) + .map_err(|e| { + RpcError::WrongHexFormat(format!( + "error:{:?} permission_context:{}", + e.to_string(), + permission_context_item.context.permissions_context + )) + })?; // Sign the userOp hash with the permission signing key let signing_key_bytes = BASE64_STANDARD .decode(storage_permissions_item.signing_key) .map_err(|e| RpcError::WrongBase64Format(e.to_string()))?; - let signer = SigningKey::from_pkcs8_der(&signing_key_bytes)?; - let signature: Signature = signer.sign(&user_op_hash); + let signer = SigningKey::from_bytes(signing_key_bytes.as_slice().into()) + .map_err(|e| RpcError::KeyFormatError(e.to_string()))?; + + // Create a LocalWallet for signing and signing the hashed message + let wallet = LocalWallet::from(signer); + let signature = wallet + .sign_hash(H256::from(&keccak256(eip191_user_op_hash.clone()))) + .unwrap(); + let packed_signature = pack_signature(&signature); // ABI encode the signatures - let concatenated_signature = abi_encode_two_bytes_arrays( - &Bytes::from(signature.to_der().as_bytes().to_vec()), - &user_op.signature, - ); + let concatenated_signature = abi_encode_two_bytes_arrays(&packed_signature, &user_op.signature); // Update the userOp with the signature user_op.signature = concatenated_signature; - // Get the Signature - // UserOpBuilder contract address + // Get the Signature from the UserOpBuilder let user_op_builder_contract_address = permission_context_item .context .signer_data @@ -142,31 +168,26 @@ async fn handler_internal( ) .await?; - // Update the userOp with the signature - user_op.signature = get_signature_result; + // Todo: remove this debug line before production stage + info!("UserOpPacked final JSON: {:?}", serde_json::json!(user_op)); - // Using the Biconomy bundler to send the userOperation - let entry_point = "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789"; - let simulation_type = "validation_and_execution"; - let bundler_url = format!( - "https://bundler.biconomy.io/api/v2/{}/{}", - chain_id, + // Update the userOp with the signature, + // send the userOperation to the bundler and get the receipt + user_op.signature = get_signature_result; + let bundler_api_token = state .config .providers - .biconomy_bundler_token + .bundler_token .clone() .ok_or(RpcError::InvalidConfiguration( - "Missing biconomy bundler token".to_string() - ))? - ); - - // Send the userOperation to the bundler and get the receipt + "Missing bundler API token".to_string(), + ))?; let receipt = send_user_operation_to_bundler( &user_op, - &bundler_url, - entry_point, - simulation_type, + &chain_id, + &bundler_api_token, + ENTRY_POINT_V07_CONTRACT_ADDRESS, &state.http_client, ) .await?; diff --git a/src/handlers/sessions/create.rs b/src/handlers/sessions/create.rs index c9ebcc41..c466929f 100644 --- a/src/handlers/sessions/create.rs +++ b/src/handlers/sessions/create.rs @@ -50,7 +50,7 @@ async fn handler_internal( // Generate a secp256k1 keys and export to DER Base64 format let signing_key = SigningKey::random(&mut OsRng); let verifying_key = VerifyingKey::from(&signing_key); - let private_key_der = signing_key.to_bytes(); + let private_key_der = signing_key.to_bytes().to_vec(); let private_key_der_base64 = BASE64_STANDARD.encode(private_key_der); let public_key_der = verifying_key.to_encoded_point(false).as_bytes().to_vec(); let public_key_der_base64 = BASE64_STANDARD.encode(&public_key_der); diff --git a/src/providers/mod.rs b/src/providers/mod.rs index ac169471..3ca95024 100644 --- a/src/providers/mod.rs +++ b/src/providers/mod.rs @@ -92,8 +92,8 @@ pub struct ProvidersConfig { pub one_inch_referrer: Option, /// GetBlock provider access tokens in JSON format pub getblock_access_tokens: Option, - /// Biconomy bundler API key - pub biconomy_bundler_token: Option, + /// Bundler API token + pub bundler_token: Option, } #[derive(Debug, Serialize, Deserialize, Clone)] diff --git a/src/utils/crypto.rs b/src/utils/crypto.rs index ed5b844f..de4de676 100644 --- a/src/utils/crypto.rs +++ b/src/utils/crypto.rs @@ -1,13 +1,16 @@ use { - crate::{analytics::MessageSource, error::RpcError, utils::generate_random_string}, + crate::{analytics::MessageSource, error::RpcError}, alloy_primitives::Address, base64::prelude::*, ethers::{ abi::Token, - core::k256::ecdsa::{signature::Verifier, Signature, VerifyingKey}, + core::{ + k256::ecdsa::{signature::Verifier, Signature, VerifyingKey}, + types::Signature as EthSignature, + }, prelude::{abigen, EthAbiCodec, EthAbiType}, providers::{Http, Middleware, Provider}, - types::{Address as EthersAddress, Bytes, H160, H256, U256}, + types::{Address as EthersAddress, Bytes, H160, H256, U128, U256}, utils::keccak256, }, once_cell::sync::Lazy, @@ -42,6 +45,8 @@ pub const JSON_RPC_GET_RECEIPT_METHOD_STR: &str = "eth_getTransactionReceipt"; pub static JSON_RPC_GET_RECEIPT_METHOD: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| Arc::from(JSON_RPC_GET_RECEIPT_METHOD_STR)); +const BUNDLER_API_URL: &str = "https://api.pimlico.io/v2"; + #[derive(thiserror::Error, Debug)] pub enum CryptoUitlsError { #[error("Namespace is not supported: {0}")] @@ -75,9 +80,9 @@ pub enum CryptoUitlsError { } /// JSON-RPC request schema -#[derive(Serialize)] +#[derive(Serialize, Clone, Debug)] pub struct JsonRpcRequest { - pub id: String, + pub id: u64, pub jsonrpc: Arc, pub method: Arc, pub params: T, @@ -87,48 +92,47 @@ pub struct JsonRpcRequest { struct BundlerJsonRpcParams { user_op: UserOperation, entry_point: String, - simulation_type: BundlerSimulationType, -} - -#[derive(Serialize, Deserialize, Debug)] -struct BundlerSimulationType { - simulation_type: String, } -/// ERC-4337 bundler userOperation schema -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, EthAbiCodec, EthAbiType)] +/// ERC-4337 bundler userOperation schema v0.7 +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UserOperation { pub sender: EthersAddress, + /// The first 192 bits are the nonce key, the last 64 bits are the nonce value pub nonce: U256, - pub init_code: Bytes, - pub call_data: Bytes, - pub call_gas_limit: U256, - pub verification_gas_limit: U256, - pub pre_verification_gas: U256, - pub max_fee_per_gas: U256, - pub max_priority_fee_per_gas: U256, - pub paymaster_and_data: Bytes, - pub signature: Bytes, -} - -/// ERC-4337 bundler Packed userOperation schema for v07 -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, EthAbiCodec, EthAbiType)] -#[serde(rename_all = "camelCase")] -pub struct PackedUserOperation { - pub sender: EthersAddress, - pub nonce: U256, - pub init_code: Bytes, pub call_data: Bytes, - pub account_gas_limits: [u8; 32], + pub call_gas_limit: U128, + pub verification_gas_limit: U128, pub pre_verification_gas: U256, - pub gas_fees: [u8; 32], - pub paymaster_and_data: Bytes, + pub max_priority_fee_per_gas: U128, + pub max_fee_per_gas: U128, pub signature: Bytes, + /* + * Optional fields + */ + /// Factory and data, are populated if deploying a new sender contract + pub factory: Option, + pub factory_data: Option, + /// Paymaster and related fields are populated if using a paymaster + pub paymaster: Option, + pub paymaster_verification_gas_limit: Option, + pub paymaster_post_op_gas_limit: Option, + pub paymaster_data: Option, } impl UserOperation { + /// Create a packed UserOperation v07 structure pub fn get_packed(&self) -> PackedUserOperation { + let init_code = match (self.factory, self.factory_data.as_ref()) { + (Some(factory), Some(factory_data)) => { + let mut init_code = factory.as_bytes().to_vec(); + init_code.extend_from_slice(factory_data); + Bytes::from(init_code) + } + _ => Bytes::new(), + }; + let account_gas_limits = concat_128( self.verification_gas_limit.low_u128().to_be_bytes(), self.call_gas_limit.low_u128().to_be_bytes(), @@ -139,20 +143,58 @@ impl UserOperation { self.max_fee_per_gas.low_u128().to_be_bytes(), ); + let paymaster_and_data = match ( + self.paymaster, + self.paymaster_verification_gas_limit, + self.paymaster_post_op_gas_limit, + self.paymaster_data.as_ref(), + ) { + ( + Some(paymaster), + Some(paymaster_verification_gas_limit), + Some(paymaster_post_op_gas_limit), + Some(paymaster_data), + ) => { + let mut paymaster_and_data = paymaster.as_bytes().to_vec(); + paymaster_and_data + .extend_from_slice(&paymaster_verification_gas_limit.low_u128().to_be_bytes()); + paymaster_and_data + .extend_from_slice(&paymaster_post_op_gas_limit.low_u128().to_be_bytes()); + paymaster_and_data.extend_from_slice(paymaster_data); + Bytes::from(paymaster_and_data) + } + _ => Bytes::new(), + }; + PackedUserOperation { sender: self.sender, nonce: self.nonce, - init_code: self.init_code.clone(), + init_code, call_data: self.call_data.clone(), - account_gas_limits, + account_gas_limits: H256::from_slice(&account_gas_limits), pre_verification_gas: self.pre_verification_gas, - gas_fees, - paymaster_and_data: self.paymaster_and_data.clone(), + gas_fees: H256::from_slice(&gas_fees), + paymaster_and_data, signature: self.signature.clone(), } } } +/// ERC-4337 bundler Packed userOperation schema for v07 +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, EthAbiCodec, EthAbiType)] +#[serde(rename_all = "camelCase")] +pub struct PackedUserOperation { + pub sender: EthersAddress, + pub nonce: U256, + pub init_code: Bytes, + pub call_data: Bytes, + pub account_gas_limits: H256, + pub pre_verification_gas: U256, + pub gas_fees: H256, + pub paymaster_and_data: Bytes, + pub signature: Bytes, +} + fn concat_128(a: [u8; 16], b: [u8; 16]) -> [u8; 32] { std::array::from_fn(|i| { if let Some(i) = i.checked_sub(a.len()) { @@ -163,11 +205,34 @@ fn concat_128(a: [u8; 16], b: [u8; 16]) -> [u8; 32] { }) } -pub fn add_eip191(message: &str) -> String { - format!("\x19Ethereum Signed Message:\n{}{}", message.len(), message) +/// Convert message to EIP-191 compatible format +pub fn to_eip191_message(message: &[u8]) -> Vec { + let prefix = format!("\x19Ethereum Signed Message:\n{}", message.len()); + let mut eip191_message = Vec::with_capacity(prefix.len() + message.len()); + eip191_message.extend_from_slice(prefix.as_bytes()); + eip191_message.extend_from_slice(message); + eip191_message +} + +/// Pack signature into a single byte array to Ethereum compatible format +pub fn pack_signature(unpacked: &EthSignature) -> Bytes { + // Extract r, s, and v from the signature + let r = unpacked.r; + let s = unpacked.s; + let v = if unpacked.v == 27 { 0x1b } else { 0x1c }; + let mut r_bytes = [0u8; 32]; + let mut s_bytes = [0u8; 32]; + r.to_big_endian(&mut r_bytes); + s.to_big_endian(&mut s_bytes); + // Pack r, s, and v into a single byte array + let mut packed_signature = Vec::with_capacity(r_bytes.len() + s_bytes.len() + 1); + packed_signature.extend_from_slice(&r_bytes); + packed_signature.extend_from_slice(&s_bytes); + packed_signature.push(v); + Bytes::from(packed_signature) } -// Encode two bytes array into a single ABI encoded bytes +/// Encode two bytes array into a single ABI encoded bytes pub fn abi_encode_two_bytes_arrays(bytes1: &Bytes, bytes2: &Bytes) -> Bytes { let tokens = vec![Token::Bytes(bytes1.to_vec()), Token::Bytes(bytes2.to_vec())]; @@ -176,7 +241,7 @@ pub fn abi_encode_two_bytes_arrays(bytes1: &Bytes, bytes2: &Bytes) -> Bytes { /// Returns the keccak256 EIP-191 hash of the message pub fn get_message_hash(message: &str) -> H256 { - let prefixed_message = add_eip191(message); + let prefixed_message = to_eip191_message(message.as_bytes()); let message_hash = ethers::core::utils::keccak256(prefixed_message.clone()); ethers::types::H256::from_slice(&message_hash) } @@ -380,9 +445,9 @@ pub async fn call_get_user_op_hash( nonce: packed_user_op.nonce, init_code: packed_user_op.init_code, call_data: packed_user_op.call_data, - account_gas_limits: packed_user_op.account_gas_limits, + account_gas_limits: packed_user_op.account_gas_limits.into(), pre_verification_gas: packed_user_op.pre_verification_gas, - gas_fees: packed_user_op.gas_fees, + gas_fees: packed_user_op.gas_fees.into(), paymaster_and_data: packed_user_op.paymaster_and_data, signature: packed_user_op.signature, }; @@ -433,9 +498,9 @@ pub async fn call_get_signature( nonce: packed_user_op.nonce, init_code: packed_user_op.init_code, call_data: packed_user_op.call_data, - account_gas_limits: packed_user_op.account_gas_limits, + account_gas_limits: packed_user_op.account_gas_limits.into(), pre_verification_gas: packed_user_op.pre_verification_gas, - gas_fees: packed_user_op.gas_fees, + gas_fees: packed_user_op.gas_fees.into(), paymaster_and_data: packed_user_op.paymaster_and_data, signature: packed_user_op.signature, }; @@ -560,6 +625,11 @@ impl ChainId { } } } + + /// Is ChainID is supported + pub fn is_supported(chain_id: u64) -> bool { + ChainId::iter().any(|x| x as u64 == chain_id) + } } #[derive(Clone, Copy, Debug, EnumString, EnumIter, Display, Eq, PartialEq)] @@ -664,29 +734,28 @@ pub fn convert_token_amount_to_value(balance: U256, price: f64, decimals: u32) - balance_f64 * price } -/// Function to send UserOperation to the bundler and return receipt +/// Function to send UserOperation to the bundler and return the receipt +#[tracing::instrument(skip(http_client), level = "debug")] pub async fn send_user_operation_to_bundler( user_op: &UserOperation, - bundler_url: &str, + chain_id: &str, + bundler_api_token: &str, entry_point: &str, - simulation_type: &str, http_client: &Client, ) -> Result { // Send the UserOperation to the bundler let jsonrpc_send_userop_request = JsonRpcRequest { - id: generate_random_string(10), + id: 1, jsonrpc: JSON_RPC_VERSION.clone(), method: JSON_RPC_BUNDLER_METHOD.clone(), - params: vec![BundlerJsonRpcParams { - user_op: user_op.clone(), - entry_point: entry_point.into(), - simulation_type: BundlerSimulationType { - simulation_type: simulation_type.into(), - }, - }], + params: serde_json::json!([user_op.clone(), entry_point]), }; + let bundler_url = format!( + "{}/{}/rpc?apikey={}", + BUNDLER_API_URL, chain_id, bundler_api_token + ); let response: serde_json::Value = http_client - .post(bundler_url) + .post(bundler_url.clone()) .json(&jsonrpc_send_userop_request) .send() .await? @@ -705,7 +774,7 @@ pub async fn send_user_operation_to_bundler( // Get the transaction receipt let jsonrpc_get_receipt_request = JsonRpcRequest { - id: generate_random_string(10), + id: 1, jsonrpc: JSON_RPC_VERSION.clone(), method: JSON_RPC_GET_RECEIPT_METHOD.clone(), params: vec![tx_hash], @@ -912,15 +981,19 @@ mod tests { let user_op = UserOperation { sender: sender_address, nonce: U256::zero(), - init_code: Bytes::from(vec![0x01, 0x02, 0x03]), call_data: Bytes::from(vec![0x04, 0x05, 0x06]), - call_gas_limit: U256::zero(), - verification_gas_limit: U256::zero(), + call_gas_limit: U128::zero(), + verification_gas_limit: U128::zero(), pre_verification_gas: U256::zero(), - max_fee_per_gas: U256::zero(), - max_priority_fee_per_gas: U256::zero(), - paymaster_and_data: Bytes::from(vec![0x07, 0x08, 0x09]), + max_fee_per_gas: U128::zero(), + max_priority_fee_per_gas: U128::zero(), signature: Bytes::from(vec![0x0a, 0x0b, 0x0c]), + factory: None, + factory_data: None, + paymaster: None, + paymaster_data: None, + paymaster_post_op_gas_limit: None, + paymaster_verification_gas_limit: None, }; let result = call_get_user_op_hash(rpc_project_id, chain_id, contract_address, user_op) @@ -929,7 +1002,7 @@ mod tests { assert_eq!( hex::encode(result), - "133f6ac5944a128b3d4c4d69ac927b2d320fdde0b35b48962c48e1b71a977c28" + "a5e787e98d421a0e62b2457e525bc8a4b1bde14cc71d48c0cf139b0b1fadb1cc" ); } @@ -968,15 +1041,19 @@ mod tests { let user_operation = UserOperation { sender: sa_address, nonce: U256::zero(), - init_code: Bytes::from(vec![0x01, 0x02, 0x03]), call_data: Bytes::from(vec![0x04, 0x05, 0x06]), - call_gas_limit: U256::zero(), - verification_gas_limit: U256::zero(), + call_gas_limit: U128::zero(), + verification_gas_limit: U128::zero(), pre_verification_gas: U256::zero(), - max_fee_per_gas: U256::zero(), - max_priority_fee_per_gas: U256::zero(), - paymaster_and_data: Bytes::from(vec![0x07, 0x08, 0x09]), + max_fee_per_gas: U128::zero(), + max_priority_fee_per_gas: U128::zero(), signature: Bytes::from(vec![0x0a, 0x0b, 0x0c]), + factory: None, + factory_data: None, + paymaster: None, + paymaster_data: None, + paymaster_post_op_gas_limit: None, + paymaster_verification_gas_limit: None, }; let result = call_get_signature( diff --git a/terraform/ecs/cluster.tf b/terraform/ecs/cluster.tf index 38052032..4c1decdb 100644 --- a/terraform/ecs/cluster.tf +++ b/terraform/ecs/cluster.tf @@ -94,7 +94,7 @@ resource "aws_ecs_task_definition" "app_task" { { name = "RPC_PROXY_PROVIDER_ONE_INCH_API_KEY", value = var.one_inch_api_key }, { name = "RPC_PROXY_PROVIDER_ONE_INCH_REFERRER", value = var.one_inch_referrer }, { name = "RPC_PROXY_PROVIDER_GETBLOCK_ACCESS_TOKENS", value = var.getblock_access_tokens }, - { name = "RPC_PROXY_PROVIDER_BICONOMY_BUNDLER_TOKEN", value = var.biconomy_bundler_token }, + { name = "RPC_PROXY_PROVIDER_BUNDLER_TOKEN", value = var.bundler_token }, { name = "RPC_PROXY_PROVIDER_PROMETHEUS_QUERY_URL", value = "http://127.0.0.1:${local.prometheus_proxy_port}/workspaces/${var.prometheus_workspace_id}" }, { name = "RPC_PROXY_PROVIDER_PROMETHEUS_WORKSPACE_HEADER", value = "aps-workspaces.${module.this.region}.amazonaws.com" }, diff --git a/terraform/ecs/variables.tf b/terraform/ecs/variables.tf index d679cb4b..1cdecde0 100644 --- a/terraform/ecs/variables.tf +++ b/terraform/ecs/variables.tf @@ -213,8 +213,8 @@ variable "getblock_access_tokens" { sensitive = true } -variable "biconomy_bundler_token" { - description = "The API key for Biconomy" +variable "bundler_token" { + description = "Bundler API token" type = string sensitive = true } diff --git a/terraform/res_ecs.tf b/terraform/res_ecs.tf index e8abaf1a..6e73ab83 100644 --- a/terraform/res_ecs.tf +++ b/terraform/res_ecs.tf @@ -71,7 +71,7 @@ module "ecs" { one_inch_api_key = var.one_inch_api_key one_inch_referrer = var.one_inch_referrer getblock_access_tokens = var.getblock_access_tokens - biconomy_bundler_token = var.biconomy_bundler_token + bundler_token = var.bundler_token # Project Registry registry_api_endpoint = var.registry_api_endpoint diff --git a/terraform/variables.tf b/terraform/variables.tf index 024d3a1b..3f0af3b3 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -133,8 +133,8 @@ variable "getblock_access_tokens" { sensitive = true } -variable "biconomy_bundler_token" { - description = "The bundler token for Biconomy" +variable "bundler_token" { + description = "Bundler API token" type = string sensitive = true }