diff --git a/crates/pool/proto/op_pool/op_pool.proto b/crates/pool/proto/op_pool/op_pool.proto index d5cd68805..0b1e6ab65 100644 --- a/crates/pool/proto/op_pool/op_pool.proto +++ b/crates/pool/proto/op_pool/op_pool.proto @@ -511,7 +511,7 @@ message PaymasterBalanceTooLow { message MaxOperationsReachedError { uint64 num_ops = 1; - bytes entity_address = 2; + Entity entity = 2; } message EntityThrottledError { diff --git a/crates/pool/src/mempool/uo_pool.rs b/crates/pool/src/mempool/uo_pool.rs index 925de0bef..2805def3a 100644 --- a/crates/pool/src/mempool/uo_pool.rs +++ b/crates/pool/src/mempool/uo_pool.rs @@ -477,7 +477,7 @@ where { return Err(MempoolError::MaxOperationsReached( self.config.same_sender_mempool_count, - pool_op.uo.sender(), + Entity::account(pool_op.uo.sender()), )); } @@ -490,7 +490,7 @@ where if state.pool.address_count(&entity.address) >= ops_allowed as usize { return Err(MempoolError::MaxOperationsReached( ops_allowed as usize, - entity.address, + entity, )); } } diff --git a/crates/pool/src/server/remote/error.rs b/crates/pool/src/server/remote/error.rs index 99a2286ec..33ae98209 100644 --- a/crates/pool/src/server/remote/error.rs +++ b/crates/pool/src/server/remote/error.rs @@ -83,7 +83,7 @@ impl TryFrom for MempoolError { Some(mempool_error::Error::MaxOperationsReached(e)) => { MempoolError::MaxOperationsReached( e.num_ops as usize, - from_bytes(&e.entity_address)?, + (&e.entity.context("should have entity in error")?).try_into()?, ) } Some(mempool_error::Error::EntityThrottled(e)) => MempoolError::EntityThrottled( @@ -168,11 +168,11 @@ impl From for ProtoMempoolError { }, )), }, - MempoolError::MaxOperationsReached(ops, addr) => ProtoMempoolError { + MempoolError::MaxOperationsReached(ops, entity) => ProtoMempoolError { error: Some(mempool_error::Error::MaxOperationsReached( MaxOperationsReachedError { num_ops: ops as u64, - entity_address: addr.to_proto_bytes(), + entity: Some((&entity).into()), }, )), }, diff --git a/crates/rpc/src/eth/error.rs b/crates/rpc/src/eth/error.rs index 0c58697a7..b180ea3f5 100644 --- a/crates/rpc/src/eth/error.rs +++ b/crates/rpc/src/eth/error.rs @@ -93,8 +93,8 @@ pub enum EthRpcError { #[error("operation is out of time range")] OutOfTimeRange(OutOfTimeRangeData), /// Max operations reached for this sender - #[error("Max operations ({0}) reached for sender {1:#032x} due to being unstaked")] - MaxOperationsReached(usize, Address), + #[error("Max operations ({0}) reached for {1} due to being unstaked")] + MaxOperationsReached(usize, Entity), /// Entity throttled or banned #[error("{} {:#032x} throttled or banned", .0.kind, .0.address)] ThrottledOrBanned(Entity), diff --git a/crates/types/src/pool/error.rs b/crates/types/src/pool/error.rs index 752030d98..e81603251 100644 --- a/crates/types/src/pool/error.rs +++ b/crates/types/src/pool/error.rs @@ -56,7 +56,7 @@ pub enum MempoolError { ReplacementUnderpriced(U256, U256), /// Max operations reached for unstaked sender [UREP-010] or unstaked non-sender entity [UREP-020] #[error("Max operations ({0}) reached for entity {1}")] - MaxOperationsReached(usize, Address), + MaxOperationsReached(usize, Entity), /// Multiple roles violation /// Spec rule: STO-040 #[error("A {} at {} in this UserOperation is used as a sender entity in another UserOperation currently in mempool.", .0.kind, .0.address)]