Skip to content

Commit 182ff97

Browse files
committed
add recover_signer for validate
1 parent 0a31f38 commit 182ff97

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

frame/ethereum/src/lib.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,21 @@ where
150150
dispatch_info: &DispatchInfoOf<T::RuntimeCall>,
151151
len: usize,
152152
) -> Option<TransactionValidity> {
153-
if let Call::transact { transaction, source: _ } = self {
153+
if let Call::transact { transaction, source } = self {
154154
if let Err(e) = CheckWeight::<T>::do_validate(dispatch_info, len) {
155155
return Some(Err(e));
156156
}
157-
158-
Some(Pallet::<T>::validate_transaction_in_pool(
159-
*origin,
160-
transaction,
161-
))
157+
match Pallet::<T>::recover_signer(&transaction) {
158+
Some(expect_source) => if expect_source != *source {
159+
return Some(Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)));
160+
} else {
161+
Some(Pallet::<T>::validate_transaction_in_pool(
162+
*origin,
163+
transaction,
164+
))
165+
},
166+
None => return Some(Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner))),
167+
}
162168
} else {
163169
None
164170
}

0 commit comments

Comments
 (0)