testutils

package
v0.0.0-...-7be72bc Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

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       = &aimiddleware.IDepositManagerDepositInfo{
		Deposit:         big.NewInt(OneETH.Int64()),
		Staked:          true,
		Stake:           big.NewInt(OneETH.Int64()),
		UnstakeDelaySec: DefaultUnstakeDelaySec,
		WithdrawTime:    big.NewInt(time.Now().Unix()),
	}
	StakedZeroDepositInfo = &aimiddleware.IDepositManagerDepositInfo{
		Deposit:         big.NewInt(0),
		Staked:          true,
		Stake:           big.NewInt(OneETH.Int64()),
		UnstakeDelaySec: DefaultUnstakeDelaySec,
		WithdrawTime:    big.NewInt(time.Now().Unix()),
	}
	NonStakedDepositInfo = &aimiddleware.IDepositManagerDepositInfo{
		Deposit:         big.NewInt(OneETH.Int64()),
		Staked:          false,
		Stake:           big.NewInt(0),
		UnstakeDelaySec: uint32(0),
		WithdrawTime:    big.NewInt(0),
	}
	NonStakedZeroDepositInfo = &aimiddleware.IDepositManagerDepositInfo{
		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 (
	MockAiOpData = 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

func AltMempoolMock() map[string]any

func BadBuilderRpcMock

func BadBuilderRpcMock() *httptest.Server

func DBMock

func DBMock() *badger.DB

func GetMockBaseFeeFunc

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

func GetOpsDiff

func GetOpsDiff(op1 *aiop.AiOperation, op2 *aiop.AiOperation) string

func IsOpsEqual

func IsOpsEqual(op1 *aiop.AiOperation, op2 *aiop.AiOperation) bool

func MockGetCode

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

func MockGetCodeZero

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

func MockValidInitAiOp

func MockValidInitAiOp() *aiop.AiOperation

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

func NewBlockMock

func NewBlockMock() map[string]any

func NewTransactionReceiptMock

func NewTransactionReceiptMock() map[string]any

func RpcMock

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