Documentation ¶
Overview ¶
Package checks implements modules for running an array of standard validations for both the Client and Bundler.
Index ¶
- func ValidateCallGasLimit(op *userop.UserOperation, ov *gas.Overhead) error
- func ValidateFeePerGas(op *userop.UserOperation, gbf gasprice.GetBaseFeeFunc) error
- func ValidateGasAvailable(op *userop.UserOperation, maxBatchGasLimit *big.Int) error
- func ValidateInitCode(op *userop.UserOperation, gs GetStakeFunc) error
- func ValidatePaymasterAndData(op *userop.UserOperation, gc GetCodeFunc, gs GetStakeFunc) error
- func ValidatePendingOps(op *userop.UserOperation, penOps []*userop.UserOperation, ...) error
- func ValidateSender(op *userop.UserOperation, gc GetCodeFunc) error
- func ValidateVerificationGas(op *userop.UserOperation, ov *gas.Overhead, maxVerificationGas *big.Int) error
- type GetCodeFunc
- type GetStakeFunc
- type Standalone
- func (s *Standalone) Clean() modules.BatchHandlerFunc
- func (s *Standalone) CodeHashes() modules.BatchHandlerFunc
- func (s *Standalone) PaymasterDeposit() modules.BatchHandlerFunc
- func (s *Standalone) SimulateOp() modules.UserOpHandlerFunc
- func (s *Standalone) ValidateOpValues() modules.UserOpHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCallGasLimit ¶ added in v0.1.1
func ValidateCallGasLimit(op *userop.UserOperation, ov *gas.Overhead) error
ValidateCallGasLimit checks the callGasLimit is at least the cost of a CALL with non-zero value.
func ValidateFeePerGas ¶ added in v0.1.1
func ValidateFeePerGas(op *userop.UserOperation, 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 ¶ added in v0.6.9
func ValidateGasAvailable(op *userop.UserOperation, maxBatchGasLimit *big.Int) error
ValidateGasAvailable checks that the max available gas is less than the batch gas limit.
func ValidateInitCode ¶ added in v0.1.1
func ValidateInitCode(op *userop.UserOperation, gs GetStakeFunc) error
ValidateInitCode checks if initCode is not empty and gets the factory address. If factory address is valid it calls a generic function that can retrieve the stake from the EntryPoint.
func ValidatePaymasterAndData ¶ added in v0.1.1
func ValidatePaymasterAndData(op *userop.UserOperation, gc GetCodeFunc, gs GetStakeFunc) 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 UserOperation
func ValidatePendingOps ¶ added in v0.1.1
func ValidatePendingOps( op *userop.UserOperation, penOps []*userop.UserOperation, maxOpsForUnstakedSender int, gs GetStakeFunc, ) error
ValidatePendingOps checks the pending UserOperations by the same sender and only passes if:
- Sender doesn't have another UserOperation already present in the pool.
- It replaces an existing UserOperation with same nonce and higher fee.
- Sender is staked and is allowed uncapped UserOperations in the pool.
func ValidateSender ¶ added in v0.1.1
func ValidateSender(op *userop.UserOperation, gc GetCodeFunc) error
ValidateSender accepts a userOp 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 ¶ added in v0.1.1
func ValidateVerificationGas(op *userop.UserOperation, 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 UserOperation plus PRE_VERIFICATION_OVERHEAD_GAS).
Types ¶
type GetCodeFunc ¶ added in v0.1.1
GetCodeFunc provides a general interface for retrieving the bytecode for a given address.
type GetStakeFunc ¶ added in v0.1.1
type GetStakeFunc = func(entity common.Address) (*entrypoint.IStakeManagerDepositInfo, error)
GetStakeFunc provides a general interface for retrieving the EntryPoint stake 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, maxOpsForUnstakedSender int, ) *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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 UserOps that use it.
func (*Standalone) SimulateOp ¶
func (s *Standalone) SimulateOp() modules.UserOpHandlerFunc
SimulateOp returns a UserOpHandler that runs through simulation of new UserOps with the EntryPoint.
func (*Standalone) ValidateOpValues ¶
func (s *Standalone) ValidateOpValues() modules.UserOpHandlerFunc
ValidateOpValues returns a UserOpHandler that runs through some first line sanity checks for new UserOps received by the Client. This should be one of the first modules executed by the Client.