Documentation ¶
Overview ¶
Package test provides helper and setup functions to test the pallet package.
Index ¶
- Constants
- func DepositAll(ctx context.Context, deps []*pallet.Depositor, reqs []*pallet.DepositReq) error
- func FundAll(ctx context.Context, funders []*pallet.Funder, reqs []*pchannel.FundingReq) error
- func MixBals(rng io.Reader, bals []pchannel.Bal)
- func Multiply(f int64, bals ...pchannel.Bal) []pchannel.Bal
- type Setup
- func (s *Setup) AssertBalanceChanges(deltas map[types.AccountID]*big.Int, epsilon *big.Int, f func())
- func (s *Setup) AssertDeposit(fid channel.FundingID, bal *big.Int)
- func (s *Setup) AssertDeposits(fids []channel.FundingID, bals []*big.Int)
- func (s *Setup) AssertNoDeposit(fid channel.FundingID)
- func (s *Setup) AssertNoRegistered(cid channel.ChannelID)
- func (s *Setup) AssertRegistered(state *channel.State, concluded bool)
Constants ¶
View Source
const ( // DefaultExtFee is a rough cost estimation for one extrinsic. // The value is oriented at the base-fee of a default substrate // node: https://crates.parity.io/frame_support/weights/constants/struct.ExtrinsicBaseWeight.html // The exact value can be configured in the substrate node itself. // More info on weight calculation: https://docs.substrate.io/v3/runtime/weights-and-fees/ DefaultExtFee = uint64(125100000) // PastBlocks defines how many past blocks should be queried. // Must be large enough to ensure that event subs can query all past events // of the current test. PastBlocks = 100 )
Variables ¶
This section is empty.
Functions ¶
func DepositAll ¶
DepositAll executes all requests with the given depositors in parallel.
Types ¶
type Setup ¶
type Setup struct { *chtest.Setup Pallet *pallet.Pallet Deps []*pallet.Depositor Funders []*pallet.Funder Adjs []*pallet.Adjudicator }
Setup is the test setup.
func (*Setup) AssertBalanceChanges ¶
func (s *Setup) AssertBalanceChanges(deltas map[types.AccountID]*big.Int, epsilon *big.Int, f func())
AssertBalanceChange checks that an on-chain account gains delta with absolute error of epsilon by executing f.
func (*Setup) AssertDeposit ¶
AssertDeposit checks that the funding ID holds the specified amount.
func (*Setup) AssertDeposits ¶
AssertDeposit checks that the funding ids holds the specified amounts.
func (*Setup) AssertNoDeposit ¶
AssertNoDeposit checks that the funding ID holds no amount.
func (*Setup) AssertNoRegistered ¶
AssertNoRegistered checks that the channel is not registered.
Click to show internal directories.
Click to hide internal directories.