testhelper

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefGasUsed           = int64(10000)
	DefGasPremium        = abi.NewTokenAmount(1000)
	DefGasFeeCap         = abi.NewTokenAmount(10000)
	DefBaseFee           = abi.NewTokenAmount(1000)
	DefGasOverEstimation = 1.25
	DefGasOverPremium    = 4.0
	DefMaxFee            = big.Mul(big.NewInt(DefGasUsed*10), DefGasFeeCap)

	// MinPackedPremium If the gas premium is lower than this value, the message will not be packaged
	MinPackedPremium = abi.NewTokenAmount(500)

	DefReplaceByFeePercent types.Percent = 125
)
View Source
var ErrGasLimitNegative = errors.New("gas limit is negative")

Functions

func AddressProtocolToSignType

func AddressProtocolToSignType(protocol address.Protocol) crypto.SigType

func Equal

func Equal(t *testing.T, expect, actual interface{})

func GenBlockHead

func GenBlockHead(miner address.Address, height abi.ChainEpoch, parents []cid.Cid) (*shared.BlockHeader, error)

func GenTipset

func GenTipset(height abi.ChainEpoch, width int, parents []cid.Cid) (*shared.TipSet, error)

func IsSortedByNonce

func IsSortedByNonce(t *testing.T, msgs []*messager.Message)

func MockReplaceMessageParams

func MockReplaceMessageParams() []*types.ReplacMessageParams

func MockSendSpecs

func MockSendSpecs() []*types.SendSpec

func MsgGroupByAddress

func MsgGroupByAddress(msgs []*messager.Message) map[address.Address][]*messager.Message

func NewMessage

func NewMessage() *types.Message

func NewMessages

func NewMessages(count int) []*types.Message

func NewShareSignedMessage

func NewShareSignedMessage() *shared.SignedMessage

func NewShareSignedMessages

func NewShareSignedMessages(count int) []*shared.SignedMessage

func NewSignedMessages

func NewSignedMessages(count int) []*types.Message

func NewUnsignedMessage

func NewUnsignedMessage() shared.Message

func RandAddresses

func RandAddresses(t *testing.T, count int) []address.Address

func RandNode

func RandNode() *types.Node

func RandNodes

func RandNodes(count int) []*types.Node

func ResolveAddr

func ResolveAddr(t *testing.T, addr address.Address) address.Address

func ResolveAddrs

func ResolveAddrs(t *testing.T, addrs []address.Address) []address.Address

func ResolveIDAddr

func ResolveIDAddr(addr address.Address) (address.Address, error)

ResolveIDAddr convert a ID address to a BLS address

func SliceToMap

func SliceToMap(in interface{}) map[string]interface{}

Types

type AuthClient

type AuthClient struct {
	*mocks.MockIAuthClient
}

func NewMockAuthClient

func NewMockAuthClient(t *testing.T) *AuthClient

func (*AuthClient) Init

func (m *AuthClient) Init(account string, addrs []address.Address)

func (*AuthClient) UpsertMiner

func (m *AuthClient) UpsertMiner(ctx context.Context, user string, miner string, openMining bool) (bool, error)

type FullNodeServer

type FullNodeServer struct {
	FullNode *mock.MockFullNode
	Stop     func(ctx context.Context) error

	Port  string
	Token string
}

func MockFullNodeServer

func MockFullNodeServer(t *testing.T) (*FullNodeServer, error)

type MockFullNode

type MockFullNode struct {
	mockV1.MockFullNode
	// contains filtered or unexported fields
}

func NewMockFullNode

func NewMockFullNode(ctx context.Context, blockDelay time.Duration) (*MockFullNode, error)

func (*MockFullNode) AddActors

func (f *MockFullNode) AddActors(addrs []address.Address) error

func (*MockFullNode) ChainGetMessagesInTipset

func (f *MockFullNode) ChainGetMessagesInTipset(ctx context.Context, key types.TipSetKey) ([]types.MessageCID, error)

func (*MockFullNode) ChainGetParentMessages

func (f *MockFullNode) ChainGetParentMessages(ctx context.Context, bcid cid.Cid) ([]types.MessageCID, error)

func (*MockFullNode) ChainGetParentReceipts

func (f *MockFullNode) ChainGetParentReceipts(ctx context.Context, bcid cid.Cid) ([]*types.MessageReceipt, error)

func (*MockFullNode) ChainGetTipSet

func (f *MockFullNode) ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*types.TipSet, error)

func (*MockFullNode) ChainHead

func (f *MockFullNode) ChainHead(ctx context.Context) (*types.TipSet, error)

func (*MockFullNode) ChainList

func (f *MockFullNode) ChainList(ctx context.Context, tsKey types.TipSetKey, count int) ([]types.TipSetKey, error)

func (*MockFullNode) ChainNotify

func (f *MockFullNode) ChainNotify(ctx context.Context) (<-chan []*types.HeadChange, error)

func (*MockFullNode) GasBatchEstimateMessageGas

func (f *MockFullNode) GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*types.EstimateMessage, fromNonce uint64, tsk types.TipSetKey) ([]*types.EstimateResult, error)

func (*MockFullNode) GasEstimateMessageGas

func (f *MockFullNode) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *types.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)

func (*MockFullNode) MpoolBatchPushUntrusted

func (f *MockFullNode) MpoolBatchPushUntrusted(ctx context.Context, smsgs []*types.SignedMessage) ([]cid.Cid, error)

func (*MockFullNode) MpoolGetConfig

func (f *MockFullNode) MpoolGetConfig(_ context.Context) (*types.MpoolConfig, error)

func (*MockFullNode) SendRevertSignal

func (f *MockFullNode) SendRevertSignal(rs *RevertSignal)

func (*MockFullNode) StateAccountKey

func (f *MockFullNode) StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)

func (*MockFullNode) StateGetActor

func (f *MockFullNode) StateGetActor(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error)

func (*MockFullNode) StateGetNetworkParams

func (f *MockFullNode) StateGetNetworkParams(ctx context.Context) (*types.NetworkParams, error)

func (*MockFullNode) StateNetworkName

func (f *MockFullNode) StateNetworkName(ctx context.Context) (types.NetworkName, error)

func (*MockFullNode) StateNetworkVersion

func (f *MockFullNode) StateNetworkVersion(arg0 context.Context, arg1 types.TipSetKey) (network.Version, error)

func (*MockFullNode) StateSearchMsg

func (f *MockFullNode) StateSearchMsg(ctx context.Context, from types.TipSetKey, msgCid cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*types.MsgLookup, error)

type RevertSignal

type RevertSignal struct {
	ExpectRevertCount int
	RevertedTS        chan []*types.TipSet
}

Jump to

Keyboard shortcuts

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