forked from mrsone40/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.go
More file actions
44 lines (39 loc) · 1.54 KB
/
interface.go
File metadata and controls
44 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package network
import (
"time"
"github.com/cosmos/cosmos-sdk/client"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/server"
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// NetworkI is an interface for a network of validators.
// It is used to abstract over the different network types (in-process, docker, etc.).
// if used there is a requirement to expose query and tx client for the nodes
type NetworkI interface {
// GetValidators returns the validators in the network
GetValidators() []ValidatorI
// WaitForNextBlock waits for the network to reach the next block
WaitForNextBlock() error
// WaitForHeight waits for the network to reach the given height
WaitForHeight(height int64) (int64, error)
// WaitForHeightWithTimeout waits for the network to reach the given height or times out
WaitForHeightWithTimeout(int64, time.Duration) (int64, error)
// RetryForBlocks retries the given function until it returns no error or the given number of blocks has passed
RetryForBlocks(retryFunc func() error, blocks int) error
// LatestHeight returns the latest height of the network
LatestHeight() (int64, error)
Cleanup()
}
// ValidatorI expose a validator's context and configuration
type ValidatorI interface {
GetCtx() *server.Context
GetAppConfig() *srvconfig.Config
GetAddress() sdk.AccAddress
GetValAddress() sdk.ValAddress
GetClientCtx() client.Context
GetAPIAddress() string
GetRPCAddress() string
GetPubKey() cryptotypes.PubKey
GetMoniker() string
}