mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
* experiment: reject bad peer info messages * v2.1.0.18 preview * add tagged sync * Add missing hypergraph changes * small tweaks to sync * allow local sync, use it for provers with workers * missing file * resolve build error * resolve sync issue, remove raw sync * resolve deletion promotion bug * resolve sync abstraction leak from tree deletion changes * rearrange prover sync * remove pruning from sync * restore removed sync flag * fix: sync, event stream deadlock, heuristic scoring of better shards * resolve hanging shutdown + pubsub proxy issue * further bugfixes: sync (restore old leaf sync), pubsub shutdown, merge events * fix: clean up rust ffi, background coverage events, and sync tweaks * fix: linking issue for channel, connectivity test aggression, sync regression, join tests * fix: disjoint sync, improper application of filter * resolve sync/reel/validation deadlock * adjust sync to handle no leaf edge cases, multi-path segment traversal * use simpler sync * faster, simpler sync with some debug extras * migration to recalculate * don't use batch * square up the roots * fix nil pointer * fix: seniority calculation, sync race condition, migration * make sync dumber * fix: tree deletion issue * fix: missing seniority merge request canonical serialization * address issues from previous commit test * stale workers should be cleared * remove missing gap check * rearrange collect, reduce sync logging noise * fix: the disjoint leaf/branch sync case * nuclear option on sync failures * v2.1.0.18, finalized
71 lines
1.6 KiB
Go
71 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"encoding/hex"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
"go.uber.org/zap"
|
|
"source.quilibrium.com/quilibrium/monorepo/config"
|
|
"source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub/pb"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/p2p"
|
|
)
|
|
|
|
var (
|
|
configDirectory = flag.String(
|
|
"config",
|
|
filepath.Join(".", ".config"),
|
|
"the configuration directory",
|
|
)
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
cfg, err := config.LoadConfig(*configDirectory, "", false)
|
|
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
logger, _ := zap.NewProduction()
|
|
pubsub := p2p.NewBlossomSub(cfg.P2P, cfg.Engine, logger, 0, p2p.ConfigDir(*configDirectory))
|
|
fmt.Print("Enter bitmask in hex (no 0x prefix): ")
|
|
reader := bufio.NewReader(os.Stdin)
|
|
bitmaskHex, _ := reader.ReadString('\n')
|
|
bitmaskHex = strings.TrimRight(bitmaskHex, "\n")
|
|
logger.Info("subscribing to bitmask")
|
|
|
|
bitmask, err := hex.DecodeString(bitmaskHex)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = pubsub.Subscribe(bitmask, func(message *pb.Message) error {
|
|
logger.Info(
|
|
"received message",
|
|
zap.String("bitmask", hex.EncodeToString(message.Bitmask)),
|
|
zap.String("peer", peer.ID(message.From).String()),
|
|
zap.String("message", string(message.Data)),
|
|
)
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
for {
|
|
fmt.Print(peer.ID(pubsub.GetPeerID()).String() + "> ")
|
|
message, _ := reader.ReadString('\n')
|
|
message = strings.TrimRight(message, "\n")
|
|
err = pubsub.PublishToBitmask(bitmask, []byte(message))
|
|
if err != nil {
|
|
logger.Error("error sending", zap.Error(err))
|
|
}
|
|
}
|
|
}
|