testutils

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: GPL-3.0 Imports: 12 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")
	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),
	}
)
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":   "0xc650",
		"signature":            "0xa925dcc5e5131636e244d4405334c25f034ebdd85c0cb12e8cdb13c15249c2d466d0bade18e2cafd3513497f7f968dcbb63e519acd9b76dcae7acd61f11aa8421b",
	}
	MockByteCode = common.Hex2Bytes("6080604052")
)

Functions

func DBMock

func DBMock() *badger.DB

func EthMock

func EthMock(mocks MethodMocks) *httptest.Server

EthMock returns a httptest.Server for mocking the return value of a JSON-RPC method call to an Ethereum node.

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 MockGetNotStakeZeroDeposit

func MockGetNotStakeZeroDeposit(addr common.Address) (*entrypoint.IStakeManagerDepositInfo, error)

func MockGetStakeZeroDeposit

func MockGetStakeZeroDeposit(addr common.Address) (*entrypoint.IStakeManagerDepositInfo, error)

func MockValidInitUserOp

func MockValidInitUserOp() *userop.UserOperation

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

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