Documentation
¶
Overview ¶
Package common is a helper around redundant creation of Network, App and Node part
As testground doesn't have native support of uint64 conversion from .toml files, GetBandwidthValue in network.go is used to adjust the bandwidth per instance for each of the test-case
In order to eliminate the boilerplate code of creating a validators' set, please use `common.BuildValidator`. This Func does: - InitChain - Add-Gen-Account - Collect-GenTxs - Add-Persistent-Peers In addition, the func returns initialized cobra cmd, so you can continue operating with the validator
Default: network.LinkShape{ Bandwidth: common.GetBandwidthValue(runenv.StringParam("bandwidth")), }
appcmd, err := common.BuildValidator(ctx, runenv, initCtx) appcmd.PayForBlob(...)
In order to eliminate the boilerplate code of creating a bridge node, please use `common.BuildBridge`. This Func does: - Listens to all available validators - Connects to the validator (match is done using group sequence) - Sends the genesis hash to the topic - - As well as it's multiaddress - Returns the node pointer itself
nd, err := common.BuildBridge(ctx, runenv, initCtx) nd.Stop()
Index ¶
- Constants
- Variables
- func BroadcastAndCollectGenTx(ctx context.Context, home string, accAddr string, initCtx *run.InitContext, ...) error
- func BuildBridge(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext, ...) (*nodebuilder.Node, error)
- func BuildOrchestrator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext) (*qgbkit.QGBKit, error)
- func BuildRelayer(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext) (*qgbkit.QGBKit, error)
- func BuildValidator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext) (*appkit.AppKit, error)
- func CheckBalanceDeduction(ctx context.Context, nd *nodebuilder.Node, bal *state.Balance) error
- func CheckSharesByNamespace(ctx context.Context, nd *nodebuilder.Node, nid namespace.ID, ...) error
- func DiscoverPeers(ctx context.Context, home string, ip net.IP, initCtx *run.InitContext, ...) error
- func ECDSAToAddress(ethPrivateKey *ecdsa.PrivateKey) *common.Address
- func GenerateEVMAddress() (*common.Address, *ecdsa.PrivateKey, error)
- func GenerateNamespaceID(amount string) namespace.ID
- func GetBandwidthValue(v string) uint64
- func GetBridgeNode(ctx context.Context, syncclient sync.Client, id int64, amountOfBridges int) (*testkit.BridgeNodeInfo, error)
- func GetBridgeNodes(ctx context.Context, syncclient sync.Client, amountOfBridges int) (bridges []*testkit.BridgeNodeInfo, err error)
- func GetRandomMessageBySize(size int) []byte
- func GetRandomNamespace() namespace.ID
- func GetRandomisedPeers(randomizer int, peersRange int, peers []appkit.ValidatorNode) []appkit.ValidatorNode
- func GetValidatorInfo(ctx context.Context, syncclient sync.Client, valAmount, id int) (*testkit.AppNodeInfo, error)
- func InitChainAndMaybeBroadcastGenesis(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext, ...) (*appkit.AppKit, string, string, error)
- func SubmitData(ctx context.Context, runenv *runtime.RunEnv, nd *nodebuilder.Node, ...) error
- func UpdateAndPublishConfig(ctx context.Context, home string, cmd *appkit.AppKit, initCtx *run.InitContext) (net.IP, error)
- func VerifyDataInNamespace(ctx context.Context, nd *nodebuilder.Node, nid namespace.ID, data []byte) error
Constants ¶
const ( // EVMPrivateKeyPassphrase the EVM keystore passphrase that will be used when storing all EVM keys EVMPrivateKeyPassphrase = "123" // P2PPrivateKeyNickname the P2P private key nickname that will be used when storing all P2P keys P2PPrivateKeyNickname = "key" )
Variables ¶
var DefaultNameId = namespace.ID{100, 100, 150, 150, 200, 200, 250, 255}
DefaultNameId is used in cases where we only have 1 Namespace.ID used across all nodes that submit pfd and get shares by this ID
Functions ¶
func BuildBridge ¶
func BuildOrchestrator ¶
func BuildRelayer ¶
func BuildValidator ¶
func CheckBalanceDeduction ¶
CheckBalanceDeduction checks if the balance of a node has been deducted after a successful pfb
func CheckSharesByNamespace ¶
func CheckSharesByNamespace(ctx context.Context, nd *nodebuilder.Node, nid namespace.ID, eh *header.ExtendedHeader, expectedData []byte) error
CheckSharesByNamespace accepts an expected namespace.ID and data that was submitted. Next, it verifies the data against the received shares of a block from a user-specified extended header by comparing length of each
func DiscoverPeers ¶
func ECDSAToAddress ¶
func ECDSAToAddress(ethPrivateKey *ecdsa.PrivateKey) *common.Address
func GenerateEVMAddress ¶
func GenerateEVMAddress() (*common.Address, *ecdsa.PrivateKey, error)
func GenerateNamespaceID ¶
GenerateNamespaceID returns a namespace ID based on runenv.StringParams defined in the composition file TODO(@Bidon15): We actually need to refactor this out using runenv.IntParam()
func GetBandwidthValue ¶
func GetBridgeNode ¶
func GetBridgeNodes ¶
func GetRandomMessageBySize ¶
GetRandomMessageBySize returns a random []byte per each call made by each instance of node type. The size is defined in the .toml file
func GetRandomNamespace ¶
GetRandomNamespace returns a random namespace.ID per each call made by each instance of node type
func GetRandomisedPeers ¶
func GetRandomisedPeers(randomizer int, peersRange int, peers []appkit.ValidatorNode) []appkit.ValidatorNode
func GetValidatorInfo ¶
func SubmitData ¶
func SubmitData(ctx context.Context, runenv *runtime.RunEnv, nd *nodebuilder.Node, nid namespace.ID, data []byte) error
SubmitData calls a node.StateService SubmitPayForBlob() method with recording a txLog output.
func UpdateAndPublishConfig ¶
func VerifyDataInNamespace ¶
func VerifyDataInNamespace(ctx context.Context, nd *nodebuilder.Node, nid namespace.ID, data []byte) error
VerifyDataInNamespace encapsulates 3 steps to get the data verified against the next block's shares found in a user-specified namespace.ID
Types ¶
This section is empty.