testutils

package
v0.6.33 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: GPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OneETH                  = big.NewInt(1000000000000000000)
	DefaultUnstakeDelaySec  = uint32(86400)
	ValidAddress1           = common.HexToAddress("0x7357b8a705328FC283dF72D7Ac546895B596DC12")
	ValidAddress2           = common.HexToAddress("0x7357c9504B8686c008CCcD6ea47f1c21B7475dE3")
	ValidAddress3           = common.HexToAddress("0x7357C8D931e8cde8ea1b777Cf8578f4A7071f100")
	ValidAddress4           = common.HexToAddress("0x73574a159D05d20FF50D5504057D5C86f2d02a45")
	ValidAddress5           = common.HexToAddress("0x7357C1Fc72a14399cb845f2f71421B4CE7eCE608")
	ChainID                 = big.NewInt(1)
	MaxOpsForUnstakedSender = 1
	StakedDepositInfo       = &entrypoint.IStakeManagerDepositInfo{
		Deposit:         big.NewInt(OneETH.Int64()),
		Staked:          true,
		Stake:           big.NewInt(OneETH.Int64()),
		UnstakeDelaySec: DefaultUnstakeDelaySec,
		WithdrawTime:    big.NewInt(time.Now().Unix()),
	}
	StakedZeroDepositInfo = &entrypoint.IStakeManagerDepositInfo{
		Deposit:         big.NewInt(0),
		Staked:          true,
		Stake:           big.NewInt(OneETH.Int64()),
		UnstakeDelaySec: DefaultUnstakeDelaySec,
		WithdrawTime:    big.NewInt(time.Now().Unix()),
	}
	NonStakedDepositInfo = &entrypoint.IStakeManagerDepositInfo{
		Deposit:         big.NewInt(OneETH.Int64()),
		Staked:          false,
		Stake:           big.NewInt(0),
		UnstakeDelaySec: uint32(0),
		WithdrawTime:    big.NewInt(0),
	}
	NonStakedZeroDepositInfo = &entrypoint.IStakeManagerDepositInfo{
		Deposit:         big.NewInt(0),
		Staked:          false,
		Stake:           big.NewInt(0),
		UnstakeDelaySec: uint32(0),
		WithdrawTime:    big.NewInt(0),
	}

	DummyEOA, _ = signer.New(hexutil.Encode(crypto.FromECDSA(pk))[2:])
	MockHash    = "0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead"
)
View Source
var (
	MockUserOpData = map[string]any{
		"sender":               "0xa13D69573f994bf662C2714560c44dd7266FC547",
		"nonce":                "0x0",
		"initCode":             "0xe19e9755942bb0bd0cccce25b1742596b8a8250b3bf2c3e700000000000000000000000078d4f01f56b982a3b03c4e127a5d3afa8ebee6860000000000000000000000008b388a082f370d8ac2e2b3997e9151168bd09ff50000000000000000000000000000000000000000000000000000000000000000",
		"callData":             "0x80c5c7d0000000000000000000000000a13d69573f994bf662c2714560c44dd7266fc547000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
		"callGasLimit":         "0x558c",
		"verificationGasLimit": "0x129727",
		"maxFeePerGas":         "0xa862145e",
		"maxPriorityFeePerGas": "0xa8621440",
		"paymasterAndData":     "0x",
		"preVerificationGas":   "0xc539",
		"signature":            "0xa925dcc5e5131636e244d4405334c25f034ebdd85c0cb12e8cdb13c15249c2d466d0bade18e2cafd3513497f7f968dcbb63e519acd9b76dcae7acd61f11aa8421b",
	}
	MockByteCode = common.Hex2Bytes("6080604052")
)

Functions

func AltMempoolMock added in v0.6.24

func AltMempoolMock() map[string]any

func BadBuilderRpcMock added in v0.6.28

func BadBuilderRpcMock() *httptest.Server

func DBMock

func DBMock() *badger.DB

func GetMockBaseFeeFunc added in v0.2.0

func GetMockBaseFeeFunc(val *big.Int) func() (*big.Int, error)

func GetOpsDiff

func GetOpsDiff(op1 *userop.UserOperation, op2 *userop.UserOperation) string

func IsOpsEqual

func IsOpsEqual(op1 *userop.UserOperation, op2 *userop.UserOperation) bool

func MockGetCode

func MockGetCode(addr common.Address) ([]byte, error)

func MockGetCodeZero

func MockGetCodeZero(addr common.Address) ([]byte, error)

func MockValidInitUserOp

func MockValidInitUserOp() *userop.UserOperation

Returns a valid initial userOperation for an EIP-4337 account.

func NewBlockMock added in v0.6.28

func NewBlockMock() map[string]any

func NewTransactionReceiptMock added in v0.6.28

func NewTransactionReceiptMock() map[string]any

func RpcMock added in v0.6.28

func RpcMock(mocks MethodMocks) *httptest.Server

Types

type MethodMocks

type MethodMocks map[string]any

Jump to

Keyboard shortcuts

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