entities

package
v0.6.47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package entities implements modules for reputation scoring and throttling/banning of entities as specified in EIP-4337.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reputation

type Reputation struct {
	// contains filtered or unexported fields
}

Reputation provides Client and Bundler modules to track the reputation of every entity seen in a UserOperation.

func New

func New(db *badger.DB, eth *ethclient.Client, repConst *ReputationConstants) *Reputation

New returns an instance of a Reputation object to track and appropriately process userOps by entity status.

func (*Reputation) CheckStatus

func (r *Reputation) CheckStatus() modules.UserOpHandlerFunc

CheckStatus returns a UserOpHandler that is used by the Client to determine if the userOp is allowed based on the entities status.

  1. ok: entity is allowed
  2. throttled: No new ops from the entity is allowed if one already exists. And it can only stays in the pool for 10 blocks
  3. banned: No ops from the entity is allowed

func (*Reputation) IncOpsIncluded

func (r *Reputation) IncOpsIncluded() modules.BatchHandlerFunc

IncOpsIncluded returns a BatchHandler used by the Bundler to increment opsIncluded counters for all relevant entities in the batch. This module should be used last once batches have been sent.

func (*Reputation) IncOpsSeen

func (r *Reputation) IncOpsSeen() modules.UserOpHandlerFunc

IncOpsSeen returns a UserOpHandler that is used by the Client to increment the opsSeen counter for all included entities.

func (*Reputation) Override

func (r *Reputation) Override(entries []*ReputationOverride) error

func (*Reputation) ValidateOpLimit

func (r *Reputation) ValidateOpLimit() modules.UserOpHandlerFunc

ValidateOpLimit returns a UserOpHandler that is used by the Client to determine if the userOp is allowed based on the entities stake and the number of pending ops in the mempool.

type ReputationConstants

type ReputationConstants struct {
	MinUnstakeDelay                int
	MinStakeValue                  int64
	SameSenderMempoolCount         int
	SameUnstakedEntityMempoolCount int
	ThrottledEntityMempoolCount    int
	ThrottledEntityLiveBlocks      int
	ThrottledEntityBundleCount     int
	MinInclusionRateDenominator    int
	ThrottlingSlack                int
	BanSlack                       int
}

ReputationConstants are a collection of values for determining the appropriate status of a UserOperation coming into the mempool.

type ReputationOverride

type ReputationOverride struct {
	Address     common.Address `json:"address"`
	OpsSeen     int            `json:"opsSeen"`
	OpsIncluded int            `json:"opsIncluded"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL