Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error out on non-serializeable evm tx #1625

Merged
merged 1 commit into from
Dec 19, 2024
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
10 changes: 4 additions & 6 deletions crates/evm/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId};
use sov_modules_api::prelude::*;
use sov_modules_api::{native_error, CallResponse, SoftConfirmationModuleCallError, WorkingSet};

use crate::conversions::ConversionError;
use crate::evm::db::EvmDb;
use crate::evm::executor::{self};
use crate::evm::handler::{CitreaExternal, CitreaExternalExt};
Expand Down Expand Up @@ -131,14 +132,11 @@ impl<C: sov_modules_api::Context> Evm<C> {
) -> Result<CallResponse, SoftConfirmationModuleCallError> {
// use of `self.block_env` is allowed here

// TODO: should not include non deserilizable transactions
let users_txs: Vec<TransactionSignedEcRecovered> = txs
.into_iter()
.filter_map(|tx| match tx.try_into() {
Ok(tx) => Some(tx),
Err(_) => None,
})
.collect();
.map(|tx| tx.try_into())
.collect::<Result<Vec<_>, ConversionError>>()
.map_err(|_| SoftConfirmationModuleCallError::EvmTxNotSerializable)?;

let cfg = self.cfg.get(working_set).expect("Evm config must be set");
let active_evm_spec = citrea_spec_id_to_evm_spec_id(context.active_spec());
Expand Down
1 change: 1 addition & 0 deletions crates/sequencer/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ where
working_set_to_discard = working_set.revert().to_revertable();
continue;
},
sov_modules_api::SoftConfirmationModuleCallError::EvmTxNotSerializable => panic!("Fed a non-serializable tx"),
// we don't call the rule enforcer in the sequencer -- yet at least
sov_modules_api::SoftConfirmationModuleCallError::RuleEnforcerUnauthorized => unreachable!(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ pub enum SoftConfirmationModuleCallError {
EvmMisplacedSystemTx,
/// Address does not have enough funds to pay for L1 fee
EvmNotEnoughFundsForL1Fee,
/// An EVM transaction in the soft confirmation was not serializable
EvmTxNotSerializable,
/// The sov-tx was not sent by the rule enforcer authority
RuleEnforcerUnauthorized,
/// The EVM transaction type is not supported
Expand Down Expand Up @@ -395,6 +397,9 @@ impl std::fmt::Display for SoftConfirmationModuleCallError {
SoftConfirmationModuleCallError::RuleEnforcerUnauthorized => {
write!(f, "Rule enforcer unauthorized")
}
SoftConfirmationModuleCallError::EvmTxNotSerializable => {
write!(f, "EVM tx not serializable")
}
}
}
}
Expand Down
Loading