Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions primitives/src/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::{evm::EthereumTransactionMessage, signature::AcalaMultiSignature, to_bytes, Address, Balance};
use frame_support::ensure;
use frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
traits::{ExtrinsicCall, Get},
Expand Down Expand Up @@ -106,6 +107,12 @@ where
target: "evm", "Ethereum eth_msg: {:?}", eth_msg
);

// module_evm::Call::eth_call, ensure tip is zero to prevent miner attacks
// module_evm::Call::eth_call_v2, tip encoded in gas_price
if eth_msg.gas_price.is_zero() {
ensure!(eth_msg.tip.is_zero(), InvalidTransaction::BadProof);
}

if !eth_msg.access_list.len().is_zero() {
// Not yet supported, require empty
return Err(InvalidTransaction::BadProof.into());
Expand Down Expand Up @@ -154,6 +161,12 @@ where
target: "evm", "Eip2930 eth_msg: {:?}", eth_msg
);

// module_evm::Call::eth_call, ensure tip is zero to prevent miner attacks
// module_evm::Call::eth_call_v2, tip encoded in gas_price
if eth_msg.gas_price.is_zero() {
ensure!(eth_msg.tip.is_zero(), InvalidTransaction::BadProof);
}

let (tx_gas_price, tx_gas_limit) = if eth_msg.gas_price.is_zero() {
recover_sign_data(&eth_msg, TxFeePerGas::get(), StorageDepositPerByte::get())
.ok_or(InvalidTransaction::BadProof)?
Expand Down
Loading