2020-07-01 16:29:09 +00:00
|
|
|
package testkit
|
2020-06-30 22:02:01 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
"github.com/filecoin-project/lotus/genesis"
|
|
|
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
|
|
"github.com/libp2p/go-libp2p-core/peer"
|
|
|
|
"github.com/testground/sdk-go/sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-07-01 16:29:09 +00:00
|
|
|
GenesisTopic = sync.NewTopic("genesis", &GenesisMsg{})
|
|
|
|
BalanceTopic = sync.NewTopic("balance", &InitialBalanceMsg{})
|
|
|
|
PresealTopic = sync.NewTopic("preseal", &PresealMsg{})
|
2020-07-07 12:58:09 +00:00
|
|
|
ClientsAddrsTopic = sync.NewTopic("clients_addrs", &ClientAddressesMsg{})
|
2020-07-01 16:29:09 +00:00
|
|
|
MinersAddrsTopic = sync.NewTopic("miners_addrs", &MinerAddressesMsg{})
|
|
|
|
PubsubTracerTopic = sync.NewTopic("pubsub_tracer", &PubsubTracerMsg{})
|
|
|
|
DrandConfigTopic = sync.NewTopic("drand_config", &DrandRuntimeInfo{})
|
2020-06-30 22:02:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-07-01 16:29:09 +00:00
|
|
|
StateReady = sync.State("ready")
|
|
|
|
StateDone = sync.State("done")
|
|
|
|
StateStopMining = sync.State("stop-mining")
|
|
|
|
StateMinerPickSeqNum = sync.State("miner-pick-seq-num")
|
2020-06-30 22:02:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type InitialBalanceMsg struct {
|
|
|
|
Addr address.Address
|
|
|
|
Balance int
|
|
|
|
}
|
|
|
|
|
|
|
|
type PresealMsg struct {
|
|
|
|
Miner genesis.Miner
|
|
|
|
Seqno int64
|
|
|
|
}
|
|
|
|
|
|
|
|
type GenesisMsg struct {
|
|
|
|
Genesis []byte
|
|
|
|
Bootstrapper []byte
|
|
|
|
}
|
|
|
|
|
2020-07-07 12:58:09 +00:00
|
|
|
type ClientAddressesMsg struct {
|
2020-07-07 16:38:15 +00:00
|
|
|
PeerNetAddr peer.AddrInfo
|
|
|
|
WalletAddr address.Address
|
2020-07-07 12:58:09 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 22:02:01 +00:00
|
|
|
type MinerAddressesMsg struct {
|
2020-07-07 12:58:09 +00:00
|
|
|
FullNetAddrs peer.AddrInfo
|
|
|
|
MinerNetAddrs peer.AddrInfo
|
|
|
|
MinerActorAddr address.Address
|
2020-06-30 22:02:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PubsubTracerMsg struct {
|
|
|
|
Multiaddr string
|
|
|
|
}
|
|
|
|
|
|
|
|
type DrandRuntimeInfo struct {
|
|
|
|
Config dtypes.DrandConfig
|
|
|
|
GossipBootstrap dtypes.DrandBootstrap
|
|
|
|
}
|