Motivation
Unlike EOA model, the transaction verification logic under account abstraction model is customizable and executed by EVM. However, this feature will make the network vulnerable to DDOS.
For example, there are some transactions with following verification logic:
function validateTx(Tx calldata tx) returns (bool isValid) {
// when network baseFee < 30 gwei, the tx is valid.
// Otherwise, the tx is invalid.
isValid = block.baseFee < 30 gwei;
}
When baseFee is below 30 gwei, the attacker can send a large number of transactions with verification logic above. Then, those transactions can be verified by nodes. However, if baseFee becomes above 30 gwei when nodes tries to include those transactions, those transactions will become invalid and nodes are unable to charge for their work.
Without introducing new trust assumptions, nodes can only introduce validation rules to restrict the validation logic and protect themself.
Validation Rules
The basic idea behind the rule: attackers are unable to use a cost <= O (1), making >= O(N) transactions O (N) invalid.
So, the rules require that the validity of multiple transactions cannot be dependent on same states that might change, such as disabling certain opcodes and restricting storage access during the validation.
However, multiple transactions may use the same entity, such as paymaster and account factory. So, the validity of those transactions has to rely on states on the paymaster. If those paymaster states change, those transactions will become invalid.
In those cases, the rules require those entities to stake (i.e. lock in some fund) and alleviate DDOS through the reputation mechanism.
The specific rules can be found in EIP-7562 and can be applied to both application level account abstraction, e.g. ERC-4337 and native account abstraction, e.g. RIP-7560.
Check Rules in Practice
Currently, bundlers in ERC-4337 will check whether they are following EIP-7562 through bundle spec tests.
However, there is no particularly good means for ERC-4337 contract developers to check rules. There is a solidity library attempting to handle it, but it cannot cover all rules.