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

Optimism Crate: Custom tx not supported during deposit transaction #1839

Open
PinelliaC opened this issue Oct 25, 2024 · 1 comment
Open

Comments

@PinelliaC
Copy link

Issue

I am developing on the main branch. While executing a deposit transaction using Optimism’s EVM, a panic occurs due to an issue with tx_type: “Custom tx not supported.”

Description

When using the Optimism crate and executing load_accounts, the function mainnet::load_accounts is called.

pub fn load_accounts<EvmWiringT: OptimismWiring, SPEC: OptimismSpec>(
    context: &mut Context<EvmWiringT>,
) -> EVMResultGeneric<(), EvmWiringT> {
    // the L1-cost fee is only computed for Optimism non-deposit transactions.

    if context.evm.env.tx.tx_type() != OpTransactionType::Deposit {
        let l1_block_info =
            super::L1BlockInfo::try_fetch(&mut context.evm.inner.db, SPEC::OPTIMISM_SPEC_ID)
                .map_err(EVMError::Database)?;

        // storage l1 block info for later use.
        *context.evm.chain.l1_block_info_mut() = Some(l1_block_info);
    }

    mainnet::load_accounts::<EvmWiringT, SPEC>(context) // <-
}

executing the load_accounts method calls the access_list method

    fn access_list(&self) -> Option<&Self::AccessList> {
        let tx_type = self.tx_type().into();
        match tx_type {
            TransactionType::Legacy => None,
            TransactionType::Eip2930 => Some(self.eip2930().access_list()),
            TransactionType::Eip1559 => Some(self.eip1559().access_list()),
            TransactionType::Eip4844 => Some(self.eip4844().access_list()),
            TransactionType::Eip7702 => Some(self.eip7702().access_list()),
            TransactionType::Custom => unimplemented!("Custom tx not supported"),
        }
    }

but during this process, the deposit transaction is matched as a custom transaction when converting it via into,

impl From<OpTransactionType> for TransactionType {
    fn from(tx_type: OpTransactionType) -> Self {
        match tx_type {
            OpTransactionType::Base(tx_type) => tx_type,
            OpTransactionType::Deposit => TransactionType::Custom,
        }
    }
}

which causes a panic in the access_list function.

This seems to be a consistent issue.

Any guidance or support would be greatly appreciated. Thank you!

@rakita
Copy link
Member

rakita commented Nov 4, 2024

Thanks for reporting, will check it out. Current main is experiencing bigger restructuring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@rakita @PinelliaC and others