diff --git a/Makefile b/Makefile index 47633d7f3..b17964ebc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TOP:=$(realpath ..) -export CGO_CFLAGS:=-I$(TOP)/bls/include -I$(TOP)/mcl/include -I/usr/local/opt/openssl/include -export CGO_LDFLAGS:=-L$(TOP)/bls/lib -L/usr/local/opt/openssl/lib -export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/usr/local/opt/openssl/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl/lib +export CGO_CFLAGS:=-I$(TOP)/bls/include -I$(TOP)/mcl/include -I/opt/homebrew/opt/openssl@1.1/include +export CGO_LDFLAGS:=-L$(TOP)/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib +export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl@1.1/lib export LIBRARY_PATH:=$(LD_LIBRARY_PATH) export DYLD_FALLBACK_LIBRARY_PATH:=$(LD_LIBRARY_PATH) export GO111MODULE:=on diff --git a/README.md b/README.md index 01c98dfd5..609ffd57f 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,9 @@ The `make` command should automatically build the Harmony binary & all dependent However, if you wish to bypass the Makefile, first export the build flags: ```bash -export CGO_CFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/usr/local/opt/openssl/include" -export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/usr/local/opt/openssl/lib" -export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/usr/local/opt/openssl/lib +export CGO_CFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/opt/homebrew/opt/openssl@1.1/include" +export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib" +export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib export LIBRARY_PATH=$LD_LIBRARY_PATH export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH export GO111MODULE=on diff --git a/api/service/legacysync/downloader/client.go b/api/service/legacysync/downloader/client.go index 42d5954b8..de08c5a98 100644 --- a/api/service/legacysync/downloader/client.go +++ b/api/service/legacysync/downloader/client.go @@ -8,6 +8,7 @@ import ( pb "github.com/harmony-one/harmony/api/service/legacysync/downloader/proto" "github.com/harmony-one/harmony/internal/utils" "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" ) // Client is the client model for downloader package. @@ -15,17 +16,22 @@ type Client struct { dlClient pb.DownloaderClient opts []grpc.DialOption conn *grpc.ClientConn + addr string } // ClientSetup setups a Client given ip and port. -func ClientSetup(ip, port string) *Client { +func ClientSetup(ip, port string, withBlock bool) *Client { client := Client{} client.opts = append(client.opts, grpc.WithInsecure()) + if withBlock { + client.opts = append(client.opts, grpc.WithBlock()) + } ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() + client.addr = fmt.Sprintf("%s:%s", ip, port) var err error - client.conn, err = grpc.DialContext(ctx, fmt.Sprintf(ip+":"+port), client.opts...) + client.conn, err = grpc.DialContext(ctx, client.addr, client.opts...) if err != nil { utils.Logger().Error().Err(err).Str("ip", ip).Msg("[SYNC] client.go:ClientSetup fail to dial") return nil @@ -35,12 +41,50 @@ func ClientSetup(ip, port string) *Client { return &client } +// IsReady returns true if client is ready +func (client *Client) IsReady() bool { + return client.conn.GetState() == connectivity.Ready +} + +// IsConnecting returns true if client is connecting +func (client *Client) IsConnecting() bool { + return client.conn.GetState() == connectivity.Connecting +} + +// State returns current Connecting state +func (client *Client) State() connectivity.State { + return client.conn.GetState() +} + +// WaitForConnection waits for client to connect +func (client *Client) WaitForConnection(t time.Duration) bool { + ctx, cancel := context.WithTimeout(context.Background(), t) + defer cancel() + + if client.conn.GetState() == connectivity.Ready { + return true + } + + if ready := client.conn.WaitForStateChange(ctx, client.conn.GetState()); !ready { + return false + } else { + return client.conn.GetState() == connectivity.Ready + } +} + // Close closes the Client. -func (client *Client) Close() { +func (client *Client) Close(reason string) { err := client.conn.Close() if err != nil { - utils.Logger().Info().Msg("[SYNC] unable to close connection") + utils.Logger().Info(). + Str("peerAddress", client.addr). + Msg("[SYNC] unable to close peer connection") + return } + utils.Logger().Info(). + Str("peerAddress", client.addr). + Str("reason", reason). + Msg("[SYNC] peer connection closed") } // GetBlockHashes gets block hashes from all the peers by calling grpc request. diff --git a/api/service/legacysync/epoch_syncing.go b/api/service/legacysync/epoch_syncing.go index 6697c90c2..8bf7ae145 100644 --- a/api/service/legacysync/epoch_syncing.go +++ b/api/service/legacysync/epoch_syncing.go @@ -37,13 +37,13 @@ type EpochSync struct { // If the last result is expired, ask the remote DNS nodes for latest height and return the result. func (ss *EpochSync) GetSyncStatus() SyncCheckResult { return ss.syncStatus.Get(func() SyncCheckResult { - return ss.isInSync(false) + return ss.isSynchronized(false) }) } -// isInSync query the remote DNS node for the latest height to check what is the current +// isSynchronized query the remote DNS node for the latest height to check what is the current // sync status -func (ss *EpochSync) isInSync(_ bool) SyncCheckResult { +func (ss *EpochSync) isSynchronized(_ bool) SyncCheckResult { if ss.syncConfig == nil { return SyncCheckResult{} // If syncConfig is not instantiated, return not in sync } @@ -70,9 +70,9 @@ func (ss *EpochSync) isInSync(_ bool) SyncCheckResult { Uint64("CurrentEpoch", curEpoch). Msg("[EPOCHSYNC] Checking sync status") return SyncCheckResult{ - IsInSync: inSync, - OtherHeight: otherHeight1, - HeightDiff: epochDiff, + IsSynchronized: inSync, + OtherHeight: otherHeight1, + HeightDiff: epochDiff, } } @@ -85,17 +85,18 @@ func (ss *EpochSync) GetActivePeerNumber() int { } // SyncLoop will keep syncing with peers until catches up -func (ss *EpochSync) SyncLoop(bc core.BlockChain, isBeacon bool, consensus *consensus.Consensus) time.Duration { - return time.Duration(ss.syncLoop(bc, isBeacon, consensus)) * time.Second +func (ss *EpochSync) SyncLoop(bc core.BlockChain, consensus *consensus.Consensus) time.Duration { + return time.Duration(syncLoop(bc, ss.syncConfig)) * time.Second } -func (ss *EpochSync) syncLoop(bc core.BlockChain, isBeacon bool, _ *consensus.Consensus) (timeout int) { - maxHeight := getMaxPeerHeight(ss.syncConfig) +func syncLoop(bc core.BlockChain, syncConfig *SyncConfig) (timeout int) { + isBeacon := bc.ShardID() == 0 + maxHeight := getMaxPeerHeight(syncConfig) for { if maxHeight == 0 || maxHeight == math.MaxUint64 { utils.Logger().Info(). - Msgf("[EPOCHSYNC] No peers to sync (isBeacon: %t, ShardID: %d, peerscount: %d)", - isBeacon, bc.ShardID(), ss.syncConfig.PeersCount()) + Msgf("[EPOCHSYNC] No peers to sync (isBeacon: %t, ShardID: %d, peersCount: %d)", + isBeacon, bc.ShardID(), syncConfig.PeersCount()) return 10 } @@ -104,19 +105,19 @@ func (ss *EpochSync) syncLoop(bc core.BlockChain, isBeacon bool, _ *consensus.Co if otherEpoch == curEpoch+1 { utils.Logger().Info(). Msgf("[EPOCHSYNC] Node is now IN SYNC! (isBeacon: %t, ShardID: %d, otherEpoch: %d, currentEpoch: %d, peersCount: %d)", - isBeacon, bc.ShardID(), otherEpoch, curEpoch, ss.syncConfig.PeersCount()) + isBeacon, bc.ShardID(), otherEpoch, curEpoch, syncConfig.PeersCount()) return 60 } if otherEpoch < curEpoch { - for _, peerCfg := range ss.syncConfig.GetPeers() { - ss.syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: current height is higher that others, removve peers: %s", peerCfg.String())) + for _, peerCfg := range syncConfig.GetPeers() { + syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: current height is higher that others, remove peers: %s", peerCfg.String())) } return 2 } utils.Logger().Info(). Msgf("[EPOCHSYNC] Node is OUT OF SYNC (isBeacon: %t, ShardID: %d, otherEpoch: %d, currentEpoch: %d, peers count %d)", - isBeacon, bc.ShardID(), otherEpoch, curEpoch, ss.syncConfig.PeersCount()) + isBeacon, bc.ShardID(), otherEpoch, curEpoch, syncConfig.PeersCount()) var heights []uint64 loopEpoch := curEpoch + 1 @@ -133,7 +134,7 @@ func (ss *EpochSync) syncLoop(bc core.BlockChain, isBeacon bool, _ *consensus.Co return 10 } - err := ss.ProcessStateSync(heights, bc) + err := ProcessStateSync(syncConfig, heights, bc) if err != nil { utils.Logger().Error().Err(err). Msgf("[EPOCHSYNC] ProcessStateSync failed (isBeacon: %t, ShardID: %d, otherEpoch: %d, currentEpoch: %d)", @@ -144,11 +145,11 @@ func (ss *EpochSync) syncLoop(bc core.BlockChain, isBeacon bool, _ *consensus.Co } // ProcessStateSync processes state sync from the blocks received but not yet processed so far -func (ss *EpochSync) ProcessStateSync(heights []uint64, bc core.BlockChain) error { +func ProcessStateSync(syncConfig *SyncConfig, heights []uint64, bc core.BlockChain) error { var payload [][]byte var peerCfg *SyncPeerConfig - peers := ss.syncConfig.GetPeers() + peers := syncConfig.GetPeers() if len(peers) == 0 { return errors.New("no peers to sync") } @@ -156,11 +157,11 @@ func (ss *EpochSync) ProcessStateSync(heights []uint64, bc core.BlockChain) erro for index, peerConfig := range peers { resp := peerConfig.GetClient().GetBlocksByHeights(heights) if resp == nil { - ss.syncConfig.RemovePeer(peerConfig, fmt.Sprintf("[EPOCHSYNC]: no response from peer: #%d %s, count %d", index, peerConfig.String(), len(peers))) + syncConfig.RemovePeer(peerConfig, fmt.Sprintf("[EPOCHSYNC]: no response from peer: #%d %s, count %d", index, peerConfig.String(), len(peers))) continue } if len(resp.Payload) == 0 { - ss.syncConfig.RemovePeer(peerConfig, fmt.Sprintf("[EPOCHSYNC]: empty payload response from peer: #%d %s, count %d", index, peerConfig.String(), len(peers))) + syncConfig.RemovePeer(peerConfig, fmt.Sprintf("[EPOCHSYNC]: empty payload response from peer: #%d %s, count %d", index, peerConfig.String(), len(peers))) continue } payload = resp.Payload @@ -168,12 +169,12 @@ func (ss *EpochSync) ProcessStateSync(heights []uint64, bc core.BlockChain) erro break } if len(payload) == 0 { - return errors.Errorf("empty payload: no blocks were returned by GetBlocksByHeights for all peers, currentPeersCount %d", ss.syncConfig.PeersCount()) + return errors.Errorf("empty payload: no blocks were returned by GetBlocksByHeights for all peers, currentPeersCount %d", syncConfig.PeersCount()) } - err := ss.processWithPayload(payload, bc) + err := processWithPayload(payload, bc) if err != nil { // Assume that node sent us invalid data. - ss.syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: failed to process with payload from peer: %s", err.Error())) + syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: failed to process with payload from peer: %s", err.Error())) utils.Logger().Error().Err(err). Msgf("[EPOCHSYNC] Removing peer %s for invalid data", peerCfg.String()) return err @@ -181,7 +182,7 @@ func (ss *EpochSync) ProcessStateSync(heights []uint64, bc core.BlockChain) erro return nil } -func (ss *EpochSync) processWithPayload(payload [][]byte, bc core.BlockChain) error { +func processWithPayload(payload [][]byte, bc core.BlockChain) error { decoded := make([]*types.Block, 0, len(payload)) for idx, blockBytes := range payload { block, err := RlpDecodeBlockOrBlockWithSig(blockBytes) @@ -201,8 +202,8 @@ func (ss *EpochSync) processWithPayload(payload [][]byte, bc core.BlockChain) er } // CreateSyncConfig creates SyncConfig for StateSync object. -func (ss *EpochSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32) error { +func (ss *EpochSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32, waitForEachPeerToConnect bool) error { var err error - ss.syncConfig, err = createSyncConfig(ss.syncConfig, peers, shardID) + ss.syncConfig, err = createSyncConfig(ss.syncConfig, peers, shardID, waitForEachPeerToConnect) return err } diff --git a/api/service/legacysync/helpers.go b/api/service/legacysync/helpers.go index 90a5dd174..ca66e0ddc 100644 --- a/api/service/legacysync/helpers.go +++ b/api/service/legacysync/helpers.go @@ -28,11 +28,11 @@ func getMaxPeerHeight(syncConfig *SyncConfig) uint64 { // utils.Logger().Debug().Bool("isBeacon", isBeacon).Str("peerIP", peerConfig.ip).Str("peerPort", peerConfig.port).Msg("[Sync]getMaxPeerHeight") response, err := peerConfig.client.GetBlockChainHeight() if err != nil { - utils.Logger().Warn().Err(err).Str("peerIP", peerConfig.ip).Str("peerPort", peerConfig.port).Msg("[Sync]GetBlockChainHeight failed") + utils.Logger().Warn().Err(err).Str("peerIP", peerConfig.peer.IP).Str("peerPort", peerConfig.peer.Port).Msg("[Sync]GetBlockChainHeight failed") syncConfig.RemovePeer(peerConfig, fmt.Sprintf("failed getMaxPeerHeight for shard %d with message: %s", syncConfig.ShardID(), err.Error())) return } - utils.Logger().Info().Str("peerIP", peerConfig.ip).Uint64("blockHeight", response.BlockHeight). + utils.Logger().Info().Str("peerIP", peerConfig.peer.IP).Uint64("blockHeight", response.BlockHeight). Msg("[SYNC] getMaxPeerHeight") lock.Lock() @@ -51,21 +51,22 @@ func getMaxPeerHeight(syncConfig *SyncConfig) uint64 { return maxHeight } -func createSyncConfig(syncConfig *SyncConfig, peers []p2p.Peer, shardID uint32) (*SyncConfig, error) { +func createSyncConfig(syncConfig *SyncConfig, peers []p2p.Peer, shardID uint32, waitForEachPeerToConnect bool) (*SyncConfig, error) { // sanity check to ensure no duplicate peers if err := checkPeersDuplicity(peers); err != nil { return syncConfig, err } // limit the number of dns peers to connect randSeed := time.Now().UnixNano() - peers = limitNumPeers(peers, randSeed) + targetSize, peers := limitNumPeers(peers, randSeed) utils.Logger().Debug(). - Int("len", len(peers)). + Int("peers count", len(peers)). + Int("target size", targetSize). Uint32("shardID", shardID). Msg("[SYNC] CreateSyncConfig: len of peers") - if len(peers) == 0 { + if targetSize == 0 { return syncConfig, errors.New("[SYNC] no peers to connect to") } if syncConfig != nil { @@ -73,24 +74,43 @@ func createSyncConfig(syncConfig *SyncConfig, peers []p2p.Peer, shardID uint32) } syncConfig = NewSyncConfig(shardID, nil) - var wg sync.WaitGroup - for _, peer := range peers { - wg.Add(1) - go func(peer p2p.Peer) { - defer wg.Done() - client := downloader.ClientSetup(peer.IP, peer.Port) - if client == nil { - return + if !waitForEachPeerToConnect { + var wg sync.WaitGroup + ps := peers[:targetSize] + for _, peer := range ps { + wg.Add(1) + go func(peer p2p.Peer) { + defer wg.Done() + client := downloader.ClientSetup(peer.IP, peer.Port, false) + if client == nil { + return + } + peerConfig := &SyncPeerConfig{ + peer: peer, + client: client, + } + syncConfig.AddPeer(peerConfig) + }(peer) + } + wg.Wait() + } else { + var connectedPeers int + for _, peer := range peers { + client := downloader.ClientSetup(peer.IP, peer.Port, true) + if client == nil || !client.IsReady() { + continue } peerConfig := &SyncPeerConfig{ - ip: peer.IP, - port: peer.Port, + peer: peer, client: client, } syncConfig.AddPeer(peerConfig) - }(peer) + connectedPeers++ + if connectedPeers >= targetSize { + break + } + } } - wg.Wait() utils.Logger().Info(). Int("len", len(syncConfig.peers)). Uint32("shardID", shardID). diff --git a/api/service/legacysync/syncing.go b/api/service/legacysync/syncing.go index e3068e125..8afaa3a95 100644 --- a/api/service/legacysync/syncing.go +++ b/api/service/legacysync/syncing.go @@ -44,12 +44,14 @@ const ( numPeersHighBound = 5 downloadTaskBatch = 5 + + //LoopMinTime sync loop must take at least as this value, otherwise it waits for it + LoopMinTime = 0 ) // SyncPeerConfig is peer config to sync. type SyncPeerConfig struct { - ip string - port string + peer p2p.Peer peerHash []byte client *downloader.Client blockHashes [][]byte // block hashes before node doing sync @@ -64,7 +66,7 @@ func (peerConfig *SyncPeerConfig) GetClient() *downloader.Client { // IsEqual checks the equality between two sync peers func (peerConfig *SyncPeerConfig) IsEqual(pc2 *SyncPeerConfig) bool { - return peerConfig.ip == pc2.ip && peerConfig.port == pc2.port + return peerConfig.peer.IP == pc2.peer.IP && peerConfig.peer.Port == pc2.peer.Port } // SyncBlockTask is the task struct to sync a specific block. @@ -161,6 +163,9 @@ func (sc *SyncConfig) ForEachPeer(f func(peer *SyncPeerConfig) (brk bool)) { } func (sc *SyncConfig) PeersCount() int { + if sc == nil { + return 0 + } sc.mtx.RLock() defer sc.mtx.RUnlock() return len(sc.peers) @@ -171,7 +176,8 @@ func (sc *SyncConfig) RemovePeer(peer *SyncPeerConfig, reason string) { sc.mtx.Lock() defer sc.mtx.Unlock() - peer.client.Close() + closeReason := fmt.Sprintf("remove peer (reason: %s)", reason) + peer.client.Close(closeReason) for i, p := range sc.peers { if p == peer { sc.peers = append(sc.peers[:i], sc.peers[i+1:]...) @@ -179,8 +185,8 @@ func (sc *SyncConfig) RemovePeer(peer *SyncPeerConfig, reason string) { } } utils.Logger().Info(). - Str("peerIP", peer.ip). - Str("peerPortMsg", peer.port). + Str("peerIP", peer.peer.IP). + Str("peerPortMsg", peer.peer.Port). Str("reason", reason). Msg("[SYNC] remove GRPC peer") } @@ -285,7 +291,7 @@ func (sc *SyncConfig) CloseConnections() { sc.mtx.RLock() defer sc.mtx.RUnlock() for _, pc := range sc.peers { - pc.client.Close() + pc.client.Close("close all connections") } } @@ -360,9 +366,9 @@ func (peerConfig *SyncPeerConfig) GetBlocks(hashes [][]byte) ([][]byte, error) { } // CreateSyncConfig creates SyncConfig for StateSync object. -func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32) error { +func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32, waitForEachPeerToConnect bool) error { var err error - ss.syncConfig, err = createSyncConfig(ss.syncConfig, peers, shardID) + ss.syncConfig, err = createSyncConfig(ss.syncConfig, peers, shardID, waitForEachPeerToConnect) return err } @@ -384,16 +390,16 @@ func checkPeersDuplicity(ps []p2p.Peer) error { } // limitNumPeers limits number of peers to release some server end sources. -func limitNumPeers(ps []p2p.Peer, randSeed int64) []p2p.Peer { +func limitNumPeers(ps []p2p.Peer, randSeed int64) (int, []p2p.Peer) { targetSize := calcNumPeersWithBound(len(ps), NumPeersLowBound, numPeersHighBound) if len(ps) <= targetSize { - return ps + return len(ps), ps } r := rand.New(rand.NewSource(randSeed)) r.Shuffle(len(ps), func(i, j int) { ps[i], ps[j] = ps[j], ps[i] }) - return ps[:targetSize] + return targetSize, ps } // Peers are expected to limited at half of the size, capped between lowBound and highBound. @@ -459,19 +465,20 @@ func (sc *SyncConfig) InitForTesting(client *downloader.Client, blockHashes [][] func (sc *SyncConfig) cleanUpPeers(maxFirstID int) { fixedPeer := sc.peers[maxFirstID] - utils.Logger().Info().Int("peers", len(sc.peers)).Msg("[SYNC] before cleanUpPeers") + var removedPeers int for i := 0; i < len(sc.peers); i++ { if CompareSyncPeerConfigByblockHashes(fixedPeer, sc.peers[i]) != 0 { // TODO: move it into a util delete func. // See tip https://github.com/golang/go/wiki/SliceTricks // Close the client and remove the peer out of the - sc.peers[i].client.Close() + sc.peers[i].client.Close("cleanup peers") copy(sc.peers[i:], sc.peers[i+1:]) sc.peers[len(sc.peers)-1] = nil sc.peers = sc.peers[:len(sc.peers)-1] + removedPeers++ } } - utils.Logger().Info().Int("peers", len(sc.peers)).Msg("[SYNC] post cleanUpPeers") + utils.Logger().Info().Int("removed peers", removedPeers).Msg("[SYNC] post cleanUpPeers") } // GetBlockHashesConsensusAndCleanUp selects the most common peer config based on their block hashes to download/sync. @@ -492,7 +499,7 @@ func (sc *SyncConfig) GetBlockHashesConsensusAndCleanUp() error { } utils.Logger().Info(). Int("maxFirstID", maxFirstID). - Str("targetPeerIP", sc.peers[maxFirstID].ip). + Str("targetPeerIP", sc.peers[maxFirstID].peer.IP). Int("maxCount", maxCount). Int("hashSize", len(sc.peers[maxFirstID].blockHashes)). Msg("[SYNC] block consensus hashes") @@ -512,15 +519,15 @@ func (ss *StateSync) getConsensusHashes(startHash []byte, size uint32) error { response := peerConfig.client.GetBlockHashes(startHash, size, ss.selfip, ss.selfport) if response == nil { utils.Logger().Warn(). - Str("peerIP", peerConfig.ip). - Str("peerPort", peerConfig.port). + Str("peerIP", peerConfig.peer.IP). + Str("peerPort", peerConfig.peer.Port). Msg("[SYNC] getConsensusHashes Nil Response") ss.syncConfig.RemovePeer(peerConfig, fmt.Sprintf("StateSync %d: nil response for GetBlockHashes", ss.blockChain.ShardID())) return } utils.Logger().Info().Uint32("queried blockHash size", size). Int("got blockHashSize", len(response.Payload)). - Str("PeerIP", peerConfig.ip). + Str("PeerIP", peerConfig.peer.IP). Msg("[SYNC] GetBlockHashes") if len(response.Payload) > int(size+1) { utils.Logger().Warn(). @@ -582,13 +589,13 @@ func (ss *StateSync) downloadBlocks(bc core.BlockChain) { payload, err := peerConfig.GetBlocks(tasks.blockHashes()) if err != nil { utils.Logger().Warn().Err(err). - Str("peerID", peerConfig.ip). - Str("port", peerConfig.port). + Str("peerID", peerConfig.peer.IP). + Str("port", peerConfig.peer.Port). Msg("[SYNC] downloadBlocks: GetBlocks failed") ss.syncConfig.RemovePeer(peerConfig, fmt.Sprintf("StateSync %d: error returned for GetBlocks: %s", ss.blockChain.ShardID(), err.Error())) return } - if err != nil || len(payload) == 0 { + if len(payload) == 0 { count++ utils.Logger().Error().Int("failNumber", count). Msg("[SYNC] downloadBlocks: no more retrievable blocks") @@ -855,7 +862,7 @@ func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc core.BlockChain haveCurrentSig := len(block.GetCurrentCommitSig()) != 0 // Verify block signatures if block.NumberU64() > 1 { - // Verify signature every 100 blocks + // Verify signature every N blocks (which N is verifyHeaderBatchSize and can be adjusted in configs) verifySeal := block.NumberU64()%verifyHeaderBatchSize == 0 || verifyAllSig verifyCurrentSig := verifyAllSig && haveCurrentSig if verifyCurrentSig { @@ -894,7 +901,7 @@ func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc core.BlockChain utils.Logger().Error(). Err(err). Msgf( - "[SYNC] UpdateBlockAndStatus: Error adding newck to blockchain %d %d", + "[SYNC] UpdateBlockAndStatus: Error adding new block to blockchain %d %d", block.NumberU64(), block.ShardID(), ) @@ -1004,7 +1011,7 @@ func (peerConfig *SyncPeerConfig) registerToBroadcast(peerHash []byte, ip, port } func (peerConfig *SyncPeerConfig) String() interface{} { - return fmt.Sprintf("peer: %s:%s ", peerConfig.ip, peerConfig.port) + return fmt.Sprintf("peer: %s:%s ", peerConfig.peer.IP, peerConfig.peer.Port) } // RegisterNodeInfo will register node to peers to accept future new block broadcasting @@ -1018,12 +1025,12 @@ func (ss *StateSync) RegisterNodeInfo() int { count := 0 ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { - logger := utils.Logger().With().Str("peerPort", peerConfig.port).Str("peerIP", peerConfig.ip).Logger() + logger := utils.Logger().With().Str("peerPort", peerConfig.peer.Port).Str("peerIP", peerConfig.peer.IP).Logger() if count >= registrationNumber { brk = true return } - if peerConfig.ip == ss.selfip && peerConfig.port == GetSyncingPort(ss.selfport) { + if peerConfig.peer.IP == ss.selfip && peerConfig.peer.Port == GetSyncingPort(ss.selfport) { logger.Debug(). Str("selfport", ss.selfport). Str("selfsyncport", GetSyncingPort(ss.selfport)). @@ -1058,11 +1065,14 @@ func (ss *StateSync) GetMaxPeerHeight() uint64 { } // SyncLoop will keep syncing with peers until catches up -func (ss *StateSync) SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeacon bool, consensus *consensus.Consensus) { +func (ss *StateSync) SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeacon bool, consensus *consensus.Consensus, loopMinTime time.Duration) { + utils.Logger().Info().Msgf("legacy sync is executing ...") if !isBeacon { ss.RegisterNodeInfo() } + for { + start := time.Now() otherHeight := getMaxPeerHeight(ss.syncConfig) currentHeight := bc.CurrentBlock().NumberU64() if currentHeight >= otherHeight { @@ -1089,6 +1099,14 @@ func (ss *StateSync) SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeaco break } ss.purgeOldBlocksFromCache() + + if loopMinTime != 0 { + waitTime := loopMinTime - time.Since(start) + c := time.After(waitTime) + select { + case <-c: + } + } } if consensus != nil { if err := ss.addConsensusLastMile(bc, consensus); err != nil { @@ -1099,6 +1117,7 @@ func (ss *StateSync) SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeaco consensus.UpdateConsensusInformation() } } + utils.Logger().Info().Msgf("legacy sync is executed") ss.purgeAllBlocksFromCache() } @@ -1149,12 +1168,19 @@ type ( } SyncCheckResult struct { - IsInSync bool - OtherHeight uint64 - HeightDiff uint64 + IsSynchronized bool + OtherHeight uint64 + HeightDiff uint64 } ) +func ParseResult(res SyncCheckResult) (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + IsSynchronized = res.IsSynchronized + OtherHeight = res.OtherHeight + HeightDiff = res.HeightDiff + return IsSynchronized, OtherHeight, HeightDiff +} + func newSyncStatus(role nodeconfig.Role) syncStatus { expiration := getSyncStatusExpiration(role) return syncStatus{ @@ -1200,6 +1226,11 @@ func (status *syncStatus) Clone() syncStatus { } } +func (ss *StateSync) IsSynchronized() bool { + result := ss.GetSyncStatus() + return result.IsSynchronized +} + func (status *syncStatus) expired() bool { return time.Since(status.lastUpdateTime) > status.expiration } @@ -1214,20 +1245,32 @@ func (status *syncStatus) update(result SyncCheckResult) { // If the last result is expired, ask the remote DNS nodes for latest height and return the result. func (ss *StateSync) GetSyncStatus() SyncCheckResult { return ss.syncStatus.Get(func() SyncCheckResult { - return ss.isInSync(false) + return ss.isSynchronized(false) + }) +} + +func (ss *StateSync) GetParsedSyncStatus() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + res := ss.syncStatus.Get(func() SyncCheckResult { + return ss.isSynchronized(false) }) + return ParseResult(res) } // GetSyncStatusDoubleChecked return the sync status when enforcing a immediate query on DNS nodes // with a double check to avoid false alarm. func (ss *StateSync) GetSyncStatusDoubleChecked() SyncCheckResult { - result := ss.isInSync(true) + result := ss.isSynchronized(true) return result } -// isInSync query the remote DNS node for the latest height to check what is the current +func (ss *StateSync) GetParsedSyncStatusDoubleChecked() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + result := ss.isSynchronized(true) + return ParseResult(result) +} + +// isSynchronized query the remote DNS node for the latest height to check what is the current // sync status -func (ss *StateSync) isInSync(doubleCheck bool) SyncCheckResult { +func (ss *StateSync) isSynchronized(doubleCheck bool) SyncCheckResult { if ss.syncConfig == nil { return SyncCheckResult{} // If syncConfig is not instantiated, return not in sync } @@ -1245,9 +1288,9 @@ func (ss *StateSync) isInSync(doubleCheck bool) SyncCheckResult { Uint64("lastHeight", lastHeight). Msg("[SYNC] Checking sync status") return SyncCheckResult{ - IsInSync: !wasOutOfSync, - OtherHeight: otherHeight1, - HeightDiff: heightDiff, + IsSynchronized: !wasOutOfSync, + OtherHeight: otherHeight1, + HeightDiff: heightDiff, } } // double check the sync status after 1 second to confirm (avoid false alarm) @@ -1269,8 +1312,8 @@ func (ss *StateSync) isInSync(doubleCheck bool) SyncCheckResult { heightDiff = 0 // overflow } return SyncCheckResult{ - IsInSync: !(wasOutOfSync && isOutOfSync && lastHeight == currentHeight), - OtherHeight: otherHeight2, - HeightDiff: heightDiff, + IsSynchronized: !(wasOutOfSync && isOutOfSync && lastHeight == currentHeight), + OtherHeight: otherHeight2, + HeightDiff: heightDiff, } } diff --git a/api/service/legacysync/syncing_test.go b/api/service/legacysync/syncing_test.go index ecccabd15..bcab494a1 100644 --- a/api/service/legacysync/syncing_test.go +++ b/api/service/legacysync/syncing_test.go @@ -29,34 +29,46 @@ func TestSyncPeerConfig_IsEqual(t *testing.T) { }{ { p1: &SyncPeerConfig{ - ip: "0.0.0.1", - port: "1", + peer: p2p.Peer{ + IP: "0.0.0.1", + Port: "1", + }, }, p2: &SyncPeerConfig{ - ip: "0.0.0.1", - port: "2", + peer: p2p.Peer{ + IP: "0.0.0.1", + Port: "2", + }, }, exp: false, }, { p1: &SyncPeerConfig{ - ip: "0.0.0.1", - port: "1", + peer: p2p.Peer{ + IP: "0.0.0.1", + Port: "1", + }, }, p2: &SyncPeerConfig{ - ip: "0.0.0.2", - port: "1", + peer: p2p.Peer{ + IP: "0.0.0.2", + Port: "1", + }, }, exp: false, }, { p1: &SyncPeerConfig{ - ip: "0.0.0.1", - port: "1", + peer: p2p.Peer{ + IP: "0.0.0.1", + Port: "1", + }, }, p2: &SyncPeerConfig{ - ip: "0.0.0.1", - port: "1", + peer: p2p.Peer{ + IP: "0.0.0.1", + Port: "1", + }, }, exp: true, }, @@ -167,7 +179,8 @@ func TestLimitPeersWithBound(t *testing.T) { for _, test := range tests { ps := makePeersForTest(test.size) - res := limitNumPeers(ps, 1) + sz, res := limitNumPeers(ps, 1) + res = res[:sz] if len(res) != test.expSize { t.Errorf("result size unexpected: %v / %v", len(res), test.expSize) @@ -183,8 +196,10 @@ func TestLimitPeersWithBound_random(t *testing.T) { ps2 := makePeersForTest(100) s1, s2 := int64(1), int64(2) - res1 := limitNumPeers(ps1, s1) - res2 := limitNumPeers(ps2, s2) + sz1, res1 := limitNumPeers(ps1, s1) + res1 = res1[:sz1] + sz2, res2 := limitNumPeers(ps2, s2) + res2 = res2[:sz2] if reflect.DeepEqual(res1, res2) { t.Fatal("not randomized limit peer") } @@ -280,7 +295,7 @@ func TestSyncStatus_Get_Concurrency(t *testing.T) { fb := func() SyncCheckResult { time.Sleep(1 * time.Second) atomic.AddInt32(&updated, 1) - return SyncCheckResult{IsInSync: true} + return SyncCheckResult{IsSynchronized: true} } for i := 0; i != 20; i++ { wg.Add(1) diff --git a/api/service/stagedsync/default_stages.go b/api/service/stagedsync/default_stages.go new file mode 100644 index 000000000..0521f30f5 --- /dev/null +++ b/api/service/stagedsync/default_stages.go @@ -0,0 +1,86 @@ +package stagedsync + +import ( + "context" +) + +type ForwardOrder []SyncStageID +type RevertOrder []SyncStageID +type CleanUpOrder []SyncStageID + +var DefaultForwardOrder = ForwardOrder{ + Heads, + BlockHashes, + BlockBodies, + // Stages below don't use Internet + States, + LastMile, + Finish, +} + +var DefaultRevertOrder = RevertOrder{ + Finish, + LastMile, + States, + BlockBodies, + BlockHashes, + Heads, +} + +var DefaultCleanUpOrder = CleanUpOrder{ + Finish, + LastMile, + States, + BlockBodies, + BlockHashes, + Heads, +} + +func DefaultStages(ctx context.Context, + headsCfg StageHeadsCfg, + blockHashesCfg StageBlockHashesCfg, + bodiesCfg StageBodiesCfg, + statesCfg StageStatesCfg, + lastMileCfg StageLastMileCfg, + finishCfg StageFinishCfg) []*Stage { + + handlerStageHeads := NewStageHeads(headsCfg) + handlerStageBlockHashes := NewStageBlockHashes(blockHashesCfg) + handlerStageBodies := NewStageBodies(bodiesCfg) + handleStageStates := NewStageStates(statesCfg) + handlerStageLastMile := NewStageLastMile(lastMileCfg) + handlerStageFinish := NewStageFinish(finishCfg) + + return []*Stage{ + { + ID: Heads, + Description: "Retrieve Chain Heads", + Handler: handlerStageHeads, + }, + { + ID: BlockHashes, + Description: "Download block hashes", + Handler: handlerStageBlockHashes, + }, + { + ID: BlockBodies, + Description: "Download block bodies", + Handler: handlerStageBodies, + }, + { + ID: States, + Description: "Insert new blocks and update blockchain states", + Handler: handleStageStates, + }, + { + ID: LastMile, + Description: "update status for blocks after sync and update last mile blocks as well", + Handler: handlerStageLastMile, + }, + { + ID: Finish, + Description: "Final stage to update current block for the RPC API", + Handler: handlerStageFinish, + }, + } +} diff --git a/api/service/stagedsync/errors.go b/api/service/stagedsync/errors.go new file mode 100644 index 000000000..148a89890 --- /dev/null +++ b/api/service/stagedsync/errors.go @@ -0,0 +1,51 @@ +package stagedsync + +import ( + "fmt" +) + +// Errors ... +var ( + ErrRegistrationFail = WrapStagedSyncError("registration failed") + ErrGetBlock = WrapStagedSyncError("get block failed") + ErrGetBlockHash = WrapStagedSyncError("get block hash failed") + ErrGetConsensusHashes = WrapStagedSyncError("get consensus hashes failed") + ErrGenStateSyncTaskQueue = WrapStagedSyncError("generate state sync task queue failed") + ErrDownloadBlocks = WrapStagedSyncError("get download blocks failed") + ErrUpdateBlockAndStatus = WrapStagedSyncError("update block and status failed") + ErrGenerateNewState = WrapStagedSyncError("get generate new state failed") + ErrFetchBlockHashProgressFail = WrapStagedSyncError("fetch cache progress for block hashes stage failed") + ErrFetchCachedBlockHashFail = WrapStagedSyncError("fetch cached block hashes failed") + ErrNotEnoughBlockHashes = WrapStagedSyncError("peers haven't sent all requested block hashes") + ErrRetrieveCachedProgressFail = WrapStagedSyncError("retrieving cache progress for block hashes stage failed") + ErrRetrieveCachedHashProgressFail = WrapStagedSyncError("retrieving cache progress for block hashes stage failed") + ErrSaveBlockHashesProgressFail = WrapStagedSyncError("saving progress for block hashes stage failed") + ErrSaveCachedBlockHashesProgressFail = WrapStagedSyncError("saving cache progress for block hashes stage failed") + ErrSavingCacheLastBlockHashFail = WrapStagedSyncError("saving cache last block hash for block hashes stage failed") + ErrCachingBlockHashFail = WrapStagedSyncError("caching downloaded block hashes failed") + ErrCommitTransactionFail = WrapStagedSyncError("failed to write db commit") + ErrUnexpectedNumberOfBlocks = WrapStagedSyncError("unexpected number of block delivered") + ErrSavingBodiesProgressFail = WrapStagedSyncError("saving progress for block bodies stage failed") + ErrAddTasksToQueueFail = WrapStagedSyncError("cannot add task to queue") + ErrSavingCachedBodiesProgressFail = WrapStagedSyncError("saving cache progress for blocks stage failed") + ErrRetrievingCachedBodiesProgressFail = WrapStagedSyncError("retrieving cache progress for blocks stage failed") + ErrNoConnectedPeers = WrapStagedSyncError("haven't connected to any peer yet!") + ErrNotEnoughConnectedPeers = WrapStagedSyncError("not enough connected peers") + ErrSaveStateProgressFail = WrapStagedSyncError("saving progress for block States stage failed") + ErrPruningCursorCreationFail = WrapStagedSyncError("failed to create cursor for pruning") + ErrInvalidBlockNumber = WrapStagedSyncError("invalid block number") + ErrInvalidBlockBytes = WrapStagedSyncError("invalid block bytes to insert into chain") + ErrAddTaskFailed = WrapStagedSyncError("cannot add task to queue") + ErrNodeNotEnoughBlockHashes = WrapStagedSyncError("some of the nodes didn't provide all block hashes") + ErrCachingBlocksFail = WrapStagedSyncError("caching downloaded block bodies failed") + ErrSaveBlocksFail = WrapStagedSyncError("save downloaded block bodies failed") + ErrStageNotFound = WrapStagedSyncError("stage not found") + ErrSomeNodesNotReady = WrapStagedSyncError("some nodes are not ready") + ErrSomeNodesBlockHashFail = WrapStagedSyncError("some nodes failed to download block hashes") + ErrMaxPeerHeightFail = WrapStagedSyncError("get max peer height failed") +) + +// WrapStagedSyncError wraps errors for staged sync and returns error object +func WrapStagedSyncError(context string) error { + return fmt.Errorf("[STAGED_SYNC]: %s", context) +} diff --git a/api/service/stagedsync/stage.go b/api/service/stagedsync/stage.go new file mode 100644 index 000000000..74fb83616 --- /dev/null +++ b/api/service/stagedsync/stage.go @@ -0,0 +1,106 @@ +package stagedsync + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/ledgerwatch/erigon-lib/kv" +) + +type ExecFunc func(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) error + +type StageHandler interface { + // Exec is the execution function for the stage to move forward. + // * firstCycle - is it the first cycle of syncing. + // * invalidBlockRevert - whether the execution is to solve the invalid block + // * s - is the current state of the stage and contains stage data. + // * reverter - if the stage needs to cause reverting, `reverter` methods can be used. + Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) error + + // Revert is the reverting logic of the stage. + // * firstCycle - is it the first cycle of syncing. + // * u - contains information about the revert itself. + // * s - represents the state of this stage at the beginning of revert. + Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) error + + // CleanUp is the execution function for the stage to prune old data. + // * firstCycle - is it the first cycle of syncing. + // * p - is the current state of the stage and contains stage data. + CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) error +} + +// Stage is a single sync stage in staged sync. +type Stage struct { + // ID of the sync stage. Should not be empty and should be unique. It is recommended to prefix it with reverse domain to avoid clashes (`com.example.my-stage`). + ID SyncStageID + // Handler handles the logic for the stage + Handler StageHandler + // Description is a string that is shown in the logs. + Description string + // DisabledDescription shows in the log with a message if the stage is disabled. Here, you can show which command line flags should be provided to enable the page. + DisabledDescription string + // Disabled defines if the stage is disabled. It sets up when the stage is build by its `StageBuilder`. + Disabled bool +} + +// StageState is the state of the stage. +type StageState struct { + state *StagedSync + ID SyncStageID + BlockNumber uint64 // BlockNumber is the current block number of the stage at the beginning of the state execution. +} + +func (s *StageState) LogPrefix() string { return s.state.LogPrefix() } + +func (s *StageState) CurrentStageProgress(db kv.Getter) (uint64, error) { + return GetStageProgress(db, s.ID, s.state.isBeacon) +} + +func (s *StageState) StageProgress(db kv.Getter, id SyncStageID) (uint64, error) { + return GetStageProgress(db, id, s.state.isBeacon) +} + +// Update updates the stage state (current block number) in the database. Can be called multiple times during stage execution. +func (s *StageState) Update(db kv.Putter, newBlockNum uint64) error { + return SaveStageProgress(db, s.ID, s.state.isBeacon, newBlockNum) +} +func (s *StageState) UpdateCleanUp(db kv.Putter, blockNum uint64) error { + return SaveStageCleanUpProgress(db, s.ID, s.state.isBeacon, blockNum) +} + +// Reverter allows the stage to cause an revert. +type Reverter interface { + // RevertTo begins staged sync revert to the specified block. + RevertTo(revertPoint uint64, invalidBlock common.Hash) +} + +// RevertState contains the information about revert. +type RevertState struct { + ID SyncStageID + // RevertPoint is the block to revert to. + RevertPoint uint64 + CurrentBlockNumber uint64 + // If revert is caused by a bad block, this hash is not empty + InvalidBlock common.Hash + state *StagedSync +} + +func (u *RevertState) LogPrefix() string { return u.state.LogPrefix() } + +// Done updates the DB state of the stage. +func (u *RevertState) Done(db kv.Putter) error { + return SaveStageProgress(db, u.ID, u.state.isBeacon, u.RevertPoint) +} + +type CleanUpState struct { + ID SyncStageID + ForwardProgress uint64 // progress of stage forward move + CleanUpProgress uint64 // progress of stage prune move. after sync cycle it become equal to ForwardProgress by Done() method + state *StagedSync +} + +func (s *CleanUpState) LogPrefix() string { return s.state.LogPrefix() + " CleanUp" } +func (s *CleanUpState) Done(db kv.Putter) error { + return SaveStageCleanUpProgress(db, s.ID, s.state.isBeacon, s.ForwardProgress) +} +func (s *CleanUpState) DoneAt(db kv.Putter, blockNum uint64) error { + return SaveStageCleanUpProgress(db, s.ID, s.state.isBeacon, blockNum) +} diff --git a/api/service/stagedsync/stage_blockhashes.go b/api/service/stagedsync/stage_blockhashes.go new file mode 100644 index 000000000..1f049d52a --- /dev/null +++ b/api/service/stagedsync/stage_blockhashes.go @@ -0,0 +1,698 @@ +package stagedsync + +import ( + "context" + "encoding/hex" + "fmt" + "strconv" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/internal/utils" + "github.com/ledgerwatch/erigon-lib/kv" + "github.com/ledgerwatch/erigon-lib/kv/mdbx" + "github.com/ledgerwatch/log/v3" +) + +type StageBlockHashes struct { + configs StageBlockHashesCfg +} + +type StageBlockHashesCfg struct { + ctx context.Context + bc core.BlockChain + db kv.RwDB + turbo bool + turboModeCh chan struct{} + bgProcRunning bool + isBeacon bool + cachedb kv.RwDB + logProgress bool +} + +func NewStageBlockHashes(cfg StageBlockHashesCfg) *StageBlockHashes { + return &StageBlockHashes{ + configs: cfg, + } +} + +func NewStageBlockHashesCfg(ctx context.Context, bc core.BlockChain, db kv.RwDB, isBeacon bool, turbo bool, logProgress bool) StageBlockHashesCfg { + cachedb, err := initHashesCacheDB(ctx, isBeacon) + if err != nil { + panic("can't initialize sync caches") + } + return StageBlockHashesCfg{ + ctx: ctx, + bc: bc, + db: db, + turbo: turbo, + isBeacon: isBeacon, + cachedb: cachedb, + logProgress: logProgress, + } +} + +func initHashesCacheDB(ctx context.Context, isBeacon bool) (db kv.RwDB, err error) { + // create caches db + cachedbName := BlockHashesCacheDB + if isBeacon { + cachedbName = "beacon_" + cachedbName + } + cachedb := mdbx.NewMDBX(log.New()).Path(cachedbName).MustOpen() + // create transaction on cachedb + tx, errRW := cachedb.BeginRw(ctx) + if errRW != nil { + utils.Logger().Error(). + Err(errRW). + Msg("[STAGED_SYNC] initializing sync caches failed") + return nil, errRW + } + defer tx.Rollback() + if err := tx.CreateBucket(BlockHashesBucket); err != nil { + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] creating cache bucket failed") + return nil, err + } + if err := tx.CreateBucket(StageProgressBucket); err != nil { + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] creating progress bucket failed") + return nil, err + } + if err := tx.Commit(); err != nil { + return nil, err + } + return cachedb, nil +} + +func (bh *StageBlockHashes) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) (err error) { + + if len(s.state.syncConfig.peers) < NumPeersLowBound { + return ErrNotEnoughConnectedPeers + } + + maxPeersHeight := s.state.syncStatus.MaxPeersHeight + currentHead := bh.configs.bc.CurrentBlock().NumberU64() + if currentHead >= maxPeersHeight { + return nil + } + currProgress := uint64(0) + targetHeight := s.state.syncStatus.currentCycle.TargetHeight + isBeacon := s.state.isBeacon + startHash := bh.configs.bc.CurrentBlock().Hash() + isLastCycle := targetHeight >= maxPeersHeight + canRunInTurboMode := bh.configs.turbo && !isLastCycle + // retrieve the progress + if errV := CreateView(bh.configs.ctx, bh.configs.db, tx, func(etx kv.Tx) error { + if currProgress, err = s.CurrentStageProgress(etx); err != nil { //GetStageProgress(etx, BlockHashes, isBeacon); err != nil { + return err + } + if currProgress > 0 { + key := strconv.FormatUint(currProgress, 10) + bucketName := GetBucketName(BlockHashesBucket, isBeacon) + currHash := []byte{} + if currHash, err = etx.GetOne(bucketName, []byte(key)); err != nil || len(currHash[:]) == 0 { + //TODO: currProgress and DB don't match. Either re-download all or verify db and set currProgress to last + return err + } + startHash.SetBytes(currHash[:]) + } + return nil + }); errV != nil { + return errV + } + + if currProgress == 0 { + if err := bh.clearBlockHashesBucket(tx, s.state.isBeacon); err != nil { + return err + } + startHash = bh.configs.bc.CurrentBlock().Hash() + currProgress = currentHead + } + + if currProgress >= targetHeight { + if canRunInTurboMode && currProgress < maxPeersHeight { + bh.configs.turboModeCh = make(chan struct{}) + go bh.runBackgroundProcess(nil, s, isBeacon, currProgress, maxPeersHeight, startHash) + } + return nil + } + + // check whether any block hashes after curr height is cached + if bh.configs.turbo && !firstCycle { + var cacheHash []byte + if cacheHash, err = bh.getHashFromCache(currProgress + 1); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] fetch cache progress for block hashes stage failed") + } else { + if len(cacheHash[:]) > 0 { + // get blocks from cached db rather than calling peers, and update current progress + newProgress, newStartHash, err := bh.loadBlockHashesFromCache(s, cacheHash, currProgress, targetHeight, tx) + if err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] fetch cached block hashes failed") + bh.clearCache() + bh.clearBlockHashesBucket(tx, isBeacon) + } else { + currProgress = newProgress + startHash.SetBytes(newStartHash[:]) + } + } + } + } + + if currProgress >= targetHeight { + if canRunInTurboMode && currProgress < maxPeersHeight { + bh.configs.turboModeCh = make(chan struct{}) + go bh.runBackgroundProcess(nil, s, isBeacon, currProgress, maxPeersHeight, startHash) + } + return nil + } + + size := uint32(0) + + startTime := time.Now() + startBlock := currProgress + if bh.configs.logProgress { + fmt.Print("\033[s") // save the cursor position + } + + for ok := true; ok; ok = currProgress < targetHeight { + size = uint32(targetHeight - currProgress) + if size > SyncLoopBatchSize { + size = SyncLoopBatchSize + } + // Gets consensus hashes. + if err := s.state.getConsensusHashes(startHash[:], size, false); err != nil { + return err + } + // selects the most common peer config based on their block hashes and doing the clean up + if err := s.state.syncConfig.GetBlockHashesConsensusAndCleanUp(false); err != nil { + return err + } + // double check block hashes + if s.state.DoubleCheckBlockHashes { + invalidPeersMap, validBlockHashes, err := s.state.getInvalidPeersByBlockHashes(tx) + if err != nil { + return err + } + if validBlockHashes < int(size) { + return ErrNotEnoughBlockHashes + } + s.state.syncConfig.cleanUpInvalidPeers(invalidPeersMap) + } + // save the downloaded files to db + if currProgress, startHash, err = bh.saveDownloadedBlockHashes(s, currProgress, startHash, tx); err != nil { + return err + } + // log the stage progress in console + if bh.configs.logProgress { + //calculating block speed + dt := time.Now().Sub(startTime).Seconds() + speed := float64(0) + if dt > 0 { + speed = float64(currProgress-startBlock) / dt + } + blockSpeed := fmt.Sprintf("%.2f", speed) + fmt.Print("\033[u\033[K") // restore the cursor position and clear the line + fmt.Println("downloading block hash progress:", currProgress, "/", targetHeight, "(", blockSpeed, "blocks/s", ")") + } + } + + // continue downloading in background + if canRunInTurboMode && currProgress < maxPeersHeight { + bh.configs.turboModeCh = make(chan struct{}) + go bh.runBackgroundProcess(nil, s, isBeacon, currProgress, maxPeersHeight, startHash) + } + return nil +} + +// runBackgroundProcess continues downloading block hashes in the background and caching them on disk while next stages are running. +// In the next sync cycle, this stage will use cached block hashes rather than download them from peers. +// This helps performance and reduces stage duration. It also helps to use the resources more efficiently. +func (bh *StageBlockHashes) runBackgroundProcess(tx kv.RwTx, s *StageState, isBeacon bool, startHeight uint64, targetHeight uint64, startHash common.Hash) error { + size := uint32(0) + currProgress := startHeight + currHash := startHash + bh.configs.bgProcRunning = true + + defer func() { + if bh.configs.bgProcRunning { + close(bh.configs.turboModeCh) + bh.configs.bgProcRunning = false + } + }() + + // retrieve bg progress and last hash + errV := bh.configs.cachedb.View(context.Background(), func(rtx kv.Tx) error { + + if progressBytes, err := rtx.GetOne(StageProgressBucket, []byte(LastBlockHeight)); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] retrieving cache progress for block hashes stage failed") + return ErrRetrieveCachedProgressFail + } else { + if len(progressBytes[:]) > 0 { + savedProgress, _ := unmarshalData(progressBytes) + if savedProgress > startHeight { + currProgress = savedProgress + // retrieve start hash + if lastBlockHash, err := rtx.GetOne(StageProgressBucket, []byte(LastBlockHash)); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] retrieving cache progress for block hashes stage failed") + return ErrRetrieveCachedHashProgressFail + } else { + currHash.SetBytes(lastBlockHash[:]) + } + } + } + } + return nil + + }) + if errV != nil { + return errV + } + + for { + select { + case <-bh.configs.turboModeCh: + return nil + default: + if currProgress >= targetHeight { + return nil + } + + size = uint32(targetHeight - currProgress) + if size > SyncLoopBatchSize { + size = SyncLoopBatchSize + } + + // Gets consensus hashes. + if err := s.state.getConsensusHashes(currHash[:], size, true); err != nil { + return err + } + + // selects the most common peer config based on their block hashes and doing the clean up + if err := s.state.syncConfig.GetBlockHashesConsensusAndCleanUp(true); err != nil { + return err + } + + // save the downloaded files to db + var err error + if currProgress, currHash, err = bh.saveBlockHashesInCacheDB(s, currProgress, currHash); err != nil { + return err + } + } + //TODO: do we need sleep a few milliseconds? ex: time.Sleep(1 * time.Millisecond) + } +} + +func (bh *StageBlockHashes) clearBlockHashesBucket(tx kv.RwTx, isBeacon bool) error { + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = bh.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + bucketName := GetBucketName(BlockHashesBucket, isBeacon) + if err := tx.ClearBucket(bucketName); err != nil { + return err + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +// saveDownloadedBlockHashes saves block hashes to db (map from block heigh to block hash) +func (bh *StageBlockHashes) saveDownloadedBlockHashes(s *StageState, progress uint64, startHash common.Hash, tx kv.RwTx) (p uint64, h common.Hash, err error) { + p = progress + h.SetBytes(startHash.Bytes()) + lastAddedID := int(0) // the first id won't be added + saved := false + + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = bh.configs.db.BeginRw(context.Background()) + if err != nil { + return p, h, err + } + defer tx.Rollback() + } + + s.state.syncConfig.ForEachPeer(func(configPeer *SyncPeerConfig) (brk bool) { + if len(configPeer.blockHashes) == 0 { + return //fetch the rest from other peer + } + + for id := 0; id < len(configPeer.blockHashes); id++ { + if id <= lastAddedID { + continue + } + blockHash := configPeer.blockHashes[id] + if len(blockHash) == 0 { + return //fetch the rest from other peer + } + key := strconv.FormatUint(p+1, 10) + bucketName := GetBucketName(BlockHashesBucket, s.state.isBeacon) + if err := tx.Put(bucketName, []byte(key), blockHash); err != nil { + utils.Logger().Error(). + Err(err). + Int("block hash index", id). + Str("block hash", hex.EncodeToString(blockHash)). + Msg("[STAGED_SYNC] adding block hash to db failed") + return + } + p++ + h.SetBytes(blockHash[:]) + lastAddedID = id + } + // check if all block hashes are added to db break the loop + if lastAddedID == len(configPeer.blockHashes)-1 { + saved = true + brk = true + } + return + }) + + // save progress + if err = s.Update(tx, p); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block hashes stage failed") + return progress, startHash, ErrSaveBlockHashesProgressFail + } + + if len(s.state.syncConfig.peers) > 0 && len(s.state.syncConfig.peers[0].blockHashes) > 0 && !saved { + return progress, startHash, ErrSaveBlockHashesProgressFail + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return progress, startHash, err + } + } + return p, h, nil +} + +// saveBlockHashesInCacheDB saves block hashes to cache db (map from block heigh to block hash) +func (bh *StageBlockHashes) saveBlockHashesInCacheDB(s *StageState, progress uint64, startHash common.Hash) (p uint64, h common.Hash, err error) { + p = progress + h.SetBytes(startHash[:]) + lastAddedID := int(0) // the first id won't be added + saved := false + + etx, err := bh.configs.cachedb.BeginRw(context.Background()) + if err != nil { + return p, h, err + } + defer etx.Rollback() + + s.state.syncConfig.ForEachPeer(func(configPeer *SyncPeerConfig) (brk bool) { + for id, blockHash := range configPeer.blockHashes { + if id <= lastAddedID { + continue + } + key := strconv.FormatUint(p+1, 10) + if err := etx.Put(BlockHashesBucket, []byte(key), blockHash); err != nil { + utils.Logger().Error(). + Err(err). + Int("block hash index", id). + Str("block hash", hex.EncodeToString(blockHash)). + Msg("[STAGED_SYNC] adding block hash to db failed") + return + } + p++ + h.SetBytes(blockHash[:]) + lastAddedID = id + } + + // check if all block hashes are added to db break the loop + if lastAddedID == len(configPeer.blockHashes)-1 { + saved = true + brk = true + } + return + }) + + // save cache progress (last block height) + if err = etx.Put(StageProgressBucket, []byte(LastBlockHeight), marshalData(p)); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving cache progress for block hashes stage failed") + return p, h, ErrSaveCachedBlockHashesProgressFail + } + + // save cache progress + if err = etx.Put(StageProgressBucket, []byte(LastBlockHash), h.Bytes()); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving cache last block hash for block hashes stage failed") + return p, h, ErrSavingCacheLastBlockHashFail + } + + // if node was connected to other peers and had some hashes to store in db, but it failed to save the blocks, return error + if len(s.state.syncConfig.peers) > 0 && len(s.state.syncConfig.peers[0].blockHashes) > 0 && !saved { + return p, h, ErrCachingBlockHashFail + } + + // commit transaction to db to cache all downloaded blocks + if err := etx.Commit(); err != nil { + return p, h, err + } + + // it cached block hashes successfully, so, it returns the cache progress and last cached block hash + return p, h, nil +} + +// clearCache removes block hashes from cache db +func (bh *StageBlockHashes) clearCache() error { + tx, err := bh.configs.cachedb.BeginRw(context.Background()) + if err != nil { + return nil + } + defer tx.Rollback() + if err := tx.ClearBucket(BlockHashesBucket); err != nil { + return nil + } + + if err := tx.Commit(); err != nil { + return err + } + + return nil +} + +// getHashFromCache fetches block hashes from cache db +func (bh *StageBlockHashes) getHashFromCache(height uint64) (h []byte, err error) { + + tx, err := bh.configs.cachedb.BeginRw(context.Background()) + if err != nil { + return nil, err + } + defer tx.Rollback() + + var cacheHash []byte + key := strconv.FormatUint(height, 10) + if exist, err := tx.Has(BlockHashesBucket, []byte(key)); !exist || err != nil { + return nil, ErrFetchBlockHashProgressFail + } + if cacheHash, err = tx.GetOne(BlockHashesBucket, []byte(key)); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] fetch cache progress for block hashes stage failed") + return nil, ErrFetchBlockHashProgressFail + } + hv, _ := unmarshalData(cacheHash) + if len(cacheHash) <= 1 || hv == 0 { + return nil, ErrFetchBlockHashProgressFail + } + if err := tx.Commit(); err != nil { + return nil, err + } + + return cacheHash[:], nil +} + +// loadBlockHashesFromCache loads block hashes from cache db to main sync db and update the progress +func (bh *StageBlockHashes) loadBlockHashesFromCache(s *StageState, startHash []byte, startHeight uint64, targetHeight uint64, tx kv.RwTx) (p uint64, h common.Hash, err error) { + + p = startHeight + h.SetBytes(startHash[:]) + useInternalTx := tx == nil + if useInternalTx { + tx, err = bh.configs.db.BeginRw(bh.configs.ctx) + if err != nil { + return p, h, err + } + defer tx.Rollback() + } + + if errV := bh.configs.cachedb.View(context.Background(), func(rtx kv.Tx) error { + // load block hashes from cache db and copy them to main sync db + for ok := true; ok; ok = p < targetHeight { + key := strconv.FormatUint(p+1, 10) + lastHash, err := rtx.GetOne(BlockHashesBucket, []byte(key)) + if err != nil { + utils.Logger().Error(). + Err(err). + Str("block height", key). + Msg("[STAGED_SYNC] retrieve block hash from cache failed") + return err + } + if len(lastHash[:]) == 0 { + return nil + } + bucketName := GetBucketName(BlockHashesBucket, s.state.isBeacon) + if err = tx.Put(bucketName, []byte(key), lastHash); err != nil { + return err + } + h.SetBytes(lastHash[:]) + p++ + } + // load extra block hashes from cache db and copy them to bg db to be downloaded in background by block stage + s.state.syncStatus.currentCycle.lock.Lock() + defer s.state.syncStatus.currentCycle.lock.Unlock() + pExtraHashes := p + s.state.syncStatus.currentCycle.ExtraHashes = make(map[uint64][]byte) + for ok := true; ok; ok = pExtraHashes < p+s.state.MaxBackgroundBlocks { + key := strconv.FormatUint(pExtraHashes+1, 10) + newHash, err := rtx.GetOne(BlockHashesBucket, []byte(key)) + if err != nil { + utils.Logger().Error(). + Err(err). + Str("block height", key). + Msg("[STAGED_SYNC] retrieve extra block hashes for background process failed") + break + } + if len(newHash[:]) == 0 { + return nil + } + s.state.syncStatus.currentCycle.ExtraHashes[pExtraHashes+1] = newHash + pExtraHashes++ + } + return nil + }); errV != nil { + return startHeight, h, errV + } + + // save progress + if err = s.Update(tx, p); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving retrieved cached progress for block hashes stage failed") + h.SetBytes(startHash[:]) + return startHeight, h, err + } + + // update the progress + if useInternalTx { + if err := tx.Commit(); err != nil { + h.SetBytes(startHash[:]) + return startHeight, h, err + } + } + return p, h, nil +} + +func (bh *StageBlockHashes) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = bh.configs.db.BeginRw(bh.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + // terminate background process in turbo mode + if bh.configs.bgProcRunning { + bh.configs.bgProcRunning = false + bh.configs.turboModeCh <- struct{}{} + close(bh.configs.turboModeCh) + } + + // clean block hashes db + hashesBucketName := GetBucketName(BlockHashesBucket, bh.configs.isBeacon) + if err = tx.ClearBucket(hashesBucketName); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] clear block hashes bucket after revert failed") + return err + } + + // clean cache db as well + if err := bh.clearCache(); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] clear block hashes cache failed") + return err + } + + // clear extra block hashes + s.state.syncStatus.currentCycle.ExtraHashes = make(map[uint64][]byte) + + // save progress + currentHead := bh.configs.bc.CurrentBlock().NumberU64() + if err = s.Update(tx, currentHead); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block hashes stage after revert failed") + return err + } + + if err = u.Done(tx); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] reset after revert failed") + return err + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return ErrCommitTransactionFail + } + } + return nil +} + +func (bh *StageBlockHashes) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = bh.configs.db.BeginRw(bh.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + // terminate background process in turbo mode + if bh.configs.bgProcRunning { + bh.configs.bgProcRunning = false + bh.configs.turboModeCh <- struct{}{} + close(bh.configs.turboModeCh) + } + + hashesBucketName := GetBucketName(BlockHashesBucket, bh.configs.isBeacon) + tx.ClearBucket(hashesBucketName) + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stage_bodies.go b/api/service/stagedsync/stage_bodies.go new file mode 100644 index 000000000..5f0d4a582 --- /dev/null +++ b/api/service/stagedsync/stage_bodies.go @@ -0,0 +1,784 @@ +package stagedsync + +import ( + "context" + "encoding/hex" + "fmt" + "strconv" + "sync" + "time" + + "github.com/Workiva/go-datastructures/queue" + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/internal/utils" + "github.com/ledgerwatch/erigon-lib/kv" + "github.com/ledgerwatch/erigon-lib/kv/mdbx" + "github.com/ledgerwatch/log/v3" +) + +type StageBodies struct { + configs StageBodiesCfg +} +type StageBodiesCfg struct { + ctx context.Context + bc core.BlockChain + db kv.RwDB + turbo bool + turboModeCh chan struct{} + bgProcRunning bool + isBeacon bool + cachedb kv.RwDB + logProgress bool +} + +func NewStageBodies(cfg StageBodiesCfg) *StageBodies { + return &StageBodies{ + configs: cfg, + } +} + +func NewStageBodiesCfg(ctx context.Context, bc core.BlockChain, db kv.RwDB, isBeacon bool, turbo bool, logProgress bool) StageBodiesCfg { + cachedb, err := initBlocksCacheDB(ctx, isBeacon) + if err != nil { + panic("can't initialize sync caches") + } + return StageBodiesCfg{ + ctx: ctx, + bc: bc, + db: db, + turbo: turbo, + isBeacon: isBeacon, + cachedb: cachedb, + logProgress: logProgress, + } +} + +func initBlocksCacheDB(ctx context.Context, isBeacon bool) (db kv.RwDB, err error) { + // create caches db + cachedbName := BlockCacheDB + if isBeacon { + cachedbName = "beacon_" + cachedbName + } + cachedb := mdbx.NewMDBX(log.New()).Path(cachedbName).MustOpen() + tx, errRW := cachedb.BeginRw(ctx) + if errRW != nil { + utils.Logger().Error(). + Err(errRW). + Msg("[STAGED_SYNC] initializing sync caches failed") + return nil, errRW + } + defer tx.Rollback() + if err := tx.CreateBucket(DownloadedBlocksBucket); err != nil { + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] creating cache bucket failed") + return nil, err + } + if err := tx.CreateBucket(StageProgressBucket); err != nil { + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] creating progress bucket failed") + return nil, err + } + if err := tx.Commit(); err != nil { + return nil, err + } + return cachedb, nil +} + +// Exec progresses Bodies stage in the forward direction +func (b *StageBodies) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) (err error) { + + maxPeersHeight := s.state.syncStatus.MaxPeersHeight + currentHead := b.configs.bc.CurrentBlock().NumberU64() + if currentHead >= maxPeersHeight { + return nil + } + currProgress := uint64(0) + targetHeight := s.state.syncStatus.currentCycle.TargetHeight + isBeacon := s.state.isBeacon + isLastCycle := targetHeight >= maxPeersHeight + canRunInTurboMode := b.configs.turbo && !isLastCycle + + if errV := CreateView(b.configs.ctx, b.configs.db, tx, func(etx kv.Tx) error { + if currProgress, err = s.CurrentStageProgress(etx); err != nil { + return err + } + return nil + }); errV != nil { + return errV + } + + if currProgress == 0 { + if err := b.clearBlocksBucket(tx, s.state.isBeacon); err != nil { + return err + } + currProgress = currentHead + } + + if currProgress >= targetHeight { + return nil + } + + // load cached blocks to main sync db + if b.configs.turbo && !firstCycle { + if currProgress, err = b.loadBlocksFromCache(s, currProgress, tx); err != nil { + return err + } + } + + if currProgress >= targetHeight { + return nil + } + + size := uint64(0) + startTime := time.Now() + startBlock := currProgress + if b.configs.logProgress { + fmt.Print("\033[s") // save the cursor position + } + + for ok := true; ok; ok = currProgress < targetHeight { + maxSize := targetHeight - currProgress + size = uint64(downloadTaskBatch * len(s.state.syncConfig.peers)) + if size > maxSize { + size = maxSize + } + if err = b.loadBlockHashesToTaskQueue(s, currProgress+1, size, tx); err != nil { + s.state.RevertTo(b.configs.bc.CurrentBlock().NumberU64(), b.configs.bc.CurrentBlock().Hash()) + return err + } + + // Download blocks. + verifyAllSig := true //TODO: move it to configs + if err = b.downloadBlocks(s, verifyAllSig, tx); err != nil { + return nil + } + // save blocks and update current progress + if currProgress, err = b.saveDownloadedBlocks(s, currProgress, tx); err != nil { + return err + } + // log the stage progress in console + if b.configs.logProgress { + //calculating block speed + dt := time.Now().Sub(startTime).Seconds() + speed := float64(0) + if dt > 0 { + speed = float64(currProgress-startBlock) / dt + } + blockSpeed := fmt.Sprintf("%.2f", speed) + fmt.Print("\033[u\033[K") // restore the cursor position and clear the line + fmt.Println("downloading blocks progress:", currProgress, "/", targetHeight, "(", blockSpeed, "blocks/s", ")") + } + } + + // Run background process in turbo mode + if canRunInTurboMode && currProgress < maxPeersHeight { + b.configs.turboModeCh = make(chan struct{}) + go b.runBackgroundProcess(tx, s, isBeacon, currProgress, currProgress+s.state.MaxBackgroundBlocks) + } + return nil +} + +// runBackgroundProcess continues downloading blocks in the background and caching them on disk while next stages are running. +// In the next sync cycle, this stage will use cached blocks rather than download them from peers. +// This helps performance and reduces stage duration. It also helps to use the resources more efficiently. +func (b *StageBodies) runBackgroundProcess(tx kv.RwTx, s *StageState, isBeacon bool, startHeight uint64, targetHeight uint64) error { + + s.state.syncStatus.currentCycle.lock.RLock() + defer s.state.syncStatus.currentCycle.lock.RUnlock() + + if s.state.syncStatus.currentCycle.Number == 0 || len(s.state.syncStatus.currentCycle.ExtraHashes) == 0 { + return nil + } + currProgress := startHeight + var err error + size := uint64(0) + b.configs.bgProcRunning = true + + defer func() { + if b.configs.bgProcRunning { + close(b.configs.turboModeCh) + b.configs.bgProcRunning = false + } + }() + + for ok := true; ok; ok = currProgress < targetHeight { + select { + case <-b.configs.turboModeCh: + return nil + default: + if currProgress >= targetHeight { + return nil + } + + maxSize := targetHeight - currProgress + size = uint64(downloadTaskBatch * len(s.state.syncConfig.peers)) + if size > maxSize { + size = maxSize + } + if err = b.loadExtraBlockHashesToTaskQueue(s, currProgress+1, size); err != nil { + return err + } + // Download blocks. + verifyAllSig := true //TODO: move it to configs + if err = b.downloadBlocks(s, verifyAllSig, nil); err != nil { + return nil + } + // save blocks and update current progress + if currProgress, err = b.cacheBlocks(s, currProgress); err != nil { + return err + } + } + } + return nil +} + +func (b *StageBodies) clearBlocksBucket(tx kv.RwTx, isBeacon bool) error { + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = b.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + bucketName := GetBucketName(DownloadedBlocksBucket, isBeacon) + if err := tx.ClearBucket(bucketName); err != nil { + return err + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +// downloadBlocks downloads blocks from state sync task queue. +func (b *StageBodies) downloadBlocks(s *StageState, verifyAllSig bool, tx kv.RwTx) (err error) { + ss := s.state + var wg sync.WaitGroup + taskQueue := downloadTaskQueue{ss.stateSyncTaskQueue} + s.state.InitDownloadedBlocksMap() + + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + wg.Add(1) + go func() { + defer wg.Done() + if !peerConfig.client.IsReady() { + // try to connect + if ready := peerConfig.client.WaitForConnection(1000 * time.Millisecond); !ready { + if !peerConfig.client.IsConnecting() { // if it's idle or closed then remove it + ss.syncConfig.RemovePeer(peerConfig, "not ready to download blocks") + } + return + } + } + for !taskQueue.empty() { + tasks, err := taskQueue.poll(downloadTaskBatch, time.Millisecond) + if err != nil || len(tasks) == 0 { + if err == queue.ErrDisposed { + continue + } + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] downloadBlocks: ss.stateSyncTaskQueue poll timeout") + break + } + payload, err := peerConfig.GetBlocks(tasks.blockHashes()) + if err != nil { + isBrokenPeer := peerConfig.AddFailedTime(downloadBlocksRetryLimit) + utils.Logger().Error(). + Err(err). + Str("peerID", peerConfig.ip). + Str("port", peerConfig.port). + Msg("[STAGED_SYNC] downloadBlocks: GetBlocks failed") + if err := taskQueue.put(tasks); err != nil { + utils.Logger().Error(). + Err(err). + Interface("taskIndexes", tasks.indexes()). + Msg("cannot add task back to queue") + } + if isBrokenPeer { + ss.syncConfig.RemovePeer(peerConfig, "get blocks failed") + } + return + } + if len(payload) == 0 { + isBrokenPeer := peerConfig.AddFailedTime(downloadBlocksRetryLimit) + utils.Logger().Error(). + Str("peerID", peerConfig.ip). + Str("port", peerConfig.port). + Msg("[STAGED_SYNC] downloadBlocks: no more retrievable blocks") + if err := taskQueue.put(tasks); err != nil { + utils.Logger().Error(). + Err(err). + Interface("taskIndexes", tasks.indexes()). + Interface("taskBlockes", tasks.blockHashesStr()). + Msg("downloadBlocks: cannot add task") + } + if isBrokenPeer { + ss.syncConfig.RemovePeer(peerConfig, "no blocks in payload") + } + return + } + // node received blocks from peer, so it is working now + peerConfig.failedTimes = 0 + + failedTasks, err := b.handleBlockSyncResult(s, payload, tasks, verifyAllSig, tx) + if err != nil { + isBrokenPeer := peerConfig.AddFailedTime(downloadBlocksRetryLimit) + utils.Logger().Error(). + Err(err). + Str("peerID", peerConfig.ip). + Str("port", peerConfig.port). + Msg("[STAGED_SYNC] downloadBlocks: handleBlockSyncResult failed") + if err := taskQueue.put(tasks); err != nil { + utils.Logger().Error(). + Err(err). + Interface("taskIndexes", tasks.indexes()). + Interface("taskBlockes", tasks.blockHashesStr()). + Msg("downloadBlocks: cannot add task") + } + if isBrokenPeer { + ss.syncConfig.RemovePeer(peerConfig, "handleBlockSyncResult failed") + } + return + } + + if len(failedTasks) != 0 { + isBrokenPeer := peerConfig.AddFailedTime(downloadBlocksRetryLimit) + utils.Logger().Error(). + Str("peerID", peerConfig.ip). + Str("port", peerConfig.port). + Msg("[STAGED_SYNC] downloadBlocks: some tasks failed") + if err := taskQueue.put(failedTasks); err != nil { + utils.Logger().Error(). + Err(err). + Interface("task Indexes", failedTasks.indexes()). + Interface("task Blocks", tasks.blockHashesStr()). + Msg("cannot add task") + } + if isBrokenPeer { + ss.syncConfig.RemovePeer(peerConfig, "some blocks failed to handle") + } + return + } + } + }() + return + }) + wg.Wait() + return nil +} + +func (b *StageBodies) handleBlockSyncResult(s *StageState, payload [][]byte, tasks syncBlockTasks, verifyAllSig bool, tx kv.RwTx) (syncBlockTasks, error) { + if len(payload) > len(tasks) { + utils.Logger().Error(). + Err(ErrUnexpectedNumberOfBlocks). + Int("expect", len(tasks)). + Int("got", len(payload)) + return tasks, ErrUnexpectedNumberOfBlocks + } + + var failedTasks syncBlockTasks + if len(payload) < len(tasks) { + utils.Logger().Warn(). + Err(ErrUnexpectedNumberOfBlocks). + Int("expect", len(tasks)). + Int("got", len(payload)) + failedTasks = append(failedTasks, tasks[len(payload):]...) + } + + s.state.lockBlocks.Lock() + defer s.state.lockBlocks.Unlock() + + for i, blockBytes := range payload { + if len(blockBytes[:]) <= 1 { + failedTasks = append(failedTasks, tasks[i]) + continue + } + k := uint64(tasks[i].index) // fmt.Sprintf("%d", tasks[i].index) //fmt.Sprintf("%020d", tasks[i].index) + s.state.downloadedBlocks[k] = make([]byte, len(blockBytes)) + copy(s.state.downloadedBlocks[k], blockBytes[:]) + } + + return failedTasks, nil +} + +func (b *StageBodies) saveProgress(s *StageState, progress uint64, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = b.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + + // save progress + if err = s.Update(tx, progress); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block bodies stage failed") + return ErrSavingBodiesProgressFail + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (b *StageBodies) loadBlockHashesToTaskQueue(s *StageState, startIndex uint64, size uint64, tx kv.RwTx) error { + s.state.stateSyncTaskQueue = queue.New(0) + if errV := CreateView(b.configs.ctx, b.configs.db, tx, func(etx kv.Tx) error { + + for i := startIndex; i < startIndex+size; i++ { + key := strconv.FormatUint(i, 10) + id := int(i - startIndex) + bucketName := GetBucketName(BlockHashesBucket, s.state.isBeacon) + blockHash, err := etx.GetOne(bucketName, []byte(key)) + if err != nil { + return err + } + if blockHash == nil || len(blockHash) == 0 { + break + } + if err := s.state.stateSyncTaskQueue.Put(SyncBlockTask{index: id, blockHash: blockHash}); err != nil { + s.state.stateSyncTaskQueue = queue.New(0) + utils.Logger().Error(). + Err(err). + Int("taskIndex", id). + Str("taskBlock", hex.EncodeToString(blockHash)). + Msg("[STAGED_SYNC] loadBlockHashesToTaskQueue: cannot add task") + break + } + } + return nil + + }); errV != nil { + return errV + } + + if s.state.stateSyncTaskQueue.Len() != int64(size) { + return ErrAddTaskFailed + } + return nil +} + +func (b *StageBodies) loadExtraBlockHashesToTaskQueue(s *StageState, startIndex uint64, size uint64) error { + + s.state.stateSyncTaskQueue = queue.New(0) + + for i := startIndex; i < startIndex+size; i++ { + id := int(i - startIndex) + blockHash := s.state.syncStatus.currentCycle.ExtraHashes[i] + if len(blockHash[:]) == 0 { + break + } + if err := s.state.stateSyncTaskQueue.Put(SyncBlockTask{index: id, blockHash: blockHash}); err != nil { + s.state.stateSyncTaskQueue = queue.New(0) + utils.Logger().Warn(). + Err(err). + Int("taskIndex", id). + Str("taskBlock", hex.EncodeToString(blockHash)). + Msg("[STAGED_SYNC] loadBlockHashesToTaskQueue: cannot add task") + break + } + } + + if s.state.stateSyncTaskQueue.Len() != int64(size) { + return ErrAddTasksToQueueFail + } + return nil +} + +func (b *StageBodies) saveDownloadedBlocks(s *StageState, progress uint64, tx kv.RwTx) (p uint64, err error) { + p = progress + + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = b.configs.db.BeginRw(context.Background()) + if err != nil { + return p, err + } + defer tx.Rollback() + } + + downloadedBlocks := s.state.GetDownloadedBlocks() + + for i := uint64(0); i < uint64(len(downloadedBlocks)); i++ { + blockBytes := downloadedBlocks[i] + n := progress + i + 1 + blkNumber := marshalData(n) + bucketName := GetBucketName(DownloadedBlocksBucket, s.state.isBeacon) + if err := tx.Put(bucketName, blkNumber, blockBytes); err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block height", n). + Msg("[STAGED_SYNC] adding block to db failed") + return p, err + } + p++ + } + // check if all block hashes are added to db break the loop + if p-progress != uint64(len(downloadedBlocks)) { + return progress, ErrSaveBlocksFail + } + // save progress + if err = s.Update(tx, p); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block bodies stage failed") + return progress, ErrSavingBodiesProgressFail + } + // if it's using its own transaction, commit transaction to db to cache all downloaded blocks + if useInternalTx { + if err := tx.Commit(); err != nil { + return progress, err + } + } + // it cached blocks successfully, so, it returns the cache progress + return p, nil +} + +func (b *StageBodies) cacheBlocks(s *StageState, progress uint64) (p uint64, err error) { + p = progress + + tx, err := b.configs.cachedb.BeginRw(context.Background()) + if err != nil { + return p, err + } + defer tx.Rollback() + + downloadedBlocks := s.state.GetDownloadedBlocks() + + for i := uint64(0); i < uint64(len(downloadedBlocks)); i++ { + blockBytes := downloadedBlocks[i] + n := progress + i + 1 + blkNumber := marshalData(n) // fmt.Sprintf("%020d", p+1) + if err := tx.Put(DownloadedBlocksBucket, blkNumber, blockBytes); err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block height", p). + Msg("[STAGED_SYNC] caching block failed") + return p, err + } + p++ + } + // check if all block hashes are added to db break the loop + if p-progress != uint64(len(downloadedBlocks)) { + return p, ErrCachingBlocksFail + } + + // save progress + if err = tx.Put(StageProgressBucket, []byte(LastBlockHeight), marshalData(p)); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving cache progress for blocks stage failed") + return p, ErrSavingCachedBodiesProgressFail + } + + if err := tx.Commit(); err != nil { + return p, err + } + + return p, nil +} + +// clearCache removes block hashes from cache db +func (b *StageBodies) clearCache() error { + tx, err := b.configs.cachedb.BeginRw(context.Background()) + if err != nil { + return nil + } + defer tx.Rollback() + + if err := tx.ClearBucket(DownloadedBlocksBucket); err != nil { + return nil + } + + if err := tx.Commit(); err != nil { + return err + } + + return nil +} + +// load blocks from cache db to main sync db and update the progress +func (b *StageBodies) loadBlocksFromCache(s *StageState, startHeight uint64, tx kv.RwTx) (p uint64, err error) { + + p = startHeight + + useInternalTx := tx == nil + if useInternalTx { + tx, err = b.configs.db.BeginRw(b.configs.ctx) + if err != nil { + return p, err + } + defer tx.Rollback() + } + + defer func() { + // Clear cache db + b.configs.cachedb.Update(context.Background(), func(etx kv.RwTx) error { + if err := etx.ClearBucket(DownloadedBlocksBucket); err != nil { + return err + } + return nil + }) + }() + + errV := b.configs.cachedb.View(context.Background(), func(rtx kv.Tx) error { + lastCachedHeightBytes, err := rtx.GetOne(StageProgressBucket, []byte(LastBlockHeight)) + if err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] retrieving cache progress for blocks stage failed") + return ErrRetrievingCachedBodiesProgressFail + } + lastHeight, err := unmarshalData(lastCachedHeightBytes) + if err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] retrieving cache progress for blocks stage failed") + return ErrRetrievingCachedBodiesProgressFail + } + + if startHeight >= lastHeight { + return nil + } + + // load block hashes from cache db snd copy them to main sync db + for ok := true; ok; ok = p < lastHeight { + key := marshalData(p + 1) + blkBytes, err := rtx.GetOne(DownloadedBlocksBucket, []byte(key)) + if err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block height", p+1). + Msg("[STAGED_SYNC] retrieve block from cache failed") + return err + } + if len(blkBytes[:]) <= 1 { + break + } + bucketName := GetBucketName(DownloadedBlocksBucket, s.state.isBeacon) + if err = tx.Put(bucketName, []byte(key), blkBytes); err != nil { + return err + } + p++ + } + return nil + }) + if errV != nil { + return startHeight, errV + } + + // save progress + if err = s.Update(tx, p); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving retrieved cached progress for blocks stage failed") + return startHeight, ErrSavingCachedBodiesProgressFail + } + + // update the progress + if useInternalTx { + if err := tx.Commit(); err != nil { + return startHeight, err + } + } + + return p, nil +} + +func (b *StageBodies) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = b.configs.db.BeginRw(b.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + // terminate background process in turbo mode + if b.configs.bgProcRunning { + b.configs.bgProcRunning = false + b.configs.turboModeCh <- struct{}{} + close(b.configs.turboModeCh) + } + + // clean block hashes db + blocksBucketName := GetBucketName(DownloadedBlocksBucket, b.configs.isBeacon) + if err = tx.ClearBucket(blocksBucketName); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] clear blocks bucket after revert failed") + return err + } + + // clean cache db as well + if err := b.clearCache(); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] clear blocks cache failed") + return err + } + + // save progress + currentHead := b.configs.bc.CurrentBlock().NumberU64() + if err = s.Update(tx, currentHead); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block bodies stage after revert failed") + return err + } + + if err = u.Done(tx); err != nil { + return err + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (b *StageBodies) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = b.configs.db.BeginRw(b.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + // terminate background process in turbo mode + if b.configs.bgProcRunning { + b.configs.bgProcRunning = false + b.configs.turboModeCh <- struct{}{} + close(b.configs.turboModeCh) + } + blocksBucketName := GetBucketName(DownloadedBlocksBucket, b.configs.isBeacon) + tx.ClearBucket(blocksBucketName) + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stage_finish.go b/api/service/stagedsync/stage_finish.go new file mode 100644 index 000000000..68396d3ab --- /dev/null +++ b/api/service/stagedsync/stage_finish.go @@ -0,0 +1,114 @@ +package stagedsync + +import ( + "context" + + "github.com/ledgerwatch/erigon-lib/kv" +) + +type StageFinish struct { + configs StageFinishCfg +} + +type StageFinishCfg struct { + ctx context.Context + db kv.RwDB +} + +func NewStageFinish(cfg StageFinishCfg) *StageFinish { + return &StageFinish{ + configs: cfg, + } +} + +func NewStageFinishCfg(ctx context.Context, db kv.RwDB) StageFinishCfg { + return StageFinishCfg{ + ctx: ctx, + db: db, + } +} + +func (finish *StageFinish) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) error { + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = finish.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + + // TODO: prepare indices (useful for RPC) and finalize + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + + return nil +} + +func (bh *StageFinish) clearBucket(tx kv.RwTx, isBeacon bool) error { + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = bh.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + bucketName := GetBucketName(BlockHashesBucket, isBeacon) + if err := tx.ClearBucket(bucketName); err != nil { + return err + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (finish *StageFinish) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = finish.configs.db.BeginRw(finish.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if err = u.Done(tx); err != nil { + return err + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (finish *StageFinish) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = finish.configs.db.BeginRw(finish.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stage_heads.go b/api/service/stagedsync/stage_heads.go new file mode 100644 index 000000000..6dcde6246 --- /dev/null +++ b/api/service/stagedsync/stage_heads.go @@ -0,0 +1,146 @@ +package stagedsync + +import ( + "context" + + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/internal/utils" + "github.com/ledgerwatch/erigon-lib/kv" +) + +type StageHeads struct { + configs StageHeadsCfg +} + +type StageHeadsCfg struct { + ctx context.Context + bc core.BlockChain + db kv.RwDB +} + +func NewStageHeads(cfg StageHeadsCfg) *StageHeads { + return &StageHeads{ + configs: cfg, + } +} + +func NewStageHeadersCfg(ctx context.Context, bc core.BlockChain, db kv.RwDB) StageHeadsCfg { + return StageHeadsCfg{ + ctx: ctx, + bc: bc, + db: db, + } +} + +func (heads *StageHeads) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) error { + + if len(s.state.syncConfig.peers) < NumPeersLowBound { + return ErrNotEnoughConnectedPeers + } + + // no need to update target if we are redoing the stages because of bad block + if invalidBlockRevert { + return nil + } + + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = heads.configs.db.BeginRw(heads.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + maxPeersHeight := s.state.syncStatus.MaxPeersHeight + maxBlocksPerSyncCycle := s.state.MaxBlocksPerSyncCycle + currentHeight := heads.configs.bc.CurrentBlock().NumberU64() + s.state.syncStatus.currentCycle.TargetHeight = maxPeersHeight + targetHeight := uint64(0) + if errV := CreateView(heads.configs.ctx, heads.configs.db, tx, func(etx kv.Tx) (err error) { + if targetHeight, err = s.CurrentStageProgress(etx); err != nil { + return err + } + return nil + }); errV != nil { + return errV + } + + // if current height is ahead of target height, we need recalculate target height + if targetHeight <= currentHeight { + if maxPeersHeight <= currentHeight { + return nil + } + utils.Logger().Info(). + Uint64("max blocks per sync cycle", maxBlocksPerSyncCycle). + Uint64("maxPeersHeight", maxPeersHeight). + Msgf("[STAGED_SYNC] current height is ahead of target height, target height is readjusted to max peers height") + targetHeight = maxPeersHeight + } + + if targetHeight > maxPeersHeight { + targetHeight = maxPeersHeight + } + + if maxBlocksPerSyncCycle > 0 && targetHeight-currentHeight > maxBlocksPerSyncCycle { + targetHeight = currentHeight + maxBlocksPerSyncCycle + } + + s.state.syncStatus.currentCycle.TargetHeight = targetHeight + + if err := s.Update(tx, targetHeight); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for headers stage failed") + return err + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + + return nil +} + +func (heads *StageHeads) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = heads.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + + if err = u.Done(tx); err != nil { + return err + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (heads *StageHeads) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = heads.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stage_lastmile.go b/api/service/stagedsync/stage_lastmile.go new file mode 100644 index 000000000..df6079bd0 --- /dev/null +++ b/api/service/stagedsync/stage_lastmile.go @@ -0,0 +1,121 @@ +package stagedsync + +import ( + "context" + + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/types" + "github.com/ledgerwatch/erigon-lib/kv" +) + +type StageLastMile struct { + configs StageLastMileCfg +} + +type StageLastMileCfg struct { + ctx context.Context + bc core.BlockChain + db kv.RwDB +} + +func NewStageLastMile(cfg StageLastMileCfg) *StageLastMile { + return &StageLastMile{ + configs: cfg, + } +} + +func NewStageLastMileCfg(ctx context.Context, bc core.BlockChain, db kv.RwDB) StageLastMileCfg { + return StageLastMileCfg{ + ctx: ctx, + bc: bc, + db: db, + } +} + +func (lm *StageLastMile) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) (err error) { + + maxPeersHeight := s.state.syncStatus.MaxPeersHeight + targetHeight := s.state.syncStatus.currentCycle.TargetHeight + isLastCycle := targetHeight >= maxPeersHeight + if !isLastCycle { + return nil + } + + bc := lm.configs.bc + // update blocks after node start sync + parentHash := bc.CurrentBlock().Hash() + for { + block := s.state.getMaxConsensusBlockFromParentHash(parentHash) + if block == nil { + break + } + err = s.state.UpdateBlockAndStatus(block, bc, true) + if err != nil { + break + } + parentHash = block.Hash() + } + // TODO ek – Do we need to hold syncMux now that syncConfig has its own mutex? + s.state.syncMux.Lock() + s.state.syncConfig.ForEachPeer(func(peer *SyncPeerConfig) (brk bool) { + peer.newBlocks = []*types.Block{} + return + }) + s.state.syncMux.Unlock() + + // update last mile blocks if any + parentHash = bc.CurrentBlock().Hash() + for { + block := s.state.getBlockFromLastMileBlocksByParentHash(parentHash) + if block == nil { + break + } + err = s.state.UpdateBlockAndStatus(block, bc, false) + if err != nil { + break + } + parentHash = block.Hash() + } + + return nil +} + +func (lm *StageLastMile) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = lm.configs.db.BeginRw(lm.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if err = u.Done(tx); err != nil { + return err + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (lm *StageLastMile) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = lm.configs.db.BeginRw(lm.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stage_state.go b/api/service/stagedsync/stage_state.go new file mode 100644 index 000000000..70e64516b --- /dev/null +++ b/api/service/stagedsync/stage_state.go @@ -0,0 +1,330 @@ +package stagedsync + +import ( + "context" + "fmt" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/internal/chain" + "github.com/harmony-one/harmony/internal/utils" + "github.com/ledgerwatch/erigon-lib/kv" + "github.com/pkg/errors" +) + +type StageStates struct { + configs StageStatesCfg +} +type StageStatesCfg struct { + ctx context.Context + bc core.BlockChain + db kv.RwDB + logProgress bool +} + +func NewStageStates(cfg StageStatesCfg) *StageStates { + return &StageStates{ + configs: cfg, + } +} + +func NewStageStatesCfg(ctx context.Context, bc core.BlockChain, db kv.RwDB, logProgress bool) StageStatesCfg { + return StageStatesCfg{ + ctx: ctx, + bc: bc, + db: db, + logProgress: logProgress, + } +} + +func getBlockHashByHeight(h uint64, isBeacon bool, tx kv.RwTx) common.Hash { + var invalidBlockHash common.Hash + hashesBucketName := GetBucketName(BlockHashesBucket, isBeacon) + blockHeight := marshalData(h) + if invalidBlockHashBytes, err := tx.GetOne(hashesBucketName, blockHeight); err == nil { + invalidBlockHash.SetBytes(invalidBlockHashBytes) + } + return invalidBlockHash +} + +// Exec progresses States stage in the forward direction +func (stg *StageStates) Exec(firstCycle bool, invalidBlockRevert bool, s *StageState, reverter Reverter, tx kv.RwTx) (err error) { + + maxPeersHeight := s.state.syncStatus.MaxPeersHeight + currentHead := stg.configs.bc.CurrentBlock().NumberU64() + if currentHead >= maxPeersHeight { + return nil + } + currProgress := stg.configs.bc.CurrentBlock().NumberU64() + targetHeight := s.state.syncStatus.currentCycle.TargetHeight + if currProgress >= targetHeight { + return nil + } + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = stg.configs.db.BeginRw(stg.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + blocksBucketName := GetBucketName(DownloadedBlocksBucket, s.state.isBeacon) + isLastCycle := targetHeight >= maxPeersHeight + verifyAllSig := s.state.VerifyAllSig || isLastCycle //if it's last cycle, we have to check all signatures + startTime := time.Now() + startBlock := currProgress + var newBlocks types.Blocks + nBlock := int(0) + + if stg.configs.logProgress { + fmt.Print("\033[s") // save the cursor position + } + + for i := currProgress + 1; i <= targetHeight; i++ { + key := marshalData(i) + blockBytes, err := tx.GetOne(blocksBucketName, key) + if err != nil { + return err + } + + // if block size is invalid, we have to break the updating state loop + // we don't need to do rollback, because the latest batch haven't added to chain yet + sz := len(blockBytes) + if sz <= 1 { + utils.Logger().Error(). + Uint64("block number", i). + Msg("block size invalid") + invalidBlockHash := getBlockHashByHeight(i, s.state.isBeacon, tx) + s.state.RevertTo(stg.configs.bc.CurrentBlock().NumberU64(), invalidBlockHash) + return ErrInvalidBlockBytes + } + + block, err := RlpDecodeBlockOrBlockWithSig(blockBytes) + if err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block number", i). + Msg("block RLP decode failed") + invalidBlockHash := getBlockHashByHeight(i, s.state.isBeacon, tx) + s.state.RevertTo(stg.configs.bc.CurrentBlock().NumberU64(), invalidBlockHash) + return err + } + + /* + // TODO: use hash as key and here check key (which is hash) against block.header.hash + gotHash := block.Hash() + if !bytes.Equal(gotHash[:], tasks[i].blockHash) { + utils.Logger().Warn(). + Err(errors.New("wrong block delivery")). + Str("expectHash", hex.EncodeToString(tasks[i].blockHash)). + Str("gotHash", hex.EncodeToString(gotHash[:])) + continue + } + */ + if block.NumberU64() != i { + invalidBlockHash := getBlockHashByHeight(i, s.state.isBeacon, tx) + s.state.RevertTo(stg.configs.bc.CurrentBlock().NumberU64(), invalidBlockHash) + return ErrInvalidBlockNumber + } + if block.NumberU64() <= currProgress { + continue + } + + // Verify block signatures + if block.NumberU64() > 1 { + // Verify signature every N blocks (which N is verifyHeaderBatchSize and can be adjusted in configs) + haveCurrentSig := len(block.GetCurrentCommitSig()) != 0 + verifySeal := block.NumberU64()%s.state.VerifyHeaderBatchSize == 0 || verifyAllSig + verifyCurrentSig := verifyAllSig && haveCurrentSig + bc := stg.configs.bc + if err = stg.verifyBlockSignatures(bc, block, verifyCurrentSig, verifySeal, verifyAllSig); err != nil { + invalidBlockHash := getBlockHashByHeight(i, s.state.isBeacon, tx) + s.state.RevertTo(stg.configs.bc.CurrentBlock().NumberU64(), invalidBlockHash) + return err + } + + /* + //TODO: we are handling the bad blocks and already blocks are verified, so do we need verify header? + err := stg.configs.bc.Engine().VerifyHeader(stg.configs.bc, block.Header(), verifySeal) + if err == engine.ErrUnknownAncestor { + return err + } else if err != nil { + utils.Logger().Error().Err(err).Msgf("[STAGED_SYNC] failed verifying signatures for new block %d", block.NumberU64()) + if !verifyAllSig { + utils.Logger().Info().Interface("block", stg.configs.bc.CurrentBlock()).Msg("[STAGED_SYNC] Rolling back last 99 blocks!") + for i := uint64(0); i < s.state.VerifyHeaderBatchSize-1; i++ { + if rbErr := stg.configs.bc.Rollback([]common.Hash{stg.configs.bc.CurrentBlock().Hash()}); rbErr != nil { + utils.Logger().Err(rbErr).Msg("[STAGED_SYNC] UpdateBlockAndStatus: failed to rollback") + return err + } + } + currProgress = stg.configs.bc.CurrentBlock().NumberU64() + } + return err + } + */ + } + + newBlocks = append(newBlocks, block) + if nBlock < s.state.InsertChainBatchSize-1 && block.NumberU64() < targetHeight { + nBlock++ + continue + } + + // insert downloaded block into chain + headBeforeNewBlocks := stg.configs.bc.CurrentBlock().NumberU64() + headHashBeforeNewBlocks := stg.configs.bc.CurrentBlock().Hash() + _, err = stg.configs.bc.InsertChain(newBlocks, false) //TODO: verifyHeaders can be done here + if err != nil { + // TODO: handle chain rollback because of bad block + utils.Logger().Error(). + Err(err). + Uint64("block number", block.NumberU64()). + Uint32("shard", block.ShardID()). + Msgf("[STAGED_SYNC] UpdateBlockAndStatus: Error adding new block to blockchain") + // rollback bc + utils.Logger().Info(). + Interface("block", stg.configs.bc.CurrentBlock()). + Msg("[STAGED_SYNC] Rolling back last added blocks!") + if rbErr := stg.configs.bc.Rollback([]common.Hash{headHashBeforeNewBlocks}); rbErr != nil { + utils.Logger().Error(). + Err(rbErr). + Msg("[STAGED_SYNC] UpdateBlockAndStatus: failed to rollback") + return err + } + s.state.RevertTo(headBeforeNewBlocks, headHashBeforeNewBlocks) + return err + } + utils.Logger().Info(). + Uint64("blockHeight", block.NumberU64()). + Uint64("blockEpoch", block.Epoch().Uint64()). + Str("blockHex", block.Hash().Hex()). + Uint32("ShardID", block.ShardID()). + Msg("[STAGED_SYNC] UpdateBlockAndStatus: New Block Added to Blockchain") + + // update cur progress + currProgress = stg.configs.bc.CurrentBlock().NumberU64() + + for i, tx := range block.StakingTransactions() { + utils.Logger().Info(). + Msgf( + "StakingTxn %d: %s, %v", i, tx.StakingType().String(), tx.StakingMessage(), + ) + } + + nBlock = 0 + newBlocks = newBlocks[:0] + // log the stage progress in console + if stg.configs.logProgress { + //calculating block speed + dt := time.Now().Sub(startTime).Seconds() + speed := float64(0) + if dt > 0 { + speed = float64(currProgress-startBlock) / dt + } + blockSpeed := fmt.Sprintf("%.2f", speed) + fmt.Print("\033[u\033[K") // restore the cursor position and clear the line + fmt.Println("insert blocks progress:", currProgress, "/", targetHeight, "(", blockSpeed, "blocks/s", ")") + } + + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + + return nil +} + +//verifyBlockSignatures verifies block signatures +func (stg *StageStates) verifyBlockSignatures(bc core.BlockChain, block *types.Block, verifyCurrentSig bool, verifySeal bool, verifyAllSig bool) (err error) { + if verifyCurrentSig { + sig, bitmap, err := chain.ParseCommitSigAndBitmap(block.GetCurrentCommitSig()) + if err != nil { + return errors.Wrap(err, "parse commitSigAndBitmap") + } + + startTime := time.Now() + if err := bc.Engine().VerifyHeaderSignature(bc, block.Header(), sig, bitmap); err != nil { + return errors.Wrapf(err, "verify header signature %v", block.Hash().String()) + } + utils.Logger().Debug(). + Int64("elapsed time", time.Now().Sub(startTime).Milliseconds()). + Msg("[STAGED_SYNC] VerifyHeaderSignature") + } + return nil +} + +// saveProgress saves the stage progress +func (stg *StageStates) saveProgress(s *StageState, tx kv.RwTx) (err error) { + + useInternalTx := tx == nil + if useInternalTx { + var err error + tx, err = stg.configs.db.BeginRw(context.Background()) + if err != nil { + return err + } + defer tx.Rollback() + } + + // save progress + if err = s.Update(tx, stg.configs.bc.CurrentBlock().NumberU64()); err != nil { + utils.Logger().Error(). + Err(err). + Msgf("[STAGED_SYNC] saving progress for block States stage failed") + return ErrSaveStateProgressFail + } + + if useInternalTx { + if err := tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (stg *StageStates) Revert(firstCycle bool, u *RevertState, s *StageState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = stg.configs.db.BeginRw(stg.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if err = u.Done(tx); err != nil { + return err + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} + +func (stg *StageStates) CleanUp(firstCycle bool, p *CleanUpState, tx kv.RwTx) (err error) { + useInternalTx := tx == nil + if useInternalTx { + tx, err = stg.configs.db.BeginRw(stg.configs.ctx) + if err != nil { + return err + } + defer tx.Rollback() + } + + if useInternalTx { + if err = tx.Commit(); err != nil { + return err + } + } + return nil +} diff --git a/api/service/stagedsync/stagedsync.go b/api/service/stagedsync/stagedsync.go new file mode 100644 index 000000000..88df1a671 --- /dev/null +++ b/api/service/stagedsync/stagedsync.go @@ -0,0 +1,1316 @@ +package stagedsync + +import ( + "bytes" + "context" + "encoding/hex" + "fmt" + "math" + "sort" + "strconv" + "sync" + "time" + + "github.com/pkg/errors" + + "github.com/Workiva/go-datastructures/queue" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/rlp" + "github.com/harmony-one/harmony/api/service/legacysync/downloader" + "github.com/harmony-one/harmony/consensus" + "github.com/harmony-one/harmony/consensus/engine" + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/internal/chain" + nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/utils" + "github.com/harmony-one/harmony/p2p" + "github.com/ledgerwatch/erigon-lib/kv" +) + +type StagedSync struct { + selfip string + selfport string + selfPeerHash [20]byte // hash of ip and address combination + commonBlocks map[int]*types.Block + downloadedBlocks map[uint64][]byte + lastMileBlocks []*types.Block // last mile blocks to catch up with the consensus + syncConfig *SyncConfig + isExplorer bool + stateSyncTaskQueue *queue.Queue + syncMux sync.Mutex + lastMileMux sync.Mutex + syncStatus syncStatus + lockBlocks sync.RWMutex + + ctx context.Context + bc core.BlockChain + isBeacon bool + db kv.RwDB + + revertPoint *uint64 // used to run stages + prevRevertPoint *uint64 // used to get value from outside of staged sync after cycle (for example to notify RPCDaemon) + invalidBlock common.Hash + + stages []*Stage + revertOrder []*Stage + pruningOrder []*Stage + currentStage uint + timings []Timing + logPrefixes []string + + // if set to true, it will double check the block hashes + // so, only blocks are sent by 2/3 of peers are considered as valid + DoubleCheckBlockHashes bool + // Maximum number of blocks per each cycle. if set to zero, all blocks will be + // downloaded and synced in one full cycle. + MaxBlocksPerSyncCycle uint64 + // maximum number of blocks which can be downloaded in background. + MaxBackgroundBlocks uint64 + // max number of blocks to use a single transaction for staged sync + MaxMemSyncCycleSize uint64 + // number of blocks to build a batch and insert to chain in staged sync + InsertChainBatchSize int + // verify signature for all blocks regardless of height or batch size + VerifyAllSig bool + // batch size to verify header before insert to chain + VerifyHeaderBatchSize uint64 + // use mem db for staged sync, set to false to use disk + UseMemDB bool + // use turbo mode for staged sync + StagedSyncTurboMode bool + // log the full sync progress in console + LogProgress bool +} + +// BlockWithSig the serialization structure for request DownloaderRequest_BLOCKWITHSIG +// The block is encoded as block + commit signature +type BlockWithSig struct { + Block *types.Block + CommitSigAndBitmap []byte +} + +type Timing struct { + isRevert bool + isCleanUp bool + stage SyncStageID + took time.Duration +} + +func (s *StagedSync) Len() int { return len(s.stages) } +func (s *StagedSync) Context() context.Context { return s.ctx } +func (s *StagedSync) IsBeacon() bool { return s.isBeacon } +func (s *StagedSync) IsExplorer() bool { return s.isExplorer } +func (s *StagedSync) Blockchain() core.BlockChain { return s.bc } +func (s *StagedSync) DB() kv.RwDB { return s.db } +func (s *StagedSync) PrevRevertPoint() *uint64 { return s.prevRevertPoint } + +func (s *StagedSync) InitDownloadedBlocksMap() error { + s.lockBlocks.Lock() + defer s.lockBlocks.Unlock() + s.downloadedBlocks = make(map[uint64][]byte) + return nil +} + +func (s *StagedSync) AddBlocks(blks map[uint64][]byte) error { + s.lockBlocks.Lock() + defer s.lockBlocks.Unlock() + for k, blkBytes := range blks { + s.downloadedBlocks[k] = make([]byte, len(blkBytes)) + copy(s.downloadedBlocks[k], blkBytes[:]) + } + return nil +} + +func (s *StagedSync) GetDownloadedBlocks() map[uint64][]byte { + d := make(map[uint64][]byte) + s.lockBlocks.RLock() + defer s.lockBlocks.RUnlock() + for k, blkBytes := range s.downloadedBlocks { + d[k] = make([]byte, len(blkBytes)) + copy(d[k], blkBytes[:]) + } + return d +} + +func (s *StagedSync) NewRevertState(id SyncStageID, revertPoint, currentProgress uint64) *RevertState { + return &RevertState{id, revertPoint, currentProgress, common.Hash{}, s} +} + +func (s *StagedSync) CleanUpStageState(id SyncStageID, forwardProgress uint64, tx kv.Tx, db kv.RwDB) (*CleanUpState, error) { + var pruneProgress uint64 + var err error + + if errV := CreateView(context.Background(), db, tx, func(tx kv.Tx) error { + pruneProgress, err = GetStageCleanUpProgress(tx, id, s.isBeacon) + if err != nil { + return err + } + return nil + }); errV != nil { + return nil, errV + } + + return &CleanUpState{id, forwardProgress, pruneProgress, s}, nil +} + +func (s *StagedSync) NextStage() { + if s == nil { + return + } + s.currentStage++ +} + +// IsBefore returns true if stage1 goes before stage2 in staged sync +func (s *StagedSync) IsBefore(stage1, stage2 SyncStageID) bool { + idx1 := -1 + idx2 := -1 + for i, stage := range s.stages { + if stage.ID == stage1 { + idx1 = i + } + + if stage.ID == stage2 { + idx2 = i + } + } + + return idx1 < idx2 +} + +// IsAfter returns true if stage1 goes after stage2 in staged sync +func (s *StagedSync) IsAfter(stage1, stage2 SyncStageID) bool { + idx1 := -1 + idx2 := -1 + for i, stage := range s.stages { + if stage.ID == stage1 { + idx1 = i + } + + if stage.ID == stage2 { + idx2 = i + } + } + + return idx1 > idx2 +} + +// RevertTo reverts the stage to a specific height +func (s *StagedSync) RevertTo(revertPoint uint64, invalidBlock common.Hash) { + utils.Logger().Info(). + Interface("invalidBlock", invalidBlock). + Uint64("revertPoint", revertPoint). + Msgf("[STAGED_SYNC] Reverting blocks") + s.revertPoint = &revertPoint + s.invalidBlock = invalidBlock +} + +func (s *StagedSync) Done() { + s.currentStage = uint(len(s.stages)) + s.revertPoint = nil +} + +func (s *StagedSync) IsDone() bool { + return s.currentStage >= uint(len(s.stages)) && s.revertPoint == nil +} + +func (s *StagedSync) LogPrefix() string { + if s == nil { + return "" + } + return s.logPrefixes[s.currentStage] +} + +func (s *StagedSync) SetCurrentStage(id SyncStageID) error { + for i, stage := range s.stages { + if stage.ID == id { + s.currentStage = uint(i) + return nil + } + } + utils.Logger().Error(). + Interface("stage id", id). + Msgf("[STAGED_SYNC] stage not found") + + return ErrStageNotFound +} + +func New(ctx context.Context, + ip string, + port string, + peerHash [20]byte, + bc core.BlockChain, + role nodeconfig.Role, + isBeacon bool, + isExplorer bool, + db kv.RwDB, + stagesList []*Stage, + revertOrder RevertOrder, + pruneOrder CleanUpOrder, + TurboMode bool, + UseMemDB bool, + doubleCheckBlockHashes bool, + maxBlocksPerCycle uint64, + maxBackgroundBlocks uint64, + maxMemSyncCycleSize uint64, + verifyAllSig bool, + verifyHeaderBatchSize uint64, + insertChainBatchSize int, + logProgress bool) *StagedSync { + + revertStages := make([]*Stage, len(stagesList)) + for i, stageIndex := range revertOrder { + for _, s := range stagesList { + if s.ID == stageIndex { + revertStages[i] = s + break + } + } + } + pruneStages := make([]*Stage, len(stagesList)) + for i, stageIndex := range pruneOrder { + for _, s := range stagesList { + if s.ID == stageIndex { + pruneStages[i] = s + break + } + } + } + logPrefixes := make([]string, len(stagesList)) + for i := range stagesList { + logPrefixes[i] = fmt.Sprintf("%d/%d %s", i+1, len(stagesList), stagesList[i].ID) + } + + return &StagedSync{ + ctx: ctx, + selfip: ip, + selfport: port, + selfPeerHash: peerHash, + bc: bc, + isBeacon: isBeacon, + isExplorer: isExplorer, + db: db, + stages: stagesList, + currentStage: 0, + revertOrder: revertStages, + pruningOrder: pruneStages, + logPrefixes: logPrefixes, + syncStatus: NewSyncStatus(role), + commonBlocks: make(map[int]*types.Block), + downloadedBlocks: make(map[uint64][]byte), + lastMileBlocks: []*types.Block{}, + syncConfig: &SyncConfig{}, + StagedSyncTurboMode: TurboMode, + UseMemDB: UseMemDB, + DoubleCheckBlockHashes: doubleCheckBlockHashes, + MaxBlocksPerSyncCycle: maxBlocksPerCycle, + MaxBackgroundBlocks: maxBackgroundBlocks, + MaxMemSyncCycleSize: maxMemSyncCycleSize, + VerifyAllSig: verifyAllSig, + VerifyHeaderBatchSize: verifyHeaderBatchSize, + InsertChainBatchSize: insertChainBatchSize, + LogProgress: logProgress, + } +} + +func (s *StagedSync) StageState(stage SyncStageID, tx kv.Tx, db kv.RwDB) (*StageState, error) { + var blockNum uint64 + var err error + if errV := CreateView(context.Background(), db, tx, func(rtx kv.Tx) error { + blockNum, err = GetStageProgress(rtx, stage, s.isBeacon) + if err != nil { + return err + } + return nil + }); errV != nil { + return nil, errV + } + + return &StageState{s, stage, blockNum}, nil +} + +func (s *StagedSync) cleanUp(fromStage int, db kv.RwDB, tx kv.RwTx, firstCycle bool) error { + found := false + for i := 0; i < len(s.pruningOrder); i++ { + if s.pruningOrder[i].ID == s.stages[fromStage].ID { + found = true + } + if !found || s.pruningOrder[i] == nil || s.pruningOrder[i].Disabled { + continue + } + if err := s.pruneStage(firstCycle, s.pruningOrder[i], db, tx); err != nil { + panic(err) + } + } + return nil +} + +func (s *StagedSync) Run(db kv.RwDB, tx kv.RwTx, firstCycle bool) error { + s.prevRevertPoint = nil + s.timings = s.timings[:0] + + for !s.IsDone() { + var invalidBlockRevert bool + if s.revertPoint != nil { + for j := 0; j < len(s.revertOrder); j++ { + if s.revertOrder[j] == nil || s.revertOrder[j].Disabled { + continue + } + if err := s.revertStage(firstCycle, s.revertOrder[j], db, tx); err != nil { + return err + } + } + s.prevRevertPoint = s.revertPoint + s.revertPoint = nil + if s.invalidBlock != (common.Hash{}) { + invalidBlockRevert = true + } + s.invalidBlock = common.Hash{} + if err := s.SetCurrentStage(s.stages[0].ID); err != nil { + return err + } + firstCycle = false + } + + stage := s.stages[s.currentStage] + + if stage.Disabled { + utils.Logger().Trace(). + Msgf("[STAGED_SYNC] %s disabled. %s", stage.ID, stage.DisabledDescription) + + s.NextStage() + continue + } + + if err := s.runStage(stage, db, tx, firstCycle, invalidBlockRevert); err != nil { + return err + } + + s.NextStage() + } + + if err := s.cleanUp(0, db, tx, firstCycle); err != nil { + return err + } + if err := s.SetCurrentStage(s.stages[0].ID); err != nil { + return err + } + if err := printLogs(tx, s.timings); err != nil { + return err + } + s.currentStage = 0 + return nil +} + +func CreateView(ctx context.Context, db kv.RwDB, tx kv.Tx, f func(tx kv.Tx) error) error { + if tx != nil { + return f(tx) + } + return db.View(ctx, func(etx kv.Tx) error { + return f(etx) + }) +} + +func ByteCount(b uint64) string { + const unit = 1024 + if b < unit { + return fmt.Sprintf("%dB", b) + } + div, exp := uint64(unit), 0 + for n := b / unit; n >= unit; n /= unit { + div *= unit + exp++ + } + return fmt.Sprintf("%.1f%cB", + float64(b)/float64(div), "KMGTPE"[exp]) +} + +func printLogs(tx kv.RwTx, timings []Timing) error { + var logCtx []interface{} + count := 0 + for i := range timings { + if timings[i].took < 50*time.Millisecond { + continue + } + count++ + if count == 50 { + break + } + if timings[i].isRevert { + logCtx = append(logCtx, "Revert "+string(timings[i].stage), timings[i].took.Truncate(time.Millisecond).String()) + } else if timings[i].isCleanUp { + logCtx = append(logCtx, "CleanUp "+string(timings[i].stage), timings[i].took.Truncate(time.Millisecond).String()) + } else { + logCtx = append(logCtx, string(timings[i].stage), timings[i].took.Truncate(time.Millisecond).String()) + } + } + if len(logCtx) > 0 { + utils.Logger().Info(). + Msgf("[STAGED_SYNC] Timings (slower than 50ms) %v", logCtx...) + } + + if tx == nil { + return nil + } + + if len(logCtx) > 0 { // also don't print this logs if everything is fast + buckets := Buckets + bucketSizes := make([]interface{}, 0, 2*len(buckets)) + for _, bucket := range buckets { + sz, err1 := tx.BucketSize(bucket) + if err1 != nil { + return err1 + } + bucketSizes = append(bucketSizes, bucket, ByteCount(sz)) + } + utils.Logger().Info(). + Msgf("[STAGED_SYNC] Tables %v", bucketSizes...) + } + tx.CollectMetrics() + return nil +} + +func (s *StagedSync) runStage(stage *Stage, db kv.RwDB, tx kv.RwTx, firstCycle bool, invalidBlockRevert bool) (err error) { + start := time.Now() + stageState, err := s.StageState(stage.ID, tx, db) + if err != nil { + return err + } + + if err = stage.Handler.Exec(firstCycle, invalidBlockRevert, stageState, s, tx); err != nil { + utils.Logger().Error(). + Err(err). + Interface("stage id", stage.ID). + Msgf("[STAGED_SYNC] stage failed") + return fmt.Errorf("[%s] %w", s.LogPrefix(), err) + } + utils.Logger().Info(). + Msgf("[STAGED_SYNC] stage %s executed successfully", stage.ID) + + took := time.Since(start) + if took > 60*time.Second { + logPrefix := s.LogPrefix() + utils.Logger().Info(). + Msgf("[STAGED_SYNC] [%s] DONE in %d", logPrefix, took) + + } + s.timings = append(s.timings, Timing{stage: stage.ID, took: took}) + return nil +} + +func (s *StagedSync) revertStage(firstCycle bool, stage *Stage, db kv.RwDB, tx kv.RwTx) error { + start := time.Now() + utils.Logger().Trace(). + Msgf("[STAGED_SYNC] Revert... stage %s", stage.ID) + stageState, err := s.StageState(stage.ID, tx, db) + if err != nil { + return err + } + + revert := s.NewRevertState(stage.ID, *s.revertPoint, stageState.BlockNumber) + revert.InvalidBlock = s.invalidBlock + + if stageState.BlockNumber <= revert.RevertPoint { + return nil + } + + if err = s.SetCurrentStage(stage.ID); err != nil { + return err + } + + err = stage.Handler.Revert(firstCycle, revert, stageState, tx) + if err != nil { + return fmt.Errorf("[%s] %w", s.LogPrefix(), err) + } + + took := time.Since(start) + if took > 60*time.Second { + logPrefix := s.LogPrefix() + utils.Logger().Info(). + Msgf("[STAGED_SYNC] [%s] Revert done in %d", logPrefix, took) + } + s.timings = append(s.timings, Timing{isRevert: true, stage: stage.ID, took: took}) + return nil +} + +func (s *StagedSync) pruneStage(firstCycle bool, stage *Stage, db kv.RwDB, tx kv.RwTx) error { + start := time.Now() + utils.Logger().Info(). + Msgf("[STAGED_SYNC] CleanUp... stage %s", stage.ID) + + stageState, err := s.StageState(stage.ID, tx, db) + if err != nil { + return err + } + + prune, err := s.CleanUpStageState(stage.ID, stageState.BlockNumber, tx, db) + if err != nil { + return err + } + if err = s.SetCurrentStage(stage.ID); err != nil { + return err + } + + err = stage.Handler.CleanUp(firstCycle, prune, tx) + if err != nil { + return fmt.Errorf("[%s] %w", s.LogPrefix(), err) + } + + took := time.Since(start) + if took > 60*time.Second { + logPrefix := s.LogPrefix() + utils.Logger().Trace(). + Msgf("[STAGED_SYNC] [%s] CleanUp done in %d", logPrefix, took) + + utils.Logger().Info(). + Msgf("[STAGED_SYNC] [%s] CleanUp done in %d", logPrefix, took) + } + s.timings = append(s.timings, Timing{isCleanUp: true, stage: stage.ID, took: took}) + return nil +} + +// DisableAllStages - including their reverts +func (s *StagedSync) DisableAllStages() []SyncStageID { + var backupEnabledIds []SyncStageID + for i := range s.stages { + if !s.stages[i].Disabled { + backupEnabledIds = append(backupEnabledIds, s.stages[i].ID) + } + } + for i := range s.stages { + s.stages[i].Disabled = true + } + return backupEnabledIds +} + +func (s *StagedSync) DisableStages(ids ...SyncStageID) { + for i := range s.stages { + for _, id := range ids { + if s.stages[i].ID != id { + continue + } + s.stages[i].Disabled = true + } + } +} + +func (s *StagedSync) EnableStages(ids ...SyncStageID) { + for i := range s.stages { + for _, id := range ids { + if s.stages[i].ID != id { + continue + } + s.stages[i].Disabled = false + } + } +} + +func (ss *StagedSync) purgeAllBlocksFromCache() { + ss.lastMileMux.Lock() + ss.lastMileBlocks = nil + ss.lastMileMux.Unlock() + + ss.syncMux.Lock() + defer ss.syncMux.Unlock() + ss.commonBlocks = make(map[int]*types.Block) + + ss.syncConfig.ForEachPeer(func(configPeer *SyncPeerConfig) (brk bool) { + configPeer.blockHashes = nil + configPeer.newBlocks = nil + return + }) +} + +func (ss *StagedSync) purgeOldBlocksFromCache() { + ss.syncMux.Lock() + defer ss.syncMux.Unlock() + ss.commonBlocks = make(map[int]*types.Block) + ss.syncConfig.ForEachPeer(func(configPeer *SyncPeerConfig) (brk bool) { + configPeer.blockHashes = nil + return + }) +} + +// AddLastMileBlock adds the latest a few block into queue for syncing +// only keep the latest blocks with size capped by LastMileBlocksSize +func (ss *StagedSync) AddLastMileBlock(block *types.Block) { + ss.lastMileMux.Lock() + defer ss.lastMileMux.Unlock() + if ss.lastMileBlocks != nil { + if len(ss.lastMileBlocks) >= LastMileBlocksSize { + ss.lastMileBlocks = ss.lastMileBlocks[1:] + } + ss.lastMileBlocks = append(ss.lastMileBlocks, block) + } +} + +// AddNewBlock will add newly received block into state syncing queue +func (ss *StagedSync) AddNewBlock(peerHash []byte, block *types.Block) { + pc := ss.syncConfig.FindPeerByHash(peerHash) + if pc == nil { + // Received a block with no active peer; just ignore. + return + } + // TODO ek – we shouldn't mess with SyncPeerConfig's mutex. + // Factor this into a method, like pc.AddNewBlock(block) + pc.mux.Lock() + defer pc.mux.Unlock() + pc.newBlocks = append(pc.newBlocks, block) + utils.Logger().Debug(). + Int("total", len(pc.newBlocks)). + Uint64("blockHeight", block.NumberU64()). + Msg("[STAGED_SYNC] new block received") +} + +// CreateSyncConfig creates SyncConfig for StateSync object. +func (ss *StagedSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32, waitForEachPeerToConnect bool) error { + // sanity check to ensure no duplicate peers + if err := checkPeersDuplicity(peers); err != nil { + return err + } + + // limit the number of dns peers to connect + randSeed := time.Now().UnixNano() + targetSize := ss.syncConfig.SelectRandomPeers(peers, randSeed) + + if len(peers) == 0 || targetSize == 0 { + return errors.New("[STAGED_SYNC] no peers to connect to") + } + + utils.Logger().Debug(). + Int("peers count", len(peers)). + Int("target size", targetSize). + Msg("[STAGED_SYNC] CreateSyncConfig: len of peers") + + if ss.syncConfig != nil { + ss.syncConfig.CloseConnections() + } + ss.syncConfig = &SyncConfig{} + + var connectedPeers int + for _, peer := range peers { + client := downloader.ClientSetup(peer.IP, peer.Port, true) + if client == nil { + continue + } + peerConfig := &SyncPeerConfig{ + ip: peer.IP, + port: peer.Port, + client: client, + } + ss.syncConfig.AddPeer(peerConfig) + connectedPeers++ + if connectedPeers >= targetSize+NumPeersReserved { + break + } + } + + if connectedPeers == 0 { + return errors.New("[STAGED_SYNC] CreateSyncConfig: no ready peers to connect") + } + + // select reserved peers + if connectedPeers > targetSize { + ss.syncConfig.reservedPeers = make([]*SyncPeerConfig, connectedPeers-targetSize) + copy(ss.syncConfig.reservedPeers, ss.syncConfig.peers[targetSize:]) + } + // select main peers + ss.syncConfig.peers = ss.syncConfig.peers[:targetSize] + + utils.Logger().Info(). + Int("len", len(ss.syncConfig.peers)). + Msg("[STAGED_SYNC] Finished making connection to peers") + + return nil +} + +// checkPeersDuplicity checks whether there are duplicates in p2p.Peer +func checkPeersDuplicity(ps []p2p.Peer) error { + type peerDupID struct { + ip string + port string + } + m := make(map[peerDupID]struct{}) + for _, p := range ps { + dip := peerDupID{p.IP, p.Port} + if _, ok := m[dip]; ok { + return fmt.Errorf("duplicate peer [%v:%v]", p.IP, p.Port) + } + m[dip] = struct{}{} + } + return nil +} + +// GetActivePeerNumber returns the number of active peers +func (ss *StagedSync) GetActivePeerNumber() int { + if ss.syncConfig == nil { + return 0 + } + // len() is atomic; no need to hold mutex. + return len(ss.syncConfig.peers) +} + +// getConsensusHashes gets all hashes needed to download. +func (ss *StagedSync) getConsensusHashes(startHash []byte, size uint32, bgMode bool) error { + var bgModeError error + + var wg sync.WaitGroup + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + wg.Add(1) + go func() { + defer wg.Done() + if !peerConfig.client.IsReady() { + // try to connect + if ready := peerConfig.client.WaitForConnection(1000 * time.Millisecond); !ready { + // replace it with reserved peer (in bg mode don't replace because maybe other stages still are using this node) + if bgMode { + bgModeError = ErrSomeNodesNotReady + brk = true //finish whole peers loop + } else { + if !peerConfig.client.IsConnecting() { + ss.syncConfig.ReplacePeerWithReserved(peerConfig, "not ready to download consensus hashes") + } + } + return + } + } + response := peerConfig.client.GetBlockHashes(startHash, size, ss.selfip, ss.selfport) + if response == nil { + utils.Logger().Warn(). + Str("peerIP", peerConfig.ip). + Str("peerPort", peerConfig.port). + Msg("[STAGED_SYNC] getConsensusHashes Nil Response, will be replaced with reserved node (if any)") + // replace it with reserved peer (in bg mode don't replace because maybe other stages still are using this node) + if bgMode { + bgModeError = ErrSomeNodesBlockHashFail + brk = true //finish whole peers loop + } else { + isBrokenPeer := peerConfig.AddFailedTime(downloadBlocksRetryLimit) + if isBrokenPeer { + ss.syncConfig.ReplacePeerWithReserved(peerConfig, "receiving nil response for block hashes") + } + } + return + } + utils.Logger().Info(). + Uint32("queried blockHash size", size). + Int("got blockHashSize", len(response.Payload)). + Str("PeerIP", peerConfig.ip). + Bool("background Mode", bgMode). + Msg("[STAGED_SYNC] GetBlockHashes") + + if len(response.Payload) > int(size+1) { + utils.Logger().Warn(). + Uint32("requestSize", size). + Int("respondSize", len(response.Payload)). + Msg("[STAGED_SYNC] getConsensusHashes: receive more blockHashes than requested!") + peerConfig.blockHashes = response.Payload[:size+1] + } else { + peerConfig.blockHashes = response.Payload + } + + }() + return + }) + wg.Wait() + + return bgModeError +} + +// getInvalidPeersByBlockHashes analyzes block hashes and detects invalid peers +func (ss *StagedSync) getInvalidPeersByBlockHashes(tx kv.RwTx) (map[string]bool, int, error) { + invalidPeers := make(map[string]bool) + if len(ss.syncConfig.peers) < 3 { + lb := len(ss.syncConfig.peers[0].blockHashes) + return invalidPeers, lb, nil + } + + // confirmations threshold to consider as valid block hash + th := 2 * int(len(ss.syncConfig.peers)/3) + if len(ss.syncConfig.peers) == 4 { + th = 3 + } + + type BlockHashMap struct { + peers map[string]bool + isValid bool + } + + // populate the block hashes map + bhm := make(map[string]*BlockHashMap) + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + for _, blkHash := range peerConfig.blockHashes { + k := string(blkHash) + if _, ok := bhm[k]; !ok { + bhm[k] = &BlockHashMap{ + peers: make(map[string]bool), + } + } + peerHash := string(peerConfig.peerHash) + bhm[k].peers[peerHash] = true + bhm[k].isValid = true + } + return + }) + + var validBlockHashes int + + for blkHash, hmap := range bhm { + + // if block is not confirmed by th% of peers, it is considered as invalid block + // So, any peer with that block hash will be considered as invalid peer + if len(hmap.peers) < th { + bhm[blkHash].isValid = false + for _, p := range ss.syncConfig.peers { + hasBlockHash := hmap.peers[string(p.peerHash)] + if hasBlockHash { + invalidPeers[string(p.peerHash)] = true + } + } + continue + } + + // so, block hash is valid, because have been sent by more than th number of peers + validBlockHashes++ + + // if all peers already sent this block hash, then it is considered as valid + if len(hmap.peers) == len(ss.syncConfig.peers) { + continue + } + + //consider invalid peer if it hasn't sent this block hash + for _, p := range ss.syncConfig.peers { + hasBlockHash := hmap.peers[string(p.peerHash)] + if !hasBlockHash { + invalidPeers[string(p.peerHash)] = true + } + } + + } + fmt.Printf("%d out of %d peers have missed blocks or sent invalid blocks\n", len(invalidPeers), len(ss.syncConfig.peers)) + return invalidPeers, validBlockHashes, nil +} + +func (ss *StagedSync) generateStateSyncTaskQueue(bc core.BlockChain, tx kv.RwTx) error { + ss.stateSyncTaskQueue = queue.New(0) + allTasksAddedToQueue := false + ss.syncConfig.ForEachPeer(func(configPeer *SyncPeerConfig) (brk bool) { + for id, blockHash := range configPeer.blockHashes { + if err := ss.stateSyncTaskQueue.Put(SyncBlockTask{index: id, blockHash: blockHash}); err != nil { + ss.stateSyncTaskQueue = queue.New(0) + utils.Logger().Error(). + Err(err). + Int("taskIndex", id). + Str("taskBlock", hex.EncodeToString(blockHash)). + Msg("[STAGED_SYNC] generateStateSyncTaskQueue: cannot add task") + break + } + } + // check if all block hashes added to task queue + if ss.stateSyncTaskQueue.Len() == int64(len(configPeer.blockHashes)) { + allTasksAddedToQueue = true + brk = true + } + return + }) + + if !allTasksAddedToQueue { + return ErrAddTaskFailed + } + utils.Logger().Info(). + Int64("length", ss.stateSyncTaskQueue.Len()). + Msg("[STAGED_SYNC] generateStateSyncTaskQueue: finished") + return nil +} + +// RlpDecodeBlockOrBlockWithSig decodes payload to types.Block or BlockWithSig. +// Return the block with commitSig if set. +func RlpDecodeBlockOrBlockWithSig(payload []byte) (*types.Block, error) { + var block *types.Block + if err := rlp.DecodeBytes(payload, &block); err == nil { + // received payload as *types.Block + return block, nil + } + + var bws BlockWithSig + if err := rlp.DecodeBytes(payload, &bws); err == nil { + block := bws.Block + block.SetCurrentCommitSig(bws.CommitSigAndBitmap) + return block, nil + } + return nil, errors.New("failed to decode to either types.Block or BlockWithSig") +} + +// CompareBlockByHash compares two block by hash, it will be used in sort the blocks +func CompareBlockByHash(a *types.Block, b *types.Block) int { + ha := a.Hash() + hb := b.Hash() + return bytes.Compare(ha[:], hb[:]) +} + +// GetHowManyMaxConsensus will get the most common blocks and the first such blockID +func GetHowManyMaxConsensus(blocks []*types.Block) (int, int) { + // As all peers are sorted by their blockHashes, all equal blockHashes should come together and consecutively. + curCount := 0 + curFirstID := -1 + maxCount := 0 + maxFirstID := -1 + for i := range blocks { + if curFirstID == -1 || CompareBlockByHash(blocks[curFirstID], blocks[i]) != 0 { + curCount = 1 + curFirstID = i + } else { + curCount++ + } + if curCount > maxCount { + maxCount = curCount + maxFirstID = curFirstID + } + } + return maxFirstID, maxCount +} + +func (ss *StagedSync) getMaxConsensusBlockFromParentHash(parentHash common.Hash) *types.Block { + var candidateBlocks []*types.Block + + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + peerConfig.mux.Lock() + defer peerConfig.mux.Unlock() + + for _, block := range peerConfig.newBlocks { + ph := block.ParentHash() + if bytes.Equal(ph[:], parentHash[:]) { + candidateBlocks = append(candidateBlocks, block) + break + } + } + return + }) + if len(candidateBlocks) == 0 { + return nil + } + // Sort by blockHashes. + sort.Slice(candidateBlocks, func(i, j int) bool { + return CompareBlockByHash(candidateBlocks[i], candidateBlocks[j]) == -1 + }) + maxFirstID, maxCount := GetHowManyMaxConsensus(candidateBlocks) + hash := candidateBlocks[maxFirstID].Hash() + utils.Logger().Debug(). + Hex("parentHash", parentHash[:]). + Hex("hash", hash[:]). + Int("maxCount", maxCount). + Msg("[STAGED_SYNC] Find block with matching parent hash") + return candidateBlocks[maxFirstID] +} + +func (ss *StagedSync) getBlockFromOldBlocksByParentHash(parentHash common.Hash) *types.Block { + for _, block := range ss.commonBlocks { + ph := block.ParentHash() + if bytes.Equal(ph[:], parentHash[:]) { + return block + } + } + return nil +} + +func (ss *StagedSync) getBlockFromLastMileBlocksByParentHash(parentHash common.Hash) *types.Block { + for _, block := range ss.lastMileBlocks { + ph := block.ParentHash() + if bytes.Equal(ph[:], parentHash[:]) { + return block + } + } + return nil +} + +// UpdateBlockAndStatus updates block and its status in db +func (ss *StagedSync) UpdateBlockAndStatus(block *types.Block, bc core.BlockChain, verifyAllSig bool) error { + if block.NumberU64() != bc.CurrentBlock().NumberU64()+1 { + utils.Logger().Debug(). + Uint64("curBlockNum", bc.CurrentBlock().NumberU64()). + Uint64("receivedBlockNum", block.NumberU64()). + Msg("[STAGED_SYNC] Inappropriate block number, ignore!") + return nil + } + + haveCurrentSig := len(block.GetCurrentCommitSig()) != 0 + // Verify block signatures + if block.NumberU64() > 1 { + // Verify signature every N blocks (which N is verifyHeaderBatchSize and can be adjusted in configs) + verifySeal := block.NumberU64()%ss.VerifyHeaderBatchSize == 0 || verifyAllSig + verifyCurrentSig := verifyAllSig && haveCurrentSig + if verifyCurrentSig { + sig, bitmap, err := chain.ParseCommitSigAndBitmap(block.GetCurrentCommitSig()) + if err != nil { + return errors.Wrap(err, "parse commitSigAndBitmap") + } + + startTime := time.Now() + if err := bc.Engine().VerifyHeaderSignature(bc, block.Header(), sig, bitmap); err != nil { + return errors.Wrapf(err, "verify header signature %v", block.Hash().String()) + } + utils.Logger().Debug(). + Int64("elapsed time", time.Now().Sub(startTime).Milliseconds()). + Msg("[STAGED_SYNC] VerifyHeaderSignature") + } + err := bc.Engine().VerifyHeader(bc, block.Header(), verifySeal) + if err == engine.ErrUnknownAncestor { + return err + } else if err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block number", block.NumberU64()). + Msgf("[STAGED_SYNC] UpdateBlockAndStatus: failed verifying signatures for new block") + + if !verifyAllSig { + utils.Logger().Info(). + Interface("block", bc.CurrentBlock()). + Msg("[STAGED_SYNC] UpdateBlockAndStatus: Rolling back last 99 blocks!") + for i := uint64(0); i < ss.VerifyHeaderBatchSize-1; i++ { + if rbErr := bc.Rollback([]common.Hash{bc.CurrentBlock().Hash()}); rbErr != nil { + utils.Logger().Error(). + Err(rbErr). + Msg("[STAGED_SYNC] UpdateBlockAndStatus: failed to rollback") + return err + } + } + } + return err + } + } + + _, err := bc.InsertChain([]*types.Block{block}, false /* verifyHeaders */) + if err != nil { + utils.Logger().Error(). + Err(err). + Uint64("block number", block.NumberU64()). + Uint32("shard", block.ShardID()). + Msgf("[STAGED_SYNC] UpdateBlockAndStatus: Error adding new block to blockchain") + return err + } + utils.Logger().Info(). + Uint64("blockHeight", block.NumberU64()). + Uint64("blockEpoch", block.Epoch().Uint64()). + Str("blockHex", block.Hash().Hex()). + Uint32("ShardID", block.ShardID()). + Msg("[STAGED_SYNC] UpdateBlockAndStatus: New Block Added to Blockchain") + + for i, tx := range block.StakingTransactions() { + utils.Logger().Info(). + Msgf( + "StakingTxn %d: %s, %v", i, tx.StakingType().String(), tx.StakingMessage(), + ) + } + return nil +} + +// RegisterNodeInfo will register node to peers to accept future new block broadcasting +// return number of successful registration +func (ss *StagedSync) RegisterNodeInfo() int { + registrationNumber := RegistrationNumber + utils.Logger().Debug(). + Int("registrationNumber", registrationNumber). + Int("activePeerNumber", len(ss.syncConfig.peers)). + Msg("[STAGED_SYNC] node registration to peers") + + count := 0 + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + logger := utils.Logger().With().Str("peerPort", peerConfig.port).Str("peerIP", peerConfig.ip).Logger() + if count >= registrationNumber { + brk = true + return + } + if peerConfig.ip == ss.selfip && peerConfig.port == GetSyncingPort(ss.selfport) { + logger.Debug(). + Str("selfport", ss.selfport). + Str("selfsyncport", GetSyncingPort(ss.selfport)). + Msg("[STAGED_SYNC] skip self") + return + } + err := peerConfig.registerToBroadcast(ss.selfPeerHash[:], ss.selfip, ss.selfport) + if err != nil { + logger.Debug(). + Hex("selfPeerHash", ss.selfPeerHash[:]). + Msg("[STAGED_SYNC] register failed to peer") + return + } + + logger.Debug().Msg("[STAGED_SYNC] register success") + count++ + return + }) + return count +} + +// getMaxPeerHeight returns the maximum blockchain heights from peers +func (ss *StagedSync) getMaxPeerHeight() (uint64, error) { + maxHeight := uint64(math.MaxUint64) + var ( + wg sync.WaitGroup + lock sync.Mutex + ) + + ss.syncConfig.ForEachPeer(func(peerConfig *SyncPeerConfig) (brk bool) { + wg.Add(1) + go func() { + defer wg.Done() + response, err := peerConfig.client.GetBlockChainHeight() + if err != nil { + utils.Logger().Error(). + Err(err). + Str("peerIP", peerConfig.ip). + Str("peerPort", peerConfig.port). + Msg("[STAGED_SYNC]GetBlockChainHeight failed") + ss.syncConfig.RemovePeer(peerConfig, "GetBlockChainHeight failed") + return + } + utils.Logger().Info(). + Str("peerIP", peerConfig.ip). + Uint64("blockHeight", response.BlockHeight). + Msg("[STAGED_SYNC] getMaxPeerHeight") + lock.Lock() + if response != nil { + if maxHeight == uint64(math.MaxUint64) || maxHeight < response.BlockHeight { + maxHeight = response.BlockHeight + } + } + lock.Unlock() + }() + return + }) + wg.Wait() + + if maxHeight == uint64(math.MaxUint64) { + return 0, ErrMaxPeerHeightFail + } + + return maxHeight, nil +} + +// IsSameBlockchainHeight checks whether the node is out of sync from other peers +func (ss *StagedSync) IsSameBlockchainHeight(bc core.BlockChain) (uint64, bool) { + otherHeight, _ := ss.getMaxPeerHeight() + currentHeight := bc.CurrentBlock().NumberU64() + return otherHeight, currentHeight == otherHeight +} + +// GetMaxPeerHeight returns maximum block height of connected peers +func (ss *StagedSync) GetMaxPeerHeight() uint64 { + mph, _ := ss.getMaxPeerHeight() + return mph +} + +func (ss *StagedSync) addConsensusLastMile(bc core.BlockChain, consensus *consensus.Consensus) error { + curNumber := bc.CurrentBlock().NumberU64() + blockIter, err := consensus.GetLastMileBlockIter(curNumber + 1) + if err != nil { + return err + } + for { + block := blockIter.Next() + if block == nil { + break + } + if _, err := bc.InsertChain(types.Blocks{block}, true); err != nil { + return errors.Wrap(err, "failed to InsertChain") + } + } + return nil +} + +// GetSyncingPort returns the syncing port. +func GetSyncingPort(nodePort string) string { + if port, err := strconv.Atoi(nodePort); err == nil { + return fmt.Sprintf("%d", port-SyncingPortDifference) + } + return "" +} + +func ParseResult(res SyncCheckResult) (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + IsSynchronized = res.IsSynchronized + OtherHeight = res.OtherHeight + HeightDiff = res.HeightDiff + return IsSynchronized, OtherHeight, HeightDiff +} + +// GetSyncStatus get the last sync status for other modules (E.g. RPC, explorer). +// If the last sync result is not expired, return the sync result immediately. +// If the last result is expired, ask the remote DNS nodes for latest height and return the result. +func (ss *StagedSync) GetSyncStatus() SyncCheckResult { + return ss.syncStatus.Get(func() SyncCheckResult { + return ss.isSynchronized(false) + }) +} + +func (ss *StagedSync) GetParsedSyncStatus() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + res := ss.syncStatus.Get(func() SyncCheckResult { + return ss.isSynchronized(false) + }) + return ParseResult(res) +} + +func (ss *StagedSync) IsSynchronized() bool { + result := ss.GetSyncStatus() + return result.IsSynchronized +} + +// GetSyncStatusDoubleChecked returns the sync status when enforcing a immediate query on DNS nodes +// with a double check to avoid false alarm. +func (ss *StagedSync) GetSyncStatusDoubleChecked() SyncCheckResult { + result := ss.isSynchronized(true) + return result +} + +func (ss *StagedSync) GetParsedSyncStatusDoubleChecked() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) { + result := ss.isSynchronized(true) + return ParseResult(result) +} + +// isSynchronized queries the remote DNS node for the latest height to check what is the current sync status +func (ss *StagedSync) isSynchronized(doubleCheck bool) SyncCheckResult { + if ss.syncConfig == nil { + return SyncCheckResult{} // If syncConfig is not instantiated, return not in sync + } + otherHeight1, _ := ss.getMaxPeerHeight() + lastHeight := ss.Blockchain().CurrentBlock().NumberU64() + wasOutOfSync := lastHeight+inSyncThreshold < otherHeight1 + + if !doubleCheck { + heightDiff := otherHeight1 - lastHeight + if otherHeight1 < lastHeight { + heightDiff = 0 // + } + utils.Logger().Info(). + Uint64("OtherHeight", otherHeight1). + Uint64("lastHeight", lastHeight). + Msg("[STAGED_SYNC] Checking sync status") + return SyncCheckResult{ + IsSynchronized: !wasOutOfSync, + OtherHeight: otherHeight1, + HeightDiff: heightDiff, + } + } + // double check the sync status after 1 second to confirm (avoid false alarm) + time.Sleep(1 * time.Second) + + otherHeight2, _ := ss.getMaxPeerHeight() + currentHeight := ss.Blockchain().CurrentBlock().NumberU64() + + isOutOfSync := currentHeight+inSyncThreshold < otherHeight2 + utils.Logger().Info(). + Uint64("OtherHeight1", otherHeight1). + Uint64("OtherHeight2", otherHeight2). + Uint64("lastHeight", lastHeight). + Uint64("currentHeight", currentHeight). + Msg("[STAGED_SYNC] Checking sync status") + // Only confirm out of sync when the node has lower height and didn't move in heights for 2 consecutive checks + heightDiff := otherHeight2 - lastHeight + if otherHeight2 < lastHeight { + heightDiff = 0 // overflow + } + return SyncCheckResult{ + IsSynchronized: !(wasOutOfSync && isOutOfSync && lastHeight == currentHeight), + OtherHeight: otherHeight2, + HeightDiff: heightDiff, + } +} diff --git a/api/service/stagedsync/stages.go b/api/service/stagedsync/stages.go new file mode 100644 index 000000000..3afff20a4 --- /dev/null +++ b/api/service/stagedsync/stages.go @@ -0,0 +1,94 @@ +package stagedsync + +import ( + "encoding/binary" + "fmt" + + "github.com/ledgerwatch/erigon-lib/kv" +) + +// SyncStageID represents the stages in the Mode.StagedSync mode +type SyncStageID string + +const ( + Heads SyncStageID = "Heads" // Heads are downloaded + BlockHashes SyncStageID = "BlockHashes" // block hashes are downloaded from peers + BlockBodies SyncStageID = "BlockBodies" // Block bodies are downloaded, TxHash and UncleHash are getting verified + States SyncStageID = "States" // will construct most recent state from downloaded blocks + LastMile SyncStageID = "LastMile" // update blocks after sync and update last mile blocks as well + Finish SyncStageID = "Finish" // Nominal stage after all other stages +) + +func GetStageName(stage string, isBeacon bool, prune bool) string { + name := stage + if isBeacon { + name = "beacon_" + name + } + if prune { + name = "prune_" + name + } + return name +} + +func GetStageID(stage SyncStageID, isBeacon bool, prune bool) []byte { + return []byte(GetStageName(string(stage), isBeacon, prune)) +} + +func GetBucketName(bucketName string, isBeacon bool) string { + name := bucketName + if isBeacon { + name = "Beacon" + name + } + return name +} + +// GetStageProgress retrieves saved progress of given sync stage from the database +func GetStageProgress(db kv.Getter, stage SyncStageID, isBeacon bool) (uint64, error) { + stgID := GetStageID(stage, isBeacon, false) + v, err := db.GetOne(kv.SyncStageProgress, stgID) + if err != nil { + return 0, err + } + return unmarshalData(v) +} + +// SaveStageProgress saves progress of given sync stage +func SaveStageProgress(db kv.Putter, stage SyncStageID, isBeacon bool, progress uint64) error { + stgID := GetStageID(stage, isBeacon, false) + return db.Put(kv.SyncStageProgress, stgID, marshalData(progress)) +} + +// GetStageCleanUpProgress retrieves saved progress of given sync stage from the database +func GetStageCleanUpProgress(db kv.Getter, stage SyncStageID, isBeacon bool) (uint64, error) { + stgID := GetStageID(stage, isBeacon, true) + v, err := db.GetOne(kv.SyncStageProgress, stgID) + if err != nil { + return 0, err + } + return unmarshalData(v) +} + +func SaveStageCleanUpProgress(db kv.Putter, stage SyncStageID, isBeacon bool, progress uint64) error { + stgID := GetStageID(stage, isBeacon, true) + return db.Put(kv.SyncStageProgress, stgID, marshalData(progress)) +} + +func marshalData(blockNumber uint64) []byte { + return encodeBigEndian(blockNumber) +} + +func unmarshalData(data []byte) (uint64, error) { + if len(data) == 0 { + return 0, nil + } + if len(data) < 8 { + return 0, fmt.Errorf("value must be at least 8 bytes, got %d", len(data)) + } + return binary.BigEndian.Uint64(data[:8]), nil +} + +func encodeBigEndian(n uint64) []byte { + var v [8]byte + binary.BigEndian.PutUint64(v[:], n) + return v[:] +} diff --git a/api/service/stagedsync/sync_config.go b/api/service/stagedsync/sync_config.go new file mode 100644 index 000000000..f42737cc1 --- /dev/null +++ b/api/service/stagedsync/sync_config.go @@ -0,0 +1,401 @@ +package stagedsync + +import ( + "bytes" + "encoding/hex" + "errors" + "math/rand" + "reflect" + "sort" + "sync" + + "github.com/harmony-one/harmony/api/service/legacysync/downloader" + pb "github.com/harmony-one/harmony/api/service/legacysync/downloader/proto" + "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/internal/utils" + "github.com/harmony-one/harmony/p2p" +) + +// Constants for syncing. +const ( + downloadBlocksRetryLimit = 3 // downloadBlocks service retry limit + RegistrationNumber = 3 + SyncingPortDifference = 3000 + inSyncThreshold = 0 // when peerBlockHeight - myBlockHeight <= inSyncThreshold, it's ready to join consensus + SyncLoopBatchSize uint32 = 30 // maximum size for one query of block hashes + verifyHeaderBatchSize uint64 = 100 // block chain header verification batch size (not used for now) + LastMileBlocksSize = 50 + + // after cutting off a number of connected peers, the result number of peers + // shall be between numPeersLowBound and numPeersHighBound + NumPeersLowBound = 3 + numPeersHighBound = 5 + + // NumPeersReserved is the number reserved peers which will be replaced with any broken peer + NumPeersReserved = 2 + + // downloadTaskBatch is the number of tasks per each downloader request + downloadTaskBatch = 5 +) + +// SyncPeerConfig is peer config to sync. +type SyncPeerConfig struct { + ip string + port string + peerHash []byte + client *downloader.Client + blockHashes [][]byte // block hashes before node doing sync + newBlocks []*types.Block // blocks after node doing sync + mux sync.RWMutex + failedTimes uint64 +} + +// CreateTestSyncPeerConfig used for testing. +func CreateTestSyncPeerConfig(client *downloader.Client, blockHashes [][]byte) *SyncPeerConfig { + return &SyncPeerConfig{ + client: client, + blockHashes: blockHashes, + } +} + +// GetClient returns client pointer of downloader.Client +func (peerConfig *SyncPeerConfig) GetClient() *downloader.Client { + return peerConfig.client +} + +// AddFailedTime considers one more peer failure and checks against max allowed failed times +func (peerConfig *SyncPeerConfig) AddFailedTime(maxFailures uint64) (mustStop bool) { + peerConfig.mux.Lock() + defer peerConfig.mux.Unlock() + peerConfig.failedTimes++ + if peerConfig.failedTimes > maxFailures { + return true + } + return false +} + +// IsEqual checks the equality between two sync peers +func (peerConfig *SyncPeerConfig) IsEqual(pc2 *SyncPeerConfig) bool { + return peerConfig.ip == pc2.ip && peerConfig.port == pc2.port +} + +// GetBlocks gets blocks by calling grpc request to the corresponding peer. +func (peerConfig *SyncPeerConfig) GetBlocks(hashes [][]byte) ([][]byte, error) { + response := peerConfig.client.GetBlocksAndSigs(hashes) + if response == nil { + return nil, ErrGetBlock + } + return response.Payload, nil +} + +func (peerConfig *SyncPeerConfig) registerToBroadcast(peerHash []byte, ip, port string) error { + response := peerConfig.client.Register(peerHash, ip, port) + if response == nil || response.Type == pb.DownloaderResponse_FAIL { + return ErrRegistrationFail + } else if response.Type == pb.DownloaderResponse_SUCCESS { + return nil + } + return ErrRegistrationFail +} + +// CompareSyncPeerConfigByblockHashes compares two SyncPeerConfig by blockHashes. +func CompareSyncPeerConfigByblockHashes(a *SyncPeerConfig, b *SyncPeerConfig) int { + if len(a.blockHashes) != len(b.blockHashes) { + if len(a.blockHashes) < len(b.blockHashes) { + return -1 + } + return 1 + } + for id := range a.blockHashes { + if !reflect.DeepEqual(a.blockHashes[id], b.blockHashes[id]) { + return bytes.Compare(a.blockHashes[id], b.blockHashes[id]) + } + } + return 0 +} + +// SyncBlockTask is the task struct to sync a specific block. +type SyncBlockTask struct { + index int + blockHash []byte +} + +type syncBlockTasks []SyncBlockTask + +func (tasks syncBlockTasks) blockHashes() [][]byte { + hashes := make([][]byte, 0, len(tasks)) + for _, task := range tasks { + hash := make([]byte, len(task.blockHash)) + copy(hash, task.blockHash) + hashes = append(hashes, task.blockHash) + } + return hashes +} + +func (tasks syncBlockTasks) blockHashesStr() []string { + hashes := make([]string, 0, len(tasks)) + for _, task := range tasks { + hash := hex.EncodeToString(task.blockHash) + hashes = append(hashes, hash) + } + return hashes +} + +func (tasks syncBlockTasks) indexes() []int { + indexes := make([]int, 0, len(tasks)) + for _, task := range tasks { + indexes = append(indexes, task.index) + } + return indexes +} + +// SyncConfig contains an array of SyncPeerConfig. +type SyncConfig struct { + // mtx locks peers, and *SyncPeerConfig pointers in peers. + // SyncPeerConfig itself is guarded by its own mutex. + mtx sync.RWMutex + reservedPeers []*SyncPeerConfig + peers []*SyncPeerConfig +} + +// AddPeer adds the given sync peer. +func (sc *SyncConfig) AddPeer(peer *SyncPeerConfig) { + sc.mtx.Lock() + defer sc.mtx.Unlock() + + // Ensure no duplicate peers + for _, p2 := range sc.peers { + if peer.IsEqual(p2) { + return + } + } + sc.peers = append(sc.peers, peer) +} + +// SelectRandomPeers limits number of peers to release some server end sources. +func (sc *SyncConfig) SelectRandomPeers(peers []p2p.Peer, randSeed int64) int { + numPeers := len(peers) + targetSize := calcNumPeersWithBound(numPeers, NumPeersLowBound, numPeersHighBound) + // if number of peers is less than required number, keep all in list + if numPeers <= targetSize { + utils.Logger().Warn(). + Int("num connected peers", numPeers). + Msg("[STAGED_SYNC] not enough connected peers to sync, still sync will on going") + return numPeers + } + //shuffle peers list + r := rand.New(rand.NewSource(randSeed)) + r.Shuffle(numPeers, func(i, j int) { peers[i], peers[j] = peers[j], peers[i] }) + + return targetSize +} + +// calcNumPeersWithBound calculates the number of connected peers with bound +// peers are expected to limited at half of the size, capped between lowBound and highBound. +func calcNumPeersWithBound(size int, lowBound, highBound int) int { + if size < lowBound { + return size + } + expLen := size / 2 + if expLen < lowBound { + expLen = lowBound + } + if expLen > highBound { + expLen = highBound + } + return expLen +} + +// ForEachPeer calls the given function with each peer. +// It breaks the iteration iff the function returns true. +func (sc *SyncConfig) ForEachPeer(f func(peer *SyncPeerConfig) (brk bool)) { + sc.mtx.RLock() + peers := make([]*SyncPeerConfig, len(sc.peers)) + copy(peers, sc.peers) + sc.mtx.RUnlock() + + for _, peer := range peers { + if f(peer) { + break + } + } +} + +// RemovePeer removes a peer from SyncConfig +func (sc *SyncConfig) RemovePeer(peer *SyncPeerConfig, reason string) { + sc.mtx.Lock() + defer sc.mtx.Unlock() + + peer.client.Close(reason) + for i, p := range sc.peers { + if p == peer { + sc.peers = append(sc.peers[:i], sc.peers[i+1:]...) + break + } + } + utils.Logger().Info(). + Str("peerIP", peer.ip). + Str("peerPortMsg", peer.port). + Str("reason", reason). + Msg("[STAGED_SYNC] remove GRPC peer") +} + +// ReplacePeerWithReserved tries to replace a peer from reserved peer list +func (sc *SyncConfig) ReplacePeerWithReserved(peer *SyncPeerConfig, reason string) { + sc.mtx.Lock() + defer sc.mtx.Unlock() + + peer.client.Close(reason) + for i, p := range sc.peers { + if p == peer { + if len(sc.reservedPeers) > 0 { + sc.peers = append(sc.peers[:i], sc.peers[i+1:]...) + sc.peers = append(sc.peers, sc.reservedPeers[0]) + utils.Logger().Info(). + Str("peerIP", peer.ip). + Str("peerPort", peer.port). + Str("reservedPeerIP", sc.reservedPeers[0].ip). + Str("reservedPeerPort", sc.reservedPeers[0].port). + Str("reason", reason). + Msg("[STAGED_SYNC] replaced GRPC peer by reserved") + sc.reservedPeers = sc.reservedPeers[1:] + } else { + sc.peers = append(sc.peers[:i], sc.peers[i+1:]...) + utils.Logger().Info(). + Str("peerIP", peer.ip). + Str("peerPortMsg", peer.port). + Str("reason", reason). + Msg("[STAGED_SYNC] remove GRPC peer without replacement") + } + break + } + } +} + +// CloseConnections close grpc connections for state sync clients +func (sc *SyncConfig) CloseConnections() { + sc.mtx.RLock() + defer sc.mtx.RUnlock() + for _, pc := range sc.peers { + pc.client.Close("close all connections") + } +} + +// FindPeerByHash returns the peer with the given hash, or nil if not found. +func (sc *SyncConfig) FindPeerByHash(peerHash []byte) *SyncPeerConfig { + sc.mtx.RLock() + defer sc.mtx.RUnlock() + for _, pc := range sc.peers { + if bytes.Equal(pc.peerHash, peerHash) { + return pc + } + } + return nil +} + +// getHowManyMaxConsensus returns max number of consensus nodes and the first ID of consensus group. +// Assumption: all peers are sorted by CompareSyncPeerConfigByBlockHashes first. +// Caller shall ensure mtx is locked for reading. +func (sc *SyncConfig) getHowManyMaxConsensus() (int, int) { + // As all peers are sorted by their blockHashes, all equal blockHashes should come together and consecutively. + if len(sc.peers) == 0 { + return -1, 0 + } else if len(sc.peers) == 1 { + return 0, 1 + } + maxFirstID := len(sc.peers) - 1 + for i := maxFirstID - 1; i >= 0; i-- { + if CompareSyncPeerConfigByblockHashes(sc.peers[maxFirstID], sc.peers[i]) != 0 { + break + } + maxFirstID = i + } + maxCount := len(sc.peers) - maxFirstID + return maxFirstID, maxCount +} + +// InitForTesting used for testing. +func (sc *SyncConfig) InitForTesting(client *downloader.Client, blockHashes [][]byte) { + sc.mtx.RLock() + defer sc.mtx.RUnlock() + for i := range sc.peers { + sc.peers[i].blockHashes = blockHashes + sc.peers[i].client = client + } +} + +// cleanUpPeers cleans up all peers whose blockHashes are not equal to +// consensus block hashes. Caller shall ensure mtx is locked for RW. +func (sc *SyncConfig) cleanUpPeers(maxFirstID int) { + fixedPeer := sc.peers[maxFirstID] + countBeforeCleanUp := len(sc.peers) + for i := 0; i < len(sc.peers); i++ { + if CompareSyncPeerConfigByblockHashes(fixedPeer, sc.peers[i]) != 0 { + // TODO: move it into a util delete func. + // See tip https://github.com/golang/go/wiki/SliceTricks + // Close the client and remove the peer out of the + sc.peers[i].client.Close("close by cleanup function, because blockHashes is not equal to consensus block hashes") + copy(sc.peers[i:], sc.peers[i+1:]) + sc.peers[len(sc.peers)-1] = nil + sc.peers = sc.peers[:len(sc.peers)-1] + } + } + if len(sc.peers) < countBeforeCleanUp { + utils.Logger().Debug(). + Int("removed peers", len(sc.peers)-countBeforeCleanUp). + Msg("[STAGED_SYNC] cleanUpPeers: a few peers removed") + } +} + +// cleanUpInvalidPeers cleans up all peers whose missed a few required block hash or sent an invalid block hash +// Caller shall ensure mtx is locked for RW. +func (sc *SyncConfig) cleanUpInvalidPeers(ipm map[string]bool) { + sc.mtx.Lock() + defer sc.mtx.Unlock() + countBeforeCleanUp := len(sc.peers) + for i := 0; i < len(sc.peers); i++ { + if ipm[string(sc.peers[i].peerHash)] == true { + sc.peers[i].client.Close("cleanup invalid peers, it may missed a few required block hashes or sent an invalid block hash") + copy(sc.peers[i:], sc.peers[i+1:]) + sc.peers[len(sc.peers)-1] = nil + sc.peers = sc.peers[:len(sc.peers)-1] + } + } + if len(sc.peers) < countBeforeCleanUp { + utils.Logger().Debug(). + Int("removed peers", len(sc.peers)-countBeforeCleanUp). + Msg("[STAGED_SYNC] cleanUpPeers: a few peers removed") + } +} + +// GetBlockHashesConsensusAndCleanUp selects the most common peer config based on their block hashes to download/sync. +// Note that choosing the most common peer config does not guarantee that the blocks to be downloaded are the correct ones. +// The subsequent node syncing steps of verifying the block header chain will give such confirmation later. +// If later block header verification fails with the sync peer config chosen here, the entire sync loop gets retried with a new peer set. +func (sc *SyncConfig) GetBlockHashesConsensusAndCleanUp(bgMode bool) error { + sc.mtx.Lock() + defer sc.mtx.Unlock() + // Sort all peers by the blockHashes. + sort.Slice(sc.peers, func(i, j int) bool { + return CompareSyncPeerConfigByblockHashes(sc.peers[i], sc.peers[j]) == -1 + }) + maxFirstID, maxCount := sc.getHowManyMaxConsensus() + if maxFirstID == -1 { + return errors.New("invalid peer index -1 for block hashes query") + } + utils.Logger().Info(). + Int("maxFirstID", maxFirstID). + Str("targetPeerIP", sc.peers[maxFirstID].ip). + Int("maxCount", maxCount). + Int("hashSize", len(sc.peers[maxFirstID].blockHashes)). + Msg("[STAGED_SYNC] block consensus hashes") + + if bgMode { + if maxCount != len(sc.peers) { + return ErrNodeNotEnoughBlockHashes + } + } else { + sc.cleanUpPeers(maxFirstID) + } + return nil +} diff --git a/api/service/stagedsync/sync_status.go b/api/service/stagedsync/sync_status.go new file mode 100644 index 000000000..556f1058b --- /dev/null +++ b/api/service/stagedsync/sync_status.go @@ -0,0 +1,90 @@ +package stagedsync + +import ( + "sync" + "time" + + nodeconfig "github.com/harmony-one/harmony/internal/configs/node" +) + +const ( + // syncStatusExpiration is the expiration time out of a sync status. + // If last sync result in memory is before the expiration, the sync status + // will be updated. + syncStatusExpiration = 6 * time.Second + + // syncStatusExpirationNonValidator is the expiration of sync cache for non-validators. + // Compared with non-validator, the sync check is not as strict as validator nodes. + // TODO: add this field to harmony config + syncStatusExpirationNonValidator = 12 * time.Second +) + +type ( + syncStatus struct { + lastResult SyncCheckResult + MaxPeersHeight uint64 + currentCycle SyncCycle + lastUpdateTime time.Time + lock sync.RWMutex + expiration time.Duration + } + + SyncCheckResult struct { + IsSynchronized bool + OtherHeight uint64 + HeightDiff uint64 + } + + SyncCycle struct { + Number uint64 + StartHash []byte + TargetHeight uint64 + ExtraHashes map[uint64][]byte + lock sync.RWMutex + } +) + +func NewSyncStatus(role nodeconfig.Role) syncStatus { + expiration := getSyncStatusExpiration(role) + return syncStatus{ + expiration: expiration, + } +} + +func getSyncStatusExpiration(role nodeconfig.Role) time.Duration { + switch role { + case nodeconfig.Validator: + return syncStatusExpiration + case nodeconfig.ExplorerNode: + return syncStatusExpirationNonValidator + default: + return syncStatusExpirationNonValidator + } +} + +func (status *syncStatus) Get(fallback func() SyncCheckResult) SyncCheckResult { + status.lock.RLock() + if !status.expired() { + result := status.lastResult + status.lock.RUnlock() + return result + } + status.lock.RUnlock() + + status.lock.Lock() + defer status.lock.Unlock() + if status.expired() { + result := fallback() + status.update(result) + } + return status.lastResult +} + +func (status *syncStatus) expired() bool { + return time.Since(status.lastUpdateTime) > status.expiration +} + +func (status *syncStatus) update(result SyncCheckResult) { + status.lastUpdateTime = time.Now() + status.lastResult = result +} diff --git a/api/service/stagedsync/syncing.go b/api/service/stagedsync/syncing.go new file mode 100644 index 000000000..d20497157 --- /dev/null +++ b/api/service/stagedsync/syncing.go @@ -0,0 +1,292 @@ +package stagedsync + +import ( + "context" + "fmt" + "time" + + "github.com/c2h5oh/datasize" + "github.com/harmony-one/harmony/consensus" + "github.com/harmony-one/harmony/core" + nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/utils" + "github.com/harmony-one/harmony/node/worker" + "github.com/harmony-one/harmony/shard" + "github.com/ledgerwatch/erigon-lib/kv" + + "github.com/ledgerwatch/erigon-lib/kv/mdbx" + "github.com/ledgerwatch/log/v3" +) + +const ( + BlockHashesBucket = "BlockHashes" + BeaconBlockHashesBucket = "BeaconBlockHashes" + DownloadedBlocksBucket = "BlockBodies" + BeaconDownloadedBlocksBucket = "BeaconBlockBodies" // Beacon Block bodies are downloaded, TxHash and UncleHash are getting verified + LastMileBlocksBucket = "LastMileBlocks" // last mile blocks to catch up with the consensus + StageProgressBucket = "StageProgress" + + // cache db keys + LastBlockHeight = "LastBlockHeight" + LastBlockHash = "LastBlockHash" + + // cache db names + BlockHashesCacheDB = "cache_block_hashes" + BlockCacheDB = "cache_blocks" +) + +var Buckets = []string{ + BlockHashesBucket, + BeaconBlockHashesBucket, + DownloadedBlocksBucket, + BeaconDownloadedBlocksBucket, + LastMileBlocksBucket, + StageProgressBucket, +} + +// CreateStagedSync creates an instance of staged sync +func CreateStagedSync( + ip string, + port string, + peerHash [20]byte, + bc core.BlockChain, + role nodeconfig.Role, + isExplorer bool, + TurboMode bool, + UseMemDB bool, + doubleCheckBlockHashes bool, + maxBlocksPerCycle uint64, + maxBackgroundBlocks uint64, + maxMemSyncCycleSize uint64, + verifyAllSig bool, + verifyHeaderBatchSize uint64, + insertChainBatchSize int, + logProgress bool, +) (*StagedSync, error) { + + ctx := context.Background() + isBeacon := bc.ShardID() == shard.BeaconChainShardID + + var db kv.RwDB + if UseMemDB { + // maximum Blocks in memory is maxMemSyncCycleSize + maxBackgroundBlocks + var dbMapSize datasize.ByteSize + if isBeacon { + // for memdb, maximum 512 kb for beacon chain each block (in average) should be enough + dbMapSize = datasize.ByteSize(maxMemSyncCycleSize+maxBackgroundBlocks) * 512 * datasize.KB + } else { + // for memdb, maximum 256 kb for each shard chains block (in average) should be enough + dbMapSize = datasize.ByteSize(maxMemSyncCycleSize+maxBackgroundBlocks) * 256 * datasize.KB + } + // we manually create memory db because "db = memdb.New()" sets the default map size (64 MB) which is not enough for some cases + db = mdbx.NewMDBX(log.New()).MapSize(dbMapSize).InMem("cache_db").MustOpen() + } else { + if isBeacon { + db = mdbx.NewMDBX(log.New()).Path("cache_beacon_db").MustOpen() + } else { + db = mdbx.NewMDBX(log.New()).Path("cache_shard_db").MustOpen() + } + } + + if errInitDB := initDB(ctx, db); errInitDB != nil { + return nil, errInitDB + } + + headsCfg := NewStageHeadersCfg(ctx, bc, db) + blockHashesCfg := NewStageBlockHashesCfg(ctx, bc, db, isBeacon, TurboMode, logProgress) + bodiesCfg := NewStageBodiesCfg(ctx, bc, db, isBeacon, TurboMode, logProgress) + statesCfg := NewStageStatesCfg(ctx, bc, db, logProgress) + lastMileCfg := NewStageLastMileCfg(ctx, bc, db) + finishCfg := NewStageFinishCfg(ctx, db) + + stages := DefaultStages(ctx, + headsCfg, + blockHashesCfg, + bodiesCfg, + statesCfg, + lastMileCfg, + finishCfg, + ) + + return New(ctx, + ip, + port, + peerHash, + bc, + role, + isBeacon, + isExplorer, + db, + stages, + DefaultRevertOrder, + DefaultCleanUpOrder, + TurboMode, + UseMemDB, + doubleCheckBlockHashes, + maxBlocksPerCycle, + maxBackgroundBlocks, + maxMemSyncCycleSize, + verifyAllSig, + verifyHeaderBatchSize, + insertChainBatchSize, + logProgress, + ), nil +} + +// initDB inits sync loop main database and create buckets +func initDB(ctx context.Context, db kv.RwDB) error { + tx, errRW := db.BeginRw(ctx) + if errRW != nil { + return errRW + } + defer tx.Rollback() + for _, name := range Buckets { + // create bucket + if err := tx.CreateBucket(GetStageName(name, false, false)); err != nil { + return err + } + // create bucket for beacon + if err := tx.CreateBucket(GetStageName(name, true, false)); err != nil { + return err + } + } + if err := tx.Commit(); err != nil { + return err + } + return nil +} + +// SyncLoop will keep syncing with peers until catches up +func (s *StagedSync) SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeacon bool, consensus *consensus.Consensus, loopMinTime time.Duration) { + + utils.Logger().Info(). + Uint64("current height", bc.CurrentBlock().NumberU64()). + Msgf("staged sync is executing ... ") + + if !s.IsBeacon() { + s.RegisterNodeInfo() + } + + // get max peers height + maxPeersHeight, err := s.getMaxPeerHeight() + if err != nil { + return + } + utils.Logger().Info(). + Uint64("maxPeersHeight", maxPeersHeight). + Msgf("[STAGED_SYNC] max peers height") + s.syncStatus.MaxPeersHeight = maxPeersHeight + + for { + if len(s.syncConfig.peers) < NumPeersLowBound { + // TODO: try to use reserved nodes + utils.Logger().Warn(). + Int("num peers", len(s.syncConfig.peers)). + Msgf("[STAGED_SYNC] Not enough connected peers") + break + } + startHead := bc.CurrentBlock().NumberU64() + + if startHead >= maxPeersHeight { + utils.Logger().Info(). + Bool("isBeacon", isBeacon). + Uint32("shard", bc.ShardID()). + Uint64("maxPeersHeight", maxPeersHeight). + Uint64("currentHeight", startHead). + Msgf("[STAGED_SYNC] Node is now IN SYNC!") + break + } + startTime := time.Now() + + if err := s.runSyncCycle(bc, worker, isBeacon, consensus, maxPeersHeight); err != nil { + utils.Logger().Error(). + Err(err). + Bool("isBeacon", isBeacon). + Uint32("shard", bc.ShardID()). + Uint64("currentHeight", startHead). + Msgf("[STAGED_SYNC] sync cycle failed") + break + } + + if loopMinTime != 0 { + waitTime := loopMinTime - time.Since(startTime) + utils.Logger().Debug(). + Bool("isBeacon", isBeacon). + Uint32("shard", bc.ShardID()). + Interface("duration", waitTime). + Msgf("[STAGED SYNC] Node is syncing ..., it's waiting a few seconds until next loop") + c := time.After(waitTime) + select { + case <-s.Context().Done(): + return + case <-c: + } + } + + // calculating sync speed (blocks/second) + currHead := bc.CurrentBlock().NumberU64() + if s.LogProgress && currHead-startHead > 0 { + dt := time.Now().Sub(startTime).Seconds() + speed := float64(0) + if dt > 0 { + speed = float64(currHead-startHead) / dt + } + syncSpeed := fmt.Sprintf("%.2f", speed) + fmt.Println("sync speed:", syncSpeed, "blocks/s (", currHead, "/", maxPeersHeight, ")") + } + + s.syncStatus.currentCycle.lock.Lock() + s.syncStatus.currentCycle.Number++ + s.syncStatus.currentCycle.lock.Unlock() + + } + + if consensus != nil { + if err := s.addConsensusLastMile(s.Blockchain(), consensus); err != nil { + utils.Logger().Error(). + Err(err). + Msg("[STAGED_SYNC] Add consensus last mile") + } + // TODO: move this to explorer handler code. + if s.isExplorer { + consensus.UpdateConsensusInformation() + } + } + s.purgeAllBlocksFromCache() + utils.Logger().Info(). + Uint64("new height", bc.CurrentBlock().NumberU64()). + Msgf("staged sync is executed") + return +} + +// runSyncCycle will run one cycle of staged syncing +func (s *StagedSync) runSyncCycle(bc core.BlockChain, worker *worker.Worker, isBeacon bool, consensus *consensus.Consensus, maxPeersHeight uint64) error { + canRunCycleInOneTransaction := s.MaxBlocksPerSyncCycle > 0 && s.MaxBlocksPerSyncCycle <= s.MaxMemSyncCycleSize + var tx kv.RwTx + if canRunCycleInOneTransaction { + var err error + if tx, err = s.DB().BeginRw(context.Background()); err != nil { + return err + } + defer tx.Rollback() + } + // Do one cycle of staged sync + initialCycle := s.syncStatus.currentCycle.Number == 0 + syncErr := s.Run(s.DB(), tx, initialCycle) + if syncErr != nil { + utils.Logger().Error(). + Err(syncErr). + Bool("isBeacon", s.IsBeacon()). + Uint32("shard", s.Blockchain().ShardID()). + Msgf("[STAGED_SYNC] Sync loop failed") + s.purgeOldBlocksFromCache() + return syncErr + } + if tx != nil { + errTx := tx.Commit() + if errTx != nil { + return errTx + } + } + return nil +} diff --git a/api/service/stagedsync/task_queue.go b/api/service/stagedsync/task_queue.go new file mode 100644 index 000000000..8802ca839 --- /dev/null +++ b/api/service/stagedsync/task_queue.go @@ -0,0 +1,38 @@ +package stagedsync + +import ( + "time" + + "github.com/Workiva/go-datastructures/queue" +) + +// downloadTaskQueue is wrapper around Queue with item to be SyncBlockTask +type downloadTaskQueue struct { + q *queue.Queue +} + +func (queue downloadTaskQueue) poll(num int64, timeOut time.Duration) (syncBlockTasks, error) { + items, err := queue.q.Poll(num, timeOut) + if err != nil { + return nil, err + } + tasks := make(syncBlockTasks, 0, len(items)) + for _, item := range items { + task := item.(SyncBlockTask) + tasks = append(tasks, task) + } + return tasks, nil +} + +func (queue downloadTaskQueue) put(tasks syncBlockTasks) error { + for _, task := range tasks { + if err := queue.q.Put(task); err != nil { + return err + } + } + return nil +} + +func (queue downloadTaskQueue) empty() bool { + return queue.q.Empty() +} diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index ad5005e33..6e3a8bbbc 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -9,7 +9,7 @@ import ( "path" "github.com/ethereum/go-ethereum/log" - net "github.com/libp2p/go-libp2p-core/network" + net "github.com/libp2p/go-libp2p/core/network" ma "github.com/multiformats/go-multiaddr" "github.com/harmony-one/harmony/internal/utils" diff --git a/cmd/harmony/config_migrations.go b/cmd/harmony/config_migrations.go index 813c9045e..70bc8fa71 100644 --- a/cmd/harmony/config_migrations.go +++ b/cmd/harmony/config_migrations.go @@ -260,6 +260,7 @@ func init() { confTree.Set("Version", "2.5.3") return confTree } + migrations["2.5.3"] = func(confTree *toml.Tree) *toml.Tree { if confTree.Get("TxPool.AllowedTxsFile") == nil { confTree.Set("TxPool.AllowedTxsFile", defaultConfig.TxPool.AllowedTxsFile) @@ -267,6 +268,7 @@ func init() { confTree.Set("Version", "2.5.4") return confTree } + migrations["2.5.4"] = func(confTree *toml.Tree) *toml.Tree { if confTree.Get("TxPool.GlobalSlots") == nil { confTree.Set("TxPool.GlobalSlots", defaultConfig.TxPool.GlobalSlots) @@ -274,6 +276,7 @@ func init() { confTree.Set("Version", "2.5.5") return confTree } + migrations["2.5.5"] = func(confTree *toml.Tree) *toml.Tree { if confTree.Get("Log.Console") == nil { confTree.Set("Log.Console", defaultConfig.Log.Console) @@ -281,6 +284,7 @@ func init() { confTree.Set("Version", "2.5.6") return confTree } + migrations["2.5.6"] = func(confTree *toml.Tree) *toml.Tree { if confTree.Get("P2P.MaxPeers") == nil { confTree.Set("P2P.MaxPeers", defaultConfig.P2P.MaxPeers) @@ -295,6 +299,23 @@ func init() { return confTree } + migrations["2.5.8"] = func(confTree *toml.Tree) *toml.Tree { + if confTree.Get("Sync.StagedSync") == nil { + confTree.Set("Sync.StagedSync", defaultConfig.Sync.StagedSync) + confTree.Set("Sync.StagedSyncCfg", defaultConfig.Sync.StagedSyncCfg) + } + confTree.Set("Version", "2.5.9") + return confTree + } + + migrations["2.5.9"] = func(confTree *toml.Tree) *toml.Tree { + if confTree.Get("P2P.WaitForEachPeerToConnect") == nil { + confTree.Set("P2P.WaitForEachPeerToConnect", defaultConfig.P2P.WaitForEachPeerToConnect) + } + confTree.Set("Version", "2.5.10") + return confTree + } + // check that the latest version here is the same as in default.go largestKey := getNextVersion(migrations) if largestKey != tomlConfigVersion { diff --git a/cmd/harmony/default.go b/cmd/harmony/default.go index 64c60365d..7de12af9c 100644 --- a/cmd/harmony/default.go +++ b/cmd/harmony/default.go @@ -5,7 +5,7 @@ import ( nodeconfig "github.com/harmony-one/harmony/internal/configs/node" ) -const tomlConfigVersion = "2.5.8" +const tomlConfigVersion = "2.5.10" const ( defNetworkType = nodeconfig.Mainnet @@ -25,13 +25,14 @@ var defaultConfig = harmonyconfig.HarmonyConfig{ }, Network: getDefaultNetworkConfig(defNetworkType), P2P: harmonyconfig.P2pConfig{ - Port: nodeconfig.DefaultP2PPort, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./.hmykey", - DiscConcurrency: nodeconfig.DefaultP2PConcurrency, - MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, - DisablePrivateIPScan: false, - MaxPeers: nodeconfig.DefaultMaxPeers, + Port: nodeconfig.DefaultP2PPort, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./.hmykey", + DiscConcurrency: nodeconfig.DefaultP2PConcurrency, + MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, + DisablePrivateIPScan: false, + MaxPeers: nodeconfig.DefaultMaxPeers, + WaitForEachPeerToConnect: nodeconfig.DefaultWaitForEachPeerToConnect, }, HTTP: harmonyconfig.HttpConfig{ Enabled: true, @@ -143,10 +144,25 @@ var defaultPrometheusConfig = harmonyconfig.PrometheusConfig{ Gateway: "https://gateway.harmony.one", } +var defaultStagedSyncConfig = harmonyconfig.StagedSyncConfig{ + TurboMode: true, + DoubleCheckBlockHashes: false, + MaxBlocksPerSyncCycle: 512, // sync new blocks in each cycle, if set to zero means all blocks in one full cycle + MaxBackgroundBlocks: 512, // max blocks to be downloaded at background process in turbo mode + InsertChainBatchSize: 128, // number of blocks to build a batch and insert to chain in staged sync + VerifyAllSig: false, // whether it should verify signatures for all blocks + VerifyHeaderBatchSize: 100, // batch size to verify block header before insert to chain + MaxMemSyncCycleSize: 1024, // max number of blocks to use a single transaction for staged sync + UseMemDB: true, // it uses memory by default. set it to false to use disk + LogProgress: false, // log the full sync progress in console +} + var ( defaultMainnetSyncConfig = harmonyconfig.SyncConfig{ Enabled: false, Downloader: false, + StagedSync: false, + StagedSyncCfg: defaultStagedSyncConfig, Concurrency: 6, MinPeers: 6, InitStreams: 8, @@ -159,6 +175,8 @@ var ( defaultTestNetSyncConfig = harmonyconfig.SyncConfig{ Enabled: true, Downloader: false, + StagedSync: false, + StagedSyncCfg: defaultStagedSyncConfig, Concurrency: 2, MinPeers: 2, InitStreams: 2, @@ -171,6 +189,8 @@ var ( defaultLocalNetSyncConfig = harmonyconfig.SyncConfig{ Enabled: true, Downloader: true, + StagedSync: false, + StagedSyncCfg: defaultStagedSyncConfig, Concurrency: 4, MinPeers: 5, InitStreams: 5, @@ -183,6 +203,8 @@ var ( defaultElseSyncConfig = harmonyconfig.SyncConfig{ Enabled: true, Downloader: true, + StagedSync: false, + StagedSyncCfg: defaultStagedSyncConfig, Concurrency: 4, MinPeers: 4, InitStreams: 4, diff --git a/cmd/harmony/dumpdb.go b/cmd/harmony/dumpdb.go index 7a4c41440..e66d3617b 100644 --- a/cmd/harmony/dumpdb.go +++ b/cmd/harmony/dumpdb.go @@ -15,12 +15,14 @@ import ( ethRawDB "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" "github.com/harmony-one/harmony/block" "github.com/harmony-one/harmony/core/rawdb" "github.com/harmony-one/harmony/core/state" "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/hmy" "github.com/harmony-one/harmony/internal/cli" + "github.com/harmony-one/harmony/shard" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding" @@ -276,14 +278,18 @@ func (db *KakashiDB) offchainDataDump(block *types.Block) { latestNumber := block.NumberU64() - uint64(i) latestBlock := db.GetBlockByNumber(latestNumber) db.GetBlockByHash(latestBlock.Hash()) - db.GetHeaderByHash(latestBlock.Hash()) + header := db.GetHeaderByHash(latestBlock.Hash()) db.GetBlockByHash(latestBlock.Hash()) rawdb.ReadBlockRewardAccumulator(db, latestNumber) rawdb.ReadBlockCommitSig(db, latestNumber) - epoch := block.Epoch() - epochInstance := shardSchedule.InstanceForEpoch(epoch) - for shard := 0; shard < int(epochInstance.NumShards()); shard++ { - rawdb.ReadCrossLinkShardBlock(db, uint32(shard), latestNumber) + // for each header, read (and write) the cross links in it + if block.ShardID() == shard.BeaconChainShardID { + crossLinks := &types.CrossLinks{} + if err := rlp.DecodeBytes(header.CrossLinks(), crossLinks); err == nil { + for _, cl := range *crossLinks { + rawdb.ReadCrossLinkShardBlock(db, cl.ShardID(), cl.BlockNum()) + } + } } } headEpoch := block.Epoch() diff --git a/cmd/harmony/flags.go b/cmd/harmony/flags.go index 02e8989da..26a250d95 100644 --- a/cmd/harmony/flags.go +++ b/cmd/harmony/flags.go @@ -218,6 +218,7 @@ var ( syncFlags = []cli.Flag{ syncStreamEnabledFlag, syncDownloaderFlag, + syncStagedSyncFlag, syncConcurrencyFlag, syncMinPeersFlag, syncInitStreamsFlag, @@ -578,6 +579,11 @@ var ( Usage: "maximum number of peers allowed, 0 means no limit", DefValue: defaultConfig.P2P.MaxConnsPerIP, } + waitForEachPeerToConnectFlag = cli.BoolFlag{ + Name: "p2p.wait-for-connections", + Usage: "node waits for each single peer to connect and it doesn't add them to peers list after timeout", + DefValue: defaultConfig.P2P.WaitForEachPeerToConnect, + } ) func applyP2PFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { @@ -614,6 +620,10 @@ func applyP2PFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { config.P2P.MaxPeers = int64(cli.GetIntFlagValue(cmd, maxPeersFlag)) } + if cli.IsFlagChanged(cmd, waitForEachPeerToConnectFlag) { + config.P2P.WaitForEachPeerToConnect = cli.GetBoolFlagValue(cmd, waitForEachPeerToConnectFlag) + } + if cli.IsFlagChanged(cmd, p2pDisablePrivateIPScanFlag) { config.P2P.DisablePrivateIPScan = cli.GetBoolFlagValue(cmd, p2pDisablePrivateIPScanFlag) } @@ -1661,6 +1671,12 @@ var ( Hidden: true, DefValue: false, } + syncStagedSyncFlag = cli.BoolFlag{ + Name: "sync.stagedsync", + Usage: "Enable the staged sync", + Hidden: false, + DefValue: false, + } syncConcurrencyFlag = cli.IntFlag{ Name: "sync.concurrency", Usage: "Concurrency when doing p2p sync requests", @@ -1708,6 +1724,10 @@ func applySyncFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { config.Sync.Downloader = cli.GetBoolFlagValue(cmd, syncDownloaderFlag) } + if cli.IsFlagChanged(cmd, syncStagedSyncFlag) { + config.Sync.StagedSync = cli.GetBoolFlagValue(cmd, syncStagedSyncFlag) + } + if cli.IsFlagChanged(cmd, syncConcurrencyFlag) { config.Sync.Concurrency = cli.GetIntFlagValue(cmd, syncConcurrencyFlag) } diff --git a/cmd/harmony/flags_test.go b/cmd/harmony/flags_test.go index 2f69ccdc2..7bd3e7199 100644 --- a/cmd/harmony/flags_test.go +++ b/cmd/harmony/flags_test.go @@ -58,13 +58,14 @@ func TestHarmonyFlags(t *testing.T) { ServerPort: nodeconfig.DefaultDNSPort, }, P2P: harmonyconfig.P2pConfig{ - Port: 9000, - IP: defaultConfig.P2P.IP, - KeyFile: defaultConfig.P2P.KeyFile, - DiscConcurrency: 5, - MaxConnsPerIP: 5, - DisablePrivateIPScan: false, - MaxPeers: defaultConfig.P2P.MaxPeers, + Port: 9000, + IP: defaultConfig.P2P.IP, + KeyFile: defaultConfig.P2P.KeyFile, + DiscConcurrency: 5, + MaxConnsPerIP: 5, + DisablePrivateIPScan: false, + MaxPeers: defaultConfig.P2P.MaxPeers, + WaitForEachPeerToConnect: false, }, HTTP: harmonyconfig.HttpConfig{ Enabled: true, @@ -366,60 +367,65 @@ func TestP2PFlags(t *testing.T) { args: []string{"--p2p.port", "9001", "--p2p.keyfile", "./key.file", "--p2p.dht.datastore", defDataStore}, expConfig: harmonyconfig.P2pConfig{ - Port: 9001, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./key.file", - DHTDataStore: &defDataStore, - MaxConnsPerIP: 10, - DisablePrivateIPScan: false, - MaxPeers: defaultConfig.P2P.MaxPeers, + Port: 9001, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./key.file", + DHTDataStore: &defDataStore, + MaxConnsPerIP: 10, + DisablePrivateIPScan: false, + MaxPeers: defaultConfig.P2P.MaxPeers, + WaitForEachPeerToConnect: false, }, }, { args: []string{"--port", "9001", "--key", "./key.file"}, expConfig: harmonyconfig.P2pConfig{ - Port: 9001, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./key.file", - MaxConnsPerIP: 10, - DisablePrivateIPScan: false, - MaxPeers: defaultConfig.P2P.MaxPeers, + Port: 9001, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./key.file", + MaxConnsPerIP: 10, + DisablePrivateIPScan: false, + MaxPeers: defaultConfig.P2P.MaxPeers, + WaitForEachPeerToConnect: false, }, }, { args: []string{"--p2p.port", "9001", "--p2p.disc.concurrency", "5", "--p2p.security.max-conn-per-ip", "5"}, expConfig: harmonyconfig.P2pConfig{ - Port: 9001, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./.hmykey", - DiscConcurrency: 5, - MaxConnsPerIP: 5, - DisablePrivateIPScan: false, - MaxPeers: defaultConfig.P2P.MaxPeers, + Port: 9001, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./.hmykey", + DiscConcurrency: 5, + MaxConnsPerIP: 5, + DisablePrivateIPScan: false, + MaxPeers: defaultConfig.P2P.MaxPeers, + WaitForEachPeerToConnect: false, }, }, { args: []string{"--p2p.no-private-ip-scan"}, expConfig: harmonyconfig.P2pConfig{ - Port: nodeconfig.DefaultP2PPort, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./.hmykey", - DiscConcurrency: nodeconfig.DefaultP2PConcurrency, - MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, - DisablePrivateIPScan: true, - MaxPeers: defaultConfig.P2P.MaxPeers, + Port: nodeconfig.DefaultP2PPort, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./.hmykey", + DiscConcurrency: nodeconfig.DefaultP2PConcurrency, + MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, + DisablePrivateIPScan: true, + MaxPeers: defaultConfig.P2P.MaxPeers, + WaitForEachPeerToConnect: false, }, }, { args: []string{"--p2p.security.max-peers", "100"}, expConfig: harmonyconfig.P2pConfig{ - Port: nodeconfig.DefaultP2PPort, - IP: nodeconfig.DefaultPublicListenIP, - KeyFile: "./.hmykey", - DiscConcurrency: nodeconfig.DefaultP2PConcurrency, - MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, - DisablePrivateIPScan: defaultConfig.P2P.DisablePrivateIPScan, - MaxPeers: 100, + Port: nodeconfig.DefaultP2PPort, + IP: nodeconfig.DefaultPublicListenIP, + KeyFile: "./.hmykey", + DiscConcurrency: nodeconfig.DefaultP2PConcurrency, + MaxConnsPerIP: nodeconfig.DefaultMaxConnPerIP, + DisablePrivateIPScan: defaultConfig.P2P.DisablePrivateIPScan, + MaxPeers: 100, + WaitForEachPeerToConnect: false, }, }, } @@ -1345,6 +1351,7 @@ func TestSyncFlags(t *testing.T) { cfgSync := defaultMainnetSyncConfig cfgSync.Enabled = true cfgSync.Downloader = true + cfgSync.StagedSync = false cfgSync.Concurrency = 10 cfgSync.MinPeers = 10 cfgSync.InitStreams = 10 diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index b972fd36a..40cb66a37 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -17,6 +17,7 @@ import ( "github.com/harmony-one/harmony/consensus/quorum" "github.com/harmony-one/harmony/internal/chain" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/shardchain/tikv_manage" "github.com/harmony-one/harmony/internal/tikv/redis_helper" "github.com/harmony-one/harmony/internal/tikv/statedb_cache" @@ -310,10 +311,11 @@ func setupNodeAndRun(hc harmonyconfig.HarmonyConfig) { // Update ethereum compatible chain ids params.UpdateEthChainIDByShard(nodeConfig.ShardID) - currentNode := setupConsensusAndNode(hc, nodeConfig) + currentNode := setupConsensusAndNode(hc, nodeConfig, registry.New()) nodeconfig.GetDefaultConfig().ShardID = nodeConfig.ShardID nodeconfig.GetDefaultConfig().IsOffline = nodeConfig.IsOffline nodeconfig.GetDefaultConfig().Downloader = nodeConfig.Downloader + nodeconfig.GetDefaultConfig().StagedSync = nodeConfig.StagedSync // Check NTP configuration accurate, err := ntp.CheckLocalTimeAccurate(nodeConfig.NtpServer) @@ -599,7 +601,17 @@ func createGlobalConfig(hc harmonyconfig.HarmonyConfig) (*nodeconfig.ConfigType, nodeConfig.SetArchival(hc.General.IsBeaconArchival, hc.General.IsArchival) nodeConfig.IsOffline = hc.General.IsOffline nodeConfig.Downloader = hc.Sync.Downloader - + nodeConfig.StagedSync = hc.Sync.StagedSync + nodeConfig.StagedSyncTurboMode = hc.Sync.StagedSyncCfg.TurboMode + nodeConfig.UseMemDB = hc.Sync.StagedSyncCfg.UseMemDB + nodeConfig.DoubleCheckBlockHashes = hc.Sync.StagedSyncCfg.DoubleCheckBlockHashes + nodeConfig.MaxBlocksPerSyncCycle = hc.Sync.StagedSyncCfg.MaxBlocksPerSyncCycle + nodeConfig.MaxBackgroundBlocks = hc.Sync.StagedSyncCfg.MaxBackgroundBlocks + nodeConfig.MaxMemSyncCycleSize = hc.Sync.StagedSyncCfg.MaxMemSyncCycleSize + nodeConfig.VerifyAllSig = hc.Sync.StagedSyncCfg.VerifyAllSig + nodeConfig.VerifyHeaderBatchSize = hc.Sync.StagedSyncCfg.VerifyHeaderBatchSize + nodeConfig.InsertChainBatchSize = hc.Sync.StagedSyncCfg.InsertChainBatchSize + nodeConfig.LogProgress = hc.Sync.StagedSyncCfg.LogProgress // P2P private key is used for secure message transfer between p2p nodes. nodeConfig.P2PPriKey, _, err = utils.LoadKeyFromFile(hc.P2P.KeyFile) if err != nil { @@ -613,14 +625,15 @@ func createGlobalConfig(hc harmonyconfig.HarmonyConfig) (*nodeconfig.ConfigType, ConsensusPubKey: nodeConfig.ConsensusPriKey[0].Pub.Object, } myHost, err = p2p.NewHost(p2p.HostConfig{ - Self: &selfPeer, - BLSKey: nodeConfig.P2PPriKey, - BootNodes: hc.Network.BootNodes, - DataStoreFile: hc.P2P.DHTDataStore, - DiscConcurrency: hc.P2P.DiscConcurrency, - MaxConnPerIP: hc.P2P.MaxConnsPerIP, - DisablePrivateIPScan: hc.P2P.DisablePrivateIPScan, - MaxPeers: hc.P2P.MaxPeers, + Self: &selfPeer, + BLSKey: nodeConfig.P2PPriKey, + BootNodes: hc.Network.BootNodes, + DataStoreFile: hc.P2P.DHTDataStore, + DiscConcurrency: hc.P2P.DiscConcurrency, + MaxConnPerIP: hc.P2P.MaxConnsPerIP, + DisablePrivateIPScan: hc.P2P.DisablePrivateIPScan, + MaxPeers: hc.P2P.MaxPeers, + WaitForEachPeerToConnect: hc.P2P.WaitForEachPeerToConnect, }) if err != nil { return nil, errors.Wrap(err, "cannot create P2P network host") @@ -647,7 +660,7 @@ func createGlobalConfig(hc harmonyconfig.HarmonyConfig) (*nodeconfig.ConfigType, return nodeConfig, nil } -func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfig.ConfigType) *node.Node { +func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfig.ConfigType, registry *registry.Registry) *node.Node { // Parse minPeers from harmonyconfig.HarmonyConfig var minPeers int var aggregateSig bool @@ -695,6 +708,11 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi collection := shardchain.NewCollection( &hc, chainDBFactory, &core.GenesisInitializer{NetworkType: nodeConfig.GetNetworkType()}, engine, &chainConfig, ) + for shardID, archival := range nodeConfig.ArchiveModes() { + if archival { + collection.DisableCache(shardID) + } + } var blockchain core.BlockChain @@ -716,14 +734,14 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi // Consensus object. decider := quorum.NewDecider(quorum.SuperMajorityVote, nodeConfig.ShardID) currentConsensus, err := consensus.New( - myHost, nodeConfig.ShardID, nodeConfig.ConsensusPriKey, blockchain, decider, minPeers, aggregateSig) + myHost, nodeConfig.ShardID, nodeConfig.ConsensusPriKey, registry.SetBlockchain(blockchain), decider, minPeers, aggregateSig) if err != nil { _, _ = fmt.Fprintf(os.Stderr, "Error :%v \n", err) os.Exit(1) } - currentNode := node.New(myHost, currentConsensus, engine, collection, blacklist, allowedTxs, localAccounts, nodeConfig.ArchiveModes(), &hc) + currentNode := node.New(myHost, currentConsensus, engine, collection, blacklist, allowedTxs, localAccounts, nodeConfig.ArchiveModes(), &hc, registry) if hc.Legacy != nil && hc.Legacy.TPBroadcastInvalidTxn != nil { currentNode.BroadcastInvalidTx = *hc.Legacy.TPBroadcastInvalidTxn diff --git a/consensus/consensus.go b/consensus/consensus.go index 4e4ac882e..89897e372 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -6,12 +6,13 @@ import ( "sync/atomic" "time" + "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/crypto/bls" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/abool" bls_core "github.com/harmony-one/bls/ffi/go/bls" "github.com/harmony-one/harmony/consensus/quorum" - "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/core/types" bls_cosi "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/internal/utils" @@ -62,8 +63,8 @@ type Consensus struct { multiSigBitmap *bls_cosi.Mask // Bitmap for parsing multisig bitmap from validators multiSigMutex sync.RWMutex - // The blockchain this consensus is working on - Blockchain core.BlockChain + // Registry for services. + registry *registry.Registry // Minimal number of peers in the shard // If the number of validators is less than minPeers, the consensus won't start MinPeers int @@ -137,7 +138,12 @@ type Consensus struct { dHelper *downloadHelper } -// VerifyBlock is a function used to verify the block and keep trace of verified blocks +// Blockchain returns the blockchain. +func (consensus *Consensus) Blockchain() core.BlockChain { + return consensus.registry.GetBlockchain() +} + +// VerifyBlock is a function used to verify the block and keep trace of verified blocks. func (consensus *Consensus) VerifyBlock(block *types.Block) error { if !consensus.FBFTLog.IsBlockVerified(block.Hash()) { if err := consensus.BlockVerifier(block); err != nil { @@ -211,12 +217,12 @@ func (consensus *Consensus) BlockNum() uint64 { // New create a new Consensus record func New( host p2p.Host, shard uint32, multiBLSPriKey multibls.PrivateKeys, - blockchain core.BlockChain, + registry *registry.Registry, Decider quorum.Decider, minPeers int, aggregateSig bool, ) (*Consensus, error) { consensus := Consensus{} consensus.Decider = Decider - consensus.Blockchain = blockchain + consensus.registry = registry consensus.MinPeers = minPeers consensus.AggregateSig = aggregateSig consensus.host = host diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index d1af65581..310c9bb9d 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -264,7 +264,7 @@ func (consensus *Consensus) ReadSignatureBitmapPayload( // (b) node in committed but has any err during processing: Syncing mode // (c) node in committed and everything looks good: Normal mode func (consensus *Consensus) UpdateConsensusInformation() Mode { - curHeader := consensus.Blockchain.CurrentHeader() + curHeader := consensus.Blockchain().CurrentHeader() curEpoch := curHeader.Epoch() nextEpoch := new(big.Int).Add(curHeader.Epoch(), common.Big1) @@ -286,13 +286,13 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode { consensus.BlockPeriod = 5 * time.Second // Enable 2s block time at the twoSecondsEpoch - if consensus.Blockchain.Config().IsTwoSeconds(nextEpoch) { + if consensus.Blockchain().Config().IsTwoSeconds(nextEpoch) { consensus.BlockPeriod = 2 * time.Second } - isFirstTimeStaking := consensus.Blockchain.Config().IsStaking(nextEpoch) && - curHeader.IsLastBlockInEpoch() && !consensus.Blockchain.Config().IsStaking(curEpoch) - haventUpdatedDecider := consensus.Blockchain.Config().IsStaking(curEpoch) && + isFirstTimeStaking := consensus.Blockchain().Config().IsStaking(nextEpoch) && + curHeader.IsLastBlockInEpoch() && !consensus.Blockchain().Config().IsStaking(curEpoch) + haventUpdatedDecider := consensus.Blockchain().Config().IsStaking(curEpoch) && consensus.Decider.Policy() != quorum.SuperMajorityStake // Only happens once, the flip-over to a new Decider policy @@ -305,7 +305,7 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode { epochToSet := curEpoch hasError := false curShardState, err := committee.WithStakingEnabled.ReadFromDB( - curEpoch, consensus.Blockchain, + curEpoch, consensus.Blockchain(), ) if err != nil { consensus.getLogger().Error(). @@ -321,7 +321,7 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode { if curHeader.IsLastBlockInEpoch() && isNotGenesisBlock { nextShardState, err := committee.WithStakingEnabled.ReadFromDB( - nextEpoch, consensus.Blockchain, + nextEpoch, consensus.Blockchain(), ) if err != nil { consensus.getLogger().Error(). @@ -389,7 +389,7 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode { // a solution to take care of this case because the coinbase of the latest block doesn't really represent the // the real current leader in case of M1 view change. if !curHeader.IsLastBlockInEpoch() && curHeader.Number().Uint64() != 0 { - leaderPubKey, err := chain.GetLeaderPubKeyFromCoinbase(consensus.Blockchain, curHeader) + leaderPubKey, err := chain.GetLeaderPubKeyFromCoinbase(consensus.Blockchain(), curHeader) if err != nil || leaderPubKey == nil { consensus.getLogger().Error().Err(err). Msg("[UpdateConsensusInformation] Unable to get leaderPubKey from coinbase") @@ -527,7 +527,7 @@ func (consensus *Consensus) selfCommit(payload []byte) error { consensus.switchPhase("selfCommit", FBFTCommit) consensus.aggregatedPrepareSig = aggSig consensus.prepareBitmap = mask - commitPayload := signature.ConstructCommitPayload(consensus.Blockchain, + commitPayload := signature.ConstructCommitPayload(consensus.Blockchain(), block.Epoch(), block.Hash(), block.NumberU64(), block.Header().ViewID().Uint64()) for i, key := range consensus.priKey { if err := consensus.commitBitmap.SetKey(key.Pub.Bytes, true); err != nil { diff --git a/consensus/consensus_test.go b/consensus/consensus_test.go index ca2875f9c..c2d3d729b 100644 --- a/consensus/consensus_test.go +++ b/consensus/consensus_test.go @@ -7,6 +7,7 @@ import ( "github.com/harmony-one/abool" "github.com/harmony-one/harmony/consensus/quorum" "github.com/harmony-one/harmony/crypto/bls" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/multibls" "github.com/harmony-one/harmony/p2p" @@ -90,7 +91,7 @@ func GenerateConsensusForTesting() (p2p.Host, multibls.PrivateKeys, *Consensus, decider := quorum.NewDecider(quorum.SuperMajorityVote, shard.BeaconChainShardID) multiBLSPrivateKey := multibls.GetPrivateKeys(bls.RandPrivateKey()) - consensus, err := New(host, shard.BeaconChainShardID, multiBLSPrivateKey, nil, decider, 3, false) + consensus, err := New(host, shard.BeaconChainShardID, multiBLSPrivateKey, registry.New(), decider, 3, false) if err != nil { return nil, nil, nil, nil, err } diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 11c7b9da9..deb0883d9 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -169,7 +169,7 @@ func (consensus *Consensus) finalCommit() { return } consensus.getLogger().Info().Hex("new", commitSigAndBitmap).Msg("[finalCommit] Overriding commit signatures!!") - consensus.Blockchain.WriteCommitSig(block.NumberU64(), commitSigAndBitmap) + consensus.Blockchain().WriteCommitSig(block.NumberU64(), commitSigAndBitmap) // Send committed message before block insertion. // if leader successfully finalizes the block, send committed message to validators @@ -267,7 +267,7 @@ func (consensus *Consensus) BlockCommitSigs(blockNum uint64) ([]byte, error) { if consensus.BlockNum() <= 1 { return nil, nil } - lastCommits, err := consensus.Blockchain.ReadCommitSig(blockNum) + lastCommits, err := consensus.Blockchain().ReadCommitSig(blockNum) if err != nil || len(lastCommits) < bls.BLSSignatureSizeInBytes { msgs := consensus.FBFTLog.GetMessagesByTypeSeq( @@ -363,9 +363,9 @@ func (consensus *Consensus) Start( case <-consensus.syncReadyChan: consensus.getLogger().Info().Msg("[ConsensusMainLoop] syncReadyChan") consensus.mutex.Lock() - if consensus.BlockNum() < consensus.Blockchain.CurrentHeader().Number().Uint64()+1 { - consensus.SetBlockNum(consensus.Blockchain.CurrentHeader().Number().Uint64() + 1) - consensus.SetViewIDs(consensus.Blockchain.CurrentHeader().ViewID().Uint64() + 1) + if consensus.BlockNum() < consensus.Blockchain().CurrentHeader().Number().Uint64()+1 { + consensus.SetBlockNum(consensus.Blockchain().CurrentHeader().Number().Uint64() + 1) + consensus.SetViewIDs(consensus.Blockchain().CurrentHeader().ViewID().Uint64() + 1) mode := consensus.UpdateConsensusInformation() consensus.current.SetMode(mode) consensus.getLogger().Info().Msg("[syncReadyChan] Start consensus timer") @@ -386,7 +386,7 @@ func (consensus *Consensus) Start( // TODO: Refactor this piece of code to consensus/downloader.go after DNS legacy sync is removed case <-consensus.syncNotReadyChan: consensus.getLogger().Info().Msg("[ConsensusMainLoop] syncNotReadyChan") - consensus.SetBlockNum(consensus.Blockchain.CurrentHeader().Number().Uint64() + 1) + consensus.SetBlockNum(consensus.Blockchain().CurrentHeader().Number().Uint64() + 1) consensus.current.SetMode(Syncing) consensus.getLogger().Info().Msg("[ConsensusMainLoop] Node is OUT OF SYNC") consensusSyncCounterVec.With(prometheus.Labels{"consensus": "out_of_sync"}).Inc() @@ -574,7 +574,7 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { Msg("[preCommitAndPropose] Sent Committed Message") } - if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk.Hash())); err != nil { + if _, err := consensus.Blockchain().InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk.Hash())); err != nil { consensus.getLogger().Error().Err(err).Msg("[preCommitAndPropose] Failed to add block to chain") return } @@ -606,7 +606,7 @@ func (consensus *Consensus) verifyLastCommitSig(lastCommitSig []byte, blk *types } aggPubKey := consensus.commitBitmap.AggregatePublic - commitPayload := signature.ConstructCommitPayload(consensus.Blockchain, + commitPayload := signature.ConstructCommitPayload(consensus.Blockchain(), blk.Epoch(), blk.Hash(), blk.NumberU64(), blk.Header().ViewID().Uint64()) if !aggSig.VerifyHash(aggPubKey, commitPayload) { @@ -658,8 +658,8 @@ func (consensus *Consensus) tryCatchup() error { } func (consensus *Consensus) commitBlock(blk *types.Block, committedMsg *FBFTMessage) error { - if consensus.Blockchain.CurrentBlock().NumberU64() < blk.NumberU64() { - if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk.Hash())); err != nil { + if consensus.Blockchain().CurrentBlock().NumberU64() < blk.NumberU64() { + if _, err := consensus.Blockchain().InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk.Hash())); err != nil { consensus.getLogger().Error().Err(err).Msg("[commitBlock] Failed to add block to chain") return err } @@ -716,7 +716,7 @@ func (consensus *Consensus) GenerateVrfAndProof(newHeader *block.Header) error { return errors.New("[GenerateVrfAndProof] no leader private key provided") } sk := vrf_bls.NewVRFSigner(key.Pri) - previousHeader := consensus.Blockchain.GetHeaderByNumber( + previousHeader := consensus.Blockchain().GetHeaderByNumber( newHeader.Number().Uint64() - 1, ) if previousHeader == nil { @@ -745,7 +745,7 @@ func (consensus *Consensus) GenerateVdfAndProof(newBlock *types.Block, vrfBlockN //derive VDF seed from VRFs generated in the current epoch seed := [32]byte{} for i := 0; i < consensus.VdfSeedSize(); i++ { - previousVrf := consensus.Blockchain.GetVrfByNumber(vrfBlockNumbers[i]) + previousVrf := consensus.Blockchain().GetVrfByNumber(vrfBlockNumbers[i]) for j := 0; j < len(seed); j++ { seed[j] = seed[j] ^ previousVrf[j] } @@ -779,7 +779,7 @@ func (consensus *Consensus) GenerateVdfAndProof(newBlock *types.Block, vrfBlockN // ValidateVdfAndProof validates the VDF/proof in the current epoch func (consensus *Consensus) ValidateVdfAndProof(headerObj *block.Header) bool { - vrfBlockNumbers, err := consensus.Blockchain.ReadEpochVrfBlockNums(headerObj.Epoch()) + vrfBlockNumbers, err := consensus.Blockchain().ReadEpochVrfBlockNums(headerObj.Epoch()) if err != nil { consensus.getLogger().Error().Err(err). Str("MsgBlockNum", headerObj.Number().String()). @@ -794,7 +794,7 @@ func (consensus *Consensus) ValidateVdfAndProof(headerObj *block.Header) bool { seed := [32]byte{} for i := 0; i < consensus.VdfSeedSize(); i++ { - previousVrf := consensus.Blockchain.GetVrfByNumber(vrfBlockNumbers[i]) + previousVrf := consensus.Blockchain().GetVrfByNumber(vrfBlockNumbers[i]) for j := 0; j < len(seed); j++ { seed[j] = seed[j] ^ previousVrf[j] } diff --git a/consensus/double_sign.go b/consensus/double_sign.go index 98ffe3309..b9bf818cb 100644 --- a/consensus/double_sign.go +++ b/consensus/double_sign.go @@ -40,8 +40,8 @@ func (consensus *Consensus) checkDoubleSign(recvMsg *FBFTMessage) bool { return true } - curHeader := consensus.Blockchain.CurrentHeader() - committee, err := consensus.Blockchain.ReadShardState(curHeader.Epoch()) + curHeader := consensus.Blockchain().CurrentHeader() + committee, err := consensus.Blockchain().ReadShardState(curHeader.Epoch()) if err != nil { consensus.getLogger().Err(err). Uint32("shard", consensus.ShardID). diff --git a/consensus/downloader.go b/consensus/downloader.go index 3c53dae1f..2734f8bae 100644 --- a/consensus/downloader.go +++ b/consensus/downloader.go @@ -90,7 +90,7 @@ func (dh *downloadHelper) downloadFinishedLoop() { } func (consensus *Consensus) addConsensusLastMile() error { - curBN := consensus.Blockchain.CurrentBlock().NumberU64() + curBN := consensus.Blockchain().CurrentBlock().NumberU64() blockIter, err := consensus.GetLastMileBlockIter(curBN + 1) if err != nil { return err @@ -100,7 +100,7 @@ func (consensus *Consensus) addConsensusLastMile() error { if block == nil { break } - if _, err := consensus.Blockchain.InsertChain(types.Blocks{block}, true); err != nil { + if _, err := consensus.Blockchain().InsertChain(types.Blocks{block}, true); err != nil { return errors.Wrap(err, "failed to InsertChain") } } diff --git a/consensus/leader.go b/consensus/leader.go index a57d2733c..477d8eb29 100644 --- a/consensus/leader.go +++ b/consensus/leader.go @@ -247,7 +247,7 @@ func (consensus *Consensus) onCommit(recvMsg *FBFTMessage) { Msg("[OnCommit] Failed finding a matching block for committed message") return } - commitPayload := signature.ConstructCommitPayload(consensus.Blockchain, + commitPayload := signature.ConstructCommitPayload(consensus.Blockchain(), blockObj.Epoch(), blockObj.Hash(), blockObj.NumberU64(), blockObj.Header().ViewID().Uint64()) logger = logger.With(). Uint64("MsgViewID", recvMsg.ViewID). diff --git a/consensus/threshold.go b/consensus/threshold.go index e4a7ff0a7..e8bd875cb 100644 --- a/consensus/threshold.go +++ b/consensus/threshold.go @@ -46,7 +46,7 @@ func (consensus *Consensus) didReachPrepareQuorum() error { Msg("[didReachPrepareQuorum] Unparseable block data") return err } - commitPayload := signature.ConstructCommitPayload(consensus.Blockchain, + commitPayload := signature.ConstructCommitPayload(consensus.Blockchain(), blockObj.Epoch(), blockObj.Hash(), blockObj.NumberU64(), blockObj.Header().ViewID().Uint64()) // so by this point, everyone has committed to the blockhash of this block diff --git a/consensus/validator.go b/consensus/validator.go index 28c0ae143..a73ac92eb 100644 --- a/consensus/validator.go +++ b/consensus/validator.go @@ -166,7 +166,7 @@ func (consensus *Consensus) sendCommitMessages(blockObj *types.Block) { priKeys := consensus.getPriKeysInCommittee() // Sign commit signature on the received block and construct the p2p messages - commitPayload := signature.ConstructCommitPayload(consensus.Blockchain, + commitPayload := signature.ConstructCommitPayload(consensus.Blockchain(), blockObj.Epoch(), blockObj.Hash(), blockObj.NumberU64(), blockObj.Header().ViewID().Uint64()) p2pMsgs := consensus.constructP2pMessages(msg_pb.MessageType_COMMIT, commitPayload, priKeys) @@ -336,7 +336,7 @@ func (consensus *Consensus) onCommitted(recvMsg *FBFTMessage) { Msg("[OnCommitted] Failed to parse commit sigBytes and bitmap") return } - if err := consensus.Blockchain.Engine().VerifyHeaderSignature(consensus.Blockchain, blockObj.Header(), + if err := consensus.Blockchain().Engine().VerifyHeaderSignature(consensus.Blockchain(), blockObj.Header(), sigBytes, bitmap); err != nil { consensus.getLogger().Error(). Uint64("blockNum", recvMsg.BlockNum). @@ -358,17 +358,17 @@ func (consensus *Consensus) onCommitted(recvMsg *FBFTMessage) { // If we already have a committed signature received before, check whether the new one // has more signatures and if yes, override the old data. // Otherwise, simply write the commit signature in db. - commitSigBitmap, err := consensus.Blockchain.ReadCommitSig(blockObj.NumberU64()) + commitSigBitmap, err := consensus.Blockchain().ReadCommitSig(blockObj.NumberU64()) // Need to check whether this block actually was committed, because it could be another block // with the same number that's committed and overriding its commit sigBytes is wrong. - blk := consensus.Blockchain.GetBlockByHash(blockObj.Hash()) + blk := consensus.Blockchain().GetBlockByHash(blockObj.Hash()) if err == nil && len(commitSigBitmap) == len(recvMsg.Payload) && blk != nil { new := mask.CountEnabled() mask.SetMask(commitSigBitmap[bls.BLSSignatureSizeInBytes:]) cur := mask.CountEnabled() if new > cur { consensus.getLogger().Info().Hex("old", commitSigBitmap).Hex("new", recvMsg.Payload).Msg("[OnCommitted] Overriding commit signatures!!") - consensus.Blockchain.WriteCommitSig(blockObj.NumberU64(), recvMsg.Payload) + consensus.Blockchain().WriteCommitSig(blockObj.NumberU64(), recvMsg.Payload) } } diff --git a/consensus/view_change.go b/consensus/view_change.go index 91dc2f827..7e3be93a7 100644 --- a/consensus/view_change.go +++ b/consensus/view_change.go @@ -129,10 +129,10 @@ func (consensus *Consensus) fallbackNextViewID() (uint64, time.Duration) { // viewID is only used as the fallback mechansim to determine the nextViewID func (consensus *Consensus) getNextViewID() (uint64, time.Duration) { // handle corner case at first - if consensus.Blockchain == nil { + if consensus.Blockchain() == nil { return consensus.fallbackNextViewID() } - curHeader := consensus.Blockchain.CurrentHeader() + curHeader := consensus.Blockchain().CurrentHeader() if curHeader == nil { return consensus.fallbackNextViewID() } @@ -172,12 +172,13 @@ func (consensus *Consensus) getNextLeaderKey(viewID uint64) *bls.PublicKeyWrappe } var lastLeaderPubKey *bls.PublicKeyWrapper var err error + blockchain := consensus.Blockchain() epoch := big.NewInt(0) - if consensus.Blockchain == nil { + if blockchain == nil { consensus.getLogger().Error().Msg("[getNextLeaderKey] Blockchain is nil. Use consensus.LeaderPubKey") lastLeaderPubKey = consensus.LeaderPubKey } else { - curHeader := consensus.Blockchain.CurrentHeader() + curHeader := blockchain.CurrentHeader() if curHeader == nil { consensus.getLogger().Error().Msg("[getNextLeaderKey] Failed to get current header from blockchain") lastLeaderPubKey = consensus.LeaderPubKey @@ -185,7 +186,7 @@ func (consensus *Consensus) getNextLeaderKey(viewID uint64) *bls.PublicKeyWrappe stuckBlockViewID := curHeader.ViewID().Uint64() + 1 gap = int(viewID - stuckBlockViewID) // this is the truth of the leader based on blockchain blocks - lastLeaderPubKey, err = chain.GetLeaderPubKeyFromCoinbase(consensus.Blockchain, curHeader) + lastLeaderPubKey, err = chain.GetLeaderPubKeyFromCoinbase(blockchain, curHeader) if err != nil || lastLeaderPubKey == nil { consensus.getLogger().Error().Err(err). Msg("[getNextLeaderKey] Unable to get leaderPubKey from coinbase. Set it to consensus.LeaderPubKey") @@ -215,7 +216,7 @@ func (consensus *Consensus) getNextLeaderKey(viewID uint64) *bls.PublicKeyWrappe // FIXME: rotate leader on harmony nodes only before fully externalization var wasFound bool var next *bls.PublicKeyWrapper - if consensus.Blockchain != nil && consensus.Blockchain.Config().IsAllowlistEpoch(epoch) { + if blockchain != nil && blockchain.Config().IsAllowlistEpoch(epoch) { wasFound, next = consensus.Decider.NthNextHmyExt( shard.Schedule.InstanceForEpoch(epoch), lastLeaderPubKey, diff --git a/consensus/view_change_construct.go b/consensus/view_change_construct.go index 5d086796c..71f9385a9 100644 --- a/consensus/view_change_construct.go +++ b/consensus/view_change_construct.go @@ -109,6 +109,10 @@ func (vc *viewChange) GetPreparedBlock(fbftlog *FBFTLog) ([]byte, []byte) { // First 32 bytes of m1 payload is the correct block hash copy(blockHash[:], vc.GetM1Payload()) + if !fbftlog.IsBlockVerified(blockHash) { + return nil, nil + } + if block := fbftlog.GetBlockByHash(blockHash); block != nil { encodedBlock, err := rlp.EncodeToBytes(block) if err != nil || len(encodedBlock) == 0 { diff --git a/core/offchain.go b/core/offchain.go index 244b757c1..3f08b4f81 100644 --- a/core/offchain.go +++ b/core/offchain.go @@ -167,6 +167,8 @@ func (bc *BlockChainImpl) CommitOffChainData( cl0, _ := bc.ReadShardLastCrossLink(crossLink.ShardID()) if cl0 == nil { + // make sure it is written at least once, so that it is overwritten below + // under "Roll up latest crosslinks" rawdb.WriteShardLastCrossLink(batch, crossLink.ShardID(), crossLink.Serialize()) } } diff --git a/go.mod b/go.mod index 2a0de6b70..d8d7aa20a 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/harmony-one/harmony -go 1.18 +go 1.19 require ( - github.com/RoaringBitmap/roaring v1.1.0 + github.com/RoaringBitmap/roaring v1.2.1 github.com/VictoriaMetrics/fastcache v1.5.7 github.com/Workiva/go-datastructures v1.0.50 github.com/allegro/bigcache v1.2.1 @@ -21,80 +21,90 @@ require ( github.com/golang/protobuf v1.5.2 github.com/golangci/golangci-lint v1.22.2 github.com/gorilla/mux v1.8.0 - github.com/gorilla/websocket v1.4.2 + github.com/gorilla/websocket v1.5.0 github.com/harmony-one/abool v1.0.1 github.com/harmony-one/bls v0.0.6 github.com/harmony-one/taggedrlp v0.1.4 github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849 github.com/hashicorp/go-version v1.2.0 - github.com/hashicorp/golang-lru v0.5.4 - github.com/ipfs/go-ds-badger v0.2.7 + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d + github.com/ipfs/go-ds-badger v0.3.0 github.com/json-iterator/go v1.1.12 - github.com/libp2p/go-libp2p v0.14.4 - github.com/libp2p/go-libp2p-core v0.8.6 - github.com/libp2p/go-libp2p-crypto v0.1.0 - github.com/libp2p/go-libp2p-discovery v0.5.1 - github.com/libp2p/go-libp2p-kad-dht v0.11.1 - github.com/libp2p/go-libp2p-pubsub v0.5.6 - github.com/multiformats/go-multiaddr v0.3.3 + github.com/libp2p/go-libp2p v0.24.0 + github.com/libp2p/go-libp2p-kad-dht v0.19.0 + github.com/libp2p/go-libp2p-pubsub v0.8.2 + github.com/multiformats/go-multiaddr v0.8.0 github.com/multiformats/go-multiaddr-dns v0.3.1 github.com/natefinch/lumberjack v2.0.0+incompatible github.com/pborman/uuid v1.2.0 - github.com/pelletier/go-toml v1.9.3 + github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.11.0 + github.com/prometheus/client_golang v1.14.0 github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 github.com/rjeczalik/notify v0.9.2 github.com/rs/cors v1.7.0 github.com/rs/zerolog v1.18.0 github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.6.1 - github.com/stretchr/testify v1.7.0 + github.com/spf13/viper v1.14.0 + github.com/stretchr/testify v1.8.1 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tikv/client-go/v2 v2.0.1 github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee go.uber.org/ratelimit v0.1.0 - go.uber.org/zap v1.20.0 - golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - golang.org/x/tools v0.1.7 // indirect - google.golang.org/grpc v1.43.0 - google.golang.org/protobuf v1.26.0 + go.uber.org/zap v1.24.0 + golang.org/x/crypto v0.4.0 + golang.org/x/net v0.3.0 // indirect + golang.org/x/sync v0.1.0 + golang.org/x/sys v0.3.0 // indirect + golang.org/x/time v0.2.0 + golang.org/x/tools v0.3.0 // indirect + google.golang.org/grpc v1.51.0 + google.golang.org/protobuf v1.28.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/yaml.v2 v2.4.0 ) +require ( + github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b + github.com/ledgerwatch/erigon-lib v0.0.0-20221218022306-0f8fdd40c2db + github.com/ledgerwatch/log/v3 v3.6.0 +) + require ( github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect github.com/BurntSushi/toml v0.3.1 // indirect github.com/OpenPeeDeeP/depguard v1.0.1 // indirect - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/VictoriaMetrics/metrics v1.23.0 // indirect github.com/aristanetworks/goarista v0.0.0-20190607111240-52c2a7864a08 // indirect - github.com/benbjohnson/clock v1.1.0 // indirect + github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.2.0 // indirect + github.com/bits-and-blooms/bitset v1.2.2 // indirect github.com/bombsimon/wsl/v2 v2.0.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/containerd/cgroups v1.0.4 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dgraph-io/badger v1.6.2 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect - github.com/edsrzf/mmap-go v1.0.0 // indirect - github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa // indirect - github.com/fatih/color v1.10.0 // indirect + github.com/edsrzf/mmap-go v1.1.0 // indirect + github.com/elastic/gosigar v0.14.2 // indirect + github.com/fatih/color v1.13.0 // indirect github.com/flynn/noise v1.0.0 // indirect - github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/francoispqt/gojay v1.2.13 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/go-critic/go-critic v0.4.0 // indirect github.com/go-lintpack/lintpack v0.5.2 // indirect - github.com/go-ole/go-ole v1.2.1 // indirect - github.com/go-stack/stack v1.8.0 // indirect + github.com/go-stack/stack v1.8.1 // indirect + github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/go-toolsmith/astcast v1.0.0 // indirect github.com/go-toolsmith/astcopy v1.0.0 // indirect github.com/go-toolsmith/astequal v1.0.0 // indirect @@ -103,7 +113,8 @@ require ( github.com/go-toolsmith/strparse v1.0.0 // indirect github.com/go-toolsmith/typep v1.0.0 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect @@ -120,140 +131,135 @@ require ( github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect - github.com/google/btree v1.0.0 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/uuid v1.1.2 // indirect + github.com/google/pprof v0.0.0-20221203041831-ce31453925ec // indirect + github.com/google/uuid v1.3.0 // indirect github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.1.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/huin/goupnp v1.0.0 // indirect + github.com/huin/goupnp v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/ipfs/go-cid v0.0.7 // indirect - github.com/ipfs/go-datastore v0.4.5 // indirect + github.com/ipfs/go-cid v0.3.2 // indirect + github.com/ipfs/go-datastore v0.6.0 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect - github.com/ipfs/go-ipns v0.0.2 // indirect + github.com/ipfs/go-ipns v0.2.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect - github.com/ipfs/go-log/v2 v2.1.3 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/ipld/go-ipld-prime v0.9.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/jmespath/go-jmespath v0.3.0 // indirect github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 // indirect github.com/kisielk/gotool v1.0.0 // indirect - github.com/klauspost/cpuid/v2 v2.0.4 // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect - github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // indirect - github.com/kr/pretty v0.2.1 // indirect - github.com/kr/text v0.1.0 // indirect - github.com/libp2p/go-addr-util v0.1.0 // indirect - github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/klauspost/compress v1.15.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.1 // indirect + github.com/koron/go-ssdp v0.0.3 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect - github.com/libp2p/go-conn-security-multistream v0.2.1 // indirect - github.com/libp2p/go-eventbus v0.2.1 // indirect - github.com/libp2p/go-flow-metrics v0.0.3 // indirect - github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052 // indirect - github.com/libp2p/go-libp2p-autonat v0.4.2 // indirect - github.com/libp2p/go-libp2p-blankhost v0.2.0 // indirect - github.com/libp2p/go-libp2p-circuit v0.4.0 // indirect - github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect - github.com/libp2p/go-libp2p-mplex v0.4.1 // indirect - github.com/libp2p/go-libp2p-nat v0.0.6 // indirect - github.com/libp2p/go-libp2p-noise v0.2.0 // indirect - github.com/libp2p/go-libp2p-peerstore v0.2.8 // indirect - github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect - github.com/libp2p/go-libp2p-record v0.1.3 // indirect - github.com/libp2p/go-libp2p-swarm v0.5.3 // indirect - github.com/libp2p/go-libp2p-tls v0.1.3 // indirect - github.com/libp2p/go-libp2p-transport-upgrader v0.4.6 // indirect - github.com/libp2p/go-libp2p-yamux v0.5.4 // indirect - github.com/libp2p/go-maddr-filter v0.1.0 // indirect - github.com/libp2p/go-mplex v0.3.0 // indirect - github.com/libp2p/go-msgio v0.0.6 // indirect - github.com/libp2p/go-nat v0.0.5 // indirect - github.com/libp2p/go-netroute v0.1.6 // indirect - github.com/libp2p/go-openssl v0.0.7 // indirect - github.com/libp2p/go-reuseport v0.0.2 // indirect - github.com/libp2p/go-reuseport-transport v0.0.5 // indirect - github.com/libp2p/go-sockaddr v0.1.1 // indirect - github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect - github.com/libp2p/go-tcp-transport v0.2.7 // indirect - github.com/libp2p/go-ws-transport v0.4.0 // indirect - github.com/libp2p/go-yamux/v2 v2.2.0 // indirect - github.com/magiconair/properties v1.8.1 // indirect + github.com/libp2p/go-flow-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect + github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect + github.com/libp2p/go-libp2p-record v0.2.0 // indirect + github.com/libp2p/go-msgio v0.2.0 // indirect + github.com/libp2p/go-nat v0.1.0 // indirect + github.com/libp2p/go-netroute v0.2.1 // indirect + github.com/libp2p/go-openssl v0.1.0 // indirect + github.com/libp2p/go-reuseport v0.2.0 // indirect + github.com/libp2p/go-yamux/v4 v4.0.0 // indirect + github.com/lucas-clemente/quic-go v0.31.0 // indirect + github.com/magiconair/properties v1.8.6 // indirect + github.com/marten-seemann/qtls-go1-18 v0.1.3 // indirect + github.com/marten-seemann/qtls-go1-19 v0.1.1 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // indirect - github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-pointer v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/miekg/dns v1.1.41 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/miekg/dns v1.1.50 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect - github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.3.3 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mschoch/smat v0.2.0 // indirect - github.com/multiformats/go-base32 v0.0.3 // indirect - github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect - github.com/multiformats/go-multibase v0.0.3 // indirect - github.com/multiformats/go-multihash v0.0.15 // indirect - github.com/multiformats/go-multistream v0.2.2 // indirect - github.com/multiformats/go-varint v0.0.6 // indirect + github.com/multiformats/go-multibase v0.1.1 // indirect + github.com/multiformats/go-multicodec v0.7.0 // indirect + github.com/multiformats/go-multihash v0.2.1 // indirect + github.com/multiformats/go-multistream v0.3.3 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c // indirect + github.com/onsi/ginkgo/v2 v2.5.1 // indirect + github.com/opencontainers/runtime-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 // indirect github.com/pingcap/kvproto v0.0.0-20220106070556-3fa8fa04f898 // indirect github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.26.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect + github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect + github.com/raulk/go-watchdog v1.3.0 // indirect + github.com/rogpeppe/go-internal v1.6.1 // indirect github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d // indirect - github.com/sirupsen/logrus v1.6.0 // indirect + github.com/sirupsen/logrus v1.8.1 // indirect github.com/sourcegraph/go-diff v0.5.1 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect - github.com/spf13/afero v1.1.2 // indirect - github.com/spf13/cast v1.3.0 // indirect - github.com/spf13/jwalterweatherman v1.0.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect - github.com/stretchr/objx v0.2.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/subosito/gotenv v1.4.1 // indirect github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201 // indirect github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e // indirect github.com/tommy-muehle/go-mnd v1.1.1 // indirect + github.com/torquem-ch/mdbx-go v0.27.0 // indirect github.com/tyler-smith/go-bip39 v1.0.2 // indirect github.com/ultraware/funlen v0.0.2 // indirect github.com/ultraware/whitespace v0.0.4 // indirect github.com/uudashr/gocognit v1.0.1 // indirect + github.com/valyala/fastrand v1.1.0 // indirect + github.com/valyala/histogram v1.2.0 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect - github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect - go.opencensus.io v0.23.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.7.0 // indirect - golang.org/x/mod v0.4.2 // indirect - golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect - golang.org/x/text v0.3.6 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect - gopkg.in/ini.v1 v1.51.0 // indirect + go.opencensus.io v0.24.0 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/dig v1.15.0 // indirect + go.uber.org/fx v1.18.2 // indirect + go.uber.org/multierr v1.8.0 // indirect + golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect + golang.org/x/mod v0.7.0 // indirect + golang.org/x/term v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.0.1-2020.1.5 // indirect + lukechampine.com/blake3 v1.1.7 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f // indirect diff --git a/go.sum b/go.sum index 243544b54..5c135cb42 100644 --- a/go.sum +++ b/go.sum @@ -2,13 +2,47 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= @@ -26,30 +60,26 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.5 h1:zl/OfRA6nftbBK9qTohYBJ5xvw6C/oNKizR7cZGl3cI= github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= -github.com/RoaringBitmap/roaring v1.1.0 h1:b10lZrZXaY6Q6EKIRrmOF519FIyQQ5anPgGr3niw2yY= -github.com/RoaringBitmap/roaring v1.1.0/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/RoaringBitmap/roaring v1.2.1 h1:58/LJlg/81wfEHd5L9qsHduznOIhyv4qb1yWcSvVq9A= +github.com/RoaringBitmap/roaring v1.2.1/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/VictoriaMetrics/metrics v1.23.0 h1:WzfqyzCaxUZip+OBbg1+lV33WChDSu4ssYII3nxtpeA= +github.com/VictoriaMetrics/metrics v1.23.0/go.mod h1:rAr/llLpEnAdTehiNlUxKgnjcOuROSzpw0GvjpEbvFc= github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo= github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -61,12 +91,9 @@ github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2uc github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/aristanetworks/goarista v0.0.0-20190607111240-52c2a7864a08 h1:UxoB3EYChE92EDNqRCS5vuE2ta4L/oKpeFaCK73KGvI= github.com/aristanetworks/goarista v0.0.0-20190607111240-52c2a7864a08/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= @@ -78,26 +105,22 @@ github.com/aws/aws-sdk-go v1.33.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beevik/ntp v0.3.0 h1:xzVrPrE4ziasFXgBVBZJDP0Wg/KpMwk2KHJ4Ba8GrDw= github.com/beevik/ntp v0.3.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= -github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= -github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Yc15FvIk= +github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bombsimon/wsl v1.2.5/go.mod h1:43lEF/i0kpXbLCeDXL9LMT8c92HyBywXb0AsgMHYngM= github.com/bombsimon/wsl/v2 v2.0.0 h1:+Vjcn+/T5lSrO8Bjzhk4v14Un/2UyCA1E3V5j9nwTkQ= github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTKY95VwV8U= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= @@ -115,7 +138,8 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b h1:6+ZFm0flnudZzdSE0JxlhR2hKnGPcNB35BjQf4RYQDY= +github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -125,57 +149,58 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= +github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= +github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU= github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8= github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= @@ -184,7 +209,6 @@ github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KP github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -192,21 +216,22 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa h1:XKAhUk/dtp+CV0VO6mhG2V7jA9vbcGcnYF/Ay9NjZrY= +github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ= +github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= +github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= @@ -215,50 +240,54 @@ github.com/ethereum/go-ethereum v1.9.9 h1:jnoBvjH8aMH++iH14XmiJdAsnRcmZUM+B5fsnE github.com/ethereum/go-ethereum v1.9.9/go.mod h1:a9TqabFudpDu1nucId+k9S8R9whYaHnGBLKFouA5EAo= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a h1:1znxn4+q2MrEdTk1eCk6KIV3muTYVclBIB6CTVR/zBc= github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-critic/go-critic v0.3.5-0.20190904082202-d79a9f0c64db/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= github.com/go-critic/go-critic v0.4.0 h1:sXD3pix0wDemuPuSlrXpJNNYXlUiKiysLrtPVQmxkzI= github.com/go-critic/go-critic v0.4.0/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-lintpack/lintpack v0.5.2 h1:DI5mA3+eKdWeJ40nU4d6Wc26qmdG8RCi/btYq0TuRN0= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= @@ -284,37 +313,41 @@ github.com/go-toolsmith/typep v1.0.0 h1:zKymWyA1TRYvqYrYDrfEMZULyrhcnGY3x7LDKU2X github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b h1:ekuhfTjngPhisSjOJ0QWKpPQE8/rbknHaes6WVJj5Hw= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -326,7 +359,6 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -363,64 +395,76 @@ github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunE github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= -github.com/google/gopacket v1.1.18/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20221203041831-ce31453925ec h1:fR20TYVVwhK4O7r7y+McjRYyaTH6/vjwJOajE+XhlzM= +github.com/google/pprof v0.0.0-20221203041831-ce31453925ec/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 h1:JVnpOZS+qxli+rgVl98ILOXVNbW+kb5wcxeGx8ShUIw= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/harmony-one/abool v1.0.1 h1:SjXLmrr3W8h6lY37gRuWtLiRknUOchnUnsXJWK6Gbm4= github.com/harmony-one/abool v1.0.1/go.mod h1:9sq0PJzb1SqRpKrpEV4Ttvm9WV5uud8sfrsPw3AIBJA= github.com/harmony-one/bls v0.0.6 h1:KG4q4JwdkPf3DtFvJmAgMRWT6QdY1A/wqN/Qt+S4VaQ= @@ -429,131 +473,83 @@ github.com/harmony-one/taggedrlp v0.1.4 h1:RZ+qy0VCzT+d/mTfq23gH3an5tSvxOhg6AddL github.com/harmony-one/taggedrlp v0.1.4/go.mod h1:osO5TRXLKdgCP+oj2J9qfqhywMOOA+4nP5q+o8nDSYA= github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849 h1:rMY4jLAen3pMTq9KO7kSXzuMaicnOHP5n1MgpA1T6G4= github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849/go.mod h1:EgNU7X5HLNBBho+OqCm1A1NrpD6xb1SHfi9pMCYaKKw= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= -github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= -github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw= -github.com/ipfs/go-datastore v0.4.0/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= -github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= -github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= -github.com/ipfs/go-datastore v0.4.5 h1:cwOUcGMLdLPWgu3SlrCckCMznaGADbPqE0r8h768/Dg= -github.com/ipfs/go-datastore v0.4.5/go.mod h1:eXTcaaiN6uOlVCLS9GjJUJtlvJfM3xk23w3fyfrmmJs= +github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= +github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= +github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= +github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= +github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= -github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk= -github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= -github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= -github.com/ipfs/go-ds-badger v0.2.7 h1:ju5REfIm+v+wgVnQ19xGLYPHYHbYLR6qJfmMbCDSK1I= -github.com/ipfs/go-ds-badger v0.2.7/go.mod h1:02rnztVKA4aZwDuaRPTf8mpqcKmXP7mLl6JPxd14JHA= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8= -github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= -github.com/ipfs/go-ds-leveldb v0.4.2/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= +github.com/ipfs/go-ds-badger v0.3.0 h1:xREL3V0EH9S219kFFueOYJJTcjgNSZ2HY1iSvN7U1Ro= +github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= -github.com/ipfs/go-ipns v0.0.2 h1:oq4ErrV4hNQ2Eim257RTYRgfOSV/s8BDaf9iIl4NwFs= -github.com/ipfs/go-ipns v0.0.2/go.mod h1:WChil4e0/m9cIINWLxZe1Jtf77oz5L05rO2ei/uKJ5U= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= -github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= -github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= +github.com/ipfs/go-ipns v0.2.0 h1:BgmNtQhqOw5XEZ8RAfWEpK4DhqaYiuP6h71MhIp7xXU= +github.com/ipfs/go-ipns v0.2.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= -github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= -github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= -github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM= -github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/ipld/go-ipld-prime v0.9.0 h1:N2OjJMb+fhyFPwPnVvJcWU/NsumP8etal+d2v3G4eww= +github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -564,341 +560,135 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= -github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kElDUEM= +github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.0.4 h1:g0I61F2K2DjRHz1cnxlkNSBIaePVoJIjjnHui8QHbiw= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.1 h1:U33DW0aiEj633gHYw3LoDNfkDiYnE5Q8M/TKJn2f2jI= +github.com/klauspost/cpuid/v2 v2.2.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= +github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= +github.com/koron/go-ssdp v0.0.3/go.mod h1:b2MxI6yh02pKrsyNoQUsk4+YNikaGhe4894J+Q5lDvA= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/ledgerwatch/erigon-lib v0.0.0-20221218022306-0f8fdd40c2db h1:wV9YkkYQArbUdTdlPxXi5BW6H9ovYbyUT8Af7foetvQ= +github.com/ledgerwatch/erigon-lib v0.0.0-20221218022306-0f8fdd40c2db/go.mod h1:5GCPOzxAshLF7f0wrMZu2Bdq0qqIiMcIubM9n+25gGo= +github.com/ledgerwatch/log/v3 v3.6.0 h1:JBUSK1epPyutUrz7KYDTcJtQLEHnehECRpKbM1ugy5M= +github.com/ledgerwatch/log/v3 v3.6.0/go.mod h1:L+Sp+ma/h205EdCjviZECjGEvYUYEyXSdiuHNZzg+xQ= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E= -github.com/libp2p/go-addr-util v0.1.0 h1:acKsntI33w2bTU7tC9a0SaPimJGfSI0bFKC18ChxeVI= -github.com/libp2p/go-addr-util v0.1.0/go.mod h1:6I3ZYuFr2O/9D+SoyM0zEw0EF3YkldtTX406BpdQMqw= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5Jb/P5ohUnFLNzEAR4DLSzpn2QLU= -github.com/libp2p/go-conn-security-multistream v0.2.1 h1:ft6/POSK7F+vl/2qzegnHDaXFU0iWB4yVTYrioC6Zy0= -github.com/libp2p/go-conn-security-multistream v0.2.1/go.mod h1:cR1d8gA0Hr59Fj6NhaTpFhJZrjSYuNmhpT2r25zYR70= -github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= -github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= -github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-flow-metrics v0.0.2/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= -github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= -github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= -github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZkfEI5sT54= -github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k= -github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw= -github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qDKwXujH5o= -github.com/libp2p/go-libp2p v0.12.0/go.mod h1:FpHZrfC1q7nA8jitvdjKBDF31hguaC676g/nT9PgQM0= -github.com/libp2p/go-libp2p v0.14.4 h1:QCJE+jGyqxWdrSPuS4jByXCzosgaIg4SJTLCRplJ53w= -github.com/libp2p/go-libp2p v0.14.4/go.mod h1:EIRU0Of4J5S8rkockZM7eJp2S0UrCyi55m2kJVru3rM= -github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052 h1:BM7aaOF7RpmNn9+9g6uTjGJ0cTzWr5j9i9IKeun2M8U= -github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo= -github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE= -github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI= -github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI= -github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A= -github.com/libp2p/go-libp2p-autonat v0.4.0/go.mod h1:YxaJlpr81FhdOv3W3BTconZPfhaYivRdf53g+S2wobk= -github.com/libp2p/go-libp2p-autonat v0.4.2 h1:YMp7StMi2dof+baaxkbxaizXjY1RPvU71CXfxExzcUU= -github.com/libp2p/go-libp2p-autonat v0.4.2/go.mod h1:YxaJlpr81FhdOv3W3BTconZPfhaYivRdf53g+S2wobk= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= -github.com/libp2p/go-libp2p-blankhost v0.2.0 h1:3EsGAi0CBGcZ33GwRuXEYJLLPoVWyXJ1bcJzAJjINkk= -github.com/libp2p/go-libp2p-blankhost v0.2.0/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= -github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= -github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= -github.com/libp2p/go-libp2p-circuit v0.4.0 h1:eqQ3sEYkGTtybWgr6JLqJY6QLtPWRErvFjFDfAOO1wc= -github.com/libp2p/go-libp2p-circuit v0.4.0/go.mod h1:t/ktoFIUzM6uLQ+o1G6NuBl2ANhBKN9Bc8jRIk31MoA= -github.com/libp2p/go-libp2p-connmgr v0.2.4 h1:TMS0vc0TCBomtQJyWr7fYxcVYYhx+q/2gF++G5Jkl/w= -github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= -github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= -github.com/libp2p/go-libp2p-core v0.2.5/go.mod h1:6+5zJmKhsf7yHn1RbmYDu08qDUpIUxGdqHuEZckmZOA= -github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= -github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= -github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= -github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= -github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.3/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM= -github.com/libp2p/go-libp2p-core v0.5.6/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.6.1/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.7.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.1/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.2/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.5/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.6 h1:3S8g006qG6Tjpj1JdRK2S+TWc2DJQKX/RG9fdLeiLSU= -github.com/libp2p/go-libp2p-core v0.8.6/go.mod h1:dgHr0l0hIKfWpGpqAMbpo19pen9wJfdCGv51mTmdpmM= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= -github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= -github.com/libp2p/go-libp2p-discovery v0.5.0/go.mod h1:+srtPIU9gDaBNu//UHvcdliKBIcr4SfDcm0/PfPJLug= -github.com/libp2p/go-libp2p-discovery v0.5.1 h1:CJylx+h2+4+s68GvrM4pGNyfNhOYviWBPtVv5PA7sfo= -github.com/libp2p/go-libp2p-discovery v0.5.1/go.mod h1:+srtPIU9gDaBNu//UHvcdliKBIcr4SfDcm0/PfPJLug= -github.com/libp2p/go-libp2p-kad-dht v0.11.1 h1:FsriVQhOUZpCotWIjyFSjEDNJmUzuMma/RyyTDZanwc= -github.com/libp2p/go-libp2p-kad-dht v0.11.1/go.mod h1:5ojtR2acDPqh/jXf5orWy8YGb8bHQDS+qeDcoscL/PI= -github.com/libp2p/go-libp2p-kbucket v0.4.7 h1:spZAcgxifvFZHBD8tErvppbnNiKA5uokDu3CV7axu70= -github.com/libp2p/go-libp2p-kbucket v0.4.7/go.mod h1:XyVo99AfQH0foSf176k4jY1xUJ2+jUJIZCSDm7r2YKk= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-mplex v0.2.2/go.mod h1:74S9eum0tVQdAfFiKxAyKzNdSuLqw5oadDq7+L/FELo= -github.com/libp2p/go-libp2p-mplex v0.2.3/go.mod h1:CK3p2+9qH9x+7ER/gWWDYJ3QW5ZxWDkm+dVvjfuG3ek= -github.com/libp2p/go-libp2p-mplex v0.3.0/go.mod h1:l9QWxRbbb5/hQMECEb908GbS9Sm2UAR2KFZKUJEynEs= -github.com/libp2p/go-libp2p-mplex v0.4.0/go.mod h1:yCyWJE2sc6TBTnFpjvLuEJgTSw/u+MamvzILKdX7asw= -github.com/libp2p/go-libp2p-mplex v0.4.1 h1:/pyhkP1nLwjG3OM+VuaNJkQT/Pqq73WzB3aDN3Fx1sc= -github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryDu6iPSC+CIb094g= -github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE= -github.com/libp2p/go-libp2p-nat v0.0.6 h1:wMWis3kYynCbHoyKLPBEMu4YRLltbm8Mk08HGSfvTkU= -github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-noise v0.1.1/go.mod h1:QDFLdKX7nluB7DEnlVPbz7xlLHdwHFA9HiohJRr3vwM= -github.com/libp2p/go-libp2p-noise v0.2.0 h1:wmk5nhB9a2w2RxMOyvsoKjizgJOEaJdfAakr0jN8gds= -github.com/libp2p/go-libp2p-noise v0.2.0/go.mod h1:IEbYhBBzGyvdLBoxxULL/SGbJARhUeqlO8lVSREYu2Q= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= -github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= -github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= -github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= -github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= -github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= -github.com/libp2p/go-libp2p-peerstore v0.2.7/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= -github.com/libp2p/go-libp2p-peerstore v0.2.8 h1:nJghUlUkFVvyk7ccsM67oFA6kqUkwyCM1G4WPVMCWYA= -github.com/libp2p/go-libp2p-peerstore v0.2.8/go.mod h1:gGiPlXdz7mIHd2vfAsHzBNAMqSDkt2UBFwgcITgw1lA= -github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= -github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= -github.com/libp2p/go-libp2p-pubsub v0.5.6 h1:YkO3gG9J1mQBEMRrM5obiG3JD0L8RcrzIpoeLeiYqH8= -github.com/libp2p/go-libp2p-pubsub v0.5.6/go.mod h1:gVOzwebXVdSMDQBTfH8ACO5EJ4SQrvsHqCmYsCZpD0E= -github.com/libp2p/go-libp2p-quic-transport v0.10.0/go.mod h1:RfJbZ8IqXIhxBRm5hqUEJqjiiY8xmEuq3HUDS993MkA= -github.com/libp2p/go-libp2p-quic-transport v0.11.2 h1:p1YQDZRHH4Cv2LPtHubqlQ9ggz4CKng/REZuXZbZMhM= -github.com/libp2p/go-libp2p-quic-transport v0.11.2/go.mod h1:wlanzKtIh6pHrq+0U3p3DY9PJfGqxMgPaGKaK5LifwQ= -github.com/libp2p/go-libp2p-record v0.1.2/go.mod h1:pal0eNcT5nqZaTV7UGhqeGqxFgGdsU/9W//C8dqjQDk= -github.com/libp2p/go-libp2p-record v0.1.3 h1:R27hoScIhQf/A8XJZ8lYpnqh9LatJ5YbHs28kCIfql0= -github.com/libp2p/go-libp2p-record v0.1.3/go.mod h1:yNUff/adKIfPnYQXgp6FQmNu3gLJ6EMg7+/vv2+9pY4= -github.com/libp2p/go-libp2p-routing-helpers v0.2.3/go.mod h1:795bh+9YeoFl99rMASoiVgHdi5bjack0N1+AFAdbvBw= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= -github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= -github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncHG0uVwGrwvjYlNY= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= -github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= -github.com/libp2p/go-libp2p-swarm v0.2.8/go.mod h1:JQKMGSth4SMqonruY0a8yjlPVIkb0mdNSwckW7OYziM= -github.com/libp2p/go-libp2p-swarm v0.3.0/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk= -github.com/libp2p/go-libp2p-swarm v0.3.1/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk= -github.com/libp2p/go-libp2p-swarm v0.5.0/go.mod h1:sU9i6BoHE0Ve5SKz3y9WfKrh8dUat6JknzUehFx8xW4= -github.com/libp2p/go-libp2p-swarm v0.5.3 h1:hsYaD/y6+kZff1o1Mc56NcuwSg80lIphTS/zDk3mO4M= -github.com/libp2p/go-libp2p-swarm v0.5.3/go.mod h1:NBn7eNW2lu568L7Ns9wdFrOhgRlkRnIDg0FLKbuu3i8= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= -github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= -github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc= -github.com/libp2p/go-libp2p-testing v0.3.0/go.mod h1:efZkql4UZ7OVsEfaxNHZPzIehtsBXMrXnCfJIgDti5g= -github.com/libp2p/go-libp2p-testing v0.4.0/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= -github.com/libp2p/go-libp2p-testing v0.4.2 h1:IOiA5mMigi+eEjf4J+B7fepDhsjtsoWA9QbsCqbNp5U= -github.com/libp2p/go-libp2p-testing v0.4.2/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= -github.com/libp2p/go-libp2p-tls v0.1.3 h1:twKMhMu44jQO+HgQK9X8NHO5HkeJu2QbhLzLJpa8oNM= -github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40sKitV4c50uI1M= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns= -github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o= -github.com/libp2p/go-libp2p-transport-upgrader v0.4.2/go.mod h1:NR8ne1VwfreD5VIWIU62Agt/J18ekORFU/j1i2y8zvk= -github.com/libp2p/go-libp2p-transport-upgrader v0.4.6 h1:SHt3g0FslnqIkEWF25YOB8UCOCTpGAVvHRWQYJ+veiI= -github.com/libp2p/go-libp2p-transport-upgrader v0.4.6/go.mod h1:JE0WQuQdy+uLZ5zOaI3Nw9dWGYJIA7mywEtP2lMvnyk= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw= -github.com/libp2p/go-libp2p-yamux v0.2.5/go.mod h1:Zpgj6arbyQrmZ3wxSZxfBmbdnWtbZ48OpsfmQVTErwA= -github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhLEn0XhIoZ5viCwU= -github.com/libp2p/go-libp2p-yamux v0.2.8/go.mod h1:/t6tDqeuZf0INZMTgd0WxIRbtK2EzI2h7HbFm9eAKI4= -github.com/libp2p/go-libp2p-yamux v0.4.0/go.mod h1:+DWDjtFMzoAwYLVkNZftoucn7PelNoy5nm3tZ3/Zw30= -github.com/libp2p/go-libp2p-yamux v0.5.0/go.mod h1:AyR8k5EzyM2QN9Bbdg6X1SkVVuqLwTGf0L4DFq9g6po= -github.com/libp2p/go-libp2p-yamux v0.5.4 h1:/UOPtT/6DHPtr3TtKXBHa6g0Le0szYuI33Xc/Xpd7fQ= -github.com/libp2p/go-libp2p-yamux v0.5.4/go.mod h1:tfrXbyaTqqSU654GTvK3ocnSZL3BuHoeTSqhcel1wsE= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M= -github.com/libp2p/go-maddr-filter v0.1.0 h1:4ACqZKw8AqiuJfwFGq1CYDFugfXTOos+qQ3DETkhtCE= -github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-mplex v0.1.1/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= -github.com/libp2p/go-mplex v0.1.2/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= -github.com/libp2p/go-mplex v0.2.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ= -github.com/libp2p/go-mplex v0.3.0 h1:U1T+vmCYJaEoDJPV1aq31N56hS+lJgb397GsylNSgrU= -github.com/libp2p/go-mplex v0.3.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.6 h1:lQ7Uc0kS1wb1EfRxO2Eir/RJoHkHn7t6o+EiwsYIKJA= -github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= -github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= -github.com/libp2p/go-nat v0.0.5 h1:qxnwkco8RLKqVh1NmjQ+tJ8p8khNLFxuElYG/TwqW4Q= -github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU= +github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= +github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= +github.com/libp2p/go-libp2p v0.24.0 h1:DQk/5bBon+yUVIGTeRVBmOYpZzoBHx/VTC0xoLgJGG4= +github.com/libp2p/go-libp2p v0.24.0/go.mod h1:28t24CYDlnBs23rIs1OclU89YbhgibrBq2LFbMe+cFw= +github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw= +github.com/libp2p/go-libp2p-asn-util v0.2.0/go.mod h1:WoaWxbHKBymSN41hWSq/lGKJEca7TNm58+gGJi2WsLI= +github.com/libp2p/go-libp2p-kad-dht v0.19.0 h1:2HuiInHZTm9ZvQajaqdaPLHr0PCKKigWiflakimttE0= +github.com/libp2p/go-libp2p-kad-dht v0.19.0/go.mod h1:qPIXdiZsLczhV4/+4EO1jE8ae0YCW4ZOogc4WVIyTEU= +github.com/libp2p/go-libp2p-kbucket v0.5.0 h1:g/7tVm8ACHDxH29BGrpsQlnNeu+6OF1A9bno/4/U1oA= +github.com/libp2p/go-libp2p-kbucket v0.5.0/go.mod h1:zGzGCpQd78b5BNTDGHNDLaTt9aDK/A02xeZp9QeFC4U= +github.com/libp2p/go-libp2p-pubsub v0.8.2 h1:QLGUmkgKmwEVxVDYGsqc5t9CykOMY2Y21cXQHjR462I= +github.com/libp2p/go-libp2p-pubsub v0.8.2/go.mod h1:e4kT+DYjzPUYGZeWk4I+oxCSYTXizzXii5LDRRhjKSw= +github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= +github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= +github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg= +github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.1.3/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.1.5/go.mod h1:V1SR3AaECRkEQCoFFzYwVYWvYIEtlxx89+O3qcpCl4A= -github.com/libp2p/go-netroute v0.1.6 h1:ruPJStbYyXVYGQ81uzEDzuvbYRLKRrLvTYd33yomC38= -github.com/libp2p/go-netroute v0.1.6/go.mod h1:AqhkMh0VuWmfgtxKPp3Oc1LdU5QSWS7wl0QLhSZqXxQ= -github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= -github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGNsw= -github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport v0.0.2 h1:XSG94b1FJfGA01BUrT82imejHQyTxO4jEWqheyCXYvU= -github.com/libp2p/go-reuseport v0.0.2/go.mod h1:SPD+5RwGC7rcnzngoYC86GjPzjSywuQyMVAheVBD9nQ= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-reuseport-transport v0.0.3/go.mod h1:Spv+MPft1exxARzP2Sruj2Wb5JSyHNncjf1Oi2dEbzM= -github.com/libp2p/go-reuseport-transport v0.0.4/go.mod h1:trPa7r/7TJK/d+0hdBLOCGvpQQVOU74OXbNCIMkufGw= -github.com/libp2p/go-reuseport-transport v0.0.5 h1:lJzi+vSYbyJj2faPKLxNGWEIBcaV/uJmyvsUxXy2mLw= -github.com/libp2p/go-reuseport-transport v0.0.5/go.mod h1:TC62hhPc8qs5c/RoXDZG6YmjK+/YWUPC0yYmeUecbjc= +github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= +github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= +github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo= +github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc= +github.com/libp2p/go-reuseport v0.2.0 h1:18PRvIMlpY6ZK85nIAicSBuXXvrYoSw3dsBAR7zc560= +github.com/libp2p/go-reuseport v0.2.0/go.mod h1:bvVho6eLMm6Bz5hmU0LYN3ixd3nPPvtIlaURZZgOY4k= github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-sockaddr v0.1.1 h1:yD80l2ZOdGksnOyHrhxDdTDFrf7Oy+v3FMVArIRgZxQ= -github.com/libp2p/go-sockaddr v0.1.1/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-stream-muxer-multistream v0.3.0 h1:TqnSHPJEIqDEO7h1wZZ0p3DXdvDSiLHQidKKUGZtiOY= -github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= -github.com/libp2p/go-tcp-transport v0.2.0/go.mod h1:vX2U0CnWimU4h0SGSEsg++AzvBcroCGYw28kh94oLe0= -github.com/libp2p/go-tcp-transport v0.2.1/go.mod h1:zskiJ70MEfWz2MKxvFB/Pv+tPIB1PpPUrHIWQ8aFw7M= -github.com/libp2p/go-tcp-transport v0.2.4/go.mod h1:9dvr03yqrPyYGIEN6Dy5UvdJZjyPFvl1S/igQ5QD1SU= -github.com/libp2p/go-tcp-transport v0.2.7 h1:Z8Kc/Kb8tD84WiaH55xAlaEnkqzrp88jSEySCKV4+gg= -github.com/libp2p/go-tcp-transport v0.2.7/go.mod h1:lue9p1b3VmZj1MhhEGB/etmvF/nBQ0X9CW2DutBT3MM= -github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzlHoKzu0yY9p/klM= -github.com/libp2p/go-ws-transport v0.3.0/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= -github.com/libp2p/go-ws-transport v0.3.1/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= -github.com/libp2p/go-ws-transport v0.4.0 h1:9tvtQ9xbws6cA5LvqdE6Ne3vcmGB4f1z9SByggk4s0k= -github.com/libp2p/go-ws-transport v0.4.0/go.mod h1:EcIEKqf/7GDjth6ksuS/6p7R49V4CBY6/E7R/iyhYUA= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.0/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= -github.com/libp2p/go-yamux v1.4.0/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= -github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= -github.com/libp2p/go-yamux/v2 v2.2.0 h1:RwtpYZ2/wVviZ5+3pjC8qdQ4TKnrak0/E01N1UWoAFU= -github.com/libp2p/go-yamux/v2 v2.2.0/go.mod h1:3So6P6TV6r75R9jiBpiIKgU/66lOarCZjqROGxzPpPQ= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/libp2p/go-yamux/v4 v4.0.0 h1:+Y80dV2Yx/kv7Y7JKu0LECyVdMXm1VUoko+VQ9rBfZQ= +github.com/libp2p/go-yamux/v4 v4.0.0/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucas-clemente/quic-go v0.19.3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8= -github.com/lucas-clemente/quic-go v0.21.2 h1:8LqqL7nBQFDUINadW0fHV/xSaCQJgmJC0Gv+qUnjd78= -github.com/lucas-clemente/quic-go v0.21.2/go.mod h1:vF5M1XqhBAHgbjKcJOXY3JZz3GP0T3FQhz/uyOUS38Q= +github.com/lucas-clemente/quic-go v0.31.0 h1:MfNp3fk0wjWRajw6quMFA3ap1AVtlU+2mtwmbVogB2M= +github.com/lucas-clemente/quic-go v0.31.0/go.mod h1:0wFbizLgYzqHqtlyxyCaJKlE7bYgE6JQ+54TLd/Dq2g= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs= -github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-15 v0.1.5 h1:Ci4EIUN6Rlb+D6GmLdej/bCQ4nPYNtVXQB+xjiXE1nk= -github.com/marten-seemann/qtls-go1-15 v0.1.5/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-16 v0.1.4 h1:xbHbOGGhrenVtII6Co8akhLEdrawwB2iHl5yhJRpnco= -github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-17 v0.1.0-rc.1 h1:/rpmWuGvceLwwWuaKPdjpR4JJEUH0tq64/I3hvzaNLM= -github.com/marten-seemann/qtls-go1-17 v0.1.0-rc.1/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= +github.com/marten-seemann/qpack v0.3.0 h1:UiWstOgT8+znlkDPOg2+3rIuYXJ2CnGDkGUXN6ki6hE= +github.com/marten-seemann/qtls-go1-18 v0.1.3 h1:R4H2Ks8P6pAtUagjFty2p7BVHn3XiwDAl7TTQf5h7TI= +github.com/marten-seemann/qtls-go1-18 v0.1.3/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= +github.com/marten-seemann/qtls-go1-19 v0.1.1 h1:mnbxeq3oEyQxQXwI4ReCgW9DPoPR94sNlqWoDZnjRIE= +github.com/marten-seemann/qtls-go1-19 v0.1.1/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/marten-seemann/webtransport-go v0.4.1 h1:8Ir7OoAvtp79yxQpa3foTKIPuoH+0eKpisHObJyu9Sk= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= +github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= +github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -908,81 +698,49 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= -github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= -github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= -github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI= -github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc= -github.com/multiformats/go-multiaddr v0.3.3 h1:vo2OTSAqnENB2rLk79pLtr+uhj+VAzSe3uef5q0lRSs= -github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= +github.com/multiformats/go-multiaddr v0.8.0 h1:aqjksEcqK+iD/Foe1RRFsGZh8+XFiGo7FgUCZlpv3LU= +github.com/multiformats/go-multiaddr v0.8.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= -github.com/multiformats/go-multiaddr-net v0.1.1/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= -github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y= -github.com/multiformats/go-multiaddr-net v0.1.3/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= -github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= -github.com/multiformats/go-multiaddr-net v0.1.5/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= -github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= -github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= +github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= +github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= +github.com/multiformats/go-multicodec v0.7.0 h1:rTUjGOwjlhGHbEMbPoSUJowG1spZTVsITRANCjKTUAQ= +github.com/multiformats/go-multicodec v0.7.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.15 h1:hWOPdrNqDjwHDx82vsYGSDZNyktOJJ2dzZJzFkOV1jM= github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= -github.com/multiformats/go-multistream v0.2.0/go.mod h1:5GZPQZbkWOLOn3J2y4Y99vVW7vOfsAflxARk3x14o6k= -github.com/multiformats/go-multistream v0.2.1/go.mod h1:5GZPQZbkWOLOn3J2y4Y99vVW7vOfsAflxARk3x14o6k= -github.com/multiformats/go-multistream v0.2.2 h1:TCYu1BHTDr1F/Qm75qwYISQdzGcRdC21nFgQW7l7GBo= -github.com/multiformats/go-multistream v0.2.2/go.mod h1:UIcnm7Zuo8HKG+HkWgfQsGL+/MIEhyTqbODbIUwSXKs= +github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= +github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= +github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o= +github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= @@ -991,60 +749,46 @@ github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c h1:1RHs3tNxjXGHeul8z2t6H2N2TlAqpKe5yryJztRx4Jk= github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.5.1 h1:auzK7OI497k6x4OvWq+TKAcpcSAlod0doAH72oIN0Jw= +github.com/onsi/ginkgo/v2 v2.5.1/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/onsi/gomega v1.24.0 h1:+0glovB9Jd6z3VR+ScSwQqXVTIfJcGA9UBM8yzQxhqg= +github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0 h1:HVl5539r48eA+uDuX/ziBmQCxzT1pGrzWbKuXT46Bq0= github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc= @@ -1065,54 +809,50 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 h1:CskT+S6Ay54OwxBGB0R3Rsx4Muto6UnEYTyKJbyRIAI= +github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= -github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= +github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -1123,6 +863,8 @@ github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspo github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -1132,9 +874,6 @@ github.com/rs/zerolog v1.18.0 h1:CbAm3kP2Tptby1i9sYy2MGRg0uxIN9cyDb59Ys7W8z8= github.com/rs/zerolog v1.18.0/go.mod h1:9nvC1axdVrAHcu/s9taAVfBuIdTZLVQmKQyvrUjF5+I= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d h1:BzRvVq1EHuIjxpijCEKpAxzKUUMurOQ4sknehIATRh8= github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d/go.mod h1:w5+eXa0mYznDkHaMCXA4XYffjlH+cy1oyKbfzJXa2Do= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= @@ -1169,67 +908,69 @@ github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYED github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/go-diff v0.5.1 h1:gO6i5zugwzo1RVTvgvfwCOSVegNuvnNi6bAD1QCmkHs= github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= +github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= -github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= +github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= +github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= @@ -1244,10 +985,11 @@ github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201 h1:7h/Oi4Zw6eGCeXh4 github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201/go.mod h1:fEvI5fhAuJn1Fn87VJF8ByE9Vc16EzWGoePZB21/nL8= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tommy-muehle/go-mnd v1.1.1 h1:4D0wuPKjOTiK2garzuPGGvm4zZ/wLYDOH8TJSABC7KU= github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= +github.com/torquem-ch/mdbx-go v0.27.0 h1:FquhRvKL2zweMdk1R6UdOx3h6DiHgJ0+P9yQvSouURI= +github.com/torquem-ch/mdbx-go v0.27.0/go.mod h1:T2fsoJDVppxfAPTLd1svUgH1kpPmeXdPESmroSHcL1E= github.com/twmb/murmur3 v1.1.3/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= @@ -1258,65 +1000,68 @@ github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbd github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= github.com/uudashr/gocognit v1.0.1 h1:MoG2fZ0b/Eo7NXoIwCVFLG5JED3qgQz5/NEE+rOsjPs= github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= +github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8= +github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= +github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ= +github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY= github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= +github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v3 v3.5.2/go.mod h1:kOOaWFFgHygyT0WlSmL8TJiXmMysO/nNUlEsSsN6W4o= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/dig v1.15.0 h1:vq3YWr8zRj1eFGC7Gvf907hE0eRjPTZ1d3xHadD6liE= +go.uber.org/dig v1.15.0/go.mod h1:pKHs0wMynzL6brANhB2hLMro+zalv1osARTviTcqHLM= +go.uber.org/fx v1.18.2 h1:bUNI6oShr+OVFQeU8cDNbnN7VFsu+SsjHzUF51V/GAU= +go.uber.org/fx v1.18.2/go.mod h1:g0V1KMQ66zIRk8bLu3Ea5Jt2w/cHlOIp4wdRsgh0JaY= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= @@ -1325,118 +1070,158 @@ go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+ go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= +go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/ratelimit v0.1.0 h1:U2AruXqeTb4Eh9sYQSTrMhH8Cb7M0Ian2ibBOnBcnAw= go.uber.org/ratelimit v0.1.0/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.20.0 h1:N4oPlghZwYG55MlU6LXk/Zp00FVNE9X9wrYO8CEs4lc= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o= +golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1448,87 +1233,112 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210317225723-c4fcb01b228e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.2.0 h1:52I/1L54xyEQAYdtcSuxtiT84KGYTBGXwayxmIpNJhE= +golang.org/x/time v0.2.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1536,93 +1346,186 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190924052046-3ac2a5bbd98a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190930201159-7c411dea38b0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191107010934-f79515f33823/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113232020-e2727e816f5a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= +golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y= +google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1631,23 +1534,24 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= @@ -1657,13 +1561,10 @@ gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 h1:a6cXbcDDUk gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= -gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1676,28 +1577,33 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= +lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4= mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/hmy/hmy.go b/hmy/hmy.go index f931b2359..58e8d59ed 100644 --- a/hmy/hmy.go +++ b/hmy/hmy.go @@ -22,7 +22,7 @@ import ( "github.com/harmony-one/harmony/shard" staking "github.com/harmony-one/harmony/staking/types" lru "github.com/hashicorp/golang-lru" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" "github.com/pkg/errors" "golang.org/x/sync/singleflight" ) diff --git a/hmy/net.go b/hmy/net.go index a1a7c685b..754195d76 100644 --- a/hmy/net.go +++ b/hmy/net.go @@ -4,7 +4,7 @@ import ( nodeconfig "github.com/harmony-one/harmony/internal/configs/node" commonRPC "github.com/harmony-one/harmony/rpc/common" "github.com/harmony-one/harmony/staking/network" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // GetCurrentUtilityMetrics .. diff --git a/internal/chain/engine.go b/internal/chain/engine.go index 4895031cb..a340e9c27 100644 --- a/internal/chain/engine.go +++ b/internal/chain/engine.go @@ -471,43 +471,24 @@ func applySlashes( // Do the slashing by groups in the sorted order for _, key := range sortedKeys { records := groupedRecords[key] - superCommittee, err := chain.ReadShardState(big.NewInt(int64(key.epoch))) - if err != nil { - return errors.New("could not read shard state") - } - - subComm, err := superCommittee.FindCommitteeByID(key.shardID) - - if err != nil { - return errors.New("could not find shard committee") - } - - // Apply the slashes, invariant: assume been verified as legit slash by this point - var slashApplied *slash.Application - votingPower, err := lookupVotingPower( - big.NewInt(int64(key.epoch)), subComm, - ) - if err != nil { - return errors.Wrapf(err, "could not lookup cached voting power in slash application") - } - rate := slash.Rate(votingPower, records) utils.Logger().Info(). - Str("rate", rate.String()). RawJSON("records", []byte(records.String())). Msg("now applying slash to state during block finalization") - if slashApplied, err = slash.Apply( + + // Apply the slashes, invariant: assume been verified as legit slash by this point + slashApplied, err := slash.Apply( chain, state, records, - rate, slashRewardBeneficiary, - ); err != nil { + ) + + if err != nil { return errors.New("[Finalize] could not apply slash") } utils.Logger().Info(). - Str("rate", rate.String()). RawJSON("records", []byte(records.String())). RawJSON("applied", []byte(slashApplied.String())). Msg("slash applied successfully") diff --git a/internal/chain/engine_test.go b/internal/chain/engine_test.go new file mode 100644 index 000000000..463a0afdb --- /dev/null +++ b/internal/chain/engine_test.go @@ -0,0 +1,387 @@ +package chain + +import ( + "fmt" + "math/big" + "testing" + + bls_core "github.com/harmony-one/bls/ffi/go/bls" + "github.com/harmony-one/harmony/block" + blockfactory "github.com/harmony-one/harmony/block/factory" + "github.com/harmony-one/harmony/consensus/engine" + consensus_sig "github.com/harmony-one/harmony/consensus/signature" + "github.com/harmony-one/harmony/crypto/bls" + "github.com/harmony-one/harmony/numeric" + "github.com/harmony-one/harmony/shard" + "github.com/harmony-one/harmony/staking/effective" + "github.com/harmony-one/harmony/staking/slash" + staking "github.com/harmony-one/harmony/staking/types" + types2 "github.com/harmony-one/harmony/staking/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/harmony-one/harmony/core/state" + "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/internal/params" +) + +var ( + bigOne = big.NewInt(1e18) + tenKOnes = new(big.Int).Mul(big.NewInt(10000), bigOne) + twentyKOnes = new(big.Int).Mul(big.NewInt(20000), bigOne) + fourtyKOnes = new(big.Int).Mul(big.NewInt(40000), bigOne) + thousandKOnes = new(big.Int).Mul(big.NewInt(1000000), bigOne) +) + +const ( + // validator creation parameters + doubleSignShardID = 0 + doubleSignEpoch = 4 + doubleSignBlockNumber = 37 + doubleSignViewID = 38 + + creationHeight = 33 + lastEpochInComm = 5 + currentEpoch = 5 + + numShard = 4 + numNodePerShard = 5 + + offenderShard = doubleSignShardID + offenderShardIndex = 0 +) + +var ( + doubleSignBlock1 = makeBlockForTest(doubleSignEpoch, 0) + doubleSignBlock2 = makeBlockForTest(doubleSignEpoch, 1) +) + +var ( + keyPairs = genKeyPairs(25) + + offIndex = offenderShard*numNodePerShard + offenderShardIndex + offAddr = makeTestAddress(offIndex) + offKey = keyPairs[offIndex] + offPub = offKey.Pub() + + leaderAddr = makeTestAddress("leader") +) + +// Tests that slashing works on the engine level. Since all slashing is +// thoroughly unit tested on `double-sign_test.go`, it just makes sure that +// slashing is applied to the state. +func TestApplySlashing(t *testing.T) { + chain := makeFakeBlockChain() + state := makeTestStateDB() + header := makeFakeHeader() + current := makeDefaultValidatorWrapper() + slashes := slash.Records{makeSlashRecord()} + + if err := state.UpdateValidatorWrapper(current.Address, current); err != nil { + t.Error(err) + } + if _, err := state.Commit(true); err != nil { + t.Error(err) + } + + // Inital Leader's balance: 0 + // Initial Validator's self-delegation: FourtyKOnes + if err := applySlashes(chain, header, state, slashes); err != nil { + t.Error(err) + } + + expDelAmountAfterSlash := twentyKOnes + expRewardToBeneficiary := tenKOnes + + if current.Delegations[0].Amount.Cmp(expDelAmountAfterSlash) != 0 { + t.Errorf("Slashing was not applied properly to validator: %v/%v", expDelAmountAfterSlash, current.Delegations[0].Amount) + } + + beneficiaryBalanceAfterSlash := state.GetBalance(leaderAddr) + if beneficiaryBalanceAfterSlash.Cmp(expRewardToBeneficiary) != 0 { + t.Errorf("Slashing reward was not added properly to beneficiary: %v/%v", expRewardToBeneficiary, beneficiaryBalanceAfterSlash) + } +} + +// +// Make slash record for testing +// + +func makeSlashRecord() slash.Record { + return slash.Record{ + Evidence: slash.Evidence{ + ConflictingVotes: slash.ConflictingVotes{ + FirstVote: makeVoteData(offKey, doubleSignBlock1), + SecondVote: makeVoteData(offKey, doubleSignBlock2), + }, + Moment: slash.Moment{ + Epoch: big.NewInt(doubleSignEpoch), + ShardID: doubleSignShardID, + Height: doubleSignBlockNumber, + ViewID: doubleSignViewID, + }, + Offender: offAddr, + }, + Reporter: makeTestAddress("reporter"), + } +} + +// +// Make validator for testing +// + +func makeDefaultValidatorWrapper() *staking.ValidatorWrapper { + pubKeys := []bls.SerializedPublicKey{offPub} + v := defaultTestValidator(pubKeys) + + ds := staking.Delegations{} + ds = append(ds, staking.Delegation{ + DelegatorAddress: offAddr, + Amount: new(big.Int).Set(fourtyKOnes), + }) + + return &staking.ValidatorWrapper{ + Validator: v, + Delegations: ds, + } +} + +func defaultTestValidator(pubKeys []bls.SerializedPublicKey) staking.Validator { + comm := staking.Commission{ + CommissionRates: staking.CommissionRates{ + Rate: numeric.MustNewDecFromStr("0.167983520183826780"), + MaxRate: numeric.MustNewDecFromStr("0.179184469782137200"), + MaxChangeRate: numeric.MustNewDecFromStr("0.152212761523253600"), + }, + UpdateHeight: big.NewInt(10), + } + + desc := staking.Description{ + Name: "someoneA", + Identity: "someoneB", + Website: "someoneC", + SecurityContact: "someoneD", + Details: "someoneE", + } + return staking.Validator{ + Address: offAddr, + SlotPubKeys: pubKeys, + LastEpochInCommittee: big.NewInt(lastEpochInComm), + MinSelfDelegation: new(big.Int).Set(tenKOnes), + MaxTotalDelegation: new(big.Int).Set(thousandKOnes), + Status: effective.Active, + Commission: comm, + Description: desc, + CreationHeight: big.NewInt(creationHeight), + } +} + +// +// Make commitee for testing +// + +func makeDefaultCommittee() shard.State { + epoch := big.NewInt(doubleSignEpoch) + maker := newShardSlotMaker(keyPairs) + sstate := shard.State{ + Epoch: epoch, + Shards: make([]shard.Committee, 0, int(numShard)), + } + for sid := uint32(0); sid != numNodePerShard; sid++ { + sstate.Shards = append(sstate.Shards, makeShardBySlotMaker(sid, maker)) + } + return sstate +} + +type shardSlotMaker struct { + kps []blsKeyPair + i int +} + +func makeShardBySlotMaker(shardID uint32, maker shardSlotMaker) shard.Committee { + cmt := shard.Committee{ + ShardID: shardID, + Slots: make(shard.SlotList, 0, numNodePerShard), + } + for nid := 0; nid != numNodePerShard; nid++ { + cmt.Slots = append(cmt.Slots, maker.makeSlot()) + } + return cmt +} + +func newShardSlotMaker(kps []blsKeyPair) shardSlotMaker { + return shardSlotMaker{kps, 0} +} + +func (maker *shardSlotMaker) makeSlot() shard.Slot { + s := shard.Slot{ + EcdsaAddress: makeTestAddress(maker.i), + BLSPublicKey: maker.kps[maker.i].Pub(), // Yes, will panic when not enough kps + } + maker.i++ + return s +} + +// +// State DB for testing +// + +func makeTestStateDB() *state.DB { + db := state.NewDatabase(rawdb.NewMemoryDatabase()) + sdb, err := state.New(common.Hash{}, db) + if err != nil { + panic(err) + } + + err = sdb.UpdateValidatorWrapper(offAddr, makeDefaultValidatorWrapper()) + if err != nil { + panic(err) + } + + return sdb +} + +// +// BLS keys for testing +// + +type blsKeyPair struct { + pri *bls_core.SecretKey + pub *bls_core.PublicKey +} + +func genKeyPairs(size int) []blsKeyPair { + kps := make([]blsKeyPair, 0, size) + for i := 0; i != size; i++ { + kps = append(kps, genKeyPair()) + } + return kps +} + +func genKeyPair() blsKeyPair { + pri := bls.RandPrivateKey() + pub := pri.GetPublicKey() + return blsKeyPair{ + pri: pri, + pub: pub, + } +} + +func (kp blsKeyPair) Pub() bls.SerializedPublicKey { + var pub bls.SerializedPublicKey + copy(pub[:], kp.pub.Serialize()) + return pub +} + +func (kp blsKeyPair) Sign(block *types.Block) []byte { + chain := &fakeBlockChain{config: *params.LocalnetChainConfig} + msg := consensus_sig.ConstructCommitPayload(chain, block.Epoch(), block.Hash(), + block.Number().Uint64(), block.Header().ViewID().Uint64()) + + sig := kp.pri.SignHash(msg) + + return sig.Serialize() +} + +// +// Mock blockchain for testing +// + +type fakeBlockChain struct { + config params.ChainConfig + currentBlock types.Block + superCommittee shard.State + snapshots map[common.Address]staking.ValidatorWrapper +} + +func makeFakeBlockChain() *fakeBlockChain { + return &fakeBlockChain{ + config: *params.LocalnetChainConfig, + currentBlock: *makeBlockForTest(currentEpoch, 0), + superCommittee: makeDefaultCommittee(), + snapshots: make(map[common.Address]staking.ValidatorWrapper), + } +} + +func makeBlockForTest(epoch int64, index int) *types.Block { + h := blockfactory.NewTestHeader() + + h.SetEpoch(big.NewInt(epoch)) + h.SetNumber(big.NewInt(doubleSignBlockNumber)) + h.SetViewID(big.NewInt(doubleSignViewID)) + h.SetRoot(common.BigToHash(big.NewInt(int64(index)))) + + return types.NewBlockWithHeader(h) +} + +func (bc *fakeBlockChain) CurrentBlock() *types.Block { + return &bc.currentBlock +} +func (bc *fakeBlockChain) CurrentHeader() *block.Header { + return bc.currentBlock.Header() +} +func (bc *fakeBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { return nil } +func (bc *fakeBlockChain) GetHeader(hash common.Hash, number uint64) *block.Header { return nil } +func (bc *fakeBlockChain) GetHeaderByHash(hash common.Hash) *block.Header { return nil } +func (bc *fakeBlockChain) ShardID() uint32 { return 0 } +func (bc *fakeBlockChain) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil } +func (bc *fakeBlockChain) WriteCommitSig(blockNum uint64, lastCommits []byte) error { return nil } +func (bc *fakeBlockChain) GetHeaderByNumber(number uint64) *block.Header { return nil } +func (bc *fakeBlockChain) ReadValidatorList() ([]common.Address, error) { return nil, nil } +func (bc *fakeBlockChain) ReadCommitSig(blockNum uint64) ([]byte, error) { return nil, nil } +func (bc *fakeBlockChain) ReadBlockRewardAccumulator(uint64) (*big.Int, error) { return nil, nil } +func (bc *fakeBlockChain) ValidatorCandidates() []common.Address { return nil } +func (cr *fakeBlockChain) ReadValidatorInformationAtState(addr common.Address, state *state.DB) (*staking.ValidatorWrapper, error) { + return nil, nil +} +func (bc *fakeBlockChain) ReadValidatorSnapshotAtEpoch(epoch *big.Int, offender common.Address) (*types2.ValidatorSnapshot, error) { + return &types2.ValidatorSnapshot{ + Validator: makeDefaultValidatorWrapper(), + Epoch: epoch, + }, nil +} +func (bc *fakeBlockChain) ReadValidatorInformation(addr common.Address) (*staking.ValidatorWrapper, error) { + return nil, nil +} +func (bc *fakeBlockChain) Config() *params.ChainConfig { + return params.LocalnetChainConfig +} +func (cr *fakeBlockChain) StateAt(root common.Hash) (*state.DB, error) { + return nil, nil +} +func (bc *fakeBlockChain) ReadValidatorSnapshot(addr common.Address) (*staking.ValidatorSnapshot, error) { + return nil, nil +} +func (bc *fakeBlockChain) ReadValidatorStats(addr common.Address) (*staking.ValidatorStats, error) { + return nil, nil +} +func (bc *fakeBlockChain) SuperCommitteeForNextEpoch(beacon engine.ChainReader, header *block.Header, isVerify bool) (*shard.State, error) { + return nil, nil +} + +// +// Fake header for testing +// + +func makeFakeHeader() *block.Header { + h := blockfactory.NewTestHeader() + h.SetCoinbase(leaderAddr) + return h +} + +// +// Utilities for testing +// + +func makeTestAddress(item interface{}) common.Address { + s := fmt.Sprintf("harmony.one.%v", item) + return common.BytesToAddress([]byte(s)) +} + +func makeVoteData(kp blsKeyPair, block *types.Block) slash.Vote { + return slash.Vote{ + SignerPubKeys: []bls.SerializedPublicKey{kp.Pub()}, + BlockHeaderHash: block.Hash(), + Signature: kp.Sign(block), + } +} diff --git a/internal/configs/harmony/harmony.go b/internal/configs/harmony/harmony.go index da37011e0..90569b96f 100644 --- a/internal/configs/harmony/harmony.go +++ b/internal/configs/harmony/harmony.go @@ -46,14 +46,15 @@ type NetworkConfig struct { } type P2pConfig struct { - Port int - IP string - KeyFile string - DHTDataStore *string `toml:",omitempty"` - DiscConcurrency int // Discovery Concurrency value - MaxConnsPerIP int - DisablePrivateIPScan bool - MaxPeers int64 + Port int + IP string + KeyFile string + DHTDataStore *string `toml:",omitempty"` + DiscConcurrency int // Discovery Concurrency value + MaxConnsPerIP int + DisablePrivateIPScan bool + MaxPeers int64 + WaitForEachPeerToConnect bool } type GeneralConfig struct { @@ -221,13 +222,28 @@ type PrometheusConfig struct { type SyncConfig struct { // TODO: Remove this bool after stream sync is fully up. - Enabled bool // enable the stream sync protocol - Downloader bool // start the sync downloader client - Concurrency int // concurrency used for stream sync protocol - MinPeers int // minimum streams to start a sync task. - InitStreams int // minimum streams in bootstrap to start sync loop. - DiscSoftLowCap int // when number of streams is below this value, spin discover during check - DiscHardLowCap int // when removing stream, num is below this value, spin discovery immediately - DiscHighCap int // upper limit of streams in one sync protocol - DiscBatch int // size of each discovery + Enabled bool // enable the stream sync protocol + Downloader bool // start the sync downloader client + StagedSync bool // use staged sync + StagedSyncCfg StagedSyncConfig // staged sync configurations + Concurrency int // concurrency used for stream sync protocol + MinPeers int // minimum streams to start a sync task. + InitStreams int // minimum streams in bootstrap to start sync loop. + DiscSoftLowCap int // when number of streams is below this value, spin discover during check + DiscHardLowCap int // when removing stream, num is below this value, spin discovery immediately + DiscHighCap int // upper limit of streams in one sync protocol + DiscBatch int // size of each discovery +} + +type StagedSyncConfig struct { + TurboMode bool // turn on turbo mode + DoubleCheckBlockHashes bool // double check all block hashes before download blocks + MaxBlocksPerSyncCycle uint64 // max number of blocks per each sync cycle, if set to zero, all blocks will be synced in one full cycle + MaxBackgroundBlocks uint64 // max number of background blocks in turbo mode + InsertChainBatchSize int // number of blocks to build a batch and insert to chain in staged sync + MaxMemSyncCycleSize uint64 // max number of blocks to use a single transaction for staged sync + VerifyAllSig bool // verify signatures for all blocks regardless of height and batch size + VerifyHeaderBatchSize uint64 // batch size to verify header before insert to chain + UseMemDB bool // it uses memory by default. set it to false to use disk + LogProgress bool // log the full sync progress in console } diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index 19798bef8..9a0e950ec 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -16,8 +16,8 @@ import ( "github.com/harmony-one/harmony/multibls" "github.com/harmony-one/harmony/shard" "github.com/harmony-one/harmony/webhooks" - p2p_crypto "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" + p2p_crypto "github.com/libp2p/go-libp2p/core/crypto" + "github.com/libp2p/go-libp2p/core/peer" "github.com/pkg/errors" ) @@ -69,22 +69,33 @@ var peerID peer.ID // PeerID of the node // ConfigType is the structure of all node related configuration variables type ConfigType struct { // The three groupID design, please refer to https://github.com/harmony-one/harmony/blob/master/node/node.md#libp2p-integration - beacon GroupID // the beacon group ID - group GroupID // the group ID of the shard (note: for beacon chain node, the beacon and shard group are the same) - client GroupID // the client group ID of the shard - isClient bool // whether this node is a client node, such as wallet - ShardID uint32 // ShardID of this node; TODO ek – revisit when resharding - role Role // Role of the node - Port string // Port of the node. - IP string // IP of the node. - RPCServer RPCServerConfig // RPC server port and ip - RosettaServer RosettaServerConfig // rosetta server port and ip - IsOffline bool - Downloader bool // Whether stream downloader is running; TODO: remove this after sync up - NtpServer string - StringRole string - P2PPriKey p2p_crypto.PrivKey `json:"-"` - ConsensusPriKey multibls.PrivateKeys `json:"-"` + beacon GroupID // the beacon group ID + group GroupID // the group ID of the shard (note: for beacon chain node, the beacon and shard group are the same) + client GroupID // the client group ID of the shard + isClient bool // whether this node is a client node, such as wallet + ShardID uint32 // ShardID of this node; TODO ek – revisit when resharding + role Role // Role of the node + Port string // Port of the node. + IP string // IP of the node. + RPCServer RPCServerConfig // RPC server port and ip + RosettaServer RosettaServerConfig // rosetta server port and ip + IsOffline bool + Downloader bool // Whether stream downloader is running; TODO: remove this after sync up + StagedSync bool // use staged sync + StagedSyncTurboMode bool // use Turbo mode for staged sync + UseMemDB bool // use mem db for staged sync + DoubleCheckBlockHashes bool + MaxBlocksPerSyncCycle uint64 // Maximum number of blocks per each cycle. if set to zero, all blocks will be downloaded and synced in one full cycle. + MaxMemSyncCycleSize uint64 // max number of blocks to use a single transaction for staged sync + MaxBackgroundBlocks uint64 // max number of background blocks in turbo mode + InsertChainBatchSize int // number of blocks to build a batch and insert to chain in staged sync + VerifyAllSig bool // verify signatures for all blocks regardless of height and batch size + VerifyHeaderBatchSize uint64 // batch size to verify header before insert to chain + LogProgress bool // log the full sync progress in console + NtpServer string + StringRole string + P2PPriKey p2p_crypto.PrivKey `json:"-"` + ConsensusPriKey multibls.PrivateKeys `json:"-"` // Database directory DBDir string networkType NetworkType diff --git a/internal/configs/node/network.go b/internal/configs/node/network.go index 0749d43e7..332b5cce7 100644 --- a/internal/configs/node/network.go +++ b/internal/configs/node/network.go @@ -63,6 +63,8 @@ const ( DefaultMaxConnPerIP = 10 // DefaultMaxPeers is the maximum number of remote peers, with 0 representing no limit DefaultMaxPeers = 0 + // DefaultWaitForEachPeerToConnect sets the sync configs to connect to neighbor peers one by one and waits for each peer to connect + DefaultWaitForEachPeerToConnect = false ) const ( diff --git a/internal/registry/registry.go b/internal/registry/registry.go new file mode 100644 index 000000000..025b652a6 --- /dev/null +++ b/internal/registry/registry.go @@ -0,0 +1,35 @@ +package registry + +import ( + "sync" + + "github.com/harmony-one/harmony/core" +) + +// Registry consolidates services at one place. +type Registry struct { + mu sync.Mutex + blockchain core.BlockChain +} + +// New creates a new registry. +func New() *Registry { + return &Registry{} +} + +// SetBlockchain sets the blockchain to registry. +func (r *Registry) SetBlockchain(bc core.BlockChain) *Registry { + r.mu.Lock() + defer r.mu.Unlock() + + r.blockchain = bc + return r +} + +// GetBlockchain gets the blockchain from registry. +func (r *Registry) GetBlockchain() core.BlockChain { + r.mu.Lock() + defer r.mu.Unlock() + + return r.blockchain +} diff --git a/internal/registry/registry_test.go b/internal/registry/registry_test.go new file mode 100644 index 000000000..0c0d18814 --- /dev/null +++ b/internal/registry/registry_test.go @@ -0,0 +1,16 @@ +package registry + +import ( + "testing" + + "github.com/harmony-one/harmony/core" + "github.com/stretchr/testify/require" +) + +func TestRegistry(t *testing.T) { + registry := New() + require.Nil(t, registry.GetBlockchain()) + + registry.SetBlockchain(core.Stub{}) + require.NotNil(t, registry.GetBlockchain()) +} diff --git a/internal/utils/utils.go b/internal/utils/utils.go index cd8483ef1..33cf09eca 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -17,7 +17,7 @@ import ( "github.com/ethereum/go-ethereum/common" bls_core "github.com/harmony-one/bls/ffi/go/bls" "github.com/harmony-one/harmony/crypto/bls" - p2p_crypto "github.com/libp2p/go-libp2p-core/crypto" + p2p_crypto "github.com/libp2p/go-libp2p/core/crypto" "github.com/pkg/errors" ) diff --git a/internal/utils/utils_test.go b/internal/utils/utils_test.go index cba42798e..b144db4e7 100644 --- a/internal/utils/utils_test.go +++ b/internal/utils/utils_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - crypto "github.com/libp2p/go-libp2p-core/crypto" + crypto "github.com/libp2p/go-libp2p/core/crypto" ) // Test for GenKeyP2P, noted the length of private key can be random @@ -52,8 +52,8 @@ func TestSaveLoadPrivateKey(t *testing.T) { if !crypto.KeyEqual(pk, pk1) { t.Errorf("loaded key is not right") - b1, _ := pk.Bytes() - b2, _ := pk1.Bytes() + b1, _ := pk.Raw() + b2, _ := pk1.Raw() t.Errorf("expecting pk: %v\n", b1) t.Errorf("got pk1: %v\n", b2) } diff --git a/node/api.go b/node/api.go index 131a7c806..ceda96808 100644 --- a/node/api.go +++ b/node/api.go @@ -10,7 +10,7 @@ import ( hmy_rpc "github.com/harmony-one/harmony/rpc" rpc_common "github.com/harmony-one/harmony/rpc/common" "github.com/harmony-one/harmony/rpc/filters" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // IsCurrentlyLeader exposes if node is currently the leader node diff --git a/node/node.go b/node/node.go index 2a7b1eaf1..769cde9e6 100644 --- a/node/node.go +++ b/node/node.go @@ -13,6 +13,7 @@ import ( "time" "github.com/harmony-one/harmony/consensus/engine" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/shardchain/tikv_manage" "github.com/harmony-one/harmony/internal/tikv" "github.com/harmony-one/harmony/internal/tikv/redis_helper" @@ -26,8 +27,8 @@ import ( "github.com/harmony-one/abool" bls_core "github.com/harmony-one/bls/ffi/go/bls" lru "github.com/hashicorp/golang-lru" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/rcrowley/go-metrics" @@ -39,6 +40,7 @@ import ( "github.com/harmony-one/harmony/api/service" "github.com/harmony-one/harmony/api/service/legacysync" "github.com/harmony-one/harmony/api/service/legacysync/downloader" + "github.com/harmony-one/harmony/api/service/stagedsync" "github.com/harmony-one/harmony/consensus" "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/core/rawdb" @@ -81,6 +83,20 @@ type syncConfig struct { withSig bool } +type ISync interface { + UpdateBlockAndStatus(block *types.Block, bc core.BlockChain, verifyAllSig bool) error + AddLastMileBlock(block *types.Block) + GetActivePeerNumber() int + CreateSyncConfig(peers []p2p.Peer, shardID uint32, waitForEachPeerToConnect bool) error + SyncLoop(bc core.BlockChain, worker *worker.Worker, isBeacon bool, consensus *consensus.Consensus, loopMinTime time.Duration) + IsSynchronized() bool + IsSameBlockchainHeight(bc core.BlockChain) (uint64, bool) + AddNewBlock(peerHash []byte, block *types.Block) + RegisterNodeInfo() int + GetParsedSyncStatus() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) + GetParsedSyncStatusDoubleChecked() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) +} + // Node represents a protocol-participating node in the network type Node struct { Consensus *consensus.Consensus // Consensus object containing all Consensus related data (e.g. committee members, signatures, commits) @@ -102,6 +118,7 @@ type Node struct { syncID [SyncIDLength]byte // a unique ID for the node during the state syncing process with peers stateSync *legacysync.StateSync epochSync *legacysync.EpochSync + stateStagedSync *stagedsync.StagedSync peerRegistrationRecord map[string]*syncConfig // record registration time (unixtime) of peers begin in syncing SyncingPeerProvider SyncingPeerProvider // The p2p host used to send/receive p2p messages @@ -127,8 +144,8 @@ type Node struct { // BroadcastInvalidTx flag is considered when adding pending tx to tx-pool BroadcastInvalidTx bool // InSync flag indicates the node is in-sync or not - IsInSync *abool.AtomicBool - proposedBlock map[uint64]*types.Block + IsSynchronized *abool.AtomicBool + proposedBlock map[uint64]*types.Block deciderCache *lru.Cache committeeCache *lru.Cache @@ -138,22 +155,40 @@ type Node struct { // context control for pub-sub handling psCtx context.Context psCancel func() + registry *registry.Registry } // Blockchain returns the blockchain for the node's current shard. func (node *Node) Blockchain() core.BlockChain { - shardID := node.NodeConfig.ShardID - bc, err := node.shardChains.ShardChain(shardID) - if err != nil { - utils.Logger().Error(). - Uint32("shardID", shardID). - Err(err). - Msg("cannot get shard chain") + return node.registry.GetBlockchain() +} + +func (node *Node) SyncInstance() ISync { + return node.GetOrCreateSyncInstance(true) +} + +func (node *Node) CurrentSyncInstance() bool { + return node.GetOrCreateSyncInstance(false) != nil +} + +// GetOrCreateSyncInstance returns an instance of state sync, either legacy or staged +// if initiate sets to true, it generates a new instance +func (node *Node) GetOrCreateSyncInstance(initiate bool) ISync { + if node.NodeConfig.StagedSync { + if initiate && node.stateStagedSync == nil { + utils.Logger().Info().Msg("initializing staged state sync") + node.stateStagedSync = node.createStagedSync(node.Blockchain()) + } + return node.stateStagedSync } - return bc + if initiate && node.stateSync == nil { + utils.Logger().Info().Msg("initializing legacy state sync") + node.stateSync = node.createStateSync(node.Beaconchain()) + } + return node.stateSync } -// Beaconchain returns the beaconchain from node. +// Beaconchain returns the beacon chain from node. func (node *Node) Beaconchain() core.BlockChain { // tikv mode not have the BeaconChain storage if node.HarmonyConfig != nil && node.HarmonyConfig.General.RunElasticMode && node.HarmonyConfig.General.ShardID != shard.BeaconChainShardID { @@ -990,11 +1025,15 @@ func New( localAccounts []common.Address, isArchival map[uint32]bool, harmonyconfig *harmonyconfig.HarmonyConfig, + registry *registry.Registry, ) *Node { - node := Node{} - node.unixTimeAtNodeStart = time.Now().Unix() - node.TransactionErrorSink = types.NewTransactionErrorSink() - node.crosslinks = crosslinks.New() + node := Node{ + registry: registry, + unixTimeAtNodeStart: time.Now().Unix(), + TransactionErrorSink: types.NewTransactionErrorSink(), + crosslinks: crosslinks.New(), + } + // Get the node config that's created in the harmony.go program. if consensusObj != nil { node.NodeConfig = nodeconfig.GetShardConfig(consensusObj.ShardID) @@ -1012,14 +1051,8 @@ func New( networkType := node.NodeConfig.GetNetworkType() chainConfig := networkType.ChainConfig() node.chainConfig = chainConfig - - for shardID, archival := range isArchival { - if archival { - collection.DisableCache(shardID) - } - } node.shardChains = collection - node.IsInSync = abool.NewBool(false) + node.IsSynchronized = abool.NewBool(false) if host != nil && consensusObj != nil { // Consensus and associated channel to communicate blocks @@ -1179,7 +1212,7 @@ func (node *Node) InitConsensusWithValidators() (err error) { Uint64("epoch", epoch.Uint64()). Msg("[InitConsensusWithValidators] Try To Get PublicKeys") shardState, err := committee.WithStakingEnabled.Compute( - epoch, node.Consensus.Blockchain, + epoch, node.Consensus.Blockchain(), ) if err != nil { utils.Logger().Err(err). @@ -1301,7 +1334,7 @@ func (node *Node) populateSelfAddresses(epoch *big.Int) { node.keysToAddrsEpoch = epoch shardID := node.Consensus.ShardID - shardState, err := node.Consensus.Blockchain.ReadShardState(epoch) + shardState, err := node.Consensus.Blockchain().ReadShardState(epoch) if err != nil { utils.Logger().Error().Err(err). Int64("epoch", epoch.Int64()). diff --git a/node/node_handler.go b/node/node_handler.go index c7cc5f53e..3db4f8dea 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -125,7 +125,7 @@ func (node *Node) stakingMessageHandler(msgPayload []byte) { switch txMessageType { case proto_node.Send: txs := staking.StakingTransactions{} - err := rlp.Decode(bytes.NewReader(msgPayload[1:]), &txs) // skip the Send messge type + err := rlp.Decode(bytes.NewReader(msgPayload[1:]), &txs) // skip the Send message type if err != nil { utils.Logger().Error(). Err(err). @@ -209,7 +209,7 @@ func (node *Node) BroadcastCrossLinkFromShardsToBeacon() { // leader of 1-3 shar err = node.host.SendMessageToGroups( []nodeconfig.GroupID{nodeconfig.NewGroupIDByShardID(shard.BeaconChainShardID)}, p2p.ConstructMessage( - proto_node.ConstructCrossLinkMessage(node.Consensus.Blockchain, headers)), + proto_node.ConstructCrossLinkMessage(node.Consensus.Blockchain(), headers)), ) if err != nil { utils.Logger().Error().Err(err).Msgf("[BroadcastCrossLink] failed to broadcast message") diff --git a/node/node_handler_test.go b/node/node_handler_test.go index ccf214688..25d966f46 100644 --- a/node/node_handler_test.go +++ b/node/node_handler_test.go @@ -12,6 +12,7 @@ import ( "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/internal/chain" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/shardchain" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/multibls" @@ -40,14 +41,19 @@ func TestAddNewBlock(t *testing.T) { decider := quorum.NewDecider( quorum.SuperMajorityVote, shard.BeaconChainShardID, ) + blockchain, err := collection.ShardChain(shard.BeaconChainShardID) + if err != nil { + t.Fatal("cannot get blockchain") + } + reg := registry.New().SetBlockchain(blockchain) consensus, err := consensus.New( - host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), nil, decider, 3, false, + host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), reg, decider, 3, false, ) if err != nil { t.Fatalf("Cannot craeate consensus: %v", err) } nodeconfig.SetNetworkType(nodeconfig.Devnet) - node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil) + node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil, reg) txs := make(map[common.Address]types.Transactions) stks := staking.StakingTransactions{} @@ -92,8 +98,13 @@ func TestVerifyNewBlock(t *testing.T) { decider := quorum.NewDecider( quorum.SuperMajorityVote, shard.BeaconChainShardID, ) + blockchain, err := collection.ShardChain(shard.BeaconChainShardID) + if err != nil { + t.Fatal("cannot get blockchain") + } + reg := registry.New().SetBlockchain(blockchain) consensus, err := consensus.New( - host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), nil, decider, 3, false, + host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), reg, decider, 3, false, ) if err != nil { t.Fatalf("Cannot craeate consensus: %v", err) @@ -101,7 +112,7 @@ func TestVerifyNewBlock(t *testing.T) { archiveMode := make(map[uint32]bool) archiveMode[0] = true archiveMode[1] = false - node := New(host, consensus, engine, collection, nil, nil, nil, archiveMode, nil) + node := New(host, consensus, engine, collection, nil, nil, nil, archiveMode, nil, reg) txs := make(map[common.Address]types.Transactions) stks := staking.StakingTransactions{} @@ -147,8 +158,9 @@ func TestVerifyVRF(t *testing.T) { decider := quorum.NewDecider( quorum.SuperMajorityVote, shard.BeaconChainShardID, ) + reg := registry.New().SetBlockchain(blockchain) consensus, err := consensus.New( - host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), blockchain, decider, 3, false, + host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), reg, decider, 3, false, ) if err != nil { t.Fatalf("Cannot craeate consensus: %v", err) @@ -156,7 +168,7 @@ func TestVerifyVRF(t *testing.T) { archiveMode := make(map[uint32]bool) archiveMode[0] = true archiveMode[1] = false - node := New(host, consensus, engine, collection, nil, nil, nil, archiveMode, nil) + node := New(host, consensus, engine, collection, nil, nil, nil, archiveMode, nil, reg) txs := make(map[common.Address]types.Transactions) stks := staking.StakingTransactions{} diff --git a/node/node_newblock_test.go b/node/node_newblock_test.go index 11bee965d..492175b1d 100644 --- a/node/node_newblock_test.go +++ b/node/node_newblock_test.go @@ -12,6 +12,7 @@ import ( "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/internal/chain" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/shardchain" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/multibls" @@ -52,7 +53,7 @@ func TestFinalizeNewBlockAsync(t *testing.T) { t.Fatalf("Cannot craeate consensus: %v", err) } - node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil) + node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil, registry.New().SetBlockchain(blockchain)) node.Worker.UpdateCurrent() diff --git a/node/node_syncing.go b/node/node_syncing.go index f10128385..d9a6c95b4 100644 --- a/node/node_syncing.go +++ b/node/node_syncing.go @@ -22,6 +22,7 @@ import ( "github.com/harmony-one/harmony/api/service/legacysync" legdownloader "github.com/harmony-one/harmony/api/service/legacysync/downloader" downloader_pb "github.com/harmony-one/harmony/api/service/legacysync/downloader/proto" + "github.com/harmony-one/harmony/api/service/stagedsync" "github.com/harmony-one/harmony/api/service/synchronize" "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/core/types" @@ -84,10 +85,7 @@ func (node *Node) DoSyncWithoutConsensus() { // IsSameHeight tells whether node is at same bc height as a peer func (node *Node) IsSameHeight() (uint64, bool) { - if node.stateSync == nil { - node.stateSync = node.createStateSync(node.Blockchain()) - } - return node.stateSync.IsSameBlockchainHeight(node.Blockchain()) + return node.SyncInstance().IsSameBlockchainHeight(node.Blockchain()) } func (node *Node) createStateSync(bc core.BlockChain) *legacysync.StateSync { @@ -110,6 +108,42 @@ func (node *Node) createStateSync(bc core.BlockChain) *legacysync.StateSync { node.GetSyncID(), node.NodeConfig.Role() == nodeconfig.ExplorerNode, role) } +func (node *Node) createStagedSync(bc core.BlockChain) *stagedsync.StagedSync { + // Temp hack: The actual port used in dns sync is node.downloaderServer.Port. + // But registration is done through an old way of port arithmetics (syncPort + 3000). + // Thus for compatibility, we are doing the arithmetics here, and not to change the + // protocol itself. This is just the temporary hack and will not be a concern after + // state sync. + var mySyncPort int + if node.downloaderServer != nil { + mySyncPort = node.downloaderServer.Port + } else { + // If local sync server is not started, the port field in protocol is actually not + // functional, simply set it to default value. + mySyncPort = nodeconfig.DefaultDNSPort + } + mutatedPort := strconv.Itoa(mySyncPort + legacysync.SyncingPortDifference) + role := node.NodeConfig.Role() + isExplorer := node.NodeConfig.Role() == nodeconfig.ExplorerNode + + if s, err := stagedsync.CreateStagedSync(node.SelfPeer.IP, mutatedPort, + node.GetSyncID(), bc, role, isExplorer, + node.NodeConfig.StagedSyncTurboMode, + node.NodeConfig.UseMemDB, + node.NodeConfig.DoubleCheckBlockHashes, + node.NodeConfig.MaxBlocksPerSyncCycle, + node.NodeConfig.MaxBackgroundBlocks, + node.NodeConfig.MaxMemSyncCycleSize, + node.NodeConfig.VerifyAllSig, + node.NodeConfig.VerifyHeaderBatchSize, + node.NodeConfig.InsertChainBatchSize, + node.NodeConfig.LogProgress); err != nil { + return nil + } else { + return s + } +} + // SyncingPeerProvider is an interface for getting the peers in the given shard. type SyncingPeerProvider interface { SyncingPeers(shardID uint32) (peers []p2p.Peer, err error) @@ -219,13 +253,13 @@ func (node *Node) doBeaconSyncing() { continue } - if err := node.epochSync.CreateSyncConfig(peers, shard.BeaconChainShardID); err != nil { + if err := node.epochSync.CreateSyncConfig(peers, shard.BeaconChainShardID, node.HarmonyConfig.P2P.WaitForEachPeerToConnect); err != nil { utils.Logger().Warn().Err(err).Msg("[EPOCHSYNC] cannot create beacon sync config") continue } } - <-time.After(node.epochSync.SyncLoop(node.EpochChain(), true, nil)) + <-time.After(node.epochSync.SyncLoop(node.EpochChain(), nil)) } } @@ -250,7 +284,9 @@ func (node *Node) DoSyncing(bc core.BlockChain, worker *worker.Worker, willJoinC // doSync keep the node in sync with other peers, willJoinConsensus means the node will try to join consensus after catch up func (node *Node) doSync(bc core.BlockChain, worker *worker.Worker, willJoinConsensus bool) { - if node.stateSync.GetActivePeerNumber() < legacysync.NumPeersLowBound { + + syncInstance := node.SyncInstance() + if syncInstance.GetActivePeerNumber() < legacysync.NumPeersLowBound { shardID := bc.ShardID() peers, err := node.SyncingPeerProvider.SyncingPeers(shardID) if err != nil { @@ -260,28 +296,28 @@ func (node *Node) doSync(bc core.BlockChain, worker *worker.Worker, willJoinCons Msg("cannot retrieve syncing peers") return } - if err := node.stateSync.CreateSyncConfig(peers, shardID); err != nil { + if err := syncInstance.CreateSyncConfig(peers, shardID, node.HarmonyConfig.P2P.WaitForEachPeerToConnect); err != nil { utils.Logger().Warn(). Err(err). Interface("peers", peers). Msg("[SYNC] create peers error") return } - utils.Logger().Debug().Int("len", node.stateSync.GetActivePeerNumber()).Msg("[SYNC] Get Active Peers") + utils.Logger().Debug().Int("len", syncInstance.GetActivePeerNumber()).Msg("[SYNC] Get Active Peers") } // TODO: treat fake maximum height - if result := node.stateSync.GetSyncStatusDoubleChecked(); !result.IsInSync { - node.IsInSync.UnSet() + if isSynchronized, _, _ := syncInstance.GetParsedSyncStatusDoubleChecked(); !isSynchronized { + node.IsSynchronized.UnSet() if willJoinConsensus { node.Consensus.BlocksNotSynchronized() } - node.stateSync.SyncLoop(bc, worker, false, node.Consensus) + syncInstance.SyncLoop(bc, worker, false, node.Consensus, legacysync.LoopMinTime) if willJoinConsensus { - node.IsInSync.Set() + node.IsSynchronized.Set() node.Consensus.BlocksSynchronized() } } - node.IsInSync.Set() + node.IsSynchronized.Set() } // SupportGRPCSyncServer do gRPC sync server @@ -331,11 +367,16 @@ func (node *Node) supportSyncing() { go node.SendNewBlockToUnsync() } - if node.stateSync == nil { + if !node.NodeConfig.StagedSync && node.stateSync == nil { node.stateSync = node.createStateSync(node.Blockchain()) utils.Logger().Debug().Msg("[SYNC] initialized state sync") } + if node.NodeConfig.StagedSync && node.stateStagedSync == nil { + node.stateStagedSync = node.createStagedSync(node.Blockchain()) + utils.Logger().Debug().Msg("[SYNC] initialized state for staged sync") + } + go node.DoSyncing(node.Blockchain(), node.Worker, joinConsensus) } @@ -356,6 +397,7 @@ func (node *Node) StartSyncingServer(port int) { // SendNewBlockToUnsync send latest verified block to unsync, registered nodes func (node *Node) SendNewBlockToUnsync() { + for { block := <-node.Consensus.VerifiedNewBlock blockBytes, err := rlp.EncodeToBytes(block) @@ -374,7 +416,7 @@ func (node *Node) SendNewBlockToUnsync() { elapseTime := time.Now().UnixNano() - config.timestamp if elapseTime > broadcastTimeout { utils.Logger().Warn().Str("peerID", peerID).Msg("[SYNC] SendNewBlockToUnsync to peer timeout") - node.peerRegistrationRecord[peerID].client.Close() + node.peerRegistrationRecord[peerID].client.Close("send new block to peer timeout") delete(node.peerRegistrationRecord, peerID) continue } @@ -383,13 +425,13 @@ func (node *Node) SendNewBlockToUnsync() { sendBytes = blockWithSigBytes } response, err := config.client.PushNewBlock(node.GetSyncID(), sendBytes, false) - // close the connection if cannot push new block to unsync node + // close the connection if cannot push new block to not synchronized node if err != nil { - node.peerRegistrationRecord[peerID].client.Close() + node.peerRegistrationRecord[peerID].client.Close("cannot push new block to not synchronized node") delete(node.peerRegistrationRecord, peerID) } if response != nil && response.Type == downloader_pb.DownloaderResponse_INSYNC { - node.peerRegistrationRecord[peerID].client.Close() + node.peerRegistrationRecord[peerID].client.Close("node is synchronized") delete(node.peerRegistrationRecord, peerID) } } @@ -403,7 +445,6 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest, in if node.NodeConfig.IsOffline { return response, nil } - switch request.Type { case downloader_pb.DownloaderRequest_BLOCKHASH: dnsServerRequestCounterVec.With(dnsReqMetricLabel("block_hash")).Inc() @@ -493,7 +534,7 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest, in // this is the out of sync node acts as grpc server side case downloader_pb.DownloaderRequest_NEWBLOCK: dnsServerRequestCounterVec.With(dnsReqMetricLabel("new block")).Inc() - if node.IsInSync.IsSet() { + if node.IsSynchronized.IsSet() { response.Type = downloader_pb.DownloaderResponse_INSYNC return response, nil } @@ -502,7 +543,7 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest, in utils.Logger().Warn().Err(err).Msg("[SYNC] unable to decode received new block") return response, err } - node.stateSync.AddNewBlock(request.PeerHash, block) + node.SyncInstance().AddNewBlock(request.PeerHash, block) case downloader_pb.DownloaderRequest_REGISTER: peerID := string(request.PeerHash[:]) @@ -528,7 +569,7 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest, in } else { response.Type = downloader_pb.DownloaderResponse_FAIL syncPort := legacysync.GetSyncingPort(port) - client := legdownloader.ClientSetup(ip, syncPort) + client := legdownloader.ClientSetup(ip, syncPort, false) if client == nil { utils.Logger().Warn(). Str("ip", ip). @@ -546,8 +587,8 @@ func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest, in } case downloader_pb.DownloaderRequest_REGISTERTIMEOUT: - if !node.IsInSync.IsSet() { - count := node.stateSync.RegisterNodeInfo() + if !node.IsSynchronized.IsSet() { + count := node.SyncInstance().RegisterNodeInfo() utils.Logger().Debug(). Int("number", count). Msg("[SYNC] extra node registered") @@ -752,18 +793,17 @@ func (node *Node) SyncStatus(shardID uint32) (bool, uint64, uint64) { func (node *Node) legacySyncStatus(shardID uint32) (bool, uint64, uint64) { switch shardID { case node.NodeConfig.ShardID: - if node.stateSync == nil { + if node.SyncInstance() == nil { return false, 0, 0 } - result := node.stateSync.GetSyncStatus() - return result.IsInSync, result.OtherHeight, result.HeightDiff + return node.SyncInstance().GetParsedSyncStatus() case shard.BeaconChainShardID: if node.epochSync == nil { return false, 0, 0 } result := node.epochSync.GetSyncStatus() - return result.IsInSync, result.OtherHeight, result.HeightDiff + return result.IsSynchronized, result.OtherHeight, result.HeightDiff default: // Shard node is not working on @@ -785,18 +825,19 @@ func (node *Node) IsOutOfSync(shardID uint32) bool { func (node *Node) legacyIsOutOfSync(shardID uint32) bool { switch shardID { case node.NodeConfig.ShardID: - if node.stateSync == nil { + if !node.NodeConfig.StagedSync && node.stateSync == nil { + return true + } else if node.NodeConfig.StagedSync && node.stateStagedSync == nil { return true } - result := node.stateSync.GetSyncStatus() - return !result.IsInSync + return node.SyncInstance().IsSynchronized() case shard.BeaconChainShardID: if node.epochSync == nil { return true } result := node.epochSync.GetSyncStatus() - return !result.IsInSync + return !result.IsSynchronized default: return true diff --git a/node/node_test.go b/node/node_test.go index bbcef4e2c..a4f1af70c 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -10,6 +10,7 @@ import ( "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/internal/chain" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/registry" "github.com/harmony-one/harmony/internal/shardchain" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/multibls" @@ -36,17 +37,23 @@ func TestNewNode(t *testing.T) { decider := quorum.NewDecider( quorum.SuperMajorityVote, shard.BeaconChainShardID, ) + chainconfig := nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType().ChainConfig() + collection := shardchain.NewCollection( + nil, testDBFactory, &core.GenesisInitializer{NetworkType: nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType()}, engine, &chainconfig, + ) + blockchain, err := collection.ShardChain(shard.BeaconChainShardID) + if err != nil { + t.Fatal("cannot get blockchain") + } + reg := registry.New().SetBlockchain(blockchain) consensus, err := consensus.New( - host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), nil, decider, 3, false, + host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), reg, decider, 3, false, ) if err != nil { t.Fatalf("Cannot craeate consensus: %v", err) } - chainconfig := nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType().ChainConfig() - collection := shardchain.NewCollection( - nil, testDBFactory, &core.GenesisInitializer{NetworkType: nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType()}, engine, &chainconfig, - ) - node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil) + + node := New(host, consensus, engine, collection, nil, nil, nil, nil, nil, reg) if node.Consensus == nil { t.Error("Consensus is not initialized for the node") } diff --git a/p2p/discovery/discovery.go b/p2p/discovery/discovery.go index cf5184368..fb9591c26 100644 --- a/p2p/discovery/discovery.go +++ b/p2p/discovery/discovery.go @@ -5,11 +5,11 @@ import ( "time" "github.com/harmony-one/harmony/internal/utils" - "github.com/libp2p/go-libp2p-core/discovery" - libp2p_host "github.com/libp2p/go-libp2p-core/host" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" - libp2p_dis "github.com/libp2p/go-libp2p-discovery" libp2p_dht "github.com/libp2p/go-libp2p-kad-dht" + "github.com/libp2p/go-libp2p/core/discovery" + libp2p_host "github.com/libp2p/go-libp2p/core/host" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + libp2p_dis "github.com/libp2p/go-libp2p/p2p/discovery/routing" "github.com/rs/zerolog" ) diff --git a/p2p/discovery/discovery_test.go b/p2p/discovery/discovery_test.go index 901627bcb..6ea902375 100644 --- a/p2p/discovery/discovery_test.go +++ b/p2p/discovery/discovery_test.go @@ -3,14 +3,13 @@ package discovery // TODO: test this module import ( - "context" "testing" "github.com/libp2p/go-libp2p" ) func TestNewDHTDiscovery(t *testing.T) { - host, err := libp2p.New(context.Background()) + host, err := libp2p.New() if err != nil { t.Fatal(err) } diff --git a/p2p/gater.go b/p2p/gater.go index ce9c8d5e9..8b63b9fb7 100644 --- a/p2p/gater.go +++ b/p2p/gater.go @@ -1,11 +1,11 @@ package p2p import ( - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/control" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" libp2p_dht "github.com/libp2p/go-libp2p-kad-dht" + "github.com/libp2p/go-libp2p/core/connmgr" + "github.com/libp2p/go-libp2p/core/control" + "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" ma "github.com/multiformats/go-multiaddr" ) diff --git a/p2p/host.go b/p2p/host.go index 882317e13..a2326c812 100644 --- a/p2p/host.go +++ b/p2p/host.go @@ -12,13 +12,13 @@ import ( "time" "github.com/libp2p/go-libp2p" - libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto" - libp2p_host "github.com/libp2p/go-libp2p-core/host" - libp2p_network "github.com/libp2p/go-libp2p-core/network" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" - libp2p_peerstore "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/protocol" libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" + libp2p_crypto "github.com/libp2p/go-libp2p/core/crypto" + libp2p_host "github.com/libp2p/go-libp2p/core/host" + libp2p_network "github.com/libp2p/go-libp2p/core/network" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + libp2p_peerstore "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/libp2p/go-libp2p/core/protocol" ma "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -80,14 +80,15 @@ const ( // HostConfig is the config structure to create a new host type HostConfig struct { - Self *Peer - BLSKey libp2p_crypto.PrivKey - BootNodes []string - DataStoreFile *string - DiscConcurrency int - MaxConnPerIP int - DisablePrivateIPScan bool - MaxPeers int64 + Self *Peer + BLSKey libp2p_crypto.PrivKey + BootNodes []string + DataStoreFile *string + DiscConcurrency int + MaxConnPerIP int + DisablePrivateIPScan bool + MaxPeers int64 + WaitForEachPeerToConnect bool } func init() { @@ -117,7 +118,7 @@ func NewHost(cfg HostConfig) (Host, error) { } ctx, cancel := context.WithCancel(context.Background()) - p2pHost, err := libp2p.New(ctx, + p2pHost, err := libp2p.New( libp2p.ListenAddrs(listenAddr), libp2p.Identity(key), libp2p.EnableNATService(), diff --git a/p2p/metrics.go b/p2p/metrics.go index 120f26102..f17e92255 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -1,9 +1,9 @@ -//package p2p +// package p2p package p2p import ( eth_metrics "github.com/ethereum/go-ethereum/metrics" - "github.com/libp2p/go-libp2p-core/metrics" + "github.com/libp2p/go-libp2p/core/metrics" ) const ( diff --git a/p2p/security/security.go b/p2p/security/security.go index 02d1b963e..932f8b6e9 100644 --- a/p2p/security/security.go +++ b/p2p/security/security.go @@ -6,7 +6,7 @@ import ( "sync/atomic" "github.com/harmony-one/harmony/internal/utils" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_network "github.com/libp2p/go-libp2p/core/network" ma "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" ) diff --git a/p2p/security/security_test.go b/p2p/security/security_test.go index 3f8b66e4f..a53b2cc4d 100644 --- a/p2p/security/security_test.go +++ b/p2p/security/security_test.go @@ -7,25 +7,25 @@ import ( "time" "github.com/libp2p/go-libp2p" - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" + ic "github.com/libp2p/go-libp2p/core/crypto" + "github.com/libp2p/go-libp2p/core/host" + libp2p_network "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" ma "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/assert" ) -type ConnectCallback func(net network.Network, conn network.Conn) error -type DisconnectCallback func(conn network.Conn) error +type ConnectCallback func(net libp2p_network.Network, conn libp2p_network.Conn) error +type DisconnectCallback func(conn libp2p_network.Conn) error type fakeHost struct { onConnections []ConnectCallback onDisconnects []DisconnectCallback } -func (fh *fakeHost) Listen(network.Network, ma.Multiaddr) {} -func (fh *fakeHost) ListenClose(network.Network, ma.Multiaddr) {} -func (fh *fakeHost) Connected(net network.Network, conn network.Conn) { +func (fh *fakeHost) Listen(libp2p_network.Network, ma.Multiaddr) {} +func (fh *fakeHost) ListenClose(libp2p_network.Network, ma.Multiaddr) {} +func (fh *fakeHost) Connected(net libp2p_network.Network, conn libp2p_network.Conn) { for _, function := range fh.onConnections { if err := function(net, conn); err != nil { fmt.Println("failed on peer connected callback") @@ -33,7 +33,7 @@ func (fh *fakeHost) Connected(net network.Network, conn network.Conn) { } } -func (fh *fakeHost) Disconnected(net network.Network, conn network.Conn) { +func (fh *fakeHost) Disconnected(net libp2p_network.Network, conn libp2p_network.Conn) { for _, function := range fh.onDisconnects { if err := function(conn); err != nil { fmt.Println("failed on peer disconnected callback") @@ -41,8 +41,8 @@ func (fh *fakeHost) Disconnected(net network.Network, conn network.Conn) { } } -func (mh *fakeHost) OpenedStream(network.Network, network.Stream) {} -func (mh *fakeHost) ClosedStream(network.Network, network.Stream) {} +func (mh *fakeHost) OpenedStream(libp2p_network.Network, libp2p_network.Stream) {} +func (mh *fakeHost) ClosedStream(libp2p_network.Network, libp2p_network.Stream) {} func (mh *fakeHost) SetConnectCallback(callback ConnectCallback) { mh.onConnections = append(mh.onConnections, callback) } @@ -135,7 +135,7 @@ func newPeer(port int) (host.Host, error) { } listenAddr := fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port) - host, err := libp2p.New(context.Background(), libp2p.ListenAddrStrings(listenAddr), libp2p.DisableRelay(), libp2p.Identity(priv), libp2p.NoSecurity) + host, err := libp2p.New(libp2p.ListenAddrStrings(listenAddr), libp2p.DisableRelay(), libp2p.Identity(priv), libp2p.NoSecurity) if err != nil { return nil, err } @@ -145,20 +145,25 @@ func newPeer(port int) (host.Host, error) { type fakeConn struct{} -func (conn *fakeConn) Close() error { return nil } -func (conn *fakeConn) LocalPeer() peer.ID { return "" } -func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil } -func (conn *fakeConn) RemotePeer() peer.ID { return "" } -func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil } +func (conn *fakeConn) ID() string { return "" } +func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil } +func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil } +func (conn *fakeConn) Close() error { return nil } +func (conn *fakeConn) LocalPeer() peer.ID { return "" } +func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil } +func (conn *fakeConn) RemotePeer() peer.ID { return "" } +func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil } +func (conn *fakeConn) ConnState() libp2p_network.ConnectionState { + return libp2p_network.ConnectionState{} +} func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil } func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { addr, _ := ma.NewMultiaddr("/ip6/fe80::7802:31ff:fee9:c093/tcp/50550") return addr } -func (conn *fakeConn) ID() string { return "" } -func (conn *fakeConn) NewStream(context.Context) (network.Stream, error) { return nil, nil } -func (conn *fakeConn) GetStreams() []network.Stream { return nil } -func (conn *fakeConn) Stat() network.Stat { return network.Stat{} } +func (conn *fakeConn) Stat() libp2p_network.ConnStats { return libp2p_network.ConnStats{} } +func (conn *fakeConn) Scope() libp2p_network.ConnScope { return nil } + func TestGetRemoteIP(t *testing.T) { ip, err := getRemoteIP(&fakeConn{}) assert.Nil(t, err) diff --git a/p2p/stream/common/streammanager/cooldown.go b/p2p/stream/common/streammanager/cooldown.go index 44cac3a34..0f837c01d 100644 --- a/p2p/stream/common/streammanager/cooldown.go +++ b/p2p/stream/common/streammanager/cooldown.go @@ -4,7 +4,7 @@ import ( "container/list" "time" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" "github.com/whyrusleeping/timecache" ) diff --git a/p2p/stream/common/streammanager/interface.go b/p2p/stream/common/streammanager/interface.go index e6659cf65..ab0a916f6 100644 --- a/p2p/stream/common/streammanager/interface.go +++ b/p2p/stream/common/streammanager/interface.go @@ -6,9 +6,9 @@ import ( "github.com/ethereum/go-ethereum/event" sttypes "github.com/harmony-one/harmony/p2p/stream/types" p2ptypes "github.com/harmony-one/harmony/p2p/types" - "github.com/libp2p/go-libp2p-core/network" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p/core/network" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" ) // StreamManager is the interface for streamManager diff --git a/p2p/stream/common/streammanager/interface_test.go b/p2p/stream/common/streammanager/interface_test.go index ed3aa28a1..fc280b47e 100644 --- a/p2p/stream/common/streammanager/interface_test.go +++ b/p2p/stream/common/streammanager/interface_test.go @@ -8,9 +8,9 @@ import ( "sync/atomic" sttypes "github.com/harmony-one/harmony/p2p/stream/types" - "github.com/libp2p/go-libp2p-core/network" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p/core/network" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" ) var _ StreamManager = &streamManager{} diff --git a/p2p/stream/common/streammanager/streammanager.go b/p2p/stream/common/streammanager/streammanager.go index 743f1c87c..4b3d19b92 100644 --- a/p2p/stream/common/streammanager/streammanager.go +++ b/p2p/stream/common/streammanager/streammanager.go @@ -10,9 +10,9 @@ import ( "github.com/harmony-one/abool" "github.com/harmony-one/harmony/internal/utils" sttypes "github.com/harmony-one/harmony/p2p/stream/types" - "github.com/libp2p/go-libp2p-core/network" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p/core/network" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" diff --git a/p2p/stream/common/streammanager/streammanager_test.go b/p2p/stream/common/streammanager/streammanager_test.go index 2f5e4bf20..5d82c8585 100644 --- a/p2p/stream/common/streammanager/streammanager_test.go +++ b/p2p/stream/common/streammanager/streammanager_test.go @@ -9,7 +9,7 @@ import ( "time" sttypes "github.com/harmony-one/harmony/p2p/stream/types" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" ) const ( diff --git a/p2p/stream/protocols/sync/protocol.go b/p2p/stream/protocols/sync/protocol.go index 36b3b15c0..facdf601d 100644 --- a/p2p/stream/protocols/sync/protocol.go +++ b/p2p/stream/protocols/sync/protocol.go @@ -16,8 +16,8 @@ import ( "github.com/harmony-one/harmony/p2p/stream/common/streammanager" sttypes "github.com/harmony-one/harmony/p2p/stream/types" "github.com/hashicorp/go-version" - libp2p_host "github.com/libp2p/go-libp2p-core/host" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_host "github.com/libp2p/go-libp2p/core/host" + libp2p_network "github.com/libp2p/go-libp2p/core/network" "github.com/rs/zerolog" ) diff --git a/p2p/stream/protocols/sync/protocol_test.go b/p2p/stream/protocols/sync/protocol_test.go index df6768195..aff6691ec 100644 --- a/p2p/stream/protocols/sync/protocol_test.go +++ b/p2p/stream/protocols/sync/protocol_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/libp2p/go-libp2p-core/discovery" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/discovery" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" ) func TestProtocol_Match(t *testing.T) { diff --git a/p2p/stream/protocols/sync/stream.go b/p2p/stream/protocols/sync/stream.go index 5c0db6fa9..0af4fff7c 100644 --- a/p2p/stream/protocols/sync/stream.go +++ b/p2p/stream/protocols/sync/stream.go @@ -12,7 +12,7 @@ import ( protobuf "github.com/golang/protobuf/proto" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" sttypes "github.com/harmony-one/harmony/p2p/stream/types" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_network "github.com/libp2p/go-libp2p/core/network" "github.com/pkg/errors" "github.com/rs/zerolog" ) diff --git a/p2p/stream/protocols/sync/stream_test.go b/p2p/stream/protocols/sync/stream_test.go index 3c8890356..a9aae57fa 100644 --- a/p2p/stream/protocols/sync/stream_test.go +++ b/p2p/stream/protocols/sync/stream_test.go @@ -10,10 +10,10 @@ import ( protobuf "github.com/golang/protobuf/proto" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" sttypes "github.com/harmony-one/harmony/p2p/stream/types" - ic "github.com/libp2p/go-libp2p-core/crypto" - libp2p_network "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" + ic "github.com/libp2p/go-libp2p/core/crypto" + libp2p_network "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" ma "github.com/multiformats/go-multiaddr" ) @@ -195,18 +195,19 @@ func (st *testP2PStream) receiveBytes(b []byte) (n int, err error) { return } -func (st *testP2PStream) Close() error { return nil } -func (st *testP2PStream) CloseRead() error { return nil } -func (st *testP2PStream) CloseWrite() error { return nil } -func (st *testP2PStream) Reset() error { return nil } -func (st *testP2PStream) SetDeadline(time.Time) error { return nil } -func (st *testP2PStream) SetReadDeadline(time.Time) error { return nil } -func (st *testP2PStream) SetWriteDeadline(time.Time) error { return nil } -func (st *testP2PStream) ID() string { return "" } -func (st *testP2PStream) Protocol() protocol.ID { return "" } -func (st *testP2PStream) SetProtocol(protocol.ID) {} -func (st *testP2PStream) Stat() libp2p_network.Stat { return libp2p_network.Stat{} } -func (st *testP2PStream) Conn() libp2p_network.Conn { return &fakeConn{} } +func (st *testP2PStream) Close() error { return nil } +func (st *testP2PStream) CloseRead() error { return nil } +func (st *testP2PStream) CloseWrite() error { return nil } +func (st *testP2PStream) Reset() error { return nil } +func (st *testP2PStream) SetDeadline(time.Time) error { return nil } +func (st *testP2PStream) SetReadDeadline(time.Time) error { return nil } +func (st *testP2PStream) SetWriteDeadline(time.Time) error { return nil } +func (st *testP2PStream) ID() string { return "" } +func (st *testP2PStream) Protocol() protocol.ID { return "" } +func (st *testP2PStream) SetProtocol(protocol.ID) error { return nil } +func (st *testP2PStream) Stat() libp2p_network.Stats { return libp2p_network.Stats{} } +func (st *testP2PStream) Conn() libp2p_network.Conn { return &fakeConn{} } +func (st *testP2PStream) Scope() libp2p_network.StreamScope { return nil } type testRemoteBaseStream struct { base *sttypes.BaseStream @@ -229,14 +230,18 @@ func (st *testRemoteBaseStream) WriteBytes(b []byte) error { type fakeConn struct{} +func (conn *fakeConn) ID() string { return "" } +func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil } +func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil } func (conn *fakeConn) Close() error { return nil } func (conn *fakeConn) LocalPeer() peer.ID { return "" } func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil } func (conn *fakeConn) RemotePeer() peer.ID { return "" } func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil } -func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil } -func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { return nil } -func (conn *fakeConn) ID() string { return "" } -func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil } -func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil } -func (conn *fakeConn) Stat() libp2p_network.Stat { return libp2p_network.Stat{} } +func (conn *fakeConn) ConnState() libp2p_network.ConnectionState { + return libp2p_network.ConnectionState{} +} +func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil } +func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { return nil } +func (conn *fakeConn) Stat() libp2p_network.ConnStats { return libp2p_network.ConnStats{} } +func (conn *fakeConn) Scope() libp2p_network.ConnScope { return nil } diff --git a/p2p/stream/types/interface.go b/p2p/stream/types/interface.go index 6001c3dba..424382cc8 100644 --- a/p2p/stream/types/interface.go +++ b/p2p/stream/types/interface.go @@ -3,7 +3,7 @@ package sttypes import ( p2ptypes "github.com/harmony-one/harmony/p2p/types" "github.com/hashicorp/go-version" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_network "github.com/libp2p/go-libp2p/core/network" ) // Protocol is the interface of protocol to be registered to libp2p. diff --git a/p2p/stream/types/stream.go b/p2p/stream/types/stream.go index dc7e42a60..3abdf4f52 100644 --- a/p2p/stream/types/stream.go +++ b/p2p/stream/types/stream.go @@ -6,7 +6,7 @@ import ( "io" "sync" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_network "github.com/libp2p/go-libp2p/core/network" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" ) diff --git a/p2p/stream/types/utils.go b/p2p/stream/types/utils.go index 3d92368ef..8acc38f40 100644 --- a/p2p/stream/types/utils.go +++ b/p2p/stream/types/utils.go @@ -11,7 +11,7 @@ import ( nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/hashicorp/go-version" - libp2p_proto "github.com/libp2p/go-libp2p-core/protocol" + libp2p_proto "github.com/libp2p/go-libp2p/core/protocol" "github.com/pkg/errors" ) diff --git a/p2p/types/peerAddr.go b/p2p/types/peerAddr.go index 724a37269..b14bed2d3 100644 --- a/p2p/types/peerAddr.go +++ b/p2p/types/peerAddr.go @@ -6,7 +6,7 @@ import ( "strings" "time" - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" ma "github.com/multiformats/go-multiaddr" madns "github.com/multiformats/go-multiaddr-dns" ) diff --git a/p2p/types/types.go b/p2p/types/types.go index 03a3c843e..515ab997c 100644 --- a/p2p/types/types.go +++ b/p2p/types/types.go @@ -1,7 +1,7 @@ package p2ptypes import ( - libp2p_peer "github.com/libp2p/go-libp2p-core/peer" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" ) // PeerID is the alias for libp2p peer ID diff --git a/p2p/utils_test.go b/p2p/utils_test.go index 7d0ead3ea..3616b04db 100644 --- a/p2p/utils_test.go +++ b/p2p/utils_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - libp2p_network "github.com/libp2p/go-libp2p-core/network" + libp2p_network "github.com/libp2p/go-libp2p/core/network" "github.com/stretchr/testify/require" ) diff --git a/rosetta/infra/harmony-mainnet.conf b/rosetta/infra/harmony-mainnet.conf index b2000fd4d..534b80887 100644 --- a/rosetta/infra/harmony-mainnet.conf +++ b/rosetta/infra/harmony-mainnet.conf @@ -1,4 +1,4 @@ -Version = "2.5.8" +Version = "2.5.9" [BLSKeys] KMSConfigFile = "" @@ -100,6 +100,7 @@ Version = "2.5.8" DiscHighCap = 128 DiscSoftLowCap = 8 Downloader = false + StagedSync = false Enabled = false InitStreams = 8 MinPeers = 5 diff --git a/rosetta/infra/harmony-pstn.conf b/rosetta/infra/harmony-pstn.conf index 18d083052..ed4c116c6 100644 --- a/rosetta/infra/harmony-pstn.conf +++ b/rosetta/infra/harmony-pstn.conf @@ -1,4 +1,4 @@ -Version = "2.5.8" +Version = "2.5.9" [BLSKeys] KMSConfigFile = "" @@ -100,6 +100,7 @@ Version = "2.5.8" DiscHighCap = 128 DiscSoftLowCap = 8 Downloader = false + StagedSync = false Enabled = false InitStreams = 8 MinPeers = 2 diff --git a/rosetta/services/network.go b/rosetta/services/network.go index c15047e48..75ac52614 100644 --- a/rosetta/services/network.go +++ b/rosetta/services/network.go @@ -9,7 +9,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/server" "github.com/coinbase/rosetta-sdk-go/types" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" "github.com/harmony-one/harmony/block" "github.com/harmony-one/harmony/eth/rpc" diff --git a/rosetta/services/network_test.go b/rosetta/services/network_test.go index 3a7819b98..3145df42c 100644 --- a/rosetta/services/network_test.go +++ b/rosetta/services/network_test.go @@ -9,7 +9,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" "github.com/harmony-one/harmony/rosetta/common" commonRPC "github.com/harmony-one/harmony/rpc/common" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) func TestErrors(t *testing.T) { diff --git a/rpc/common/types.go b/rpc/common/types.go index 3fc514429..98819f693 100644 --- a/rpc/common/types.go +++ b/rpc/common/types.go @@ -7,7 +7,7 @@ import ( nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/harmony-one/harmony/internal/params" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // BlockArgs is struct to include optional block formatting params. diff --git a/scripts/go_executable_build.sh b/scripts/go_executable_build.sh index f5984c7dd..2c1cc99f0 100755 --- a/scripts/go_executable_build.sh +++ b/scripts/go_executable_build.sh @@ -41,9 +41,9 @@ if [ "$(uname -s)" == "Darwin" ]; then GOOS=darwin LIB[libbls384_256.dylib]=${BLS_DIR}/lib/libbls384_256.dylib LIB[libmcl.dylib]=${MCL_DIR}/lib/libmcl.dylib - LIB[libgmp.10.dylib]=/usr/local/opt/gmp/lib/libgmp.10.dylib - LIB[libgmpxx.4.dylib]=/usr/local/opt/gmp/lib/libgmpxx.4.dylib - LIB[libcrypto.1.1.dylib]=/usr/local/opt/openssl/lib/libcrypto.1.1.dylib + LIB[libgmp.10.dylib]=/opt/homebrew/opt/gmp/lib/libgmp.10.dylib + LIB[libgmpxx.4.dylib]=/opt/homebrew/opt/gmp/lib/libgmpxx.4.dylib + LIB[libcrypto.1.1.dylib]=/opt/homebrew/opt/openssl@1.1/lib/libcrypto.1.1.dylib else MD5=md5sum LIB[libbls384_256.so]=${BLS_DIR}/lib/libbls384_256.so diff --git a/scripts/setup_bls_build_flags.sh b/scripts/setup_bls_build_flags.sh index 9af1ca121..92ee20579 100644 --- a/scripts/setup_bls_build_flags.sh +++ b/scripts/setup_bls_build_flags.sh @@ -19,7 +19,7 @@ case "${HMY_PATH+set}" in fi ;; esac -: ${OPENSSL_DIR="/usr/local/opt/openssl"} +: ${OPENSSL_DIR="/opt/homebrew/opt/openssl@1.1"} : ${MCL_DIR="${HMY_PATH}/mcl"} : ${BLS_DIR="${HMY_PATH}/bls"} export CGO_CFLAGS="-I${BLS_DIR}/include -I${MCL_DIR}/include" diff --git a/staking/slash/double-sign.go b/staking/slash/double-sign.go index cd26214b6..6c871f992 100644 --- a/staking/slash/double-sign.go +++ b/staking/slash/double-sign.go @@ -1,7 +1,6 @@ package slash import ( - "bytes" "encoding/hex" "encoding/json" "math/big" @@ -10,10 +9,8 @@ import ( "github.com/harmony-one/harmony/shard" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" bls_core "github.com/harmony-one/bls/ffi/go/bls" consensus_sig "github.com/harmony-one/harmony/consensus/signature" - "github.com/harmony-one/harmony/consensus/votepower" "github.com/harmony-one/harmony/core/state" "github.com/harmony-one/harmony/crypto/hash" common2 "github.com/harmony-one/harmony/internal/common" @@ -24,33 +21,6 @@ import ( "github.com/pkg/errors" ) -// invariant assumes snapshot, current can be rlp.EncodeToBytes -func payDebt( - snapshot, current *staking.ValidatorWrapper, - slashDebt, payment *big.Int, - slashDiff *Application, -) error { - utils.Logger().Info(). - RawJSON("snapshot", []byte(snapshot.String())). - RawJSON("current", []byte(current.String())). - Uint64("slash-debt", slashDebt.Uint64()). - Uint64("payment", payment.Uint64()). - RawJSON("slash-track", []byte(slashDiff.String())). - Msg("slash debt payment before application") - slashDiff.TotalSlashed.Add(slashDiff.TotalSlashed, payment) - slashDebt.Sub(slashDebt, payment) - if slashDebt.Cmp(common.Big0) == -1 { - x1, _ := rlp.EncodeToBytes(snapshot) - x2, _ := rlp.EncodeToBytes(current) - utils.Logger().Info(). - Str("snapshot-rlp", hex.EncodeToString(x1)). - Str("current-rlp", hex.EncodeToString(x2)). - Msg("slashdebt balance cannot go below zero") - return errSlashDebtCannotBeNegative - } - return nil -} - // Moment .. type Moment struct { Epoch *big.Int `json:"epoch"` @@ -130,7 +100,7 @@ func (r Record) MarshalJSON() ([]byte, error) { common2.MustAddressToBech32(r.Evidence.Offender) return json.Marshal(struct { Evidence Evidence `json:"evidence"` - Beneficiary string `json:"beneficiary"` + Reporter string `json:"reporter"` AddressForBLSKey string `json:"offender"` }{r.Evidence, reporter, offender}) } @@ -302,7 +272,7 @@ var ( oneDoubleSignerRate = numeric.MustNewDecFromStr("0.02") ) -// applySlashRate returns (amountPostSlash, amountOfReduction, amountOfReduction / 2) +// applySlashRate applies a decimal percentage to a bigInt value func applySlashRate(amount *big.Int, rate numeric.Dec) *big.Int { return numeric.NewDecFromBigInt( amount, @@ -334,149 +304,147 @@ func (r Records) SetDifference(ys Records) Records { return diff } -func payDownAsMuchAsCan( - snapshot, current *staking.ValidatorWrapper, - slashDebt, nowAmt *big.Int, - slashDiff *Application, -) error { - if nowAmt.Cmp(common.Big0) == 1 && slashDebt.Cmp(common.Big0) == 1 { - // 0.50_amount > 0.06_debt => slash == 0.0, nowAmt == 0.44 - if nowAmt.Cmp(slashDebt) >= 0 { - nowAmt.Sub(nowAmt, slashDebt) - if err := payDebt( - snapshot, current, slashDebt, slashDebt, slashDiff, - ); err != nil { - return err - } - } else { - // 0.50_amount < 2.4_debt =>, slash == 1.9, nowAmt == 0.0 - if err := payDebt( - snapshot, current, slashDebt, nowAmt, slashDiff, - ); err != nil { - return err - } - nowAmt.Sub(nowAmt, nowAmt) - } +func payDownByDelegationStaked( + delegation *staking.Delegation, + slashDebt, totalSlashed *big.Int, +) { + payDown(delegation.Amount, slashDebt, totalSlashed) +} + +func payDownByUndelegation( + undelegation *staking.Undelegation, + slashDebt, totalSlashed *big.Int, +) { + payDown(undelegation.Amount, slashDebt, totalSlashed) +} + +func payDownByReward( + delegation *staking.Delegation, + slashDebt, totalSlashed *big.Int, +) { + payDown(delegation.Reward, slashDebt, totalSlashed) +} + +func payDown( + balance, debt, totalSlashed *big.Int, +) { + slashAmount := new(big.Int).Set(debt) + if balance.Cmp(debt) < 0 { + slashAmount.Set(balance) } + balance.Sub(balance, slashAmount) + debt.Sub(debt, slashAmount) + totalSlashed.Add(totalSlashed, slashAmount) +} - return nil +func makeSlashList(snapshot, current *staking.ValidatorWrapper) ([][2]int, *big.Int) { + slashIndexPairs := make([][2]int, 0, len(snapshot.Delegations)) + slashDelegations := make(map[common.Address]int, len(snapshot.Delegations)) + totalStake := big.NewInt(0) + for index, delegation := range snapshot.Delegations { + slashDelegations[delegation.DelegatorAddress] = index + totalStake.Add(totalStake, delegation.Amount) + } + for index, delegation := range current.Delegations { + if oldIndex, exist := slashDelegations[delegation.DelegatorAddress]; exist { + slashIndexPairs = append(slashIndexPairs, [2]int{oldIndex, index}) + } + } + return slashIndexPairs, totalStake } +// delegatorSlashApply applies slashing to all delegators including the validator. +// The validator’s self-owned stake is slashed by 50%. +// The stake of external delegators is slashed by 80% of the leader’s self-owned slashed stake, each one proportionally to their stake. func delegatorSlashApply( snapshot, current *staking.ValidatorWrapper, - rate numeric.Dec, state *state.DB, rewardBeneficiary common.Address, doubleSignEpoch *big.Int, slashTrack *Application, ) error { + // First delegation is validator's own stake + validatorDebt := new(big.Int).Div(snapshot.Delegations[0].Amount, common.Big2) + return delegatorSlashApplyDebt(snapshot, current, state, validatorDebt, rewardBeneficiary, doubleSignEpoch, slashTrack) +} - for _, delegationSnapshot := range snapshot.Delegations { - slashDebt := applySlashRate(delegationSnapshot.Amount, rate) - slashDiff := &Application{big.NewInt(0), big.NewInt(0)} - snapshotAddr := delegationSnapshot.DelegatorAddress - for i := range current.Delegations { - delegationNow := current.Delegations[i] - if nowAmt := delegationNow.Amount; delegationNow.DelegatorAddress == snapshotAddr { - utils.Logger().Info(). - RawJSON("delegation-snapshot", []byte(delegationSnapshot.String())). - RawJSON("delegation-current", []byte(delegationNow.String())). - Uint64("initial-slash-debt", slashDebt.Uint64()). - Str("rate", rate.String()). - Msg("attempt to apply slashing based on snapshot amount to current state") - // Current delegation has some money and slashdebt is still not paid off - // so contribute as much as can with current delegation amount - if err := payDownAsMuchAsCan( - snapshot, current, slashDebt, nowAmt, slashDiff, - ); err != nil { - return err - } - - // NOTE Assume did as much as could above, now check the undelegations - for i := range delegationNow.Undelegations { - undelegate := delegationNow.Undelegations[i] - // the epoch matters, only those undelegation - // such that epoch>= doubleSignEpoch should be slashable - if undelegate.Epoch.Cmp(doubleSignEpoch) >= 0 { - if slashDebt.Cmp(common.Big0) <= 0 { - utils.Logger().Info(). - RawJSON("delegation-snapshot", []byte(delegationSnapshot.String())). - RawJSON("delegation-current", []byte(delegationNow.String())). - Msg("paid off the slash debt") - break - } - nowAmt := undelegate.Amount - if err := payDownAsMuchAsCan( - snapshot, current, slashDebt, nowAmt, slashDiff, - ); err != nil { - return err - } - - if nowAmt.Cmp(common.Big0) == 0 { - utils.Logger().Info(). - RawJSON("delegation-snapshot", []byte(delegationSnapshot.String())). - RawJSON("delegation-current", []byte(delegationNow.String())). - Msg("delegation amount after paying slash debt is 0") - } - } - } - - // if we still have a slashdebt - // even after taking away from delegation amount - // and even after taking away from undelegate, - // then we need to take from their pending rewards - if slashDebt.Cmp(common.Big0) == 1 { - nowAmt := delegationNow.Reward - utils.Logger().Info(). - RawJSON("delegation-snapshot", []byte(delegationSnapshot.String())). - RawJSON("delegation-current", []byte(delegationNow.String())). - Uint64("slash-debt", slashDebt.Uint64()). - Uint64("now-amount-reward", nowAmt.Uint64()). - Msg("needed to dig into reward to pay off slash debt") - if err := payDownAsMuchAsCan( - snapshot, current, slashDebt, nowAmt, slashDiff, - ); err != nil { - return err - } - } - - // NOTE only need to pay beneficiary here, - // they only get half of what was actually dispersed - halfOfSlashDebt := new(big.Int).Div(slashDiff.TotalSlashed, common.Big2) - slashDiff.TotalBeneficiaryReward.Add(slashDiff.TotalBeneficiaryReward, halfOfSlashDebt) - utils.Logger().Info(). - RawJSON("delegation-snapshot", []byte(delegationSnapshot.String())). - RawJSON("delegation-current", []byte(delegationNow.String())). - Uint64("beneficiary-reward", halfOfSlashDebt.Uint64()). - RawJSON("application", []byte(slashDiff.String())). - Msg("completed an application of slashing") - state.AddBalance(rewardBeneficiary, halfOfSlashDebt) - slashTrack.TotalBeneficiaryReward.Add( - slashTrack.TotalBeneficiaryReward, slashDiff.TotalBeneficiaryReward, - ) - slashTrack.TotalSlashed.Add( - slashTrack.TotalSlashed, slashDiff.TotalSlashed, - ) - } +// delegatorSlashApply applies slashing to all delegators including the validator. +// The validator’s self-owned stake is slashed by 50%. +// The stake of external delegators is slashed by 80% of the leader’s self-owned slashed stake, each one proportionally to their stake. +func delegatorSlashApplyDebt( + snapshot, current *staking.ValidatorWrapper, + state *state.DB, + validatorDebt *big.Int, + rewardBeneficiary common.Address, + doubleSignEpoch *big.Int, + slashTrack *Application, +) error { + slashIndexPairs, totalStake := makeSlashList(snapshot, current) + validatorDelegation := ¤t.Delegations[0] + totalExternalStake := new(big.Int).Sub(totalStake, validatorDelegation.Amount) + validatorSlashed := applySlashingToDelegation(validatorDelegation, state, rewardBeneficiary, doubleSignEpoch, validatorDebt) + totalSlahsed := new(big.Int).Set(validatorSlashed) + // External delegators + + aggregateDebt := applySlashRate(validatorSlashed, numeric.MustNewDecFromStr("0.8")) + + for _, indexPair := range slashIndexPairs[1:] { + snapshotIndex := indexPair[0] + currentIndex := indexPair[1] + delegationSnapshot := snapshot.Delegations[snapshotIndex] + delegationCurrent := ¤t.Delegations[currentIndex] + // A*(B/C) => (A*B)/C + // slashDebt = aggregateDebt*(Amount/totalExternalStake) + slashDebt := new(big.Int).Mul(delegationSnapshot.Amount, aggregateDebt) + slashDebt.Div(slashDebt, totalExternalStake) + + slahsed := applySlashingToDelegation(delegationCurrent, state, rewardBeneficiary, doubleSignEpoch, slashDebt) + totalSlahsed.Add(totalSlahsed, slahsed) + } + + // finally, kick them off forever + current.Status = effective.Banned + if err := current.SanityCheck(); err != nil { + return err + } + state.UpdateValidatorWrapper(current.Address, current) + beneficiaryReward := new(big.Int).Div(totalSlahsed, common.Big2) + state.AddBalance(rewardBeneficiary, beneficiaryReward) + slashTrack.TotalBeneficiaryReward.Add(slashTrack.TotalBeneficiaryReward, beneficiaryReward) + slashTrack.TotalSlashed.Add(slashTrack.TotalSlashed, totalSlahsed) + return nil +} + +// applySlashingToDelegation applies slashing to a delegator, given the amount that should be slashed. +// Also, rewards the beneficiary half of the amount that was successfully slashed. +func applySlashingToDelegation(delegation *staking.Delegation, state *state.DB, rewardBeneficiary common.Address, doubleSignEpoch *big.Int, slashDebt *big.Int) *big.Int { + slashed := big.NewInt(0) + debtCopy := new(big.Int).Set(slashDebt) + + payDownByDelegationStaked(delegation, debtCopy, slashed) + + // NOTE Assume did as much as could above, now check the undelegations + for i := range delegation.Undelegations { + if debtCopy.Sign() == 0 { + break } - // after the loops, paid off as much as could - if slashDebt.Cmp(common.Big0) == -1 { - x1, _ := rlp.EncodeToBytes(snapshot) - x2, _ := rlp.EncodeToBytes(current) - utils.Logger().Error().Str("slash-rate", rate.String()). - Str("snapshot-rlp", hex.EncodeToString(x1)). - Str("current-rlp", hex.EncodeToString(x2)). - Msg("slash debt not paid off") - return errors.Wrapf(errSlashDebtCannotBeNegative, "amt %v", slashDebt) + undelegation := &delegation.Undelegations[i] + // the epoch matters, only those undelegation + // such that epoch>= doubleSignEpoch should be slashable + if undelegation.Epoch.Cmp(doubleSignEpoch) >= 0 { + payDownByUndelegation(undelegation, debtCopy, slashed) } } - return nil + if debtCopy.Sign() == 1 { + payDownByReward(delegation, debtCopy, slashed) + } + return slashed } // Apply .. func Apply( chain staking.ValidatorSnapshotReader, state *state.DB, - slashes Records, rate numeric.Dec, rewardBeneficiary common.Address, + slashes Records, rewardBeneficiary common.Address, ) (*Application, error) { slashDiff := &Application{big.NewInt(0), big.NewInt(0)} for _, slash := range slashes { @@ -498,26 +466,20 @@ func Apply( errValidatorNotFoundDuringSlash, " %s ", err.Error(), ) } - // NOTE invariant: first delegation is the validators own - // stake, rest are external delegations. - // Bottom line: everyone will be slashed under the same rule. + // NOTE invariant: first delegation is the validators own stake, + // rest are external delegations. if err := delegatorSlashApply( - snapshot.Validator, current, rate, state, + snapshot.Validator, current, state, rewardBeneficiary, slash.Evidence.Epoch, slashDiff, ); err != nil { return nil, err } - // finally, kick them off forever - current.Status = effective.Banned utils.Logger().Info(). RawJSON("delegation-current", []byte(current.String())). RawJSON("slash", []byte(slash.String())). - Msg("about to update staking info for a validator after a slash") + Msg("slash applyed") - if err := current.SanityCheck(); err != nil { - return nil, err - } } return slashDiff, nil } @@ -526,39 +488,3 @@ func Apply( func IsBanned(wrapper *staking.ValidatorWrapper) bool { return wrapper.Status == effective.Banned } - -// Rate is the slashing % rate -func Rate(votingPower *votepower.Roster, records Records) numeric.Dec { - rate := numeric.ZeroDec() - - for i := range records { - doubleSignKeys := []bls.SerializedPublicKey{} - for _, pubKey1 := range records[i].Evidence.FirstVote.SignerPubKeys { - for _, pubKey2 := range records[i].Evidence.SecondVote.SignerPubKeys { - if shard.CompareBLSPublicKey(pubKey1, pubKey2) == 0 { - doubleSignKeys = append(doubleSignKeys, pubKey1) - break - } - } - } - - for _, key := range doubleSignKeys { - if card, exists := votingPower.Voters[key]; exists && - bytes.Equal(card.EarningAccount[:], records[i].Evidence.Offender[:]) { - rate = rate.Add(card.GroupPercent) - } else { - utils.Logger().Debug(). - RawJSON("roster", []byte(votingPower.String())). - RawJSON("double-sign-record", []byte(records[i].String())). - Msg("did not have offenders voter card in roster as expected") - } - } - - } - - if rate.LT(oneDoubleSignerRate) { - rate = oneDoubleSignerRate - } - - return rate -} diff --git a/staking/slash/double-sign_test.go b/staking/slash/double-sign_test.go index 265b38106..7dbd3ed70 100644 --- a/staking/slash/double-sign_test.go +++ b/staking/slash/double-sign_test.go @@ -16,7 +16,6 @@ import ( bls_core "github.com/harmony-one/bls/ffi/go/bls" blockfactory "github.com/harmony-one/harmony/block/factory" consensus_sig "github.com/harmony-one/harmony/consensus/signature" - "github.com/harmony-one/harmony/consensus/votepower" "github.com/harmony-one/harmony/core/state" "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/internal/params" @@ -35,6 +34,8 @@ var ( thirtyKOnes = new(big.Int).Mul(big.NewInt(30000), bigOne) thirtyFiveKOnes = new(big.Int).Mul(big.NewInt(35000), bigOne) fourtyKOnes = new(big.Int).Mul(big.NewInt(40000), bigOne) + fiftyKOnes = new(big.Int).Mul(big.NewInt(50000), bigOne) + hundredKOnes = new(big.Int).Mul(big.NewInt(100000), bigOne) thousandKOnes = new(big.Int).Mul(big.NewInt(1000000), bigOne) ) @@ -307,7 +308,7 @@ func makeSimpleRecords(indexes []int) Records { return rs } -func TestPayDownAsMuchAsCan(t *testing.T) { +func TestPayDown(t *testing.T) { tests := []struct { debt, amt *big.Int diff *Application @@ -346,17 +347,7 @@ func TestPayDownAsMuchAsCan(t *testing.T) { }, } for i, test := range tests { - vwSnap := defaultValidatorWrapper() - vwCur := defaultCurrentValidatorWrapper() - - err := payDownAsMuchAsCan(vwSnap, vwCur, test.debt, test.amt, test.diff) - if assErr := assertError(err, test.expErr); assErr != nil { - t.Errorf("Test %v: %v", i, assErr) - } - if err != nil || test.expErr != nil { - continue - } - + payDown(test.amt, test.debt, test.diff.TotalSlashed) if test.debt.Cmp(test.expDebt) != 0 { t.Errorf("Test %v: unexpected debt %v / %v", i, test.debt, test.expDebt) } @@ -374,104 +365,275 @@ func TestPayDownAsMuchAsCan(t *testing.T) { } } +func TestApplySlashingToDelegator(t *testing.T) { + tests := []applySlashingToDelegatorTestCase{ + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: big.NewInt(0), + expDel: expDelegation{ + expAmt: twentyKOnes, + expReward: tenKOnes, + expUndelAmt: []*big.Int{tenKOnes, tenKOnes}, + }, + expSlashed: common.Big0, + expBeneficiaryReward: common.Big0, + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: twentyKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: tenKOnes, + expUndelAmt: []*big.Int{tenKOnes, tenKOnes}, + }, + expSlashed: twentyKOnes, + expBeneficiaryReward: tenKOnes, + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: twentyFiveKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: tenKOnes, + expUndelAmt: []*big.Int{tenKOnes, fiveKOnes}, + }, + expSlashed: twentyFiveKOnes, + expBeneficiaryReward: new(big.Int).Div(twentyFiveKOnes, common.Big2), + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: thirtyKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: tenKOnes, + expUndelAmt: []*big.Int{tenKOnes, big.NewInt(0)}, + }, + expSlashed: thirtyKOnes, + expBeneficiaryReward: new(big.Int).Div(thirtyKOnes, common.Big2), + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: thirtyFiveKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: fiveKOnes, + expUndelAmt: []*big.Int{tenKOnes, big.NewInt(0)}, + }, + expSlashed: thirtyFiveKOnes, + expBeneficiaryReward: new(big.Int).Div(thirtyFiveKOnes, common.Big2), + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: fourtyKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: big.NewInt(0), + expUndelAmt: []*big.Int{tenKOnes, big.NewInt(0)}, + }, + expSlashed: fourtyKOnes, + expBeneficiaryReward: twentyKOnes, + }, + { + snapshot: defaultSnapValidatorWrapper(), + current: defaultCurrentValidatorWrapper(), + delegationIdx: 0, + debt: fiftyKOnes, + expDel: expDelegation{ + expAmt: big.NewInt(0), + expReward: big.NewInt(0), + expUndelAmt: []*big.Int{tenKOnes, big.NewInt(0)}, + }, + expSlashed: fourtyKOnes, + expBeneficiaryReward: twentyKOnes, + }, + } + for i, tc := range tests { + tc.makeData() + tc.apply() + + if err := tc.checkResult(); err != nil { + t.Errorf("Test %v: %v", i, err) + } + } +} + func TestDelegatorSlashApply(t *testing.T) { tests := []slashApplyTestCase{ { - rate: numeric.ZeroDec(), - snapshot: defaultSnapValidatorWrapper(), - current: defaultCurrentValidatorWrapper(), - expDels: []expDelegation{ + snapshot: generateValidatorWrapper([]testDelegation{ { - expAmt: twentyKOnes, - expReward: tenKOnes, - expUndelAmt: []*big.Int{tenKOnes, tenKOnes}, + address: "off", + amount: fourtyKOnes, + }, + }), + current: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: fourtyKOnes, }, + }), + expDels: []expDelegation{ { - expAmt: fourtyKOnes, + expAmt: twentyKOnes, expReward: tenKOnes, expUndelAmt: []*big.Int{}, }, }, - expSlashed: common.Big0, - expBeneficiaryReward: common.Big0, + expSlashed: twentyKOnes, + expBeneficiaryReward: tenKOnes, }, { - rate: numeric.NewDecWithPrec(25, 2), - snapshot: defaultSnapValidatorWrapper(), - current: defaultCurrentValidatorWrapper(), + snapshot: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: fourtyKOnes, + }, + { + address: "del1", + amount: fourtyKOnes, + }, + }), + current: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: fourtyKOnes, + }, + { + address: "del1", + amount: fourtyKOnes, + }, + }), expDels: []expDelegation{ { - expAmt: tenKOnes, + expAmt: twentyKOnes, expReward: tenKOnes, - expUndelAmt: []*big.Int{tenKOnes, tenKOnes}, + expUndelAmt: []*big.Int{}, }, { - expAmt: fourtyKOnes, + expAmt: new(big.Int).Mul(big.NewInt(24000), bigOne), expReward: tenKOnes, expUndelAmt: []*big.Int{}, }, }, - expSlashed: tenKOnes, - expBeneficiaryReward: fiveKOnes, + expSlashed: new(big.Int).Mul(big.NewInt(36000), bigOne), + expBeneficiaryReward: new(big.Int).Mul(big.NewInt(18000), bigOne), }, { - rate: numeric.NewDecWithPrec(625, 3), - snapshot: defaultSnapValidatorWrapper(), - current: defaultCurrentValidatorWrapper(), + snapshot: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: fiftyKOnes, + }, + { + address: "del1", + amount: fourtyKOnes, + }, + { + address: "del2", + amount: tenKOnes, + }, + }), + current: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: fiftyKOnes, + }, + { + address: "del1", + amount: fourtyKOnes, + }, + { + address: "del2", + amount: tenKOnes, + }, + }), expDels: []expDelegation{ { - expAmt: common.Big0, + expAmt: twentyFiveKOnes, expReward: tenKOnes, - expUndelAmt: []*big.Int{tenKOnes, fiveKOnes}, + expUndelAmt: []*big.Int{}, }, { - expAmt: fourtyKOnes, + expAmt: new(big.Int).Mul(big.NewInt(24000), bigOne), + expReward: tenKOnes, + expUndelAmt: []*big.Int{}, + }, + { + expAmt: new(big.Int).Mul(big.NewInt(6000), bigOne), expReward: tenKOnes, expUndelAmt: []*big.Int{}, }, }, - expSlashed: twentyFiveKOnes, - expBeneficiaryReward: new(big.Int).Div(twentyFiveKOnes, common.Big2), + expSlashed: new(big.Int).Mul(big.NewInt(45000), bigOne), + expBeneficiaryReward: new(big.Int).Mul(big.NewInt(22500), bigOne), }, { - rate: numeric.NewDecWithPrec(875, 3), - snapshot: defaultSnapValidatorWrapper(), - current: defaultCurrentValidatorWrapper(), - expDels: []expDelegation{ + snapshot: generateValidatorWrapper([]testDelegation{ { - expAmt: common.Big0, - expReward: fiveKOnes, - expUndelAmt: []*big.Int{tenKOnes, common.Big0}, + address: "off", + amount: hundredKOnes, + }, + { + address: "del1", + amount: twentyKOnes, + }, + { + address: "del2", + amount: twentyKOnes, + }, + }), + current: generateValidatorWrapper([]testDelegation{ + { + address: "off", + amount: hundredKOnes, + }, + { + address: "del1", + amount: common.Big0, + historyUndel: twentyKOnes, + afterSignUndel: common.Big0, }, { - expAmt: fourtyKOnes, + address: "del2", + amount: common.Big0, + historyUndel: common.Big0, + afterSignUndel: twentyKOnes, + }, + }), + expDels: []expDelegation{ + { + expAmt: fiftyKOnes, expReward: tenKOnes, expUndelAmt: []*big.Int{}, }, - }, - expSlashed: thirtyFiveKOnes, - expBeneficiaryReward: new(big.Int).Div(thirtyFiveKOnes, common.Big2), - }, - { - rate: numeric.NewDecWithPrec(150, 2), - snapshot: defaultSnapValidatorWrapper(), - current: defaultCurrentValidatorWrapper(), - expDels: []expDelegation{ { expAmt: common.Big0, expReward: common.Big0, - expUndelAmt: []*big.Int{tenKOnes, common.Big0}, + expUndelAmt: []*big.Int{twentyKOnes, common.Big0}, }, { - expAmt: fourtyKOnes, + expAmt: common.Big0, expReward: tenKOnes, - expUndelAmt: []*big.Int{}, + expUndelAmt: []*big.Int{common.Big0, common.Big0}, }, }, - expSlashed: fourtyKOnes, - expBeneficiaryReward: twentyKOnes, + expSlashed: new(big.Int).Mul(big.NewInt(80000), bigOne), + expBeneficiaryReward: fourtyKOnes, }, } + for i, tc := range tests { tc.makeData() tc.apply() @@ -482,9 +644,23 @@ func TestDelegatorSlashApply(t *testing.T) { } } +type applySlashingToDelegatorTestCase struct { + snapshot, current *staking.ValidatorWrapper + state *state.DB + beneficiary common.Address + slashTrack *Application + debt *big.Int + delegationIdx int + + gotErr error + + expDel expDelegation + expSlashed, expBeneficiaryReward *big.Int + expErr error +} + type slashApplyTestCase struct { snapshot, current *staking.ValidatorWrapper - rate numeric.Dec beneficiary common.Address state *state.DB @@ -496,6 +672,41 @@ type slashApplyTestCase struct { expErr error } +func (tc *applySlashingToDelegatorTestCase) makeData() { + tc.beneficiary = leaderAddr + tc.state = makeTestStateDB() + tc.slashTrack = &Application{ + TotalSlashed: new(big.Int).Set(common.Big0), + TotalBeneficiaryReward: new(big.Int).Set(common.Big0), + } +} + +func (tc *applySlashingToDelegatorTestCase) apply() { + tc.gotErr = delegatorSlashApplyDebt(tc.snapshot, tc.current, tc.state, tc.debt, tc.beneficiary, + big.NewInt(doubleSignEpoch), tc.slashTrack) +} + +func (tc *applySlashingToDelegatorTestCase) checkResult() error { + if err := assertError(tc.gotErr, tc.expErr); err != nil { + return err + } + if err := tc.expDel.checkDelegation(tc.current.Delegations[tc.delegationIdx]); err != nil { + return fmt.Errorf("delegations[%v]: %v", tc.delegationIdx, err) + } + if tc.slashTrack.TotalSlashed.Cmp(tc.expSlashed) != 0 { + return fmt.Errorf("unexpected total slash %v / %v", tc.slashTrack.TotalSlashed, + tc.expSlashed) + } + if tc.slashTrack.TotalBeneficiaryReward.Cmp(tc.expBeneficiaryReward) != 0 { + return fmt.Errorf("unexpected beneficiary reward %v / %v", tc.slashTrack.TotalBeneficiaryReward, + tc.expBeneficiaryReward) + } + if bal := tc.state.GetBalance(tc.beneficiary); bal.Cmp(tc.expBeneficiaryReward) != 0 { + return fmt.Errorf("unexpected balance for beneficiary %v / %v", bal, tc.expBeneficiaryReward) + } + return nil +} + func (tc *slashApplyTestCase) makeData() { tc.beneficiary = leaderAddr tc.state = makeTestStateDB() @@ -506,8 +717,7 @@ func (tc *slashApplyTestCase) makeData() { } func (tc *slashApplyTestCase) apply() { - tc.gotErr = delegatorSlashApply(tc.snapshot, tc.current, tc.rate, tc.state, tc.beneficiary, - big.NewInt(doubleSignEpoch), tc.slashTrack) + tc.gotErr = delegatorSlashApply(tc.snapshot, tc.current, tc.state, tc.beneficiary, big.NewInt(doubleSignEpoch), tc.slashTrack) } func (tc *slashApplyTestCase) checkResult() error { @@ -542,6 +752,13 @@ type expDelegation struct { expUndelAmt []*big.Int } +type testDelegation struct { + address string + amount *big.Int + historyUndel *big.Int + afterSignUndel *big.Int +} + func (ed expDelegation) checkDelegation(d staking.Delegation) error { if d.Amount.Cmp(ed.expAmt) != 0 { return fmt.Errorf("unexpected amount %v / %v", d.Amount, ed.expAmt) @@ -569,16 +786,14 @@ func TestApply(t *testing.T) { snapshot: defaultSnapValidatorWrapper(), current: defaultCurrentValidatorWrapper(), slashes: Records{defaultSlashRecord()}, - rate: numeric.NewDecWithPrec(625, 3), - expSlashed: twentyFiveKOnes, - expBeneficiaryReward: new(big.Int).Div(twentyFiveKOnes, common.Big2), + expSlashed: twentyKOnes, + expBeneficiaryReward: tenKOnes, }, { // missing snapshot in chain current: defaultCurrentValidatorWrapper(), slashes: Records{defaultSlashRecord()}, - rate: numeric.NewDecWithPrec(625, 3), expErr: errors.New("could not find validator"), }, @@ -586,7 +801,6 @@ func TestApply(t *testing.T) { // missing vWrapper in state snapshot: defaultSnapValidatorWrapper(), slashes: Records{defaultSlashRecord()}, - rate: numeric.NewDecWithPrec(625, 3), expErr: errValidatorNotFoundDuringSlash, }, @@ -605,7 +819,6 @@ func TestApply(t *testing.T) { type applyTestCase struct { snapshot, current *staking.ValidatorWrapper slashes Records - rate numeric.Dec chain *fakeBlockChain state, stateSnap *state.DB @@ -636,7 +849,7 @@ func (tc *applyTestCase) makeData(t *testing.T) { } func (tc *applyTestCase) apply() { - tc.gotDiff, tc.gotErr = Apply(tc.chain, tc.state, tc.slashes, tc.rate, leaderAddr) + tc.gotDiff, tc.gotErr = Apply(tc.chain, tc.state, tc.slashes, leaderAddr) } func (tc *applyTestCase) checkResult() error { @@ -646,14 +859,14 @@ func (tc *applyTestCase) checkResult() error { if (tc.gotErr != nil) || (tc.expErr != nil) { return nil } - if tc.gotDiff.TotalBeneficiaryReward.Cmp(tc.expBeneficiaryReward) != 0 { - return fmt.Errorf("unexpected beneficiry reward %v / %v", tc.gotDiff.TotalBeneficiaryReward, - tc.expBeneficiaryReward) - } if tc.gotDiff.TotalSlashed.Cmp(tc.expSlashed) != 0 { return fmt.Errorf("unexpected total slash %v / %v", tc.gotDiff.TotalSlashed, tc.expSlashed) } + if tc.gotDiff.TotalBeneficiaryReward.Cmp(tc.expBeneficiaryReward) != 0 { + return fmt.Errorf("unexpected beneficiary reward %v / %v", tc.gotDiff.TotalBeneficiaryReward, + tc.expBeneficiaryReward) + } if err := tc.checkState(); err != nil { return fmt.Errorf("state check: %v", err) } @@ -675,87 +888,12 @@ func (tc *applyTestCase) checkState() error { if err != nil { return err } - if tc.rate != numeric.ZeroDec() && reflect.DeepEqual(vwSnap.Delegations, vw.Delegations) { + if reflect.DeepEqual(vwSnap.Delegations, vw.Delegations) { return fmt.Errorf("status still unchanged") } return nil } -func TestRate(t *testing.T) { - tests := []struct { - votingPower *votepower.Roster - records Records - expRate numeric.Dec - }{ - { - votingPower: makeVotingPower(map[bls.SerializedPublicKey]numeric.Dec{ - keyPairs[0].Pub(): numeric.NewDecWithPrec(1, 2), - keyPairs[1].Pub(): numeric.NewDecWithPrec(2, 2), - keyPairs[2].Pub(): numeric.NewDecWithPrec(3, 2), - }), - records: Records{ - makeEmptyRecordWithSignerKey(keyPairs[0].Pub()), - makeEmptyRecordWithSignerKey(keyPairs[1].Pub()), - makeEmptyRecordWithSignerKey(keyPairs[2].Pub()), - }, - expRate: numeric.NewDecWithPrec(6, 2), - }, - { - votingPower: makeVotingPower(map[bls.SerializedPublicKey]numeric.Dec{ - keyPairs[0].Pub(): numeric.NewDecWithPrec(1, 2), - }), - records: Records{ - makeEmptyRecordWithSignerKey(keyPairs[0].Pub()), - }, - expRate: oneDoubleSignerRate, - }, - { - votingPower: makeVotingPower(map[bls.SerializedPublicKey]numeric.Dec{}), - records: Records{}, - expRate: oneDoubleSignerRate, - }, - { - votingPower: makeVotingPower(map[bls.SerializedPublicKey]numeric.Dec{ - keyPairs[0].Pub(): numeric.NewDecWithPrec(1, 2), - keyPairs[1].Pub(): numeric.NewDecWithPrec(2, 2), - keyPairs[3].Pub(): numeric.NewDecWithPrec(3, 2), - }), - records: Records{ - makeEmptyRecordWithSignerKey(keyPairs[0].Pub()), - makeEmptyRecordWithSignerKey(keyPairs[1].Pub()), - makeEmptyRecordWithSignerKey(keyPairs[2].Pub()), - }, - expRate: numeric.NewDecWithPrec(3, 2), - }, - } - for i, test := range tests { - rate := Rate(test.votingPower, test.records) - if rate.IsNil() || !rate.Equal(test.expRate) { - t.Errorf("Test %v: unexpected rate %v / %v", i, rate, test.expRate) - } - } - -} - -func makeEmptyRecordWithSignerKey(pub bls.SerializedPublicKey) Record { - var r Record - r.Evidence.SecondVote.SignerPubKeys = []bls.SerializedPublicKey{pub} - r.Evidence.FirstVote.SignerPubKeys = []bls.SerializedPublicKey{pub} - return r -} - -func makeVotingPower(m map[bls.SerializedPublicKey]numeric.Dec) *votepower.Roster { - r := &votepower.Roster{ - Voters: make(map[bls.SerializedPublicKey]*votepower.AccommodateHarmonyVote), - } - for pub, pct := range m { - r.Voters[pub] = &votepower.AccommodateHarmonyVote{ - PureStakedVote: votepower.PureStakedVote{GroupPercent: pct}, - } - } - return r -} - func defaultSlashRecord() Record { return Record{ Evidence: Evidence{ @@ -856,6 +994,45 @@ func defaultTestValidator(pubKeys []bls.SerializedPublicKey) staking.Validator { } } +func generateValidatorWrapper(delData []testDelegation) *staking.ValidatorWrapper { + pubKeys := []bls.SerializedPublicKey{offPub} + v := defaultTestValidator(pubKeys) + ds := generateDelegations(delData) + + return &staking.ValidatorWrapper{ + Validator: v, + Delegations: ds, + } +} + +func generateDelegations(delData []testDelegation) staking.Delegations { + delegations := make(staking.Delegations, len(delData)) + for i, del := range delData { + delegations[i] = makeDelegation(makeTestAddress(del.address), new(big.Int).Set(del.amount)) + + if del.historyUndel != nil { + delegations[i].Undelegations = append( + delegations[i].Undelegations, + staking.Undelegation{ + Amount: new(big.Int).Set(del.historyUndel), + Epoch: big.NewInt(doubleSignEpoch - 1), + }, + ) + } + if del.afterSignUndel != nil { + delegations[i].Undelegations = append( + delegations[i].Undelegations, + staking.Undelegation{ + Amount: new(big.Int).Set(del.afterSignUndel), + Epoch: big.NewInt(doubleSignEpoch + 1), + }, + ) + } + } + + return delegations +} + func defaultTestDelegations() staking.Delegations { return staking.Delegations{ makeDelegation(offAddr, new(big.Int).Set(fourtyKOnes)), @@ -897,8 +1074,8 @@ func makeHistoryUndelegation() staking.Undelegation { } // makeCommitteeFromKeyPairs makes a shard state for testing. -// address is generated by makeTestAddress -// bls key is get from the variable keyPairs []blsKeyPair +// address is generated by makeTestAddress +// bls key is get from the variable keyPairs []blsKeyPair func makeDefaultCommittee() shard.State { epoch := big.NewInt(doubleSignEpoch) maker := newShardSlotMaker(keyPairs) diff --git a/test/helpers/p2p.go b/test/helpers/p2p.go index 425c37724..55e45a592 100644 --- a/test/helpers/p2p.go +++ b/test/helpers/p2p.go @@ -5,7 +5,7 @@ import ( harmony_bls "github.com/harmony-one/harmony/crypto/bls" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/harmony-one/harmony/p2p" - libp2p_crypto "github.com/libp2p/go-libp2p-crypto" + libp2p_crypto "github.com/libp2p/go-libp2p/core/crypto" "github.com/pkg/errors" )