Skip to content

Commit 19d0d2b

Browse files
authored
chore: aggregate PRs (#11286)
This PR aggregates changes from the following PRs: - Closes #11283 by @\oooLowNeoNooo - Closes #11285 by @\Sharilleed223
1 parent 5314461 commit 19d0d2b

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

crates/anvil/core/src/eth/wallet.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ pub enum WalletError {
4040
/// The transaction value is not 0.
4141
///
4242
/// The value should be 0 to prevent draining the sequencer.
43-
#[error("tx value not zero")]
43+
#[error("transaction value must be zero for delegated transactions")]
4444
ValueNotZero,
4545
/// The from field is set on the transaction.
4646
///
4747
/// Requests with the from field are rejected, since it is implied that it will always be the
4848
/// sequencer.
49-
#[error("tx from field is set")]
49+
#[error("transaction 'from' field should not be set for delegated transactions")]
5050
FromSet,
5151
/// The nonce field is set on the transaction.
5252
///
5353
/// Requests with the nonce field set are rejected, as this is managed by the sequencer.
54-
#[error("tx nonce is set")]
54+
#[error("transaction nonce should not be set for delegated transactions")]
5555
NonceSet,
5656
/// An authorization item was invalid.
5757
///
5858
/// The item is invalid if it tries to delegate an account to a contract that is not
5959
/// whitelisted.
60-
#[error("invalid authorization address")]
60+
#[error("invalid authorization address: contract is not whitelisted for delegation")]
6161
InvalidAuthorization,
6262
/// The to field of the transaction was invalid.
6363
///
@@ -66,14 +66,14 @@ pub enum WalletError {
6666
/// - There is no bytecode at the destination, or
6767
/// - The bytecode is not an EIP-7702 delegation designator, or
6868
/// - The delegation designator points to a contract that is not whitelisted
69-
#[error("the destination of the transaction is not a delegated account")]
69+
#[error("transaction destination is not a valid delegated account")]
7070
IllegalDestination,
7171
/// The transaction request was invalid.
7272
///
7373
/// This is likely an internal error, as most of the request is built by the sequencer.
74-
#[error("invalid tx request")]
74+
#[error("invalid transaction request format")]
7575
InvalidTransactionRequest,
7676
/// An internal error occurred.
77-
#[error("internal error")]
77+
#[error("internal server error occurred")]
7878
InternalError,
7979
}

crates/anvil/src/eth/error.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub enum BlockchainError {
105105
"op-stack deposit tx received but is not supported.\n\nYou can use it by running anvil with '--optimism'."
106106
)]
107107
DepositTransactionUnsupported,
108-
#[error("UnknownTransactionType not supported ")]
108+
#[error("Unknown transaction type not supported")]
109109
UnknownTransactionType,
110110
#[error("Excess blob gas not set.")]
111111
ExcessBlobGasNotSet,
@@ -178,21 +178,7 @@ where
178178

179179
impl From<WalletError> for BlockchainError {
180180
fn from(value: WalletError) -> Self {
181-
match value {
182-
WalletError::ValueNotZero => Self::Message("tx value not zero".to_string()),
183-
WalletError::FromSet => Self::Message("tx from field is set".to_string()),
184-
WalletError::NonceSet => Self::Message("tx nonce is set".to_string()),
185-
WalletError::InvalidAuthorization => {
186-
Self::Message("invalid authorization address".to_string())
187-
}
188-
WalletError::IllegalDestination => Self::Message(
189-
"the destination of the transaction is not a delegated account".to_string(),
190-
),
191-
WalletError::InternalError => Self::Message("internal error".to_string()),
192-
WalletError::InvalidTransactionRequest => {
193-
Self::Message("invalid tx request".to_string())
194-
}
195-
}
181+
Self::Message(value.to_string())
196182
}
197183
}
198184

@@ -349,7 +335,7 @@ impl From<InvalidTransaction> for InvalidTransactionError {
349335
Self::GasTooHigh(ErrDetail { detail: String::from("CallGasCostMoreThanGasLimit") })
350336
}
351337
InvalidTransaction::GasFloorMoreThanGasLimit { .. } => {
352-
Self::GasTooHigh(ErrDetail { detail: String::from("CallGasCostMoreThanGasLimit") })
338+
Self::GasTooHigh(ErrDetail { detail: String::from("GasFloorMoreThanGasLimit") })
353339
}
354340
InvalidTransaction::RejectCallerWithCode => Self::SenderNoEOA,
355341
InvalidTransaction::LackOfFundForMaxFee { .. } => Self::InsufficientFunds,

0 commit comments

Comments
 (0)