Skip to content

Commit

Permalink
fix: keep naming consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
andysim3d committed Jan 9, 2025
1 parent 9fb85ec commit c2f3c17
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 59 deletions.
10 changes: 5 additions & 5 deletions crates/pool/src/server/remote/protos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use alloy_primitives::{Address, B256};
use anyhow::{anyhow, Context};
use rundler_task::grpc::protos::{from_bytes, ConversionError, ToProtoBytes};
use rundler_types::{
authorization::Authorization,
authorization::Eip7702Auth,
chain::ChainSpec,
da::{
BedrockDAGasUOData as RundlerBedrockDAGasUOData, DAGasUOData as RundlerDAGasUOData,
Expand Down Expand Up @@ -83,9 +83,9 @@ pub trait TryUoFromProto<T>: Sized {
fn try_uo_from_proto(value: T, chain_spec: &ChainSpec) -> Result<Self, ConversionError>;
}

impl From<AuthorizationTuple> for Authorization {
impl From<AuthorizationTuple> for Eip7702Auth {
fn from(value: AuthorizationTuple) -> Self {
Authorization {
Eip7702Auth {
chain_id: value.chain_id,
address: from_bytes(&value.address).unwrap_or_default(),
nonce: value.nonce,
Expand All @@ -103,7 +103,7 @@ impl TryUoFromProto<UserOperationV06> for v0_6::UserOperation {
let authorization_tuple = op
.authorization_tuple
.as_ref()
.map(|authorization| Authorization::from(authorization.clone()));
.map(|authorization| Eip7702Auth::from(authorization.clone()));

Ok(v0_6::UserOperationBuilder::new(
chain_spec,
Expand Down Expand Up @@ -164,7 +164,7 @@ impl TryUoFromProto<UserOperationV07> for v0_7::UserOperation {
let authorization_tuple = op
.authorization_tuple
.as_ref()
.map(|authorization| Authorization::from(authorization.clone()));
.map(|authorization| Eip7702Auth::from(authorization.clone()));

let mut builder = v0_7::UserOperationBuilder::new(
chain_spec,
Expand Down
8 changes: 4 additions & 4 deletions crates/provider/src/alloy/entry_point/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
gas_limit: u64,
gas_fees: GasFees,
) -> TransactionRequest {
let mut authorization_list: Vec<SignedAuthorization> = vec![];
let mut eip7702_auth_list: Vec<SignedAuthorization> = vec![];
let mut ops_per_aggregator: Vec<UserOpsPerAggregatorV0_6> = ops_per_aggregator
.into_iter()
.map(|uoa| UserOpsPerAggregatorV0_6 {
Expand All @@ -541,7 +541,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
.into_iter()
.map(|op| {
if let Some(authorization) = &op.authorization_tuple {
authorization_list.push(SignedAuthorization::from(authorization.clone()));
eip7702_auth_list.push(SignedAuthorization::from(authorization.clone()));
}
op.into()
})
Expand All @@ -567,8 +567,8 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
.gas_limit(gas_limit)
.max_fee_per_gas(gas_fees.max_fee_per_gas)
.max_priority_fee_per_gas(gas_fees.max_priority_fee_per_gas);
if !authorization_list.is_empty() {
txn_request = txn_request.with_authorization_list(authorization_list);
if !eip7702_auth_list.is_empty() {
txn_request = txn_request.with_authorization_list(eip7702_auth_list);
}

txn_request
Expand Down
4 changes: 2 additions & 2 deletions crates/provider/src/alloy/entry_point/v0_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use rundler_contracts::v0_7::{
ENTRY_POINT_SIMULATIONS_V0_7_DEPLOYED_BYTECODE,
};
use rundler_types::{
authorization::Authorization,
authorization::Eip7702Auth,
chain::ChainSpec,
da::{DAGasBlockData, DAGasUOData},
v0_7::UserOperation,
Expand Down Expand Up @@ -609,7 +609,7 @@ impl TryFrom<ExecutionResultV0_7> for ExecutionResult {

fn add_authorization_tuple(
sender: Address,
authorization: &Option<Authorization>,
authorization: &Option<Eip7702Auth>,
state_override: &mut StateOverride,
) {
if let Some(authorization) = &authorization {
Expand Down
14 changes: 7 additions & 7 deletions crates/rpc/src/types/rpc_authorization.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use alloy_primitives::{Address, U256, U64, U8};
use rundler_types::authorization::Authorization;
use rundler_types::authorization::Eip7702Auth;
use serde::{Deserialize, Serialize};

/// authorization tuple for 7702 txn support
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub(crate) struct RpcAuthorization {
pub(crate) struct RpcEip7702Auth {
/// The chain ID of the authorization.
pub chain_id: U64,
/// The address of the authorization.
Expand All @@ -20,9 +20,9 @@ pub(crate) struct RpcAuthorization {
pub s: U256,
}

impl From<RpcAuthorization> for Authorization {
fn from(val: RpcAuthorization) -> Self {
Authorization {
impl From<RpcEip7702Auth> for Eip7702Auth {
fn from(val: RpcEip7702Auth) -> Self {
Eip7702Auth {
chain_id: val.chain_id.to(),
address: val.address,
nonce: val.nonce.to(),
Expand All @@ -33,8 +33,8 @@ impl From<RpcAuthorization> for Authorization {
}
}

impl From<Authorization> for RpcAuthorization {
fn from(value: Authorization) -> Self {
impl From<Eip7702Auth> for RpcEip7702Auth {
fn from(value: Eip7702Auth) -> Self {
Self {
chain_id: U64::from(value.chain_id),
address: value.address,
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/src/types/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rundler_types::{
};
use serde::{Deserialize, Serialize};

use super::{rpc_authorization::RpcAuthorization, FromRpc, RpcAddress};
use super::{rpc_authorization::RpcEip7702Auth, FromRpc, RpcAddress};
/// User operation definition for RPC
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
Expand All @@ -38,7 +38,7 @@ pub(crate) struct RpcUserOperation {
max_priority_fee_per_gas: U128,
paymaster_and_data: Bytes,
signature: Bytes,
eip7702_auth: Option<RpcAuthorization>,
eip7702_auth: Option<RpcEip7702Auth>,
}

impl From<UserOperation> for RpcUserOperation {
Expand Down Expand Up @@ -99,7 +99,7 @@ pub(crate) struct RpcUserOperationOptionalGas {
max_priority_fee_per_gas: Option<U128>,
paymaster_and_data: Bytes,
signature: Bytes,
authorization_contract: Option<Address>,
eip7702_auth_address: Option<Address>,
}

impl From<RpcUserOperationOptionalGas> for UserOperationOptionalGas {
Expand All @@ -116,7 +116,7 @@ impl From<RpcUserOperationOptionalGas> for UserOperationOptionalGas {
max_priority_fee_per_gas: def.max_priority_fee_per_gas.map(|x| x.to()),
paymaster_and_data: def.paymaster_and_data,
signature: def.signature,
authorization_contract: def.authorization_contract,
eip7702_auth_address: def.eip7702_auth_address,
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/src/types/v0_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rundler_types::{
};
use serde::{Deserialize, Serialize};

use super::{rpc_authorization::RpcAuthorization, FromRpc, RpcAddress};
use super::{rpc_authorization::RpcEip7702Auth, FromRpc, RpcAddress};

/// User operation definition for RPC inputs
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
Expand Down Expand Up @@ -49,7 +49,7 @@ pub(crate) struct RpcUserOperation {
paymaster_data: Option<Bytes>,
signature: Bytes,
#[serde(skip_serializing_if = "Option::is_none")]
eip7702_auth: Option<RpcAuthorization>,
eip7702_auth: Option<RpcEip7702Auth>,
}

impl From<UserOperation> for RpcUserOperation {
Expand Down Expand Up @@ -159,7 +159,7 @@ pub(crate) struct RpcUserOperationOptionalGas {
paymaster_post_op_gas_limit: Option<U128>,
paymaster_data: Option<Bytes>,
signature: Bytes,
eip7702_auth: Option<RpcAuthorization>,
eip7702_auth: Option<RpcEip7702Auth>,
}

impl From<RpcUserOperationOptionalGas> for UserOperationOptionalGas {
Expand All @@ -180,7 +180,7 @@ impl From<RpcUserOperationOptionalGas> for UserOperationOptionalGas {
paymaster_post_op_gas_limit: def.paymaster_post_op_gas_limit.map(|x| x.to()),
paymaster_data: def.paymaster_data.unwrap_or_default(),
signature: def.signature,
authorization_contract: def.eip7702_auth.map(|a| a.address),
eip7702_auth_address: def.eip7702_auth.map(|a| a.address),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sim/src/estimation/estimate_call_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ where
let callless_op = self.specialization.get_op_with_no_call_gas(op.clone());

if let Some(authorization_tuple) = op.authorization_tuple().clone() {
let authorization_contract = authorization_tuple.address;
let eip7702_auth_address = authorization_tuple.address;
authorization_utils::apply_7702_overrides(
&mut state_override,
op.sender(),
authorization_contract,
eip7702_auth_address,
);
}
let mut min_gas = 0;
Expand Down
2 changes: 1 addition & 1 deletion crates/sim/src/estimation/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ mod tests {
max_priority_fee_per_gas: None,
paymaster_and_data: Bytes::new(),
signature: Bytes::new(),
authorization_contract: None,
eip7702_auth_address: None,
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/sim/src/estimation/v0_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ mod tests {

factory: None,
factory_data: Bytes::new(),
authorization_contract: None,
eip7702_auth_address: None,
}
}

Expand Down Expand Up @@ -847,7 +847,7 @@ mod tests {

factory: None,
factory_data: Bytes::new(),
authorization_contract: None,
eip7702_auth_address: None,
};

let estimation = estimator
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
/// authorization tuple for 7702 txn support
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Authorization {
pub struct Eip7702Auth {
/// The chain ID of the authorization.
pub chain_id: u64,
/// The address of the authorization.
Expand All @@ -34,8 +34,8 @@ pub struct Authorization {
pub s: U256,
}

impl From<Authorization> for alloy_eips::eip7702::SignedAuthorization {
fn from(value: Authorization) -> Self {
impl From<Eip7702Auth> for alloy_eips::eip7702::SignedAuthorization {
fn from(value: Eip7702Auth) -> Self {
let authorization = alloy_eips::eip7702::Authorization {
chain_id: value.chain_id,
address: value.address,
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/user_operation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub mod v0_6;
/// User Operation types for Entry Point v0.7
pub mod v0_7;

use crate::{authorization::Authorization, chain::ChainSpec, Entity};
use crate::{authorization::Eip7702Auth, chain::ChainSpec, Entity};

/// A user op must be valid for at least this long into the future to be included.
pub const TIME_RANGE_BUFFER: Duration = Duration::from_secs(60);
Expand Down Expand Up @@ -111,7 +111,7 @@ pub trait UserOperation: Debug + Clone + Send + Sync + 'static {
}

/// Return the authorization list of the UO. empty if it is not 7702 txn.
fn authorization_tuple(&self) -> Option<Authorization>;
fn authorization_tuple(&self) -> Option<Eip7702Auth>;

/*
* Enhanced functions
Expand Down Expand Up @@ -503,7 +503,7 @@ impl UserOperation for UserOperationVariant {
}
}

fn authorization_tuple(&self) -> Option<Authorization> {
fn authorization_tuple(&self) -> Option<Eip7702Auth> {
match self {
UserOperationVariant::V0_6(op) => op.authorization_tuple(),
UserOperationVariant::V0_7(op) => op.authorization_tuple(),
Expand Down
16 changes: 8 additions & 8 deletions crates/types/src/user_operation/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::{
UserOperationVariant,
};
use crate::{
authorization::Authorization,
authorization::Eip7702Auth,
chain::ChainSpec,
entity::{Entity, EntityType},
EntryPointVersion,
Expand Down Expand Up @@ -80,7 +80,7 @@ pub struct UserOperation {
pub signature: Bytes,

/// eip 7702 - list of authorities.
pub authorization_tuple: Option<Authorization>,
pub authorization_tuple: Option<Eip7702Auth>,

/// Cached calldata gas cost
pub calldata_gas_cost: u128,
Expand Down Expand Up @@ -288,7 +288,7 @@ impl UserOperationTrait for UserOperation {
+ super::byte_array_abi_len(&self.signature)
}

fn authorization_tuple(&self) -> Option<Authorization> {
fn authorization_tuple(&self) -> Option<Eip7702Auth> {
self.authorization_tuple.clone()
}
}
Expand Down Expand Up @@ -402,7 +402,7 @@ pub struct UserOperationOptionalGas {
pub signature: Bytes,

/// eip 7702 - tuple of authority.
pub authorization_contract: Option<Address>,
pub eip7702_auth_address: Option<Address>,
}

impl UserOperationOptionalGas {
Expand Down Expand Up @@ -483,7 +483,7 @@ impl UserOperationOptionalGas {
super::default_if_none_or_equal(self.verification_gas_limit, max_verification_gas, 0);
let pvg = super::default_if_none_or_equal(self.pre_verification_gas, max_call_gas, 0);

let authorization_tuple = self.authorization_contract.map(|address| Authorization {
let authorization_tuple = self.eip7702_auth_address.map(|address| Eip7702Auth {
address,
..Default::default()
});
Expand Down Expand Up @@ -550,7 +550,7 @@ pub struct UserOperationBuilder<'a> {
/// to UO directly but included for implementation's sake.
pub struct ExtendedUserOperation {
/// EIP 7702: authorization tuples.
pub authorization_tuple: Option<Authorization>,
pub authorization_tuple: Option<Eip7702Auth>,
}

/// User operation required fields
Expand Down Expand Up @@ -686,7 +686,7 @@ impl<'a> UserOperationBuilder<'a> {
}

/// Sets the authorization tuple.
pub fn authorization_tuple(mut self, authorization: Option<Authorization>) -> Self {
pub fn authorization_tuple(mut self, authorization: Option<Eip7702Auth>) -> Self {
self.extended.authorization_tuple = authorization;
self
}
Expand Down Expand Up @@ -938,7 +938,7 @@ mod tests {
pre_verification_gas: None,
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
authorization_contract: None,
eip7702_auth_address: None,
}
.max_fill(&ChainSpec::default());

Expand Down
Loading

0 comments on commit c2f3c17

Please sign in to comment.