Documentation ¶
Overview ¶
Package checks implements modules for running an array of standard validations for both the Client and Bundler.
Index ¶
- Variables
- func ValidateCallGasLimit(op *aiop.AiOperation, ov *gas.Overhead) error
- func ValidateFeePerGas(op *aiop.AiOperation, gbf gasprice.GetBaseFeeFunc) error
- func ValidateGasAvailable(op *aiop.AiOperation, maxBatchGasLimit *big.Int) error
- func ValidateInitCode(op *aiop.AiOperation) error
- func ValidatePaymasterAndData(op *aiop.AiOperation, dep *aimiddleware.IDepositManagerDepositInfo, ...) error
- func ValidatePendingOps(op *aiop.AiOperation, penOps []*aiop.AiOperation) error
- func ValidateSender(op *aiop.AiOperation, gc GetCodeFunc) error
- func ValidateVerificationGas(op *aiop.AiOperation, ov *gas.Overhead, maxVerificationGas *big.Int) error
- type GetCodeFunc
- type Standalone
- func (s *Standalone) Clean() modules.BatchHandlerFunc
- func (s *Standalone) CodeHashes() modules.BatchHandlerFunc
- func (s *Standalone) PaymasterDeposit() modules.BatchHandlerFunc
- func (s *Standalone) SimulateBatch() modules.BatchHandlerFunc
- func (s *Standalone) SimulateOp() modules.AiOpHandlerFunc
- func (s *Standalone) ValidateOpValues() modules.AiOpHandlerFunc
Constants ¶
This section is empty.
Variables ¶
var (
ErrReplacementOpUnderpriced = fmt.Errorf(
"pending ops: replacement op must increase maxFeePerGas and MaxPriorityFeePerGas by >= %d%%",
minPriceBump,
)
)
Functions ¶
func ValidateCallGasLimit ¶
func ValidateCallGasLimit(op *aiop.AiOperation, ov *gas.Overhead) error
ValidateCallGasLimit checks the callGasLimit is at least the cost of a CALL with non-zero value.
func ValidateFeePerGas ¶
func ValidateFeePerGas(op *aiop.AiOperation, gbf gasprice.GetBaseFeeFunc) error
ValidateFeePerGas checks the maxFeePerGas is sufficiently high to be included with the current block.basefee. Alternatively, if basefee is not supported, then check that maxPriorityFeePerGas is equal to maxFeePerGas as a fallback.
func ValidateGasAvailable ¶
func ValidateGasAvailable(op *aiop.AiOperation, maxBatchGasLimit *big.Int) error
ValidateGasAvailable checks that the max available gas is less than the batch gas limit.
func ValidateInitCode ¶
func ValidateInitCode(op *aiop.AiOperation) error
ValidateInitCode checks if initCode is not empty and has a valid factory address.
func ValidatePaymasterAndData ¶
func ValidatePaymasterAndData( op *aiop.AiOperation, dep *aimiddleware.IDepositManagerDepositInfo, gc GetCodeFunc, ) error
ValidatePaymasterAndData checks the paymasterAndData is either zero bytes or the first 20 bytes contain an address that
- currently has nonempty code on chain
- has a sufficient deposit to pay for the AiOperation
func ValidatePendingOps ¶
func ValidatePendingOps( op *aiop.AiOperation, penOps []*aiop.AiOperation, ) error
ValidatePendingOps checks the pending AiOperations by the same sender and only passes if:
- Sender doesn't have another AiOperation already present in the pool.
- It replaces an existing AiOperation with same nonce and higher fee.
func ValidateSender ¶
func ValidateSender(op *aiop.AiOperation, gc GetCodeFunc) error
ValidateSender accepts a aiOp and a generic function that can retrieve the bytecode of the sender. Either the sender is deployed (non-zero length bytecode) or the initCode is not empty (but not both).
func ValidateVerificationGas ¶
func ValidateVerificationGas(op *aiop.AiOperation, ov *gas.Overhead, maxVerificationGas *big.Int) error
ValidateVerificationGas checks that the verificationGasLimit is sufficiently low (<= MAX_VERIFICATION_GAS) and the preVerificationGas is sufficiently high (enough to pay for the calldata gas cost of serializing the AiOperation plus PRE_VERIFICATION_OVERHEAD_GAS).
Types ¶
type GetCodeFunc ¶
GetCodeFunc provides a general interface for retrieving the bytecode for a given address.
type Standalone ¶
type Standalone struct {
// contains filtered or unexported fields
}
Standalone exposes modules to perform basic Client and Bundler checks as specified in EIP-4337. It is intended for bundlers that are independent of an Ethereum node and hence relies on a given ethClient to query blockchain state.
func New ¶
func New( db *badger.DB, rpc *rpc.Client, ov *gas.Overhead, alt *altmempools.Directory, maxVerificationGas *big.Int, maxBatchGasLimit *big.Int, isRIP7212Supported bool, tracer string, repConst *entities.ReputationConstants, ) *Standalone
New returns a Standalone instance with methods that can be used in Client and Bundler modules to perform standard checks as specified in EIP-4337.
func (*Standalone) Clean ¶
func (s *Standalone) Clean() modules.BatchHandlerFunc
Clean returns a BatchHandler that clears the DB of data that is no longer required. This should be one of the last modules executed by the Bundler.
func (*Standalone) CodeHashes ¶
func (s *Standalone) CodeHashes() modules.BatchHandlerFunc
CodeHashes returns a BatchHandler that verifies the code for any interacted contracts has not changed since the first simulation.
func (*Standalone) PaymasterDeposit ¶
func (s *Standalone) PaymasterDeposit() modules.BatchHandlerFunc
PaymasterDeposit returns a BatchHandler that tracks each paymaster in the batch and ensures it has enough deposit to pay for all the AiOps that use it.
func (*Standalone) SimulateBatch ¶
func (s *Standalone) SimulateBatch() modules.BatchHandlerFunc
TODO: Implement
func (*Standalone) SimulateOp ¶
func (s *Standalone) SimulateOp() modules.AiOpHandlerFunc
SimulateOp returns a AiOpHandler that runs through simulation of new AiOps with the AiMiddleware.
func (*Standalone) ValidateOpValues ¶
func (s *Standalone) ValidateOpValues() modules.AiOpHandlerFunc
ValidateOpValues returns a AiOpHandler that runs through some first line sanity checks for new AiOps received by the Client. This should be one of the first modules executed by the Client.