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) error
- func ValidateFeePerGas(op *userop.UserOperation, gbf GetBaseFeeFunc) 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, maxVerificationGas *big.Int) error
- type GetBaseFeeFunc
- 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) 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 GetBaseFeeFunc) error
ValidateFeePerGas checks the maxFeePerGas is sufficiently high to be included with the current block.basefee.
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, 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 GetBaseFeeFunc ¶ added in v0.2.0
GetBaseFeeFunc provides a general interface for retrieving the closest estimate for basefee to allow for timely execution of a transaction.
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, maxVerificationGas *big.Int, maxOpsForUnstakedSender int, tracer string, ) *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.