Skip to content

Commit

Permalink
fix: allow tx's from EIP-7702 delegated accounts (paradigmxyz#10702)
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg authored Sep 4, 2024
1 parent 86a2ac6 commit 9e3edcc
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions crates/transaction-pool/src/validate/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,37 @@ where
}
};

// Signer account shouldn't have bytecode. Presence of bytecode means this is a
// smartcontract.
// Unless Prague is active, the signer account shouldn't have bytecode.
//
// If Prague is active, only EIP-7702 bytecode is allowed for the sender.
//
// Any other case means that the account is not an EOA, and should not be able to send
// transactions.
if account.has_bytecode() {
return TransactionValidationOutcome::Invalid(
transaction,
InvalidTransactionError::SignerAccountHasBytecode.into(),
)
let is_eip7702 = if self.fork_tracker.is_prague_activated() {
match self
.client
.latest()
.and_then(|state| state.bytecode_by_hash(account.get_bytecode_hash()))
{
Ok(bytecode) => bytecode.unwrap_or_default().is_eip7702(),
Err(err) => {
return TransactionValidationOutcome::Error(
*transaction.hash(),
Box::new(err),
)
}
}
} else {
false
};

if !is_eip7702 {
return TransactionValidationOutcome::Invalid(
transaction,
InvalidTransactionError::SignerAccountHasBytecode.into(),
)
}
}

// Checks for nonce
Expand Down

0 comments on commit 9e3edcc

Please sign in to comment.