Skip to content

Commit

Permalink
fix(rpc): fix error message for unstaked entity mempool count
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Jun 25, 2024
1 parent ac74140 commit 3ffd875
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/pool/proto/op_pool/op_pool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ message PaymasterBalanceTooLow {

message MaxOperationsReachedError {
uint64 num_ops = 1;
bytes entity_address = 2;
Entity entity = 2;
}

message EntityThrottledError {
Expand Down
4 changes: 2 additions & 2 deletions crates/pool/src/mempool/uo_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
));
}

Expand All @@ -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,
));
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/pool/src/server/remote/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl TryFrom<ProtoMempoolError> 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(
Expand Down Expand Up @@ -168,11 +168,11 @@ impl From<MempoolError> 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()),
},
)),
},
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/src/eth/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion crates/types/src/pool/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 3ffd875

Please sign in to comment.