From c53f5e9b9c56670a59ffd8e58ec8fdb6d998226b Mon Sep 17 00:00:00 2001 From: simlecode Date: Tue, 17 May 2022 15:04:06 +0800 Subject: [PATCH 1/4] feat: remove unused code --- .circleci/config.yml | 1 + Makefile | 11 +- api/{api_poster.go => api_miner.go} | 0 api/client/client.go | 2 +- api/client/gateway_client.go | 4 +- api/permissioned.go | 2 +- api/proxy_gen.go | 233 +++-- api/types.go | 52 - build/parameters.go | 11 - build/params_shared_funcs.go | 12 - build/params_shared_vals.go | 23 - build/proof-params/parameters.json | 202 ---- build/proof-params/srs-inner-product.json | 7 - build/sqlite-sql/venus-miner.db | Bin 5120 -> 0 bytes build/sqlite-sql/venus-miner.sql | 44 - build/tools.go | 3 +- chain/util.go | 29 +- cmd/init.go | 33 - cmd/main.go | 4 +- cmd/run.go | 3 +- gen/api/proxygen.go | 339 +++++++ go.mod | 44 +- go.sum | 71 +- lib/backupds/datastore.go | 190 ---- lib/backupds/read.go | 76 -- lib/blockstore/badger/blockstore.go | 959 ------------------ lib/blockstore/badger/blockstore_test.go | 90 -- .../badger/blockstore_test_suite.go | 323 ------ lib/blockstore/blockstore.go | 58 -- lib/blockstore/fallback.go | 108 -- lib/blockstore/mem.go | 102 -- lib/blockstore/sync.go | 81 -- lib/journal/alerting/alerts.go | 161 +++ lib/journal/alerting/alerts_test.go | 61 ++ {journal => lib/journal}/env.go | 2 +- {journal => lib/journal/fsjournal}/fs.go | 41 +- lib/journal/mockjournal/journal.go | 75 ++ {journal => lib/journal}/nil.go | 0 {journal => lib/journal}/registry.go | 0 {journal => lib/journal}/registry_test.go | 0 {journal => lib/journal}/types.go | 6 +- lib/logger/levels.go | 16 + {metrics => lib/metrics}/expoter.go | 0 {metrics => lib/metrics}/metrics.go | 0 lib/sigs/bls/bls_bench_test.go | 39 - lib/sigs/bls/init.go | 86 -- lib/sigs/doc.go | 9 - lib/sigs/secp/init.go | 59 -- lib/sigs/sigs.go | 112 -- {system => lib/system}/resources.go | 0 lib/venuslog/levels.go | 23 - miner/minerwpp.go | 4 +- miner/multiminer.go | 12 +- node/builder.go | 22 +- node/fxlog.go | 17 - node/modules/core.go | 112 +- node/modules/miner.go | 4 +- node/modules/services.go | 5 +- node/modules/storage.go | 5 +- node/repo/blockstore_opts.go | 50 - node/repo/fsrepo.go | 47 - node/repo/interface.go | 24 - node/repo/memrepo.go | 318 ------ node/repo/memrepo_test.go | 10 - sector-storage/ffiwrapper/types.go | 19 - sector-storage/ffiwrapper/verifier_cgo.go | 44 - 66 files changed, 917 insertions(+), 3583 deletions(-) rename api/{api_poster.go => api_miner.go} (100%) delete mode 100644 api/types.go delete mode 100644 build/parameters.go delete mode 100644 build/proof-params/parameters.json delete mode 100644 build/proof-params/srs-inner-product.json delete mode 100644 build/sqlite-sql/venus-miner.db delete mode 100644 build/sqlite-sql/venus-miner.sql create mode 100644 gen/api/proxygen.go delete mode 100644 lib/backupds/datastore.go delete mode 100644 lib/backupds/read.go delete mode 100644 lib/blockstore/badger/blockstore.go delete mode 100644 lib/blockstore/badger/blockstore_test.go delete mode 100644 lib/blockstore/badger/blockstore_test_suite.go delete mode 100644 lib/blockstore/blockstore.go delete mode 100644 lib/blockstore/fallback.go delete mode 100644 lib/blockstore/mem.go delete mode 100644 lib/blockstore/sync.go create mode 100644 lib/journal/alerting/alerts.go create mode 100644 lib/journal/alerting/alerts_test.go rename {journal => lib/journal}/env.go (86%) rename {journal => lib/journal/fsjournal}/fs.go (66%) create mode 100644 lib/journal/mockjournal/journal.go rename {journal => lib/journal}/nil.go (100%) rename {journal => lib/journal}/registry.go (100%) rename {journal => lib/journal}/registry_test.go (100%) rename {journal => lib/journal}/types.go (96%) create mode 100644 lib/logger/levels.go rename {metrics => lib/metrics}/expoter.go (100%) rename {metrics => lib/metrics}/metrics.go (100%) delete mode 100644 lib/sigs/bls/bls_bench_test.go delete mode 100644 lib/sigs/bls/init.go delete mode 100644 lib/sigs/doc.go delete mode 100644 lib/sigs/secp/init.go delete mode 100644 lib/sigs/sigs.go rename {system => lib/system}/resources.go (100%) delete mode 100644 lib/venuslog/levels.go delete mode 100644 node/fxlog.go delete mode 100644 node/repo/blockstore_opts.go delete mode 100644 node/repo/memrepo.go delete mode 100644 node/repo/memrepo_test.go delete mode 100644 sector-storage/ffiwrapper/types.go delete mode 100644 sector-storage/ffiwrapper/verifier_cgo.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 317ec03..54c9a93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -229,6 +229,7 @@ jobs: - prepare - run: make deps - run: go install golang.org/x/tools/cmd/goimports + - run: make api-gen - run: go generate -x ./... - run: git --no-pager diff - run: git --no-pager diff --quiet diff --git a/Makefile b/Makefile index a098d0d..1572aae 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ all: build .PHONY: all docker GOVERSION:=$(shell go version | cut -d' ' -f 3 | cut -d. -f 2) -ifeq ($(shell expr $(GOVERSION) \< 15), 1) +ifeq ($(shell expr $(GOVERSION) \< 17), 1) $(warning Your Golang version is go 1.$(GOVERSION)) -$(error Update Golang to version to at least 1.15.5) +$(error Update Golang to version to at least 1.17.9) endif # git modules that need to be loaded @@ -63,7 +63,6 @@ deps: $(BUILD_DEPS) miner: $(BUILD_DEPS) rm -f venus-miner go build $(GOFLAGS) -o venus-miner ./cmd/ - go run github.com/GeertJohan/go.rice/rice append --exec venus-miner -i ./build .PHONY: miner BINS+=venus-miner @@ -82,6 +81,12 @@ dist-clean: git submodule deinit --all -f .PHONY: dist-clean +api-gen: + go run ./gen/api + goimports -w api + goimports -w api +.PHONY: api-gen + print-%: @echo $*=$($*) diff --git a/api/api_poster.go b/api/api_miner.go similarity index 100% rename from api/api_poster.go rename to api/api_miner.go diff --git a/api/client/client.go b/api/client/client.go index cab46a2..2aa7db3 100644 --- a/api/client/client.go +++ b/api/client/client.go @@ -24,7 +24,7 @@ func NewCommonRPC(ctx context.Context, addr string, requestHeader http.Header) ( // NewMinerRPC creates a new http jsonrpc client for miner func NewMinerRPC(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.MinerAPI, jsonrpc.ClientCloser, error) { - var res api.MinerStruct + var res api.MinerAPIStruct closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin", []interface{}{ &res.CommonStruct.Internal, diff --git a/api/client/gateway_client.go b/api/client/gateway_client.go index 3a7adf6..3afca48 100644 --- a/api/client/gateway_client.go +++ b/api/client/gateway_client.go @@ -11,7 +11,7 @@ import ( gateway "github.com/filecoin-project/venus/venus-shared/api/gateway/v1" ) -func NewGatewayRPC(cfg *config.GatewayNode) (gateway.IGateway, jsonrpc.ClientCloser, error) { +func NewGatewayRPC(ctx context.Context, cfg *config.GatewayNode) (gateway.IGateway, jsonrpc.ClientCloser, error) { var err error addrs, err := cfg.DialArgs() if err != nil { @@ -21,7 +21,7 @@ func NewGatewayRPC(cfg *config.GatewayNode) (gateway.IGateway, jsonrpc.ClientClo var gatewayAPI gateway.IGateway = nil var closer jsonrpc.ClientCloser for _, addr := range addrs { - gatewayAPI, closer, err = gateway.NewIGatewayRPC(context.Background(), addr, cfg.AuthHeader()) + gatewayAPI, closer, err = gateway.NewIGatewayRPC(ctx, addr, cfg.AuthHeader()) if err == nil { return gatewayAPI, closer, err } diff --git a/api/permissioned.go b/api/permissioned.go index 085f7bf..37ebc62 100644 --- a/api/permissioned.go +++ b/api/permissioned.go @@ -17,7 +17,7 @@ var AllPermissions = []auth.Permission{PermRead, PermWrite, PermSign, PermAdmin} var DefaultPerms = []auth.Permission{PermRead} func PermissionedMinerAPI(a MinerAPI) MinerAPI { - var out MinerStruct + var out MinerAPIStruct auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal) auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.CommonStruct.Internal) return &out diff --git a/api/proxy_gen.go b/api/proxy_gen.go index acb6b94..196df4c 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -1,114 +1,231 @@ +// Code generated by ./gen/api. DO NOT EDIT. + package api import ( "context" + "errors" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/go-state-types/abi" - "github.com/google/uuid" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" + "github.com/google/uuid" ) -// All permissions are listed in permissioned.go -var _ = AllPermissions +var ErrNotSupported = errors.New("method not supported") type CommonStruct struct { Internal struct { - AuthVerify func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"read"` - AuthNew func(ctx context.Context, perms []auth.Permission) ([]byte, error) `perm:"admin"` + AuthNew func(p0 context.Context, p1 []auth.Permission) ([]byte, error) `perm:"admin"` + + AuthVerify func(p0 context.Context, p1 string) ([]auth.Permission, error) `perm:"read"` - ID func(context.Context) (peer.ID, error) `perm:"read"` - Version func(context.Context) (APIVersion, error) `perm:"read"` + Closing func(p0 context.Context) (<-chan struct{}, error) `perm:"read"` - LogList func(context.Context) ([]string, error) `perm:"write"` - LogSetLevel func(context.Context, string, string) error `perm:"write"` + LogList func(p0 context.Context) ([]string, error) `perm:"write"` - Shutdown func(context.Context) error `perm:"admin"` - Session func(context.Context) (uuid.UUID, error) `perm:"read"` - Closing func(context.Context) (<-chan struct{}, error) `perm:"read"` + LogSetLevel func(p0 context.Context, p1 string, p2 string) error `perm:"write"` + + Session func(p0 context.Context) (uuid.UUID, error) `perm:"read"` + + Shutdown func(p0 context.Context) error `perm:"admin"` + + Version func(p0 context.Context) (APIVersion, error) `perm:"read"` } } -// CommonStruct +type CommonStub struct { +} + +type MinerAPIStruct struct { + CommonStruct + + Internal struct { + AddAddress func(p0 context.Context, p1 dtypes.MinerInfo) error `perm:"admin"` + + CountWinners func(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) `perm:"read"` + + ListAddress func(p0 context.Context) ([]dtypes.MinerInfo, error) `perm:"read"` + + Start func(p0 context.Context, p1 []address.Address) error `perm:"admin"` + + StatesForMining func(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) `perm:"read"` -func (c *CommonStruct) AuthVerify(ctx context.Context, token string) ([]auth.Permission, error) { - return c.Internal.AuthVerify(ctx, token) + Stop func(p0 context.Context, p1 []address.Address) error `perm:"admin"` + + UpdateAddress func(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) `perm:"write"` + } } -func (c *CommonStruct) AuthNew(ctx context.Context, perms []auth.Permission) ([]byte, error) { - return c.Internal.AuthNew(ctx, perms) +type MinerAPIStub struct { + CommonStub } -// Version implements API.Version -func (c *CommonStruct) Version(ctx context.Context) (APIVersion, error) { - return c.Internal.Version(ctx) +func (s *CommonStruct) AuthNew(p0 context.Context, p1 []auth.Permission) ([]byte, error) { + if s.Internal.AuthNew == nil { + return *new([]byte), ErrNotSupported + } + return s.Internal.AuthNew(p0, p1) } -func (c *CommonStruct) LogList(ctx context.Context) ([]string, error) { - return c.Internal.LogList(ctx) +func (s *CommonStub) AuthNew(p0 context.Context, p1 []auth.Permission) ([]byte, error) { + return *new([]byte), ErrNotSupported } -func (c *CommonStruct) LogSetLevel(ctx context.Context, group, level string) error { - return c.Internal.LogSetLevel(ctx, group, level) +func (s *CommonStruct) AuthVerify(p0 context.Context, p1 string) ([]auth.Permission, error) { + if s.Internal.AuthVerify == nil { + return *new([]auth.Permission), ErrNotSupported + } + return s.Internal.AuthVerify(p0, p1) } -func (c *CommonStruct) Shutdown(ctx context.Context) error { - return c.Internal.Shutdown(ctx) +func (s *CommonStub) AuthVerify(p0 context.Context, p1 string) ([]auth.Permission, error) { + return *new([]auth.Permission), ErrNotSupported } -func (c *CommonStruct) Session(ctx context.Context) (uuid.UUID, error) { - return c.Internal.Session(ctx) +func (s *CommonStruct) Closing(p0 context.Context) (<-chan struct{}, error) { + if s.Internal.Closing == nil { + return nil, ErrNotSupported + } + return s.Internal.Closing(p0) } -func (c *CommonStruct) Closing(ctx context.Context) (<-chan struct{}, error) { - return c.Internal.Closing(ctx) +func (s *CommonStub) Closing(p0 context.Context) (<-chan struct{}, error) { + return nil, ErrNotSupported } -var _ Common = &CommonStruct{} +func (s *CommonStruct) LogList(p0 context.Context) ([]string, error) { + if s.Internal.LogList == nil { + return *new([]string), ErrNotSupported + } + return s.Internal.LogList(p0) +} -type MinerStruct struct { - CommonStruct +func (s *CommonStub) LogList(p0 context.Context) ([]string, error) { + return *new([]string), ErrNotSupported +} - Internal struct { - UpdateAddress func(context.Context, int64, int64) ([]dtypes.MinerInfo, error) `perm:"write"` - ListAddress func(context.Context) ([]dtypes.MinerInfo, error) `perm:"read"` - StatesForMining func(context.Context, []address.Address) ([]dtypes.MinerState, error) `perm:"read"` - CountWinners func(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]dtypes.CountWinners, error) `perm:"read"` - Start func(context.Context, []address.Address) error `perm:"admin"` - Stop func(context.Context, []address.Address) error `perm:"admin"` - AddAddress func(context.Context, dtypes.MinerInfo) error `perm:"admin"` +func (s *CommonStruct) LogSetLevel(p0 context.Context, p1 string, p2 string) error { + if s.Internal.LogSetLevel == nil { + return ErrNotSupported } + return s.Internal.LogSetLevel(p0, p1, p2) +} + +func (s *CommonStub) LogSetLevel(p0 context.Context, p1 string, p2 string) error { + return ErrNotSupported } -func (s *MinerStruct) UpdateAddress(ctx context.Context, skip int64, limit int64) ([]dtypes.MinerInfo, error) { - return s.Internal.UpdateAddress(ctx, skip, limit) +func (s *CommonStruct) Session(p0 context.Context) (uuid.UUID, error) { + if s.Internal.Session == nil { + return *new(uuid.UUID), ErrNotSupported + } + return s.Internal.Session(p0) } -func (s *MinerStruct) ListAddress(ctx context.Context) ([]dtypes.MinerInfo, error) { - return s.Internal.ListAddress(ctx) +func (s *CommonStub) Session(p0 context.Context) (uuid.UUID, error) { + return *new(uuid.UUID), ErrNotSupported } -func (s *MinerStruct) StatesForMining(ctx context.Context, addrs []address.Address) ([]dtypes.MinerState, error) { - return s.Internal.StatesForMining(ctx, addrs) +func (s *CommonStruct) Shutdown(p0 context.Context) error { + if s.Internal.Shutdown == nil { + return ErrNotSupported + } + return s.Internal.Shutdown(p0) } -func (s *MinerStruct) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]dtypes.CountWinners, error) { - return s.Internal.CountWinners(ctx, addrs, start, end) +func (s *CommonStub) Shutdown(p0 context.Context) error { + return ErrNotSupported } -func (s *MinerStruct) Start(ctx context.Context, addrs []address.Address) error { - return s.Internal.Start(ctx, addrs) +func (s *CommonStruct) Version(p0 context.Context) (APIVersion, error) { + if s.Internal.Version == nil { + return *new(APIVersion), ErrNotSupported + } + return s.Internal.Version(p0) } -func (s *MinerStruct) Stop(ctx context.Context, addrs []address.Address) error { - return s.Internal.Stop(ctx, addrs) +func (s *CommonStub) Version(p0 context.Context) (APIVersion, error) { + return *new(APIVersion), ErrNotSupported +} + +func (s *MinerAPIStruct) AddAddress(p0 context.Context, p1 dtypes.MinerInfo) error { + if s.Internal.AddAddress == nil { + return ErrNotSupported + } + return s.Internal.AddAddress(p0, p1) +} + +func (s *MinerAPIStub) AddAddress(p0 context.Context, p1 dtypes.MinerInfo) error { + return ErrNotSupported +} + +func (s *MinerAPIStruct) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) { + if s.Internal.CountWinners == nil { + return *new([]dtypes.CountWinners), ErrNotSupported + } + return s.Internal.CountWinners(p0, p1, p2, p3) +} + +func (s *MinerAPIStub) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) { + return *new([]dtypes.CountWinners), ErrNotSupported +} + +func (s *MinerAPIStruct) ListAddress(p0 context.Context) ([]dtypes.MinerInfo, error) { + if s.Internal.ListAddress == nil { + return *new([]dtypes.MinerInfo), ErrNotSupported + } + return s.Internal.ListAddress(p0) +} + +func (s *MinerAPIStub) ListAddress(p0 context.Context) ([]dtypes.MinerInfo, error) { + return *new([]dtypes.MinerInfo), ErrNotSupported +} + +func (s *MinerAPIStruct) Start(p0 context.Context, p1 []address.Address) error { + if s.Internal.Start == nil { + return ErrNotSupported + } + return s.Internal.Start(p0, p1) +} + +func (s *MinerAPIStub) Start(p0 context.Context, p1 []address.Address) error { + return ErrNotSupported +} + +func (s *MinerAPIStruct) StatesForMining(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) { + if s.Internal.StatesForMining == nil { + return *new([]dtypes.MinerState), ErrNotSupported + } + return s.Internal.StatesForMining(p0, p1) +} + +func (s *MinerAPIStub) StatesForMining(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) { + return *new([]dtypes.MinerState), ErrNotSupported +} + +func (s *MinerAPIStruct) Stop(p0 context.Context, p1 []address.Address) error { + if s.Internal.Stop == nil { + return ErrNotSupported + } + return s.Internal.Stop(p0, p1) +} + +func (s *MinerAPIStub) Stop(p0 context.Context, p1 []address.Address) error { + return ErrNotSupported +} + +func (s *MinerAPIStruct) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) { + if s.Internal.UpdateAddress == nil { + return *new([]dtypes.MinerInfo), ErrNotSupported + } + return s.Internal.UpdateAddress(p0, p1, p2) } -func (s *MinerStruct) AddAddress(ctx context.Context, mi dtypes.MinerInfo) error { - return s.Internal.AddAddress(ctx, mi) +func (s *MinerAPIStub) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) { + return *new([]dtypes.MinerInfo), ErrNotSupported } -var _ MinerAPI = &MinerStruct{} +var _ Common = new(CommonStruct) +var _ MinerAPI = new(MinerAPIStruct) diff --git a/api/types.go b/api/types.go deleted file mode 100644 index 41164ba..0000000 --- a/api/types.go +++ /dev/null @@ -1,52 +0,0 @@ -package api - -import ( - "encoding/json" - "github.com/filecoin-project/go-state-types/abi" - "github.com/libp2p/go-libp2p-core/peer" - pubsub "github.com/libp2p/go-libp2p-pubsub" - ma "github.com/multiformats/go-multiaddr" -) - -// TODO: check if this exists anywhere else - -type MultiaddrSlice []ma.Multiaddr - -func (m *MultiaddrSlice) UnmarshalJSON(raw []byte) (err error) { - var temp []string - if err := json.Unmarshal(raw, &temp); err != nil { - return err - } - - res := make([]ma.Multiaddr, len(temp)) - for i, str := range temp { - res[i], err = ma.NewMultiaddr(str) - if err != nil { - return err - } - } - *m = res - return nil -} - -var _ json.Unmarshaler = new(MultiaddrSlice) - -type ObjStat struct { - Size uint64 - Links uint64 -} - -type PubsubScore struct { - ID peer.ID - Score *pubsub.PeerScoreSnapshot -} - -type MessageSendSpec struct { - MaxFee abi.TokenAmount -} - -type NetBlockList struct { - Peers []peer.ID - IPAddrs []string - IPSubnets []string -} diff --git a/build/parameters.go b/build/parameters.go deleted file mode 100644 index b70dad1..0000000 --- a/build/parameters.go +++ /dev/null @@ -1,11 +0,0 @@ -package build - -import rice "github.com/GeertJohan/go.rice" - -func ParametersJSON() []byte { - return rice.MustFindBox("proof-params").MustBytes("parameters.json") -} - -func SrsJSON() []byte { - return rice.MustFindBox("proof-params").MustBytes("srs-inner-product.json") -} diff --git a/build/params_shared_funcs.go b/build/params_shared_funcs.go index b6bc9c5..a9566ae 100644 --- a/build/params_shared_funcs.go +++ b/build/params_shared_funcs.go @@ -24,9 +24,6 @@ func InitNetWorkParams(nettype string) error { if os.Getenv("MINING_USE_TEST_ADDRESSES") != "1" { SetAddressNetwork(address.Mainnet) } - - Devnet = false - BuildType = BuildMainnet UpgradeSmokeHeight = 51000 @@ -62,9 +59,6 @@ func InitNetWorkParams(nettype string) error { ) SetAddressNetwork(address.Testnet) - - Devnet = true - BuildType = BuildCalibnet UpgradeSmokeHeight = -2 @@ -80,9 +74,6 @@ func InitNetWorkParams(nettype string) error { ) SetAddressNetwork(address.Testnet) - - Devnet = true - BuildType = BuildButterflynet UpgradeSmokeHeight = -2 @@ -99,9 +90,6 @@ func InitNetWorkParams(nettype string) error { policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) SetAddressNetwork(address.Testnet) - - Devnet = true - BuildType = BuildInteropnet UpgradeSmokeHeight = -2 diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index ed464ef..b46fae5 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -13,15 +13,9 @@ import ( "github.com/filecoin-project/venus/venus-shared/actors/policy" ) -// Blocks (e) -var BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch) - // Epochs const Finality = policy.ChainFinality -// ///// -// Mining - // Epochs const TicketRandomnessLookback = abi.ChainEpoch(1) @@ -30,18 +24,6 @@ const TicketRandomnessLookback = abi.ChainEpoch(1) const AddressMainnetEnvVar = "_mainnet_" -// the 'f' prefix doesn't matter -var ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a") - -// ///// -// Devnet settings - -var Devnet = true - -const FilBase = uint64(2_000_000_000) - -const FilecoinPrecision = uint64(1_000_000_000_000_000_000) - // Build Settings var ( UpgradeSmokeHeight abi.ChainEpoch = -1 @@ -57,8 +39,3 @@ func init() { SetAddressNetwork(address.Mainnet) } } - -// /////// -// Limits - -const BlockGasLimit = 10_000_000_000 diff --git a/build/proof-params/parameters.json b/build/proof-params/parameters.json deleted file mode 100644 index 88bb0bf..0000000 --- a/build/proof-params/parameters.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.params": { - "cid": "Qma5WL6abSqYg9uUQAZ3EHS286bsNsha7oAGsJBD48Bq2q", - "digest": "c3ad7bb549470b82ad52ed070aebb4f4", - "sector_size": 536870912 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.vk": { - "cid": "QmUa7f9JtJMsqJJ3s3ZXk6WyF4xJLE8FiqYskZGgk8GCDv", - "digest": "994c5b7d450ca9da348c910689f2dc7f", - "sector_size": 536870912 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.params": { - "cid": "QmQiT4qBGodrVNEgVTDXxBNDdPbaD8Ag7Sx3ZTq1zHX79S", - "digest": "5aedd2cf3e5c0a15623d56a1b43110ad", - "sector_size": 8388608 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.vk": { - "cid": "QmdcpKUQvHM8RFRVKbk1yHfEqMcBzhtFWKRp9SNEmWq37i", - "digest": "abd80269054d391a734febdac0d2e687", - "sector_size": 8388608 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.params": { - "cid": "QmYM6Hg7mjmvA3ZHTsqkss1fkdyDju5dDmLiBZGJ5pz9y9", - "digest": "311f92a3e75036ced01b1c0025f1fa0c", - "sector_size": 2048 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.vk": { - "cid": "QmaQsTLL3nc5dw6wAvaioJSBfd1jhQrA2o6ucFf7XeV74P", - "digest": "eadad9784969890d30f2749708c79771", - "sector_size": 2048 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.params": { - "cid": "QmNPc75iEfcahCwNKdqnWLtxnjspUGGR4iscjiz3wP3RtS", - "digest": "1b3cfd761a961543f9eb273e435a06a2", - "sector_size": 34359738368 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.vk": { - "cid": "QmdFFUe1gcz9MMHc6YW8aoV48w4ckvcERjt7PkydQAMfCN", - "digest": "3a6941983754737fde880d29c7094905", - "sector_size": 34359738368 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.params": { - "cid": "QmUB6xTVjzBQGuDNeyJMrrJ1byk58vhPm8eY2Lv9pgwanp", - "digest": "1a392e7b759fb18e036c7559b5ece816", - "sector_size": 68719476736 - }, - "v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.vk": { - "cid": "Qmd794Jty7k26XJ8Eg4NDEks65Qk8G4GVfGkwqvymv8HAg", - "digest": "80e366df2f1011953c2d01c7b7c9ee8e", - "sector_size": 68719476736 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.params": { - "cid": "QmVxjFRyhmyQaZEtCh7nk2abc7LhFkzhnRX4rcHqCCpikR", - "digest": "7610b9f82bfc88405b7a832b651ce2f6", - "sector_size": 2048 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.vk": { - "cid": "QmcS5JZs8X3TdtkEBpHAdUYjdNDqcL7fWQFtQz69mpnu2X", - "digest": "0e0958009936b9d5e515ec97b8cb792d", - "sector_size": 2048 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.params": { - "cid": "QmUiRx71uxfmUE8V3H9sWAsAXoM88KR4eo1ByvvcFNeTLR", - "digest": "1a7d4a9c8a502a497ed92a54366af33f", - "sector_size": 536870912 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.vk": { - "cid": "QmfCeddjFpWtavzfEzZpJfzSajGNwfL4RjFXWAvA9TSnTV", - "digest": "4dae975de4f011f101f5a2f86d1daaba", - "sector_size": 536870912 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.params": { - "cid": "QmcSTqDcFVLGGVYz1njhUZ7B6fkKtBumsLUwx4nkh22TzS", - "digest": "82c88066be968bb550a05e30ff6c2413", - "sector_size": 2048 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.vk": { - "cid": "QmSTCXF2ipGA3f6muVo6kHc2URSx6PzZxGUqu7uykaH5KU", - "digest": "ffd79788d614d27919ae5bd2d94eacb6", - "sector_size": 2048 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.params": { - "cid": "QmU9SBzJNrcjRFDiFc4GcApqdApN6z9X7MpUr66mJ2kAJP", - "digest": "700171ecf7334e3199437c930676af82", - "sector_size": 8388608 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.vk": { - "cid": "QmbmUMa3TbbW3X5kFhExs6WgC4KeWT18YivaVmXDkB6ANG", - "digest": "79ebb55f56fda427743e35053edad8fc", - "sector_size": 8388608 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.params": { - "cid": "QmdNEL2RtqL52GQNuj8uz6mVj5Z34NVnbaJ1yMyh1oXtBx", - "digest": "c49499bb76a0762884896f9683403f55", - "sector_size": 8388608 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.vk": { - "cid": "QmUiVYCQUgr6Y13pZFr8acWpSM4xvTXUdcvGmxyuHbKhsc", - "digest": "34d4feeacd9abf788d69ef1bb4d8fd00", - "sector_size": 8388608 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.params": { - "cid": "QmVgCsJFRXKLuuUhT3aMYwKVGNA9rDeR6DCrs7cAe8riBT", - "digest": "827359440349fe8f5a016e7598993b79", - "sector_size": 536870912 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.vk": { - "cid": "QmfA31fbCWojSmhSGvvfxmxaYCpMoXP95zEQ9sLvBGHNaN", - "digest": "bd2cd62f65c1ab84f19ca27e97b7c731", - "sector_size": 536870912 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.params": { - "cid": "QmaUmfcJt6pozn8ndq1JVBzLRjRJdHMTPd4foa8iw5sjBZ", - "digest": "2cf49eb26f1fee94c85781a390ddb4c8", - "sector_size": 34359738368 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.vk": { - "cid": "QmR9i9KL3vhhAqTBGj1bPPC7LvkptxrH9RvxJxLN1vvsBE", - "digest": "0f8ec542485568fa3468c066e9fed82b", - "sector_size": 34359738368 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.params": { - "cid": "Qmdtczp7p4wrbDofmHdGhiixn9irAcN77mV9AEHZBaTt1i", - "digest": "d84f79a16fe40e9e25a36e2107bb1ba0", - "sector_size": 34359738368 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.vk": { - "cid": "QmZCvxKcKP97vDAk8Nxs9R1fWtqpjQrAhhfXPoCi1nkDoF", - "digest": "fc02943678dd119e69e7fab8420e8819", - "sector_size": 34359738368 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.params": { - "cid": "QmeAN4vuANhXsF8xP2Lx5j2L6yMSdogLzpcvqCJThRGK1V", - "digest": "3810b7780ac0e299b22ae70f1f94c9bc", - "sector_size": 68719476736 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.vk": { - "cid": "QmWV8rqZLxs1oQN9jxNWmnT1YdgLwCcscv94VARrhHf1T7", - "digest": "59d2bf1857adc59a4f08fcf2afaa916b", - "sector_size": 68719476736 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.params": { - "cid": "QmVkrXc1SLcpgcudK5J25HH93QvR9tNsVhVTYHm5UymXAz", - "digest": "2170a91ad5bae22ea61f2ea766630322", - "sector_size": 68719476736 - }, - "v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.vk": { - "cid": "QmbfQjPD7EpzjhWGmvWAsyN2mAZ4PcYhsf3ujuhU9CSuBm", - "digest": "6d3789148fb6466d07ee1e24d6292fd6", - "sector_size": 68719476736 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.params": { - "cid": "QmWceMgnWYLopMuM4AoGMvGEau7tNe5UK83XFjH5V9B17h", - "digest": "434fb1338ecfaf0f59256f30dde4968f", - "sector_size": 2048 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.vk": { - "cid": "QmamahpFCstMUqHi2qGtVoDnRrsXhid86qsfvoyCTKJqHr", - "digest": "dc1ade9929ade1708238f155343044ac", - "sector_size": 2048 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.params": { - "cid": "QmYBpTt7LWNAWr1JXThV5VxX7wsQFLd1PHrGYVbrU1EZjC", - "digest": "6c77597eb91ab936c1cef4cf19eba1b3", - "sector_size": 536870912 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.vk": { - "cid": "QmWionkqH2B6TXivzBSQeSyBxojaiAFbzhjtwYRrfwd8nH", - "digest": "065179da19fbe515507267677f02823e", - "sector_size": 536870912 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.params": { - "cid": "QmPXAPPuQtuQz7Zz3MHMAMEtsYwqM1o9H1csPLeiMUQwZH", - "digest": "09e612e4eeb7a0eb95679a88404f960c", - "sector_size": 8388608 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.vk": { - "cid": "QmYCuipFyvVW1GojdMrjK1JnMobXtT4zRCZs1CGxjizs99", - "digest": "b687beb9adbd9dabe265a7e3620813e4", - "sector_size": 8388608 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.params": { - "cid": "QmengpM684XLQfG8754ToonszgEg2bQeAGUan5uXTHUQzJ", - "digest": "6a388072a518cf46ebd661f5cc46900a", - "sector_size": 34359738368 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.vk": { - "cid": "Qmf93EMrADXAK6CyiSfE8xx45fkMfR3uzKEPCvZC1n2kzb", - "digest": "0c7b4aac1c40fdb7eb82bc355b41addf", - "sector_size": 34359738368 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.params": { - "cid": "QmS7ye6Ri2MfFzCkcUJ7FQ6zxDKuJ6J6B8k5PN7wzSR9sX", - "digest": "1801f8a6e1b00bceb00cc27314bb5ce3", - "sector_size": 68719476736 - }, - "v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.vk": { - "cid": "QmehSmC6BhrgRZakPDta2ewoH9nosNzdjCqQRXsNFNUkLN", - "digest": "a89884252c04c298d0b3c81bfd884164", - "sector_size": 68719476736 - } -} diff --git a/build/proof-params/srs-inner-product.json b/build/proof-params/srs-inner-product.json deleted file mode 100644 index 8566bf5..0000000 --- a/build/proof-params/srs-inner-product.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "v28-fil-inner-product-v1.srs": { - "cid": "Qmdq44DjcQnFfU3PJcdX7J49GCqcUYszr1TxMbHtAkvQ3g", - "digest": "ae20310138f5ba81451d723f858e3797", - "sector_size": 0 - } -} diff --git a/build/sqlite-sql/venus-miner.db b/build/sqlite-sql/venus-miner.db deleted file mode 100644 index 27c6925183e69f3a0eff522e4029bf9fff9bf5fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5120 zcmWFz^vNtqRY=P(%1ta$FlJz3U}R))P*7lCU|<4bRv?A}5T6Cc0n&^}Y+Otx2Hi($ zyv%lhTN;O!cz00MsgAqsw>K0Z1?B|wuD z!W@H~Jsg8HObs;ArAzX&Q}f^oj7&{YRPb_X8nUp7yUH^%Wag!$RumWJ026h5VrfY} zm>&;!O}rtT$=Vpm$Sy7^$=Fm2_EBzTUTRS>gk(bT3q*`qkEEm&fqe%dV16>j^ixh| zaYVUo diff --git a/build/sqlite-sql/venus-miner.sql b/build/sqlite-sql/venus-miner.sql deleted file mode 100644 index 5f870d4..0000000 --- a/build/sqlite-sql/venus-miner.sql +++ /dev/null @@ -1,44 +0,0 @@ -/* -Navicat SQLite Data Transfer - -Source Server : venus-miner -Source Server Version : 30714 -Source Host : :0 - -Target Server Type : SQLite -Target Server Version : 30714 -File Encoding : 65001 - -Date: 2021-03-01 14:49:38 -*/ - -PRAGMA foreign_keys = OFF; - --- ---------------------------- --- Table structure for miners --- ---------------------------- -DROP TABLE IF EXISTS "main"."miners"; -CREATE TABLE miners( - id INT PRIMARY KEY NOT NULL, - addr VARCHAR(30) NOT NULL, - listen_api VARCHAR(50) NOT NULL, - token VARCHAR(255) NOT NULL -); - --- ---------------------------- --- Records of miners --- ---------------------------- - --- ---------------------------- --- Table structure for venus_api --- ---------------------------- -DROP TABLE IF EXISTS "main"."venus_api"; -CREATE TABLE venus_api( - id INT PRIMARY KEY NOT NULL, - api VARCHAR(50) NOT NULL, - token VARCHAR(255) NOT NULL -); - --- ---------------------------- --- Records of venus_api --- ---------------------------- diff --git a/build/tools.go b/build/tools.go index 20f5c88..c86e9ec 100644 --- a/build/tools.go +++ b/build/tools.go @@ -3,7 +3,8 @@ package build +// in order to gen check: ci import ( - _ "github.com/GeertJohan/go.rice/rice" + _ "github.com/golang/mock/mockgen" _ "golang.org/x/tools/cmd/stringer" ) diff --git a/chain/util.go b/chain/util.go index 31591f9..8e1c4fc 100644 --- a/chain/util.go +++ b/chain/util.go @@ -11,12 +11,9 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/network" "github.com/minio/blake2b-simd" - "go.opencensus.io/trace" - - "github.com/filecoin-project/venus-miner/lib/sigs" "github.com/filecoin-project/venus/venus-shared/actors/builtin" - types2 "github.com/filecoin-project/venus/venus-shared/types" + "github.com/filecoin-project/venus/venus-shared/types" "github.com/filecoin-project/venus/venus-shared/types/wallet" ) @@ -27,7 +24,7 @@ type WinningPoStProver interface { ComputeProof(context.Context, []builtin.ExtendedSectorInfo, abi.PoStRandomness, abi.ChainEpoch, network.Version) ([]builtin.PoStProof, error) } -type SignFunc func(ctx context.Context, account string, signer address.Address, toSign []byte, meta types2.MsgMeta) (*crypto.Signature, error) +type SignFunc func(ctx context.Context, account string, signer address.Address, toSign []byte, meta types.MsgMeta) (*crypto.Signature, error) // type SignFunc func(context.Context, address.Address, []byte) (*crypto.Signature, error) @@ -52,25 +49,9 @@ func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.Cha return h.Sum(nil), nil } -func VerifyVRF(ctx context.Context, worker address.Address, vrfBase, vrfproof []byte) error { - _, span := trace.StartSpan(ctx, "VerifyVRF") - defer span.End() - - sig := &crypto.Signature{ - Type: crypto.SigTypeBLS, - Data: vrfproof, - } - - if err := sigs.Verify(sig, worker, vrfBase); err != nil { - return fmt.Errorf("vrf was invalid: %w", err) - } - - return nil -} - func ComputeVRF(ctx context.Context, sign SignFunc, account string, worker address.Address, sigInput []byte) ([]byte, error) { // log.Infof("sigInput: %s", hex.EncodeToString(sigInput)) - sig, err := sign(ctx, account, worker, sigInput, types2.MsgMeta{Type: types2.MTDrawRandomParam}) + sig, err := sign(ctx, account, worker, sigInput, types.MsgMeta{Type: types.MTDrawRandomParam}) if err != nil { return nil, err } @@ -83,7 +64,7 @@ func ComputeVRF(ctx context.Context, sign SignFunc, account string, worker addre } func IsRoundWinner(ctx context.Context, round abi.ChainEpoch, account string, - miner address.Address, brand types2.BeaconEntry, mbi *types2.MiningBaseInfo, sign SignFunc) (*types2.ElectionProof, error) { + miner address.Address, brand types.BeaconEntry, mbi *types.MiningBaseInfo, sign SignFunc) (*types.ElectionProof, error) { buf := new(bytes.Buffer) if err := miner.MarshalCBOR(buf); err != nil { @@ -111,7 +92,7 @@ func IsRoundWinner(ctx context.Context, round abi.ChainEpoch, account string, return nil, fmt.Errorf("failed to compute VRF: %w", err) } - ep := &types2.ElectionProof{VRFProof: vrfout} + ep := &types.ElectionProof{VRFProof: vrfout} j := ep.ComputeWinCount(mbi.MinerPower, mbi.NetworkPower) ep.WinCount = j if j < 1 { diff --git a/cmd/init.go b/cmd/init.go index ad0caa4..776d7b7 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -7,15 +7,12 @@ import ( "os" "time" - "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-state-types/abi" "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p-core/crypto" "github.com/mitchellh/go-homedir" "github.com/urfave/cli/v2" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/venus/venus-shared/api" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" types2 "github.com/filecoin-project/venus/venus-shared/types" @@ -349,33 +346,3 @@ func SyncWait(ctx context.Context, napi v1.FullNode, watch bool) error { i++ } } - -func fetchingProofParameters(ctx context.Context) error { // nolint - ss := make([]uint64, 0) - - log.Info("SupportedProofTypes: ", miner0.SupportedProofTypes) - for spf := range miner0.SupportedProofTypes { - switch spf { - case abi.RegisteredSealProof_StackedDrg2KiBV1: - ss = append(ss, 2048) - case abi.RegisteredSealProof_StackedDrg8MiBV1: - ss = append(ss, 8<<20) - case abi.RegisteredSealProof_StackedDrg512MiBV1: - ss = append(ss, 512<<20) - case abi.RegisteredSealProof_StackedDrg32GiBV1: - ss = append(ss, 32<<30) - case abi.RegisteredSealProof_StackedDrg64GiBV1: - ss = append(ss, 64<<30) - default: - - } - } - - for _, ssize := range ss { - if err := paramfetch.GetParams(ctx, build.ParametersJSON(), build.SrsJSON(), uint64(ssize)); err != nil { - return fmt.Errorf("fetching proof parameters: %w", err) - } - } - - return nil -} diff --git a/cmd/main.go b/cmd/main.go index 1794a4d..3109994 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -8,7 +8,7 @@ import ( "github.com/filecoin-project/venus-miner/build" lcli "github.com/filecoin-project/venus-miner/cli" - "github.com/filecoin-project/venus-miner/lib/venuslog" + "github.com/filecoin-project/venus-miner/lib/logger" "github.com/filecoin-project/venus-miner/node/repo" ) @@ -20,7 +20,7 @@ const FlagMinerRepo = "miner-repo" const FlagMinerRepoDeprecation = "storagerepo" func main() { - venuslog.SetupLogLevels() + logger.SetupLogLevels() local := []*cli.Command{ initCmd, diff --git a/cmd/run.go b/cmd/run.go index 6f39970..8672e4b 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -22,8 +22,8 @@ import ( lapi "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/build" lcli "github.com/filecoin-project/venus-miner/cli" + "github.com/filecoin-project/venus-miner/lib/metrics" "github.com/filecoin-project/venus-miner/lib/tracing" - "github.com/filecoin-project/venus-miner/metrics" "github.com/filecoin-project/venus-miner/node" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/dtypes" @@ -205,7 +205,6 @@ func serveRPC(minerAPI lapi.MinerAPI, stop node.StopFunc, addr multiaddr.Multiad rpcServer := jsonrpc.NewServer(serverOptions...) rpcServer.Register("Filecoin", lapi.PermissionedMinerAPI(minerAPI)) - // rpcServer.Register("Filecoin", minerAPI) mux := mux.NewRouter() mux.Handle("/rpc/v0", rpcServer) diff --git a/gen/api/proxygen.go b/gen/api/proxygen.go new file mode 100644 index 0000000..aed18e3 --- /dev/null +++ b/gen/api/proxygen.go @@ -0,0 +1,339 @@ +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "io" + "os" + "path/filepath" + "strings" + "text/template" +) + +type methodMeta struct { + node ast.Node + ftype *ast.FuncType +} + +type Visitor struct { + Methods map[string]map[string]*methodMeta + Include map[string][]string +} + +func (v *Visitor) Visit(node ast.Node) ast.Visitor { + st, ok := node.(*ast.TypeSpec) + if !ok { + return v + } + + iface, ok := st.Type.(*ast.InterfaceType) + if !ok { + return v + } + if v.Methods[st.Name.Name] == nil { + v.Methods[st.Name.Name] = map[string]*methodMeta{} + } + for _, m := range iface.Methods.List { + switch ft := m.Type.(type) { + case *ast.Ident: + v.Include[st.Name.Name] = append(v.Include[st.Name.Name], ft.Name) + case *ast.FuncType: + v.Methods[st.Name.Name][m.Names[0].Name] = &methodMeta{ + node: m, + ftype: ft, + } + } + } + + return v +} + +func main() { + if err := generate("./api", "api", "api", "./api/proxy_gen.go"); err != nil { + fmt.Println("error: ", err) + } +} + +func typeName(e ast.Expr, pkg string) (string, error) { + switch t := e.(type) { + case *ast.SelectorExpr: + return t.X.(*ast.Ident).Name + "." + t.Sel.Name, nil + case *ast.Ident: + pstr := t.Name + return pstr, nil + case *ast.ArrayType: + subt, err := typeName(t.Elt, pkg) + if err != nil { + return "", err + } + return "[]" + subt, nil + case *ast.StarExpr: + subt, err := typeName(t.X, pkg) + if err != nil { + return "", err + } + return "*" + subt, nil + case *ast.MapType: + k, err := typeName(t.Key, pkg) + if err != nil { + return "", err + } + v, err := typeName(t.Value, pkg) + if err != nil { + return "", err + } + return "map[" + k + "]" + v, nil + case *ast.StructType: + if len(t.Fields.List) != 0 { + return "", fmt.Errorf("can't struct") + } + return "struct{}", nil + case *ast.InterfaceType: + if len(t.Methods.List) != 0 { + return "", fmt.Errorf("can't interface") + } + return "interface{}", nil + case *ast.ChanType: + subt, err := typeName(t.Value, pkg) + if err != nil { + return "", err + } + if t.Dir == ast.SEND { + subt = "->chan " + subt + } else { + subt = "<-chan " + subt + } + return subt, nil + default: + return "", fmt.Errorf("unknown type") + } +} + +func generate(path, pkg, outpkg, outfile string) error { + fset := token.NewFileSet() + apiDir, err := filepath.Abs(path) + if err != nil { + return err + } + outfile, err = filepath.Abs(outfile) + if err != nil { + return err + } + pkgs, err := parser.ParseDir(fset, apiDir, nil, parser.AllErrors|parser.ParseComments) + if err != nil { + return err + } + + ap := pkgs[pkg] + + v := &Visitor{make(map[string]map[string]*methodMeta), map[string][]string{}} + ast.Walk(v, ap) + + type methodInfo struct { + Name string + node ast.Node + Tags map[string][]string + NamedParams, ParamNames, Results, DefRes string + } + + type strinfo struct { + Name string + Methods map[string]*methodInfo + Include []string + } + + type meta struct { + Infos map[string]*strinfo + Imports map[string]string + OutPkg string + } + + m := &meta{ + OutPkg: outpkg, + Infos: map[string]*strinfo{}, + Imports: map[string]string{}, + } + + for fn, f := range ap.Files { + if strings.HasSuffix(fn, "gen.go") { + continue + } + + //fmt.Println("F:", fn) + cmap := ast.NewCommentMap(fset, f, f.Comments) + + for _, im := range f.Imports { + m.Imports[im.Path.Value] = im.Path.Value + if im.Name != nil { + m.Imports[im.Path.Value] = im.Name.Name + " " + m.Imports[im.Path.Value] + } + } + + for ifname, methods := range v.Methods { + if _, ok := m.Infos[ifname]; !ok { + m.Infos[ifname] = &strinfo{ + Name: ifname, + Methods: map[string]*methodInfo{}, + Include: v.Include[ifname], + } + } + info := m.Infos[ifname] + for mname, node := range methods { + filteredComments := cmap.Filter(node.node).Comments() + + if _, ok := info.Methods[mname]; !ok { + var params, pnames []string + for _, param := range node.ftype.Params.List { + pstr, err := typeName(param.Type, outpkg) + if err != nil { + return err + } + + c := len(param.Names) + if c == 0 { + c = 1 + } + + for i := 0; i < c; i++ { + pname := fmt.Sprintf("p%d", len(params)) + pnames = append(pnames, pname) + params = append(params, pname+" "+pstr) + } + } + + results := []string{} + for _, result := range node.ftype.Results.List { + rs, err := typeName(result.Type, outpkg) + if err != nil { + return err + } + results = append(results, rs) + } + + defRes := "" + if len(results) > 1 { + defRes = results[0] + switch { + case defRes[0] == '*' || defRes[0] == '<', defRes == "interface{}": + defRes = "nil" + case defRes == "bool": + defRes = "false" + case defRes == "string": + defRes = `""` + case defRes == "int", defRes == "int64", defRes == "uint64", defRes == "uint": + defRes = "0" + default: + defRes = "*new(" + defRes + ")" + } + defRes += ", " + } + + info.Methods[mname] = &methodInfo{ + Name: mname, + node: node.node, + Tags: map[string][]string{}, + NamedParams: strings.Join(params, ", "), + ParamNames: strings.Join(pnames, ", "), + Results: strings.Join(results, ", "), + DefRes: defRes, + } + } + + // try to parse tag info + if len(filteredComments) > 0 { + tagstr := filteredComments[len(filteredComments)-1].List[0].Text + tagstr = strings.TrimPrefix(tagstr, "//") + tl := strings.Split(strings.TrimSpace(tagstr), " ") + for _, ts := range tl { + tf := strings.Split(ts, ":") + if len(tf) != 2 { + continue + } + if tf[0] != "perm" { // todo: allow more tag types + continue + } + info.Methods[mname].Tags[tf[0]] = tf + } + } + } + } + } + + /*jb, err := json.MarshalIndent(Infos, "", " ") + if err != nil { + return err + } + fmt.Println(string(jb))*/ + + w, err := os.OpenFile(outfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666) + if err != nil { + return err + } + + err = doTemplate(w, m, `// Code generated by ./gen/api. DO NOT EDIT. + +package {{.OutPkg}} + +import ( +{{range .Imports}} {{.}} +{{end}} +) +`) + if err != nil { + return err + } + + err = doTemplate(w, m, ` + +var ErrNotSupported = errors.New("method not supported") + +{{range .Infos}} +type {{.Name}}Struct struct { +{{range .Include}} + {{.}}Struct +{{end}} + Internal struct { +{{range .Methods}} + {{.Name}} func({{.NamedParams}}) ({{.Results}}) `+"`"+`{{range .Tags}}{{index . 0}}:"{{index . 1}}"{{end}}`+"`"+` +{{end}} + } +} + +type {{.Name}}Stub struct { +{{range .Include}} + {{.}}Stub +{{end}} +} +{{end}} + +{{range .Infos}} +{{$name := .Name}} +{{range .Methods}} +func (s *{{$name}}Struct) {{.Name}}({{.NamedParams}}) ({{.Results}}) { + if s.Internal.{{.Name}} == nil { + return {{.DefRes}}ErrNotSupported + } + return s.Internal.{{.Name}}({{.ParamNames}}) +} + +func (s *{{$name}}Stub) {{.Name}}({{.NamedParams}}) ({{.Results}}) { + return {{.DefRes}}ErrNotSupported +} +{{end}} +{{end}} + +{{range .Infos}}var _ {{.Name}} = new({{.Name}}Struct) +{{end}} + +`) + return err +} + +func doTemplate(w io.Writer, info interface{}, templ string) error { + t := template.Must(template.New(""). + Funcs(template.FuncMap{}).Parse(templ)) + + return t.Execute(w, info) +} diff --git a/go.mod b/go.mod index fa8e68b..e927049 100644 --- a/go.mod +++ b/go.mod @@ -6,16 +6,12 @@ require ( contrib.go.opencensus.io/exporter/jaeger v0.2.1 contrib.go.opencensus.io/exporter/prometheus v0.4.0 github.com/BurntSushi/toml v0.4.1 - github.com/GeertJohan/go.rice v1.0.2 github.com/dgraph-io/badger/v2 v2.2007.3 github.com/dustin/go-humanize v1.0.0 github.com/elastic/gosigar v0.14.2 - github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f github.com/filecoin-project/go-address v0.0.6 github.com/filecoin-project/go-bitfield v0.2.4 - github.com/filecoin-project/go-crypto v0.0.1 github.com/filecoin-project/go-jsonrpc v0.1.5 - github.com/filecoin-project/go-paramfetch v0.0.4 github.com/filecoin-project/go-state-types v0.1.8 github.com/filecoin-project/specs-actors v0.9.15 github.com/filecoin-project/specs-actors/v2 v2.3.6 @@ -23,25 +19,20 @@ require ( github.com/filecoin-project/venus v1.6.0-rc1 github.com/gbrlsnchs/jwt/v3 v3.0.1 github.com/go-resty/resty/v2 v2.4.0 + github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 github.com/hashicorp/golang-lru v0.5.4 - github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-cid v0.1.0 github.com/ipfs/go-datastore v0.5.1 github.com/ipfs/go-ds-badger2 v0.1.2 github.com/ipfs/go-ds-leveldb v0.5.0 github.com/ipfs/go-ds-measure v0.2.0 github.com/ipfs/go-fs-lock v0.0.7 - github.com/ipfs/go-ipfs-blockstore v1.1.2 - github.com/ipfs/go-ipfs-util v0.0.2 github.com/ipfs/go-log/v2 v2.5.1 github.com/ipfs/go-metrics-interface v0.0.1 github.com/kelseyhightower/envconfig v1.4.0 - github.com/libp2p/go-buffer-pool v0.0.2 github.com/libp2p/go-libp2p-core v0.15.1 - github.com/libp2p/go-libp2p-pubsub v0.6.1 - github.com/libp2p/go-libp2p-record v0.1.3 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-base32 v0.0.4 @@ -49,11 +40,9 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.12.1 github.com/raulk/clock v1.1.0 - github.com/raulk/go-watchdog v1.2.0 github.com/stretchr/testify v1.7.1 github.com/syndtr/goleveldb v1.0.0 github.com/urfave/cli/v2 v2.3.0 - github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 go.opencensus.io v0.23.0 go.uber.org/fx v1.15.0 go.uber.org/zap v1.21.0 @@ -64,24 +53,21 @@ require ( require ( github.com/DataDog/zstd v1.4.1 // indirect - github.com/GeertJohan/go.incremental v1.0.0 // indirect github.com/ahmetb/go-linq/v3 v3.2.0 // indirect - github.com/akavel/rsrc v0.8.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/containerd/cgroups v1.0.3 // indirect - github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/daaku/go.zipexe v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e // indirect github.com/dgraph-io/ristretto v0.0.4-0.20210122082011-bb5d392ed82d // indirect github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect - github.com/docker/go-units v0.4.0 // indirect + github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f // indirect github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect github.com/filecoin-project/go-amt-ipld/v3 v3.1.0 // indirect github.com/filecoin-project/go-amt-ipld/v4 v4.0.0 // indirect + github.com/filecoin-project/go-commp-utils v0.1.3 // indirect github.com/filecoin-project/go-fil-commcid v0.1.0 // indirect github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect @@ -96,43 +82,36 @@ require ( github.com/go-kit/log v0.2.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect - github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.3 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect + github.com/ipfs/go-block-format v0.0.3 // indirect + github.com/ipfs/go-ipfs-blockstore v1.1.2 // indirect github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect + github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipld-cbor v0.0.6 // indirect github.com/ipfs/go-ipld-format v0.2.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect - github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 // indirect github.com/jbenet/goprocess v0.1.4 // indirect - github.com/jessevdk/go-flags v1.4.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.2 // indirect github.com/klauspost/cpuid/v2 v2.0.12 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/libp2p/go-flow-metrics v0.0.3 // indirect - github.com/libp2p/go-libp2p-discovery v0.6.0 // indirect - github.com/libp2p/go-libp2p-peerstore v0.6.0 // indirect - github.com/libp2p/go-msgio v0.2.0 // indirect github.com/libp2p/go-openssl v0.0.7 // indirect github.com/magefile/mage v1.11.0 // indirect github.com/mattn/go-isatty v0.0.14 // indirect - github.com/mattn/go-runewidth v0.0.10 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base36 v0.1.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-multicodec v0.4.1 // indirect github.com/multiformats/go-multihash v0.1.0 // indirect github.com/multiformats/go-varint v0.0.6 // indirect - github.com/nkovacs/streamquote v1.0.0 // indirect - github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect @@ -140,18 +119,16 @@ require ( github.com/prometheus/common v0.33.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/prometheus/statsd_exporter v0.21.0 // indirect - github.com/rivo/uniseg v0.1.0 // indirect github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasttemplate v1.1.0 // indirect - github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect + github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 // indirect github.com/x448/float16 v0.8.4 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/dig v1.13.0 // indirect + go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go4.org v0.0.0-20200411211856-f5505b9728dd // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect @@ -163,7 +140,6 @@ require ( golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/api v0.43.0 // indirect google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect lukechampine.com/blake3 v1.1.7 // indirect diff --git a/go.sum b/go.sum index 8f51a37..ba668d7 100644 --- a/go.sum +++ b/go.sum @@ -60,10 +60,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg= -github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= -github.com/GeertJohan/go.rice v1.0.2 h1:PtRw+Tg3oa3HYwiDBZyvOJ8LdIyf6lAovJJtr7YOAYk= -github.com/GeertJohan/go.rice v1.0.2/go.mod h1:af5vUNlDNkCjOZeSGFgIJxDje9qdjsO6hshx0gTmZt4= github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee/go.mod h1:W0GbEAA4uFNYOGG2cJpmFJ04E6SD1NLELPYZB57/7AY= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= @@ -81,8 +77,6 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE= github.com/ahmetb/go-linq/v3 v3.2.0/go.mod h1:haQ3JfOeWK8HpVxMtHHEMPVgBKiYyQ+f1/kLZh/cj9U= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= -github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/akrylysov/pogreb v0.10.1/go.mod h1:pNs6QmpQ1UlTJKDezuRWmaqkgUE2TuU0YTWyqJZ7+lI= 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= @@ -162,7 +156,6 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf 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/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -186,7 +179,6 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH 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/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBdAP4= github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= 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= @@ -198,11 +190,9 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee 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 v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= 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/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -217,17 +207,15 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY= -github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E= 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/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.3.13/go.mod h1:WAmG5dWY8/PYHt4vKxlt90NsbHMAOCiteYKZMiIRfOo= +github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e h1:lj77EKYUpYXTd8CD/+QMIf8b6OIOTsfEBSXiAzuEHTU= github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e/go.mod h1:3ZQK6DMPSz/QZ73jlWxBtUhNA8xZx7LzUFSq/OfP8vk= 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= @@ -284,7 +272,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.12.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/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0= github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8= @@ -305,6 +292,7 @@ github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= github.com/filecoin-project/go-cbor-util v0.0.1/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= +github.com/filecoin-project/go-commp-utils v0.1.3 h1:rTxbkNXZU7FLgdkBk8RsQIEOuPONHykEoX3xGk41Fkw= github.com/filecoin-project/go-commp-utils v0.1.3/go.mod h1:3ENlD1pZySaUout0p9ANQrY3fDFoXdqyX04J+dWpK30= github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= github.com/filecoin-project/go-crypto v0.0.1 h1:AcvpSGGCgjaY8y1az6AMfKQWreF/pWO2JJGLl6gCq6o= @@ -334,7 +322,6 @@ github.com/filecoin-project/go-leb128 v0.0.0-20190212224330-8d79a5489543/go.mod github.com/filecoin-project/go-legs v0.3.7/go.mod h1:pgekGm8/gKY5zCtQ/qGAoSjGP92wTLFqpO3GPHeu8YU= github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak= github.com/filecoin-project/go-padreader v0.0.1/go.mod h1:VYVPJqwpsfmtoHnAmPx6MUwmrK6HIcDqZJiuZhtmfLQ= -github.com/filecoin-project/go-paramfetch v0.0.4 h1:H+Me8EL8T5+79z/KHYQQcT8NVOzYVqXIi7nhb48tdm8= github.com/filecoin-project/go-paramfetch v0.0.4/go.mod h1:1FH85P8U+DUEmWk1Jkw3Bw7FrwTVUNHk/95PSPG+dts= github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= @@ -391,7 +378,6 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -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/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= @@ -456,14 +442,11 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -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-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= -github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 h1:s+PDl6lozQ+dEUtUtQnO7+A2iPG3sK1pI4liU+jxn90= github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= 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/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -497,6 +480,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt 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.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +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= @@ -545,7 +529,6 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u 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.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= @@ -886,7 +869,6 @@ github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4 github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c/go.mod h1:sdx1xVM9UuLw1tXnhJWN3piypTUO3vCIHYmG15KE/dU= 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= @@ -894,7 +876,6 @@ github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0 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 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -942,7 +923,6 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= @@ -981,11 +961,9 @@ github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0 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/go.mod h1:cR1d8gA0Hr59Fj6NhaTpFhJZrjSYuNmhpT2r25zYR70= -github.com/libp2p/go-conn-security-multistream v0.3.0 h1:9UCIKlBL1hC9u7nkMXpD1nkc/T53PKMAn3/k9ivBAVc= github.com/libp2p/go-conn-security-multistream v0.3.0/go.mod h1:EEP47t4fw/bTelVmEzIDqSe69hO/ip52xBEhZMLWAHM= github.com/libp2p/go-doh-resolver v0.3.1/go.mod h1:y5go1ZppAq9N2eppbX0xON01CyPBeUg2yS6BTssssog= 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= @@ -1024,7 +1002,6 @@ github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv 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/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= -github.com/libp2p/go-libp2p-blankhost v0.3.0 h1:kTnLArltMabZlzY63pgGDA4kkUcLkBFSM98zBssn/IY= github.com/libp2p/go-libp2p-blankhost v0.3.0/go.mod h1:urPC+7U01nCGgJ3ZsV8jdwTp6Ji9ID0dMTvq+aJ+nZU= github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= @@ -1034,7 +1011,6 @@ github.com/libp2p/go-libp2p-circuit v0.4.0/go.mod h1:t/ktoFIUzM6uLQ+o1G6NuBl2ANh github.com/libp2p/go-libp2p-circuit v0.6.0/go.mod h1:kB8hY+zCpMeScyvFrKrGicRdid6vNXbunKE4rXATZ0M= github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0= github.com/libp2p/go-libp2p-connmgr v0.3.0/go.mod h1:RVoyPjJm0J9Vd1m6qUN2Tn7kJm4rL1Ml20pFsFgPGik= -github.com/libp2p/go-libp2p-connmgr v0.3.1 h1:alEy2fpGKFu+7ZhQF4GF0dvKLyVHeLtIfS/KziwoiZw= github.com/libp2p/go-libp2p-connmgr v0.3.1/go.mod h1:RVoyPjJm0J9Vd1m6qUN2Tn7kJm4rL1Ml20pFsFgPGik= github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= @@ -1078,7 +1054,6 @@ github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFT 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.6.0 h1:1XdPmhMJr8Tmj/yUfkJMIi8mgwWrLUsCB3bMxdT+DSo= github.com/libp2p/go-libp2p-discovery v0.6.0/go.mod h1:/u1voHt0tKIe5oIA1RHBKQLVCWPna2dXmPNHc2zR9S8= github.com/libp2p/go-libp2p-gostream v0.3.0/go.mod h1:pLBQu8db7vBMNINGsAwLL/ZCE8wng5V1FThoaE5rNjc= github.com/libp2p/go-libp2p-gostream v0.3.1/go.mod h1:1V3b+u4Zhaq407UUY9JLCpboaeufAeVQbnvAt12LRsI= @@ -1132,14 +1107,11 @@ github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuD github.com/libp2p/go-libp2p-peerstore v0.2.7/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.2.8/go.mod h1:gGiPlXdz7mIHd2vfAsHzBNAMqSDkt2UBFwgcITgw1lA= github.com/libp2p/go-libp2p-peerstore v0.4.0/go.mod h1:rDJUFyzEWPpXpEwywkcTYYzDHlwza8riYMaUzaN6hX0= -github.com/libp2p/go-libp2p-peerstore v0.6.0 h1:HJminhQSGISBIRb93N6WK3t6Fa8OOTnHd/VBjL4mY5A= github.com/libp2p/go-libp2p-peerstore v0.6.0/go.mod h1:DGEmKdXrcYpK9Jha3sS7MhqYdInxJy84bIPtSu65bKc= -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-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= github.com/libp2p/go-libp2p-pubsub v0.6.0/go.mod h1:nJv87QM2cU0w45KPR1rZicq+FmFIOD16zmT+ep1nOmg= -github.com/libp2p/go-libp2p-pubsub v0.6.1 h1:wycbV+f4rreCoVY61Do6g/BUk0RIrbNRcYVbn+QkjGk= github.com/libp2p/go-libp2p-pubsub v0.6.1/go.mod h1:nJv87QM2cU0w45KPR1rZicq+FmFIOD16zmT+ep1nOmg= github.com/libp2p/go-libp2p-pubsub-router v0.5.0/go.mod h1:TRJKskSem3C0aSb3CmRgPwq6IleVFzds6hS09fmZbGM= github.com/libp2p/go-libp2p-quic-transport v0.10.0/go.mod h1:RfJbZ8IqXIhxBRm5hqUEJqjiiY8xmEuq3HUDS993MkA= @@ -1148,13 +1120,11 @@ github.com/libp2p/go-libp2p-quic-transport v0.13.0/go.mod h1:39/ZWJ1TW/jx1iFkKzz github.com/libp2p/go-libp2p-quic-transport v0.15.0/go.mod h1:wv4uGwjcqe8Mhjj7N/Ic0aKjA+/10UnMlSzLO0yRpYQ= github.com/libp2p/go-libp2p-quic-transport v0.15.2/go.mod h1:wv4uGwjcqe8Mhjj7N/Ic0aKjA+/10UnMlSzLO0yRpYQ= github.com/libp2p/go-libp2p-quic-transport v0.16.0/go.mod h1:1BXjVMzr+w7EkPfiHkKnwsWjPjtfaNT0q8RS3tGDvEQ= -github.com/libp2p/go-libp2p-quic-transport v0.17.0 h1:yFh4Gf5MlToAYLuw/dRvuzYd1EnE2pX3Lq1N6KDiWRQ= github.com/libp2p/go-libp2p-quic-transport v0.17.0/go.mod h1:x4pw61P3/GRCcSLypcQJE/Q2+E9f4X+5aRcZLXf20LM= github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= github.com/libp2p/go-libp2p-record v0.1.1/go.mod h1:VRgKajOyMVgP/F0L5g3kH7SVskp17vFi2xheb5uMJtg= 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-resource-manager v0.1.0/go.mod h1:wJPNjeE4XQlxeidwqVY5G6DLOKqFK33u2n8blpl0I6Y= github.com/libp2p/go-libp2p-resource-manager v0.1.3/go.mod h1:wJPNjeE4XQlxeidwqVY5G6DLOKqFK33u2n8blpl0I6Y= @@ -1180,7 +1150,6 @@ github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL github.com/libp2p/go-libp2p-swarm v0.9.0/go.mod h1:2f8d8uxTJmpeqHF/1ujjdXZp+98nNIbujVOMEZxCbZ8= github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= github.com/libp2p/go-libp2p-swarm v0.10.1/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= -github.com/libp2p/go-libp2p-swarm v0.10.2 h1:UaXf+CTq6Ns1N2V1EgqJ9Q3xaRsiN7ImVlDMpirMAWw= github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -1197,12 +1166,10 @@ github.com/libp2p/go-libp2p-testing v0.6.0/go.mod h1:QBk8fqIL1XNcno/l3/hhaIEn4aL github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2Cl+FAjoWIA2pa0X6E= github.com/libp2p/go-libp2p-testing v0.8.0/go.mod h1:gRdsNxQSxAZowTgcLY7CC33xPmleZzoBpqSYbWenqPc= github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= -github.com/libp2p/go-libp2p-testing v0.9.2 h1:dCpODRtRaDZKF8HXT9qqqgON+OMEB423Knrgeod8j84= github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40sKitV4c50uI1M= github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.3.1/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= -github.com/libp2p/go-libp2p-tls v0.4.1 h1:1ByJUbyoMXvYXDoW6lLsMxqMViQNXmt+CfQqlnCpY+M= github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= @@ -1217,7 +1184,6 @@ github.com/libp2p/go-libp2p-transport-upgrader v0.4.6/go.mod h1:JE0WQuQdy+uLZ5zO github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= github.com/libp2p/go-libp2p-transport-upgrader v0.6.0/go.mod h1:1e07y1ZSZdHo9HPbuU8IztM1Cj+DR5twgycb4pnRzRo= github.com/libp2p/go-libp2p-transport-upgrader v0.7.0/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= -github.com/libp2p/go-libp2p-transport-upgrader v0.7.1 h1:MSMe+tUfxpC9GArTz7a4G5zQKQgGh00Vio87d3j3xIg= github.com/libp2p/go-libp2p-transport-upgrader v0.7.1/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= github.com/libp2p/go-libp2p-xor v0.0.0-20210714161855-5c005aca55db/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY= github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8= @@ -1237,7 +1203,6 @@ github.com/libp2p/go-libp2p-yamux v0.6.0/go.mod h1:MRhd6mAYnFRnSISp4M8i0ClV/j+mW github.com/libp2p/go-libp2p-yamux v0.7.0/go.mod h1:fMyA0CsPfHkIuBU0wjRGrCjTBFiXTXxG0k5M4ETv+08= github.com/libp2p/go-libp2p-yamux v0.8.0/go.mod h1:yTkPgN2ib8FHyU1ZcVD7aelzyAqXXwEPbyx+aSKm9h8= github.com/libp2p/go-libp2p-yamux v0.8.1/go.mod h1:rUozF8Jah2dL9LLGyBaBeTQeARdwhefMCTQVQt6QobE= -github.com/libp2p/go-libp2p-yamux v0.9.1 h1:oplewiRix8s45SOrI30rCPZG5mM087YZp+VYhXAh4+c= github.com/libp2p/go-libp2p-yamux v0.9.1/go.mod h1:wRc6wvyxQINFcKe7daL4BeQ02Iyp+wxyC8WCNfngBrA= github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= @@ -1257,7 +1222,6 @@ github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+ github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= github.com/libp2p/go-msgio v0.1.0/go.mod h1:eNlv2vy9V2X/kNldcZ+SShFE++o2Yjxwx6RAYsmgJnE= -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.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= @@ -1267,7 +1231,6 @@ github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdm 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/go.mod h1:AqhkMh0VuWmfgtxKPp3Oc1LdU5QSWS7wl0QLhSZqXxQ= -github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= 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= @@ -1277,13 +1240,11 @@ github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGN 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/go.mod h1:SPD+5RwGC7rcnzngoYC86GjPzjSywuQyMVAheVBD9nQ= -github.com/libp2p/go-reuseport v0.1.0 h1:0ooKOx2iwyIkf339WCZ2HN3ujTDbkK0PjC7JVoP1AiM= github.com/libp2p/go-reuseport v0.1.0/go.mod h1:bQVn9hmfcTaoo0c9v5pBhOarsU1eNOBZdaAd2hzXRKU= 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/go.mod h1:TC62hhPc8qs5c/RoXDZG6YmjK+/YWUPC0yYmeUecbjc= -github.com/libp2p/go-reuseport-transport v0.1.0 h1:C3PHeHjmnz8m6f0uydObj02tMEoi7CyD1zuN7xQT8gc= github.com/libp2p/go-reuseport-transport v0.1.0/go.mod h1:vev0C0uMkzriDY59yFHD9v+ujJvYmDQVLowvAjEOmfw= 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= @@ -1294,7 +1255,6 @@ github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqX github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw= 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/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= -github.com/libp2p/go-stream-muxer-multistream v0.4.0 h1:HsM/9OdtqnIzjVXcxTXjmqKrj3gJ8kacaOJwJS1ipaY= github.com/libp2p/go-stream-muxer-multistream v0.4.0/go.mod h1:nb+dGViZleRP4XcyHuZSVrJCBl55nRBOMmiSL/dyziw= github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o= github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= @@ -1306,7 +1266,6 @@ github.com/libp2p/go-tcp-transport v0.2.4/go.mod h1:9dvr03yqrPyYGIEN6Dy5UvdJZjyP github.com/libp2p/go-tcp-transport v0.2.7/go.mod h1:lue9p1b3VmZj1MhhEGB/etmvF/nBQ0X9CW2DutBT3MM= github.com/libp2p/go-tcp-transport v0.4.0/go.mod h1:0y52Rwrn4076xdJYu/51/qJIdxz+EWDAOG2S45sV3VI= github.com/libp2p/go-tcp-transport v0.5.0/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= -github.com/libp2p/go-tcp-transport v0.5.1 h1:edOOs688VLZAozWC7Kj5/6HHXKNwi9M6wgRmmLa8M6Q= github.com/libp2p/go-tcp-transport v0.5.1/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc= @@ -1326,7 +1285,6 @@ github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZ 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 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI= github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= github.com/libp2p/go-yamux/v2 v2.0.0/go.mod h1:NVWira5+sVUIU6tu1JWvaRn1dRnG+cawOJiflsAM+7U= github.com/libp2p/go-yamux/v2 v2.1.1/go.mod h1:3So6P6TV6r75R9jiBpiIKgU/66lOarCZjqROGxzPpPQ= @@ -1335,7 +1293,6 @@ github.com/libp2p/go-yamux/v2 v2.3.0/go.mod h1:iTU+lOIn/2h0AgKcL49clNTwfEw+WSfDY github.com/libp2p/go-yamux/v3 v3.0.1/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= github.com/libp2p/go-yamux/v3 v3.0.2/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= github.com/libp2p/go-yamux/v3 v3.1.1/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= -github.com/libp2p/go-yamux/v3 v3.1.2 h1:lNEy28MBk1HavUAlzKgShp+F6mn/ea1nDYWftZhFW9Q= github.com/libp2p/go-yamux/v3 v3.1.2/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= @@ -1346,7 +1303,6 @@ github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2 github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= -github.com/lucas-clemente/quic-go v0.27.1 h1:sOw+4kFSVrdWOYmUjufQ9GBVPqZ+tu+jMtXxXNmRJyk= github.com/lucas-clemente/quic-go v0.27.1/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= @@ -1364,16 +1320,12 @@ github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1j 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/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= github.com/marten-seemann/qtls-go1-17 v0.1.0-rc.1/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= -github.com/marten-seemann/qtls-go1-17 v0.1.1 h1:DQjHPq+aOzUeh9/lixAGunn6rIOQyWChPSI4+hgW7jc= github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= -github.com/marten-seemann/qtls-go1-18 v0.1.1 h1:qp7p7XXUFL7fpBvSS1sWD+uSqPvzNQK43DH+/qEkj0Y= github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= -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/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -1383,7 +1335,6 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 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= @@ -1399,7 +1350,6 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-xmlrpc v0.0.3/go.mod h1:mqc2dz7tP5x5BKlCahN/n+hs7OSZKJkS9JsHNBRlrxA= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -1422,9 +1372,7 @@ github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJys github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/miekg/dns v1.1.48/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= 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= @@ -1486,7 +1434,6 @@ github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsV github.com/multiformats/go-multiaddr-dns v0.3.0/go.mod h1:mNzQ4eTGDg0ll1N9jKPOUogZPoJ30W8a7zk66FQPpdQ= 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= @@ -1524,7 +1471,6 @@ github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9 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/go.mod h1:UIcnm7Zuo8HKG+HkWgfQsGL+/MIEhyTqbODbIUwSXKs= -github.com/multiformats/go-multistream v0.3.0 h1:yX1v4IWseLPmr0rmnDo148wWJbNx40JxBZGmQb5fUP4= github.com/multiformats/go-multistream v0.3.0/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= @@ -1550,8 +1496,6 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c/go.mod h1:7qN3Y0BvzRUf4LofcoJplQL10lsFDb4PYlePTVwrP28= -github.com/nkovacs/streamquote v1.0.0 h1:PmVIV08Zlx2lZK5fFZlMZ04eHcDTIFJCv/5/0twVUow= -github.com/nkovacs/streamquote v1.0.0/go.mod h1:BN+NaZ2CmdKqUuTUXUEm9j95B2TRbpOWpxbJYzzgUsc= 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= @@ -1582,7 +1526,6 @@ github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 h1:3snG66yBm59tKhhSPQrQ/0bCrv1LQbKt40LnUPiUxdc= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc= github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= @@ -1689,10 +1632,8 @@ github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3M github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/raulk/clock v1.1.0 h1:dpb29+UKMbLqiU/jqIJptgLR1nn23HLgMY0sTCDza5Y= github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= -github.com/raulk/go-watchdog v1.2.0 h1:konN75pw2BMmZ+AfuAm5rtFsWcJpKF3m02rKituuXNo= github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 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= @@ -1824,10 +1765,8 @@ github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2 github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.1.0 h1:RZqt0yGBsps8NGvLSGW804QQqCUYYLsaOjTVHy1Ocw4= github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= @@ -1869,9 +1808,7 @@ github.com/whyrusleeping/go-sysinfo v0.0.0-20190219211824-4a357d4b90b1/go.mod h1 github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= 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/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -2504,7 +2441,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG 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.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 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= @@ -2529,7 +2465,6 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 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/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= gopkg.in/cheggaaa/pb.v1 v1.0.28/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= diff --git a/lib/backupds/datastore.go b/lib/backupds/datastore.go deleted file mode 100644 index 0bc95e7..0000000 --- a/lib/backupds/datastore.go +++ /dev/null @@ -1,190 +0,0 @@ -package backupds - -import ( - "context" - "crypto/sha256" - "fmt" - "io" - "sync" - - logging "github.com/ipfs/go-log/v2" - cbg "github.com/whyrusleeping/cbor-gen" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" -) - -var log = logging.Logger("backupds") - -type Datastore struct { - child datastore.Batching - - backupLk sync.RWMutex -} - -func Wrap(child datastore.Batching) *Datastore { - return &Datastore{ - child: child, - } -} - -// Writes a datastore dump into the provided writer as -// [array(*) of [key, value] tuples, checksum] -func (d *Datastore) Backup(ctx context.Context, out io.Writer) error { - scratch := make([]byte, 9) - - if err := cbg.WriteMajorTypeHeaderBuf(scratch, out, cbg.MajArray, 2); err != nil { - return fmt.Errorf("writing tuple header: %w", err) - } - - hasher := sha256.New() - hout := io.MultiWriter(hasher, out) - - // write KVs - { - // write indefinite length array header - if _, err := hout.Write([]byte{0x9f}); err != nil { - return fmt.Errorf("writing header: %w", err) - } - - d.backupLk.Lock() - defer d.backupLk.Unlock() - - log.Info("Starting datastore backup") - defer log.Info("Datastore backup done") - - qr, err := d.child.Query(ctx, query.Query{}) - if err != nil { - return fmt.Errorf("query: %w", err) - } - defer func() { - if err := qr.Close(); err != nil { - log.Errorf("query close error: %+v", err) - return - } - }() - - for result := range qr.Next() { - if err := cbg.WriteMajorTypeHeaderBuf(scratch, hout, cbg.MajArray, 2); err != nil { - return fmt.Errorf("writing tuple header: %w", err) - } - - if err := cbg.WriteMajorTypeHeaderBuf(scratch, hout, cbg.MajByteString, uint64(len([]byte(result.Key)))); err != nil { - return fmt.Errorf("writing key header: %w", err) - } - - if _, err := hout.Write([]byte(result.Key)[:]); err != nil { - return fmt.Errorf("writing key: %w", err) - } - - if err := cbg.WriteMajorTypeHeaderBuf(scratch, hout, cbg.MajByteString, uint64(len(result.Value))); err != nil { - return fmt.Errorf("writing value header: %w", err) - } - - if _, err := hout.Write(result.Value[:]); err != nil { - return fmt.Errorf("writing value: %w", err) - } - } - - // array break - if _, err := hout.Write([]byte{0xff}); err != nil { - return fmt.Errorf("writing array 'break': %w", err) - } - } - - // Write the checksum - { - sum := hasher.Sum(nil) - - if err := cbg.WriteMajorTypeHeaderBuf(scratch, hout, cbg.MajByteString, uint64(len(sum))); err != nil { - return fmt.Errorf("writing checksum header: %w", err) - } - - if _, err := hout.Write(sum[:]); err != nil { - return fmt.Errorf("writing checksum: %w", err) - } - } - - return nil -} - -// proxy - -func (d *Datastore) Get(ctx context.Context, key datastore.Key) (value []byte, err error) { - return d.child.Get(ctx, key) -} - -func (d *Datastore) Has(ctx context.Context, key datastore.Key) (exists bool, err error) { - return d.child.Has(ctx, key) -} - -func (d *Datastore) GetSize(ctx context.Context, key datastore.Key) (size int, err error) { - return d.child.GetSize(ctx, key) -} - -func (d *Datastore) Query(ctx context.Context, q query.Query) (query.Results, error) { - return d.child.Query(ctx, q) -} - -func (d *Datastore) Put(ctx context.Context, key datastore.Key, value []byte) error { - d.backupLk.RLock() - defer d.backupLk.RUnlock() - - return d.child.Put(ctx, key, value) -} - -func (d *Datastore) Delete(ctx context.Context, key datastore.Key) error { - d.backupLk.RLock() - defer d.backupLk.RUnlock() - - return d.child.Delete(ctx, key) -} - -func (d *Datastore) Sync(ctx context.Context, prefix datastore.Key) error { - d.backupLk.RLock() - defer d.backupLk.RUnlock() - - return d.child.Sync(ctx, prefix) -} - -func (d *Datastore) Close() error { - d.backupLk.RLock() - defer d.backupLk.RUnlock() - - return d.child.Close() -} - -func (d *Datastore) Batch(ctx context.Context) (datastore.Batch, error) { - b, err := d.child.Batch(ctx) - if err != nil { - return nil, err - } - - return &bbatch{ - b: b, - rlk: d.backupLk.RLocker(), - }, nil -} - -type bbatch struct { - b datastore.Batch - rlk sync.Locker -} - -func (b *bbatch) Put(ctx context.Context, key datastore.Key, value []byte) error { - return b.b.Put(ctx, key, value) -} - -func (b *bbatch) Delete(ctx context.Context, key datastore.Key) error { - return b.b.Delete(ctx, key) -} - -func (b *bbatch) Commit(ctx context.Context) error { - b.rlk.Lock() - defer b.rlk.Unlock() - - return b.b.Commit(ctx) -} - -var _ datastore.Batch = &bbatch{} -var _ datastore.Batching = &Datastore{} diff --git a/lib/backupds/read.go b/lib/backupds/read.go deleted file mode 100644 index 877aa21..0000000 --- a/lib/backupds/read.go +++ /dev/null @@ -1,76 +0,0 @@ -package backupds - -import ( - "bytes" - "crypto/sha256" - "fmt" - "io" - - "github.com/ipfs/go-datastore" - cbg "github.com/whyrusleeping/cbor-gen" -) - -func ReadBackup(r io.Reader, cb func(key datastore.Key, value []byte) error) error { - scratch := make([]byte, 9) - - if _, err := r.Read(scratch[:1]); err != nil { - return fmt.Errorf("reading array header: %w", err) - } - - if scratch[0] != 0x82 { - return fmt.Errorf("expected array(2) header byte 0x82, got %x", scratch[0]) - } - - hasher := sha256.New() - hr := io.TeeReader(r, hasher) - - if _, err := hr.Read(scratch[:1]); err != nil { - return fmt.Errorf("reading array header: %w", err) - } - - if scratch[0] != 0x9f { - return fmt.Errorf("expected indefinite length array header byte 0x9f, got %x", scratch[0]) - } - - for { - if _, err := hr.Read(scratch[:1]); err != nil { - return fmt.Errorf("reading tuple header: %w", err) - } - - if scratch[0] == 0xff { - break - } - - if scratch[0] != 0x82 { - return fmt.Errorf("expected array(2) header 0x82, got %x", scratch[0]) - } - - keyb, err := cbg.ReadByteArray(hr, 1<<40) - if err != nil { - return fmt.Errorf("reading key: %w", err) - } - key := datastore.NewKey(string(keyb)) - - value, err := cbg.ReadByteArray(hr, 1<<40) - if err != nil { - return fmt.Errorf("reading value: %w", err) - } - - if err := cb(key, value); err != nil { - return err - } - } - - sum := hasher.Sum(nil) - - expSum, err := cbg.ReadByteArray(r, 32) - if err != nil { - return fmt.Errorf("reading expected checksum: %w", err) - } - - if !bytes.Equal(sum, expSum) { - return fmt.Errorf("checksum didn't match; expected %x, got %x", expSum, sum) - } - - return nil -} diff --git a/lib/blockstore/badger/blockstore.go b/lib/blockstore/badger/blockstore.go deleted file mode 100644 index 86414c2..0000000 --- a/lib/blockstore/badger/blockstore.go +++ /dev/null @@ -1,959 +0,0 @@ -package badgerbs - -import ( - "context" - "fmt" - "io" - "os" - "path/filepath" - "runtime" - "sync" - "time" - - "github.com/dgraph-io/badger/v2" - "github.com/dgraph-io/badger/v2/options" - "github.com/dgraph-io/badger/v2/pb" - "github.com/multiformats/go-base32" - "go.uber.org/zap" - - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" - logger "github.com/ipfs/go-log/v2" - pool "github.com/libp2p/go-buffer-pool" - - "github.com/filecoin-project/venus-miner/lib/blockstore" -) - -var ( - // KeyPool is the buffer pool we use to compute storage keys. - KeyPool *pool.BufferPool = pool.GlobalPool -) - -var ( - // ErrBlockstoreClosed is returned from blockstore operations after - // the blockstore has been closed. - ErrBlockstoreClosed = fmt.Errorf("badger blockstore closed") - - log = logger.Logger("badgerbs") -) - -// aliases to mask badger dependencies. -const ( - // FileIO is equivalent to badger/options.FileIO. - FileIO = options.FileIO - // MemoryMap is equivalent to badger/options.MemoryMap. - MemoryMap = options.MemoryMap - // LoadToRAM is equivalent to badger/options.LoadToRAM. - LoadToRAM = options.LoadToRAM -) - -// Options embeds the badger options themselves, and augments them with -// blockstore-specific options. -type Options struct { - badger.Options - - // Prefix is an optional prefix to prepend to keys. Default: "". - Prefix string -} - -func DefaultOptions(path string) Options { - return Options{ - Options: badger.DefaultOptions(path), - Prefix: "", - } -} - -// badgerLogger is a local wrapper for go-log to make the interface -// compatible with badger.Logger (namely, aliasing Warnf to Warningf) -type badgerLogger struct { - *zap.SugaredLogger // skips 1 caller to get useful line info, skipping over badger.Options. - - skip2 *zap.SugaredLogger // skips 2 callers, just like above + this logger. -} - -// Warningf is required by the badger logger APIs. -func (b *badgerLogger) Warningf(format string, args ...interface{}) { - b.skip2.Warnf(format, args...) -} - -// bsState is the current blockstore state -type bsState int - -const ( - // stateOpen signifies an open blockstore - stateOpen bsState = iota - // stateClosing signifies a blockstore that is currently closing - stateClosing - // stateClosed signifies a blockstore that has been colosed - stateClosed -) - -type bsMoveState int - -const ( - // moveStateNone signifies that there is no move in progress - moveStateNone bsMoveState = iota - // moveStateMoving signifies that there is a move in a progress - moveStateMoving - // moveStateCleanup signifies that a move has completed or aborted and we are cleaning up - moveStateCleanup - // moveStateLock signifies that an exclusive lock has been acquired - moveStateLock -) - -// Blockstore is a badger-backed IPLD blockstore. -type Blockstore struct { - stateLk sync.RWMutex - state bsState - viewers sync.WaitGroup - - moveMx sync.Mutex - moveCond sync.Cond - moveState bsMoveState - rlock int - - db *badger.DB - dbNext *badger.DB // when moving - opts Options - - prefixing bool - prefix []byte - prefixLen int -} - -var _ blockstore.Blockstore = (*Blockstore)(nil) -var _ blockstore.Viewer = (*Blockstore)(nil) -var _ io.Closer = (*Blockstore)(nil) - -// Open creates a new badger-backed blockstore, with the supplied options. -func Open(opts Options) (*Blockstore, error) { - opts.Logger = &badgerLogger{ - SugaredLogger: log.Desugar().WithOptions(zap.AddCallerSkip(1)).Sugar(), - skip2: log.Desugar().WithOptions(zap.AddCallerSkip(2)).Sugar(), - } - - db, err := badger.Open(opts.Options) - if err != nil { - return nil, fmt.Errorf("failed to open badger blockstore: %w", err) - } - - bs := &Blockstore{db: db, opts: opts} - if p := opts.Prefix; p != "" { - bs.prefixing = true - bs.prefix = []byte(p) - bs.prefixLen = len(bs.prefix) - } - - bs.moveCond.L = &bs.moveMx - - return bs, nil -} - -// Close closes the store. If the store has already been closed, this noops and -// returns an error, even if the first closure resulted in error. -func (b *Blockstore) Close() error { - b.stateLk.Lock() - if b.state != stateOpen { - b.stateLk.Unlock() - return nil - } - b.state = stateClosing - b.stateLk.Unlock() - - defer func() { - b.stateLk.Lock() - b.state = stateClosed - b.stateLk.Unlock() - }() - - // wait for all accesses to complete - b.viewers.Wait() - - return b.db.Close() -} - -func (b *Blockstore) access() error { - b.stateLk.RLock() - defer b.stateLk.RUnlock() - - if b.state != stateOpen { - return ErrBlockstoreClosed - } - - b.viewers.Add(1) - return nil -} - -func (b *Blockstore) isOpen() bool { - b.stateLk.RLock() - defer b.stateLk.RUnlock() - - return b.state == stateOpen -} - -// lockDB/unlockDB implement a recursive lock contingent on move state -func (b *Blockstore) lockDB() { - b.moveMx.Lock() - defer b.moveMx.Unlock() - - if b.rlock == 0 { - for b.moveState == moveStateLock { - b.moveCond.Wait() - } - } - - b.rlock++ -} - -func (b *Blockstore) unlockDB() { - b.moveMx.Lock() - defer b.moveMx.Unlock() - - b.rlock-- - if b.rlock == 0 && b.moveState == moveStateLock { - b.moveCond.Broadcast() - } -} - -// lockMove/unlockMove implement an exclusive lock of move state -func (b *Blockstore) lockMove() { //nolint - b.moveMx.Lock() - b.moveState = moveStateLock - for b.rlock > 0 { - b.moveCond.Wait() - } -} - -func (b *Blockstore) unlockMove(state bsMoveState) { //nolint - b.moveState = state - b.moveCond.Broadcast() - b.moveMx.Unlock() -} - -// movingGC moves the blockstore to a new path, adjacent to the current path, and creates -// a symlink from the current path to the new path; the old blockstore is deleted. -// -// The blockstore MUST accept new writes during the move and ensure that these -// are persisted to the new blockstore; if a failure occurs aboring the move, -// then they must be peristed to the old blockstore. -// In short, the blockstore must not lose data from new writes during the move. -func (b *Blockstore) movingGC() error { //nolint - // this inlines moveLock/moveUnlock for the initial state check to prevent a second move - // while one is in progress without clobbering state - b.moveMx.Lock() - if b.moveState != moveStateNone { - b.moveMx.Unlock() - return fmt.Errorf("move in progress") - } - - b.moveState = moveStateLock - for b.rlock > 0 { - b.moveCond.Wait() - } - - b.moveState = moveStateMoving - b.moveCond.Broadcast() - b.moveMx.Unlock() - - var newPath string - - defer func() { - b.lockMove() - - dbNext := b.dbNext - b.dbNext = nil - - var state bsMoveState - if dbNext != nil { - state = moveStateCleanup - } else { - state = moveStateNone - } - - b.unlockMove(state) - - if dbNext != nil { - // the move failed and we have a left-over db; delete it. - err := dbNext.Close() - if err != nil { - log.Warnf("error closing badger db: %s", err) - } - b.deleteDB(newPath) - - b.lockMove() - b.unlockMove(moveStateNone) - } - }() - - // we resolve symlinks to create the new path in the adjacent to the old path. - // this allows the user to symlink the db directory into a separate filesystem. - basePath := b.opts.Dir - linkPath, err := filepath.EvalSymlinks(basePath) - if err != nil { - return fmt.Errorf("error resolving symlink %s: %w", basePath, err) - } - - if basePath == linkPath { - newPath = basePath - } else { - // we do this dance to create a name adjacent to the current one, while avoiding clown - // shoes with multiple moves (i.e. we can't just take the basename of the linkPath, as it - // could have been created in a previous move and have the timestamp suffix, which would then - // perpetuate itself. - name := filepath.Base(basePath) - dir := filepath.Dir(linkPath) - newPath = filepath.Join(dir, name) - } - newPath = fmt.Sprintf("%s.%d", newPath, time.Now().UnixNano()) - - log.Infof("moving blockstore from %s to %s", b.opts.Dir, newPath) - - opts := b.opts - opts.Dir = newPath - opts.ValueDir = newPath - - dbNew, err := badger.Open(opts.Options) - if err != nil { - return fmt.Errorf("failed to open badger blockstore in %s: %w", newPath, err) - } - - b.lockMove() - b.dbNext = dbNew - b.unlockMove(moveStateMoving) - - log.Info("copying blockstore") - err = b.doCopy(b.db, b.dbNext) - if err != nil { - return fmt.Errorf("error moving badger blockstore to %s: %w", newPath, err) - } - - b.lockMove() - dbOld := b.db - b.db = b.dbNext - b.dbNext = nil - b.unlockMove(moveStateCleanup) - - err = dbOld.Close() - if err != nil { - log.Warnf("error closing old badger db: %s", err) - } - - // this is the canonical db path; this is where our db lives. - dbPath := b.opts.Dir - - // we first move the existing db out of the way, and only delete it after we have symlinked the - // new db to the canonical path - backupPath := fmt.Sprintf("%s.old.%d", dbPath, time.Now().Unix()) - if err = os.Rename(dbPath, backupPath); err != nil { - // this is not catastrophic in the sense that we have not lost any data. - // but it is pretty bad, as the db path points to the old db, while we are now using to the new - // db; we can't continue and leave a ticking bomb for the next restart. - // so a panic is appropriate and user can fix. - panic(fmt.Errorf("error renaming old badger db dir from %s to %s: %w; USER ACTION REQUIRED", dbPath, backupPath, err)) //nolint - } - - if err = symlink(newPath, dbPath); err != nil { - // same here; the db path is pointing to the void. panic and let the user fix. - panic(fmt.Errorf("error symlinking new badger db dir from %s to %s: %w; USER ACTION REQUIRED", newPath, dbPath, err)) //nolint - } - - // the delete follows symlinks - b.deleteDB(backupPath) - - log.Info("moving blockstore done") - return nil -} - -// symlink creates a symlink from path to linkTo; the link is relative if the two are -// in the same directory -func symlink(path, linkTo string) error { //nolint - resolvedPathDir, err := filepath.EvalSymlinks(filepath.Dir(path)) - if err != nil { - return fmt.Errorf("error resolving links in %s: %w", path, err) - } - - resolvedLinkDir, err := filepath.EvalSymlinks(filepath.Dir(linkTo)) - if err != nil { - return fmt.Errorf("error resolving links in %s: %w", linkTo, err) - } - - if resolvedPathDir == resolvedLinkDir { - path = filepath.Base(path) - } - - return os.Symlink(path, linkTo) -} - -// doCopy copies a badger blockstore to another, with an optional filter; if the filter -// is not nil, then only cids that satisfy the filter will be copied. -func (b *Blockstore) doCopy(from, to *badger.DB) error { //nolint - workers := runtime.NumCPU() / 2 - if workers < 2 { - workers = 2 - } - - stream := from.NewStream() - stream.NumGo = workers - stream.LogPrefix = "doCopy" - stream.Send = func(list *pb.KVList) error { - batch := to.NewWriteBatch() - defer batch.Cancel() - - for _, kv := range list.Kv { - if kv.Key == nil || kv.Value == nil { - continue - } - if err := batch.Set(kv.Key, kv.Value); err != nil { - return err - } - } - - return batch.Flush() - } - - return stream.Orchestrate(context.Background()) -} - -func (b *Blockstore) deleteDB(path string) { //nolint - // follow symbolic links, otherwise the data wil be left behind - linkPath, err := filepath.EvalSymlinks(path) - if err != nil { - log.Warnf("error resolving symlinks in %s", path) - return - } - - log.Infof("removing data directory %s", linkPath) - if err := os.RemoveAll(linkPath); err != nil { - log.Warnf("error deleting db at %s: %s", linkPath, err) - return - } - - if path != linkPath { - log.Infof("removing link %s", path) - if err := os.Remove(path); err != nil { - log.Warnf("error removing symbolic link %s", err) - } - } -} - -func (b *Blockstore) onlineGC() error { //nolint - b.lockDB() - defer b.unlockDB() - - // compact first to gather the necessary statistics for GC - nworkers := runtime.NumCPU() / 2 - if nworkers < 2 { - nworkers = 2 - } - - err := b.db.Flatten(nworkers) - if err != nil { - return err - } - - for err == nil { - err = b.db.RunValueLogGC(0.125) - } - - if err == badger.ErrNoRewrite { - // not really an error in this case, it signals the end of GC - return nil - } - - return err -} - -// Size returns the aggregate size of the blockstore -func (b *Blockstore) Size() (int64, error) { - if err := b.access(); err != nil { - return 0, err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - lsm, vlog := b.db.Size() - size := lsm + vlog - - if size == 0 { - // badger reports a 0 size on symlinked directories... sigh - dir := b.opts.Dir - entries, err := os.ReadDir(dir) - if err != nil { - return 0, err - } - - for _, e := range entries { - path := filepath.Join(dir, e.Name()) - finfo, err := os.Stat(path) - if err != nil { - return 0, err - } - size += finfo.Size() - } - } - - return size, nil -} - -// View implements blockstore.Viewer, which leverages zero-copy read-only -// access to values. -func (b *Blockstore) View(ctx context.Context, cid cid.Cid, fn func([]byte) error) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(cid) - if pooled { - defer KeyPool.Put(k) - } - - return b.db.View(func(txn *badger.Txn) error { - switch item, err := txn.Get(k); err { - case nil: - return item.Value(fn) - case badger.ErrKeyNotFound: - return blockstore.ErrNotFound - default: - return fmt.Errorf("failed to view block from badger blockstore: %w", err) - } - }) -} - -// Has implements Blockstore.Has. -func (b *Blockstore) Has(ctx context.Context, cid cid.Cid) (bool, error) { - if err := b.access(); err != nil { - return false, err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(cid) - if pooled { - defer KeyPool.Put(k) - } - - err := b.db.View(func(txn *badger.Txn) error { - _, err := txn.Get(k) - return err - }) - - switch err { - case badger.ErrKeyNotFound: - return false, nil - case nil: - return true, nil - default: - return false, fmt.Errorf("failed to check if block exists in badger blockstore: %w", err) - } -} - -// Get implements Blockstore.Get. -func (b *Blockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) { - if !cid.Defined() { - return nil, blockstore.ErrNotFound - } - - if err := b.access(); err != nil { - return nil, err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(cid) - if pooled { - defer KeyPool.Put(k) - } - - var val []byte - err := b.db.View(func(txn *badger.Txn) error { - switch item, err := txn.Get(k); err { - case nil: - val, err = item.ValueCopy(nil) - return err - case badger.ErrKeyNotFound: - return blockstore.ErrNotFound - default: - return fmt.Errorf("failed to get block from badger blockstore: %w", err) - } - }) - if err != nil { - return nil, err - } - return blocks.NewBlockWithCid(val, cid) -} - -// GetSize implements Blockstore.GetSize. -func (b *Blockstore) GetSize(ctx context.Context, cid cid.Cid) (int, error) { - if err := b.access(); err != nil { - return 0, err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(cid) - if pooled { - defer KeyPool.Put(k) - } - - var size int - err := b.db.View(func(txn *badger.Txn) error { - switch item, err := txn.Get(k); err { - case nil: - size = int(item.ValueSize()) - case badger.ErrKeyNotFound: - return blockstore.ErrNotFound - default: - return fmt.Errorf("failed to get block size from badger blockstore: %w", err) - } - return nil - }) - if err != nil { - size = -1 - } - return size, err -} - -// Put implements Blockstore.Put. -func (b *Blockstore) Put(ctx context.Context, block blocks.Block) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(block.Cid()) - if pooled { - defer KeyPool.Put(k) - } - - put := func(db *badger.DB) error { - err := db.Update(func(txn *badger.Txn) error { - return txn.Set(k, block.RawData()) - }) - if err != nil { - return fmt.Errorf("failed to put block in badger blockstore: %w", err) - } - - return nil - } - - if err := put(b.db); err != nil { - return err - } - - if b.dbNext != nil { - if err := put(b.dbNext); err != nil { - return err - } - } - - return nil -} - -// PutMany implements Blockstore.PutMany. -func (b *Blockstore) PutMany(ctx context.Context, blocks []blocks.Block) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - // toReturn tracks the byte slices to return to the pool, if we're using key - // prefixing. we can't return each slice to the pool after each Set, because - // badger holds on to the slice. - var toReturn [][]byte - if b.prefixing { - toReturn = make([][]byte, 0, len(blocks)) - defer func() { - for _, b := range toReturn { - KeyPool.Put(b) - } - }() - } - - keys := make([][]byte, 0, len(blocks)) - for _, block := range blocks { - k, pooled := b.PooledStorageKey(block.Cid()) - if pooled { - toReturn = append(toReturn, k) - } - keys = append(keys, k) - } - - put := func(db *badger.DB) error { - batch := db.NewWriteBatch() - defer batch.Cancel() - - for i, block := range blocks { - k := keys[i] - if err := batch.Set(k, block.RawData()); err != nil { - return err - } - } - - err := batch.Flush() - if err != nil { - return fmt.Errorf("failed to put blocks in badger blockstore: %w", err) - } - - return nil - } - - if err := put(b.db); err != nil { - return err - } - - if b.dbNext != nil { - if err := put(b.dbNext); err != nil { - return err - } - } - - return nil -} - -// DeleteBlock implements Blockstore.DeleteBlock. -func (b *Blockstore) DeleteBlock(ctx context.Context, cid cid.Cid) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - k, pooled := b.PooledStorageKey(cid) - if pooled { - defer KeyPool.Put(k) - } - - return b.db.Update(func(txn *badger.Txn) error { - return txn.Delete(k) - }) -} - -func (b *Blockstore) DeleteMany(ctx context.Context, cids []cid.Cid) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - // toReturn tracks the byte slices to return to the pool, if we're using key - // prefixing. we can't return each slice to the pool after each Set, because - // badger holds on to the slice. - var toReturn [][]byte - if b.prefixing { - toReturn = make([][]byte, 0, len(cids)) - defer func() { - for _, b := range toReturn { - KeyPool.Put(b) - } - }() - } - - batch := b.db.NewWriteBatch() - defer batch.Cancel() - - for _, cid := range cids { - k, pooled := b.PooledStorageKey(cid) - if pooled { - toReturn = append(toReturn, k) - } - if err := batch.Delete(k); err != nil { - return err - } - } - - err := batch.Flush() - if err != nil { - err = fmt.Errorf("failed to delete blocks from badger blockstore: %w", err) - } - return err -} - -// AllKeysChan implements Blockstore.AllKeysChan. -func (b *Blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - if err := b.access(); err != nil { - return nil, err - } - - b.lockDB() - defer b.unlockDB() - - txn := b.db.NewTransaction(false) - opts := badger.IteratorOptions{PrefetchSize: 100} - if b.prefixing { - opts.Prefix = b.prefix - } - iter := txn.NewIterator(opts) - - ch := make(chan cid.Cid) - go func() { - defer b.viewers.Done() - defer close(ch) - defer iter.Close() - - // NewCidV1 makes a copy of the multihash buffer, so we can reuse it to - // contain allocs. - var buf []byte - for iter.Rewind(); iter.Valid(); iter.Next() { - if ctx.Err() != nil { - return // context has fired. - } - if !b.isOpen() { - // open iterators will run even after the database is closed... - return // closing, yield. - } - k := iter.Item().Key() - if b.prefixing { - k = k[b.prefixLen:] - } - - if reqlen := base32.RawStdEncoding.DecodedLen(len(k)); len(buf) < reqlen { - buf = make([]byte, reqlen) - } - if n, err := base32.RawStdEncoding.Decode(buf, k); err == nil { - select { - case ch <- cid.NewCidV1(cid.Raw, buf[:n]): - case <-ctx.Done(): - return - } - } else { - log.Warnf("failed to decode key %s in badger AllKeysChan; err: %s", k, err) - } - } - }() - - return ch, nil -} - -// Implementation of BlockstoreIterator interface -func (b *Blockstore) ForEachKey(f func(cid.Cid) error) error { - if err := b.access(); err != nil { - return err - } - defer b.viewers.Done() - - b.lockDB() - defer b.unlockDB() - - txn := b.db.NewTransaction(false) - defer txn.Discard() - - opts := badger.IteratorOptions{PrefetchSize: 100} - if b.prefixing { - opts.Prefix = b.prefix - } - - iter := txn.NewIterator(opts) - defer iter.Close() - - var buf []byte - for iter.Rewind(); iter.Valid(); iter.Next() { - if !b.isOpen() { - return ErrBlockstoreClosed - } - - k := iter.Item().Key() - if b.prefixing { - k = k[b.prefixLen:] - } - - klen := base32.RawStdEncoding.DecodedLen(len(k)) - if klen > len(buf) { - buf = make([]byte, klen) - } - - n, err := base32.RawStdEncoding.Decode(buf, k) - if err != nil { - return err - } - - c := cid.NewCidV1(cid.Raw, buf[:n]) - - err = f(c) - if err != nil { - return err - } - } - - return nil -} - -// HashOnRead implements Blockstore.HashOnRead. It is not supported by this -// blockstore. -func (b *Blockstore) HashOnRead(_ bool) { - log.Warnf("called HashOnRead on badger blockstore; function not supported; ignoring") -} - -// PooledStorageKey returns the storage key under which this CID is stored. -// -// The key is: prefix + base32_no_padding(cid.Hash) -// -// This method may return pooled byte slice, which MUST be returned to the -// KeyPool if pooled=true, or a leak will occur. -func (b *Blockstore) PooledStorageKey(cid cid.Cid) (key []byte, pooled bool) { - h := cid.Hash() - size := base32.RawStdEncoding.EncodedLen(len(h)) - if !b.prefixing { // optimize for branch prediction. - k := pool.Get(size) - base32.RawStdEncoding.Encode(k, h) - return k, true // slicing upto length unnecessary; the pool has already done this. - } - - size += b.prefixLen - k := pool.Get(size) - copy(k, b.prefix) - base32.RawStdEncoding.Encode(k[b.prefixLen:], h) - return k, true // slicing upto length unnecessary; the pool has already done this. -} - -// Storage acts like PooledStorageKey, but attempts to write the storage key -// into the provided slice. If the slice capacity is insufficient, it allocates -// a new byte slice with enough capacity to accommodate the result. This method -// returns the resulting slice. -func (b *Blockstore) StorageKey(dst []byte, cid cid.Cid) []byte { - h := cid.Hash() - reqsize := base32.RawStdEncoding.EncodedLen(len(h)) + b.prefixLen - if reqsize > cap(dst) { - // passed slice is smaller than required size; create new. - dst = make([]byte, reqsize) - } else if reqsize > len(dst) { - // passed slice has enough capacity, but its length is - // restricted, expand. - dst = dst[:cap(dst)] - } - - if b.prefixing { // optimize for branch prediction. - copy(dst, b.prefix) - base32.RawStdEncoding.Encode(dst[b.prefixLen:], h) - } else { - base32.RawStdEncoding.Encode(dst, h) - } - return dst[:reqsize] -} - -// this method is added for lotus-shed needs -// WARNING: THIS IS COMPLETELY UNSAFE; DONT USE THIS IN PRODUCTION CODE -func (b *Blockstore) DB() *badger.DB { - return b.db -} diff --git a/lib/blockstore/badger/blockstore_test.go b/lib/blockstore/badger/blockstore_test.go deleted file mode 100644 index e357117..0000000 --- a/lib/blockstore/badger/blockstore_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package badgerbs - -import ( - "io/ioutil" - "os" - "testing" - - blocks "github.com/ipfs/go-block-format" - blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/stretchr/testify/require" -) - -func TestBadgerBlockstore(t *testing.T) { - (&Suite{ - NewBlockstore: newBlockstore(DefaultOptions), - OpenBlockstore: openBlockstore(DefaultOptions), - }).RunTests(t, "non_prefixed") - - prefixed := func(path string) Options { - opts := DefaultOptions(path) - opts.Prefix = "/prefixed/" - return opts - } - - (&Suite{ - NewBlockstore: newBlockstore(prefixed), - OpenBlockstore: openBlockstore(prefixed), - }).RunTests(t, "prefixed") -} - -func TestStorageKey(t *testing.T) { - bs, _ := newBlockstore(DefaultOptions)(t) - bbs := bs.(*Blockstore) - defer bbs.Close() //nolint:errcheck - - cid1 := blocks.NewBlock([]byte("some data")).Cid() - cid2 := blocks.NewBlock([]byte("more data")).Cid() - cid3 := blocks.NewBlock([]byte("a little more data")).Cid() - require.NotEqual(t, cid1, cid2) // sanity check - require.NotEqual(t, cid2, cid3) // sanity check - - // nil slice; let StorageKey allocate for us. - k1 := bbs.StorageKey(nil, cid1) - require.Len(t, k1, 55) - require.True(t, cap(k1) == len(k1)) - - // k1's backing array is reused. - k2 := bbs.StorageKey(k1, cid2) - require.Len(t, k2, 55) - require.True(t, cap(k2) == len(k1)) - - // bring k2 to len=0, and verify that its backing array gets reused - // (i.e. k1 and k2 are overwritten) - k3 := bbs.StorageKey(k2[:0], cid3) - require.Len(t, k3, 55) - require.True(t, cap(k3) == len(k3)) - - // backing array of k1 and k2 has been modified, i.e. memory is shared. - require.Equal(t, k3, k1) - require.Equal(t, k3, k2) -} - -func newBlockstore(optsSupplier func(path string) Options) func(tb testing.TB) (bs blockstore.Blockstore, path string) { - return func(tb testing.TB) (bs blockstore.Blockstore, path string) { - tb.Helper() - - path, err := ioutil.TempDir("", "") - if err != nil { - tb.Fatal(err) - } - - db, err := Open(optsSupplier(path)) - if err != nil { - tb.Fatal(err) - } - - tb.Cleanup(func() { - _ = os.RemoveAll(path) - }) - - return db, path - } -} - -func openBlockstore(optsSupplier func(path string) Options) func(tb testing.TB, path string) (bs blockstore.Blockstore, err error) { - return func(tb testing.TB, path string) (bs blockstore.Blockstore, err error) { - tb.Helper() - return Open(optsSupplier(path)) - } -} diff --git a/lib/blockstore/badger/blockstore_test_suite.go b/lib/blockstore/badger/blockstore_test_suite.go deleted file mode 100644 index 0416c96..0000000 --- a/lib/blockstore/badger/blockstore_test_suite.go +++ /dev/null @@ -1,323 +0,0 @@ -package badgerbs - -import ( - "context" - "fmt" - "io" - "reflect" - "strings" - "testing" - - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" - u "github.com/ipfs/go-ipfs-util" - - "github.com/filecoin-project/venus-miner/lib/blockstore" - - "github.com/stretchr/testify/require" -) - -// TODO: move this to go-ipfs-blockstore. -type Suite struct { - NewBlockstore func(tb testing.TB) (bs blockstore.Blockstore, path string) - OpenBlockstore func(tb testing.TB, path string) (bs blockstore.Blockstore, err error) -} - -func (s *Suite) RunTests(t *testing.T, prefix string) { - v := reflect.TypeOf(s) - f := func(t *testing.T) { - for i := 0; i < v.NumMethod(); i++ { - if m := v.Method(i); strings.HasPrefix(m.Name, "Test") { - f := m.Func.Interface().(func(*Suite, *testing.T)) - t.Run(m.Name, func(t *testing.T) { - f(s, t) - }) - } - } - } - - if prefix == "" { - f(t) - } else { - t.Run(prefix, f) - } -} - -func (s *Suite) TestGetWhenKeyNotPresent(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - c := cid.NewCidV0(u.Hash([]byte("stuff"))) - bl, err := bs.Get(ctx, c) - require.Nil(t, bl) - require.Equal(t, blockstore.ErrNotFound, err) -} - -func (s *Suite) TestGetWhenKeyIsNil(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - _, err := bs.Get(ctx, cid.Undef) - require.Equal(t, blockstore.ErrNotFound, err) -} - -func (s *Suite) TestPutThenGetBlock(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - orig := blocks.NewBlock([]byte("some data")) - - err := bs.Put(ctx, orig) - require.NoError(t, err) - - fetched, err := bs.Get(ctx, orig.Cid()) - require.NoError(t, err) - require.Equal(t, orig.RawData(), fetched.RawData()) -} - -func (s *Suite) TestHas(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - orig := blocks.NewBlock([]byte("some data")) - - err := bs.Put(ctx, orig) - require.NoError(t, err) - - ok, err := bs.Has(ctx, orig.Cid()) - require.NoError(t, err) - require.True(t, ok) - - ok, err = bs.Has(ctx, blocks.NewBlock([]byte("another thing")).Cid()) - require.NoError(t, err) - require.False(t, ok) -} - -func (s *Suite) TestCidv0v1(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - orig := blocks.NewBlock([]byte("some data")) - - err := bs.Put(ctx, orig) - require.NoError(t, err) - - fetched, err := bs.Get(ctx, cid.NewCidV1(cid.DagProtobuf, orig.Cid().Hash())) - require.NoError(t, err) - require.Equal(t, orig.RawData(), fetched.RawData()) -} - -func (s *Suite) TestPutThenGetSizeBlock(t *testing.T) { - ctx := context.Background() - - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - block := blocks.NewBlock([]byte("some data")) - missingBlock := blocks.NewBlock([]byte("missingBlock")) - emptyBlock := blocks.NewBlock([]byte{}) - - err := bs.Put(ctx, block) - require.NoError(t, err) - - blockSize, err := bs.GetSize(ctx, block.Cid()) - require.NoError(t, err) - require.Len(t, block.RawData(), blockSize) - - err = bs.Put(ctx, emptyBlock) - require.NoError(t, err) - - emptySize, err := bs.GetSize(ctx, emptyBlock.Cid()) - require.NoError(t, err) - require.Zero(t, emptySize) - - missingSize, err := bs.GetSize(ctx, missingBlock.Cid()) - require.Equal(t, blockstore.ErrNotFound, err) - require.Equal(t, -1, missingSize) -} - -func (s *Suite) TestAllKeysSimple(t *testing.T) { - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - keys := insertBlocks(t, bs, 100) - - ctx := context.Background() - ch, err := bs.AllKeysChan(ctx) - require.NoError(t, err) - actual := collect(ch) - - require.ElementsMatch(t, keys, actual) -} - -func (s *Suite) TestAllKeysRespectsContext(t *testing.T) { - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - _ = insertBlocks(t, bs, 100) - - ctx, cancel := context.WithCancel(context.Background()) - ch, err := bs.AllKeysChan(ctx) - require.NoError(t, err) - - // consume 2, then cancel context. - v, ok := <-ch - require.NotEqual(t, cid.Undef, v) - require.True(t, ok) - - v, ok = <-ch - require.NotEqual(t, cid.Undef, v) - require.True(t, ok) - - cancel() - // pull one value out to avoid race - _, _ = <-ch // nolint - - v, ok = <-ch - require.Equal(t, cid.Undef, v) - require.False(t, ok) -} - -func (s *Suite) TestDoubleClose(t *testing.T) { - bs, _ := s.NewBlockstore(t) - c, ok := bs.(io.Closer) - if !ok { - t.SkipNow() - } - require.NoError(t, c.Close()) - require.NoError(t, c.Close()) -} - -func (s *Suite) TestReopenPutGet(t *testing.T) { - ctx := context.Background() - bs, path := s.NewBlockstore(t) - c, ok := bs.(io.Closer) - if !ok { - t.SkipNow() - } - - orig := blocks.NewBlock([]byte("some data")) - err := bs.Put(ctx, orig) - require.NoError(t, err) - - err = c.Close() - require.NoError(t, err) - - bs, err = s.OpenBlockstore(t, path) - require.NoError(t, err) - - fetched, err := bs.Get(ctx, orig.Cid()) - require.NoError(t, err) - require.Equal(t, orig.RawData(), fetched.RawData()) - - err = bs.(io.Closer).Close() - require.NoError(t, err) -} - -func (s *Suite) TestPutMany(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - blks := []blocks.Block{ - blocks.NewBlock([]byte("foo1")), - blocks.NewBlock([]byte("foo2")), - blocks.NewBlock([]byte("foo3")), - } - err := bs.PutMany(ctx, blks) - require.NoError(t, err) - - for _, blk := range blks { - fetched, err := bs.Get(ctx, blk.Cid()) - require.NoError(t, err) - require.Equal(t, blk.RawData(), fetched.RawData()) - - ok, err := bs.Has(ctx, blk.Cid()) - require.NoError(t, err) - require.True(t, ok) - } - - ch, err := bs.AllKeysChan(context.Background()) - require.NoError(t, err) - - cids := collect(ch) - require.Len(t, cids, 3) -} - -func (s *Suite) TestDelete(t *testing.T) { - ctx := context.Background() - bs, _ := s.NewBlockstore(t) - if c, ok := bs.(io.Closer); ok { - defer func() { require.NoError(t, c.Close()) }() - } - - blks := []blocks.Block{ - blocks.NewBlock([]byte("foo1")), - blocks.NewBlock([]byte("foo2")), - blocks.NewBlock([]byte("foo3")), - } - err := bs.PutMany(ctx, blks) - require.NoError(t, err) - - err = bs.DeleteBlock(ctx, blks[1].Cid()) - require.NoError(t, err) - - ch, err := bs.AllKeysChan(context.Background()) - require.NoError(t, err) - - cids := collect(ch) - require.Len(t, cids, 2) - require.ElementsMatch(t, cids, []cid.Cid{ - cid.NewCidV1(cid.Raw, blks[0].Cid().Hash()), - cid.NewCidV1(cid.Raw, blks[2].Cid().Hash()), - }) - - has, err := bs.Has(ctx, blks[1].Cid()) - require.NoError(t, err) - require.False(t, has) -} - -func insertBlocks(t *testing.T, bs blockstore.Blockstore, count int) []cid.Cid { - ctx := context.Background() - keys := make([]cid.Cid, count) - for i := 0; i < count; i++ { - block := blocks.NewBlock([]byte(fmt.Sprintf("some data %d", i))) - err := bs.Put(ctx, block) - require.NoError(t, err) - // NewBlock assigns a CIDv0; we convert it to CIDv1 because that's what - // the store returns. - keys[i] = cid.NewCidV1(cid.Raw, block.Multihash()) - } - return keys -} - -func collect(ch <-chan cid.Cid) []cid.Cid { - var keys []cid.Cid - for k := range ch { - keys = append(keys, k) - } - return keys -} diff --git a/lib/blockstore/blockstore.go b/lib/blockstore/blockstore.go deleted file mode 100644 index 7b6c788..0000000 --- a/lib/blockstore/blockstore.go +++ /dev/null @@ -1,58 +0,0 @@ -// blockstore contains all the basic blockstore constructors used by filecoin. Any -// blockstores not ultimately constructed out of the building blocks in this -// package may not work properly. -// -// * This package correctly wraps blockstores with the IdBlockstore. This blockstore: -// * Filters out all puts for blocks with CIDs using the "identity" hash function. -// * Extracts inlined blocks from CIDs using the identity hash function and -// returns them on get/has, ignoring the contents of the blockstore. -// * In the future, this package may enforce additional restrictions on block -// sizes, CID validity, etc. -// -// To make auditing for misuse of blockstores tractable, this package re-exports -// parts of the go-ipfs-blockstore package such that no other package needs to -// import it directly. -package blockstore - -import ( - "context" - - ds "github.com/ipfs/go-datastore" - - blockstore "github.com/ipfs/go-ipfs-blockstore" -) - -// WrapIDStore wraps the underlying blockstore in an "identity" blockstore. -func WrapIDStore(bstore blockstore.Blockstore) blockstore.Blockstore { - return blockstore.NewIdStore(bstore) -} - -// NewBlockstore creates a new blockstore wrapped by the given datastore. -func NewBlockstore(dstore ds.Batching) blockstore.Blockstore { - return WrapIDStore(blockstore.NewBlockstore(dstore)) -} - -// Alias so other packages don't have to import go-ipfs-blockstore -type Blockstore = blockstore.Blockstore -type Viewer = blockstore.Viewer -type GCBlockstore = blockstore.GCBlockstore -type CacheOpts = blockstore.CacheOpts -type GCLocker = blockstore.GCLocker - -var ErrNotFound = blockstore.ErrNotFound - -func DefaultCacheOpts() CacheOpts { - return CacheOpts{ - HasBloomFilterSize: 0, - HasBloomFilterHashes: 0, - HasARCCacheSize: 512 << 10, - } -} - -func CachedBlockstore(ctx context.Context, bs Blockstore, opts CacheOpts) (Blockstore, error) { - bs, err := blockstore.CachedBlockstore(ctx, bs, opts) - if err != nil { - return nil, err - } - return WrapIDStore(bs), nil -} diff --git a/lib/blockstore/fallback.go b/lib/blockstore/fallback.go deleted file mode 100644 index f857766..0000000 --- a/lib/blockstore/fallback.go +++ /dev/null @@ -1,108 +0,0 @@ -package blockstore - -import ( - "context" - "fmt" - "sync" - "time" - - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log/v2" -) - -var log = logging.Logger("blockstore") - -// UnwrapFallbackStore takes a blockstore, and returns the underlying blockstore -// if it was a FallbackStore. Otherwise, it just returns the supplied store -// unmodified. -func UnwrapFallbackStore(bs Blockstore) (Blockstore, bool) { - if fbs, ok := bs.(*FallbackStore); ok { - return fbs.Blockstore, true - } - return bs, false -} - -// FallbackStore is a read-through store that queries another (potentially -// remote) source if the block is not found locally. If the block is found -// during the fallback, it stores it in the local store. -type FallbackStore struct { - Blockstore - - lk sync.RWMutex - // missFn is the function that will be invoked on a local miss to pull the - // block from elsewhere. - missFn func(context.Context, cid.Cid) (blocks.Block, error) -} - -var _ Blockstore = (*FallbackStore)(nil) - -func (fbs *FallbackStore) SetFallback(missFn func(context.Context, cid.Cid) (blocks.Block, error)) { - fbs.lk.Lock() - defer fbs.lk.Unlock() - - fbs.missFn = missFn -} - -func (fbs *FallbackStore) getFallback(c cid.Cid) (blocks.Block, error) { - log.Warnf("fallbackstore: block not found locally, fetching from the network; cid: %s", c) - fbs.lk.RLock() - defer fbs.lk.RUnlock() - - if fbs.missFn == nil { - // FallbackStore wasn't configured yet (chainstore/bitswap aren't up yet) - // Wait for a bit and retry - fbs.lk.RUnlock() - time.Sleep(5 * time.Second) - fbs.lk.RLock() - - if fbs.missFn == nil { - log.Errorw("fallbackstore: missFn not configured yet") - return nil, ErrNotFound - } - } - - ctx, cancel := context.WithTimeout(context.TODO(), 120*time.Second) - defer cancel() - - b, err := fbs.missFn(ctx, c) - if err != nil { - return nil, err - } - - // chain bitswap puts blocks in temp blockstore which is cleaned up - // every few min (to drop any messages we fetched but don't want) - // in this case we want to keep this block around - if err := fbs.Put(ctx, b); err != nil { - return nil, fmt.Errorf("persisting fallback-fetched block: %w", err) - } - return b, nil -} - -func (fbs *FallbackStore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error) { - b, err := fbs.Blockstore.Get(ctx, c) - switch err { - case nil: - return b, nil - case ErrNotFound: - return fbs.getFallback(c) - default: - return b, err - } -} - -func (fbs *FallbackStore) GetSize(ctx context.Context, c cid.Cid) (int, error) { - sz, err := fbs.Blockstore.GetSize(ctx, c) - switch err { - case nil: - return sz, nil - case ErrNotFound: - b, err := fbs.getFallback(c) - if err != nil { - return 0, err - } - return len(b.RawData()), nil - default: - return sz, err - } -} diff --git a/lib/blockstore/mem.go b/lib/blockstore/mem.go deleted file mode 100644 index d6b14f0..0000000 --- a/lib/blockstore/mem.go +++ /dev/null @@ -1,102 +0,0 @@ -package blockstore - -import ( - "context" - - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" -) - -// NewMemory returns a temporary memory-backed blockstore. -func NewMemory() MemBlockstore { - return make(MemBlockstore) -} - -// MemBlockstore is a terminal blockstore that keeps blocks in memory. -type MemBlockstore map[cid.Cid]blocks.Block - -func (m MemBlockstore) DeleteBlock(ctx context.Context, k cid.Cid) error { - delete(m, k) - return nil -} - -func (m MemBlockstore) DeleteMany(ctx context.Context, ks []cid.Cid) error { - for _, k := range ks { - delete(m, k) - } - return nil -} - -func (m MemBlockstore) Has(ctx context.Context, k cid.Cid) (bool, error) { - _, ok := m[k] - return ok, nil -} - -func (m MemBlockstore) View(ctx context.Context, k cid.Cid, callback func([]byte) error) error { - b, ok := m[k] - if !ok { - return ErrNotFound - } - return callback(b.RawData()) -} - -func (m MemBlockstore) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { - b, ok := m[k] - if !ok { - return nil, ErrNotFound - } - return b, nil -} - -// GetSize returns the CIDs mapped BlockSize -func (m MemBlockstore) GetSize(ctx context.Context, k cid.Cid) (int, error) { - b, ok := m[k] - if !ok { - return 0, ErrNotFound - } - return len(b.RawData()), nil -} - -// Put puts a given block to the underlying datastore -func (m MemBlockstore) Put(ctx context.Context, b blocks.Block) error { - // Convert to a basic block for safety, but try to reuse the existing - // block if it's already a basic block. - k := b.Cid() - if _, ok := b.(*blocks.BasicBlock); !ok { - // If we already have the block, abort. - if _, ok := m[k]; ok { - return nil - } - // the error is only for debugging. - b, _ = blocks.NewBlockWithCid(b.RawData(), b.Cid()) - } - m[b.Cid()] = b - return nil -} - -// PutMany puts a slice of blocks at the same time using batching -// capabilities of the underlying datastore whenever possible. -func (m MemBlockstore) PutMany(ctx context.Context, bs []blocks.Block) error { - for _, b := range bs { - _ = m.Put(ctx, b) // can't fail - } - return nil -} - -// AllKeysChan returns a channel from which -// the CIDs in the Blockstore can be read. It should respect -// the given context, closing the channel if it becomes Done. -func (m MemBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - ch := make(chan cid.Cid, len(m)) - for k := range m { - ch <- k - } - close(ch) - return ch, nil -} - -// HashOnRead specifies if every read block should be -// rehashed to make sure it matches its CID. -func (m MemBlockstore) HashOnRead(enabled bool) { - // no-op -} diff --git a/lib/blockstore/sync.go b/lib/blockstore/sync.go deleted file mode 100644 index 1b4ad82..0000000 --- a/lib/blockstore/sync.go +++ /dev/null @@ -1,81 +0,0 @@ -package blockstore - -import ( - "context" - "sync" - - blocks "github.com/ipfs/go-block-format" - "github.com/ipfs/go-cid" -) - -// NewMemorySync returns a thread-safe in-memory blockstore. -func NewMemorySync() *SyncBlockstore { - return &SyncBlockstore{bs: make(MemBlockstore)} -} - -// SyncBlockstore is a terminal blockstore that is a synchronized version -// of MemBlockstore. -type SyncBlockstore struct { - mu sync.RWMutex - bs MemBlockstore // specifically use a memStore to save indirection overhead. -} - -func (m *SyncBlockstore) DeleteBlock(ctx context.Context, k cid.Cid) error { - m.mu.Lock() - defer m.mu.Unlock() - return m.bs.DeleteBlock(ctx, k) -} - -func (m *SyncBlockstore) DeleteMany(ctx context.Context, ks []cid.Cid) error { - m.mu.Lock() - defer m.mu.Unlock() - return m.bs.DeleteMany(ctx, ks) -} - -func (m *SyncBlockstore) Has(ctx context.Context, k cid.Cid) (bool, error) { - m.mu.RLock() - defer m.mu.RUnlock() - return m.bs.Has(ctx, k) -} - -func (m *SyncBlockstore) View(ctx context.Context, k cid.Cid, callback func([]byte) error) error { - m.mu.RLock() - defer m.mu.RUnlock() - - return m.bs.View(ctx, k, callback) -} - -func (m *SyncBlockstore) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { - m.mu.RLock() - defer m.mu.RUnlock() - return m.bs.Get(ctx, k) -} - -func (m *SyncBlockstore) GetSize(ctx context.Context, k cid.Cid) (int, error) { - m.mu.RLock() - defer m.mu.RUnlock() - return m.bs.GetSize(ctx, k) -} - -func (m *SyncBlockstore) Put(ctx context.Context, b blocks.Block) error { - m.mu.Lock() - defer m.mu.Unlock() - return m.bs.Put(ctx, b) -} - -func (m *SyncBlockstore) PutMany(ctx context.Context, bs []blocks.Block) error { - m.mu.Lock() - defer m.mu.Unlock() - return m.bs.PutMany(ctx, bs) -} - -func (m *SyncBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - m.mu.RLock() - defer m.mu.RUnlock() - // this blockstore implementation doesn't do any async work. - return m.bs.AllKeysChan(ctx) -} - -func (m *SyncBlockstore) HashOnRead(enabled bool) { - // noop -} diff --git a/lib/journal/alerting/alerts.go b/lib/journal/alerting/alerts.go new file mode 100644 index 0000000..336c9b9 --- /dev/null +++ b/lib/journal/alerting/alerts.go @@ -0,0 +1,161 @@ +package alerting + +import ( + "encoding/json" + "sort" + "sync" + "time" + + "github.com/filecoin-project/venus-miner/lib/journal" + logging "github.com/ipfs/go-log/v2" +) + +var log = logging.Logger("alerting") + +// Alerting provides simple stateful alert system. Consumers can register alerts, +// which can be raised and resolved. +// +// When an alert is raised or resolved, a related journal entry is recorded. +type Alerting struct { + j journal.Journal + + lk sync.Mutex + alerts map[AlertType]Alert +} + +// AlertType is a unique alert identifier +type AlertType struct { + System, Subsystem string +} + +// AlertEvent contains information about alert state transition +type AlertEvent struct { + Type string // either 'raised' or 'resolved' + Message json.RawMessage + Time time.Time +} + +type Alert struct { + Type AlertType + Active bool + + LastActive *AlertEvent // NOTE: pointer for nullability, don't mutate the referenced object! + LastResolved *AlertEvent + + journalType journal.EventType +} + +func NewAlertingSystem(j journal.Journal) *Alerting { + return &Alerting{ + j: j, + + alerts: map[AlertType]Alert{}, + } +} + +func (a *Alerting) AddAlertType(system, subsystem string) AlertType { + a.lk.Lock() + defer a.lk.Unlock() + + at := AlertType{ + System: system, + Subsystem: subsystem, + } + + if _, exists := a.alerts[at]; exists { + return at + } + + et := a.j.RegisterEventType(system, subsystem) + + a.alerts[at] = Alert{ + Type: at, + Active: false, + journalType: et, + } + + return at +} + +func (a *Alerting) update(at AlertType, message interface{}, upd func(Alert, json.RawMessage) Alert) { + a.lk.Lock() + defer a.lk.Unlock() + + alert, ok := a.alerts[at] + if !ok { + log.Errorw("unknown alert", "type", at, "message", message) + } + + rawMsg, err := json.Marshal(message) + if err != nil { + log.Errorw("marshaling alert message failed", "type", at, "error", err) + rawMsg, err = json.Marshal(&struct { + AlertError string + }{ + AlertError: err.Error(), + }) + log.Errorw("marshaling marshaling error failed", "type", at, "error", err) + } + + a.alerts[at] = upd(alert, rawMsg) +} + +// Raise marks the alert condition as active and records related event in the journal +func (a *Alerting) Raise(at AlertType, message interface{}) { + log.Errorw("alert raised", "type", at, "message", message) + + a.update(at, message, func(alert Alert, rawMsg json.RawMessage) Alert { + alert.Active = true + alert.LastActive = &AlertEvent{ + Type: "raised", + Message: rawMsg, + Time: time.Now(), + } + + a.j.RecordEvent(alert.journalType, func() interface{} { + return alert.LastActive + }) + + return alert + }) +} + +// Resolve marks the alert condition as resolved and records related event in the journal +func (a *Alerting) Resolve(at AlertType, message interface{}) { + log.Errorw("alert resolved", "type", at, "message", message) + + a.update(at, message, func(alert Alert, rawMsg json.RawMessage) Alert { + alert.Active = false + alert.LastResolved = &AlertEvent{ + Type: "resolved", + Message: rawMsg, + Time: time.Now(), + } + + a.j.RecordEvent(alert.journalType, func() interface{} { + return alert.LastResolved + }) + + return alert + }) +} + +// GetAlerts returns all registered (active and inactive) alerts +func (a *Alerting) GetAlerts() []Alert { + a.lk.Lock() + defer a.lk.Unlock() + + out := make([]Alert, 0, len(a.alerts)) + for _, alert := range a.alerts { + out = append(out, alert) + } + sort.Slice(out, func(i, j int) bool { + if out[i].Type.System != out[j].Type.System { + return out[i].Type.System < out[j].Type.System + } + + return out[i].Type.Subsystem < out[j].Type.Subsystem + }) + + return out +} diff --git a/lib/journal/alerting/alerts_test.go b/lib/journal/alerting/alerts_test.go new file mode 100644 index 0000000..b319eb3 --- /dev/null +++ b/lib/journal/alerting/alerts_test.go @@ -0,0 +1,61 @@ +package alerting + +import ( + "encoding/json" + "testing" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/filecoin-project/venus-miner/lib/journal" + "github.com/filecoin-project/venus-miner/lib/journal/mockjournal" +) + +func TestAlerting(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + j := mockjournal.NewMockJournal(mockCtrl) + + a := NewAlertingSystem(j) + + j.EXPECT().RegisterEventType("s1", "b1").Return(journal.EventType{System: "s1", Event: "b1"}) + al1 := a.AddAlertType("s1", "b1") + + j.EXPECT().RegisterEventType("s2", "b2").Return(journal.EventType{System: "s2", Event: "b2"}) + al2 := a.AddAlertType("s2", "b2") + + l := a.GetAlerts() + require.Len(t, l, 2) + require.Equal(t, al1, l[0].Type) + require.Equal(t, al2, l[1].Type) + + for _, alert := range l { + require.False(t, alert.Active) + require.Nil(t, alert.LastActive) + require.Nil(t, alert.LastResolved) + } + + j.EXPECT().RecordEvent(a.alerts[al1].journalType, gomock.Any()) + a.Raise(al1, "test") + + for _, alert := range l { // check for no magic mutations + require.False(t, alert.Active) + require.Nil(t, alert.LastActive) + require.Nil(t, alert.LastResolved) + } + + l = a.GetAlerts() + require.Len(t, l, 2) + require.Equal(t, al1, l[0].Type) + require.Equal(t, al2, l[1].Type) + + require.True(t, l[0].Active) + require.NotNil(t, l[0].LastActive) + require.Equal(t, "raised", l[0].LastActive.Type) + require.Equal(t, json.RawMessage(`"test"`), l[0].LastActive.Message) + require.Nil(t, l[0].LastResolved) + + require.False(t, l[1].Active) + require.Nil(t, l[1].LastActive) + require.Nil(t, l[1].LastResolved) +} diff --git a/journal/env.go b/lib/journal/env.go similarity index 86% rename from journal/env.go rename to lib/journal/env.go index 33dd79c..6838084 100644 --- a/journal/env.go +++ b/lib/journal/env.go @@ -6,7 +6,7 @@ import ( // envJournalDisabledEvents is the environment variable through which disabled // journal events can be customized. -const envDisabledEvents = "VENUS_MINER_JOURNAL_DISABLED_EVENTS" +const envDisabledEvents = "LOTUS_JOURNAL_DISABLED_EVENTS" func EnvDisabledEvents() DisabledEvents { if env, ok := os.LookupEnv(envDisabledEvents); ok { diff --git a/journal/fs.go b/lib/journal/fsjournal/fs.go similarity index 66% rename from journal/fs.go rename to lib/journal/fsjournal/fs.go index db194d4..4e4a1ae 100644 --- a/journal/fs.go +++ b/lib/journal/fsjournal/fs.go @@ -1,4 +1,4 @@ -package journal +package fsjournal import ( "encoding/json" @@ -6,15 +6,20 @@ import ( "os" "path/filepath" + logging "github.com/ipfs/go-log/v2" + "github.com/filecoin-project/venus-miner/build" + "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/node/repo" ) +var log = logging.Logger("fsjournal") + const RFC3339nocolon = "2006-01-02T150405Z0700" // fsJournal is a basic journal backed by files on a filesystem. type fsJournal struct { - EventTypeRegistry + journal.EventTypeRegistry dir string sizeLimit int64 @@ -22,7 +27,7 @@ type fsJournal struct { fi *os.File fSize int64 - incoming chan *Event + incoming chan *journal.Event closing chan struct{} closed chan struct{} @@ -30,17 +35,17 @@ type fsJournal struct { // OpenFSJournal constructs a rolling filesystem journal, with a default // per-file size limit of 1GiB. -func OpenFSJournal(lr repo.LockedRepo, disabled DisabledEvents) (Journal, error) { +func OpenFSJournal(lr repo.LockedRepo, disabled journal.DisabledEvents) (journal.Journal, error) { dir := filepath.Join(lr.Path(), "journal") if err := os.MkdirAll(dir, 0755); err != nil { return nil, fmt.Errorf("failed to mk directory %s for file journal: %w", dir, err) } f := &fsJournal{ - EventTypeRegistry: NewEventTypeRegistry(disabled), + EventTypeRegistry: journal.NewEventTypeRegistry(disabled), dir: dir, sizeLimit: 1 << 30, - incoming: make(chan *Event, 32), + incoming: make(chan *journal.Event, 32), closing: make(chan struct{}), closed: make(chan struct{}), } @@ -54,7 +59,7 @@ func OpenFSJournal(lr repo.LockedRepo, disabled DisabledEvents) (Journal, error) return f, nil } -func (f *fsJournal) RecordEvent(evtType EventType, supplier func() interface{}) { +func (f *fsJournal) RecordEvent(evtType journal.EventType, supplier func() interface{}) { defer func() { if r := recover(); r != nil { log.Warnf("recovered from panic while recording journal event; type=%s, err=%v", evtType, r) @@ -65,7 +70,7 @@ func (f *fsJournal) RecordEvent(evtType EventType, supplier func() interface{}) return } - je := &Event{ + je := &journal.Event{ EventType: evtType, Timestamp: build.Clock.Now(), Data: supplier(), @@ -83,7 +88,7 @@ func (f *fsJournal) Close() error { return nil } -func (f *fsJournal) putEvent(evt *Event) error { +func (f *fsJournal) putEvent(evt *journal.Event) error { b, err := json.Marshal(evt) if err != nil { return err @@ -106,14 +111,28 @@ func (f *fsJournal) rollJournalFile() error { if f.fi != nil { _ = f.fi.Close() } + current := filepath.Join(f.dir, "lotus-journal.ndjson") + rolled := filepath.Join(f.dir, fmt.Sprintf( + "lotus-journal-%s.ndjson", + build.Clock.Now().Format(RFC3339nocolon), + )) + + // check if journal file exists + if fi, err := os.Stat(current); err == nil && !fi.IsDir() { + err := os.Rename(current, rolled) + if err != nil { + return fmt.Errorf("failed to roll journal file: %w", err) + } + } - nfi, err := os.Create(filepath.Join(f.dir, fmt.Sprintf("venus-miner-journal-%s.ndjson", build.Clock.Now().Format(RFC3339nocolon)))) + nfi, err := os.Create(current) if err != nil { - return fmt.Errorf("failed to open journal file: %w", err) + return fmt.Errorf("failed to create journal file: %w", err) } f.fi = nfi f.fSize = 0 + return nil } diff --git a/lib/journal/mockjournal/journal.go b/lib/journal/mockjournal/journal.go new file mode 100644 index 0000000..acb8dbb --- /dev/null +++ b/lib/journal/mockjournal/journal.go @@ -0,0 +1,75 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/filecoin-project/venus-miner/lib/journal (interfaces: Journal) + +// Package mockjournal is a generated GoMock package. +package mockjournal + +import ( + reflect "reflect" + + journal "github.com/filecoin-project/venus-miner/lib/journal" + gomock "github.com/golang/mock/gomock" +) + +// MockJournal is a mock of Journal interface. +type MockJournal struct { + ctrl *gomock.Controller + recorder *MockJournalMockRecorder +} + +// MockJournalMockRecorder is the mock recorder for MockJournal. +type MockJournalMockRecorder struct { + mock *MockJournal +} + +// NewMockJournal creates a new mock instance. +func NewMockJournal(ctrl *gomock.Controller) *MockJournal { + mock := &MockJournal{ctrl: ctrl} + mock.recorder = &MockJournalMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockJournal) EXPECT() *MockJournalMockRecorder { + return m.recorder +} + +// Close mocks base method. +func (m *MockJournal) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockJournalMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockJournal)(nil).Close)) +} + +// RecordEvent mocks base method. +func (m *MockJournal) RecordEvent(arg0 journal.EventType, arg1 func() interface{}) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "RecordEvent", arg0, arg1) +} + +// RecordEvent indicates an expected call of RecordEvent. +func (mr *MockJournalMockRecorder) RecordEvent(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordEvent", reflect.TypeOf((*MockJournal)(nil).RecordEvent), arg0, arg1) +} + +// RegisterEventType mocks base method. +func (m *MockJournal) RegisterEventType(arg0, arg1 string) journal.EventType { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterEventType", arg0, arg1) + ret0, _ := ret[0].(journal.EventType) + return ret0 +} + +// RegisterEventType indicates an expected call of RegisterEventType. +func (mr *MockJournalMockRecorder) RegisterEventType(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterEventType", reflect.TypeOf((*MockJournal)(nil).RegisterEventType), arg0, arg1) +} diff --git a/journal/nil.go b/lib/journal/nil.go similarity index 100% rename from journal/nil.go rename to lib/journal/nil.go diff --git a/journal/registry.go b/lib/journal/registry.go similarity index 100% rename from journal/registry.go rename to lib/journal/registry.go diff --git a/journal/registry_test.go b/lib/journal/registry_test.go similarity index 100% rename from journal/registry_test.go rename to lib/journal/registry_test.go diff --git a/journal/types.go b/lib/journal/types.go similarity index 96% rename from journal/types.go rename to lib/journal/types.go index 3e240a9..af21607 100644 --- a/journal/types.go +++ b/lib/journal/types.go @@ -4,12 +4,8 @@ import ( "fmt" "strings" "time" - - logging "github.com/ipfs/go-log/v2" ) -var log = logging.Logger("journal") - var ( // DefaultDisabledEvents lists the journal events disabled by // default, usually because they are considered noisy. @@ -69,6 +65,8 @@ func (et EventType) Enabled() bool { return et.safe && et.enabled } +//go:generate go run github.com/golang/mock/mockgen -destination=mockjournal/journal.go -package=mockjournal . Journal + // Journal represents an audit trail of system actions. // // Every entry is tagged with a timestamp, a system name, and an event name. diff --git a/lib/logger/levels.go b/lib/logger/levels.go new file mode 100644 index 0000000..26ef340 --- /dev/null +++ b/lib/logger/levels.go @@ -0,0 +1,16 @@ +package logger + +import ( + "os" + + logging "github.com/ipfs/go-log/v2" +) + +func SetupLogLevels() { + if _, set := os.LookupEnv("GOLOG_LOG_LEVEL"); !set { + _ = logging.SetLogLevel("*", "INFO") + _ = logging.SetLogLevel("miner", "DEBUG") + } + // Always mute RtRefreshManager because it breaks terminals + _ = logging.SetLogLevel("dht/RtRefreshManager", "FATAL") +} diff --git a/metrics/expoter.go b/lib/metrics/expoter.go similarity index 100% rename from metrics/expoter.go rename to lib/metrics/expoter.go diff --git a/metrics/metrics.go b/lib/metrics/metrics.go similarity index 100% rename from metrics/metrics.go rename to lib/metrics/metrics.go diff --git a/lib/sigs/bls/bls_bench_test.go b/lib/sigs/bls/bls_bench_test.go deleted file mode 100644 index 118d259..0000000 --- a/lib/sigs/bls/bls_bench_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package bls - -import ( - "crypto/rand" - "testing" - - "github.com/filecoin-project/go-address" -) - -func BenchmarkBLSSign(b *testing.B) { - signer := blsSigner{} - for i := 0; i < b.N; i++ { - b.StopTimer() - pk, _ := signer.GenPrivate() - randMsg := make([]byte, 32) - _, _ = rand.Read(randMsg) - b.StartTimer() - - _, _ = signer.Sign(pk, randMsg) - } -} - -func BenchmarkBLSVerify(b *testing.B) { - signer := blsSigner{} - for i := 0; i < b.N; i++ { - b.StopTimer() - randMsg := make([]byte, 32) - _, _ = rand.Read(randMsg) - - priv, _ := signer.GenPrivate() - pk, _ := signer.ToPublic(priv) - addr, _ := address.NewBLSAddress(pk) - sig, _ := signer.Sign(priv, randMsg) - - b.StartTimer() - - _ = signer.Verify(sig, addr, randMsg) - } -} diff --git a/lib/sigs/bls/init.go b/lib/sigs/bls/init.go deleted file mode 100644 index 5cdaca5..0000000 --- a/lib/sigs/bls/init.go +++ /dev/null @@ -1,86 +0,0 @@ -package bls - -import ( - "crypto/rand" - "fmt" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/crypto" - - ffi "github.com/filecoin-project/filecoin-ffi" - - "github.com/filecoin-project/venus-miner/lib/sigs" -) - -const DST = string("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_") - -type SecretKey = ffi.PrivateKey -type PublicKey = ffi.PublicKey -type Signature = ffi.Signature -type AggregateSignature = ffi.Signature - -type blsSigner struct{} - -func (blsSigner) GenPrivate() ([]byte, error) { - // Generate 32 bytes of randomness - var ikm [32]byte - _, err := rand.Read(ikm[:]) - if err != nil { - return nil, fmt.Errorf("bls signature error generating random data") - } - // Note private keys seem to be serialized little-endian! - sk := ffi.PrivateKeyGenerateWithSeed(ikm) - return sk[:], nil -} - -func (blsSigner) ToPublic(priv []byte) ([]byte, error) { - if priv == nil || len(priv) != ffi.PrivateKeyBytes { - return nil, fmt.Errorf("bls signature invalid private key") - } - - sk := new(SecretKey) - copy(sk[:], priv[:ffi.PrivateKeyBytes]) - - pubkey := ffi.PrivateKeyPublicKey(*sk) - - return pubkey[:], nil -} - -func (blsSigner) Sign(p []byte, msg []byte) ([]byte, error) { - if p == nil || len(p) != ffi.PrivateKeyBytes { - return nil, fmt.Errorf("bls signature invalid private key") - } - - sk := new(SecretKey) - copy(sk[:], p[:ffi.PrivateKeyBytes]) - - sig := ffi.PrivateKeySign(*sk, msg) - - return sig[:], nil -} - -func (blsSigner) Verify(sig []byte, a address.Address, msg []byte) error { - payload := a.Payload() - if sig == nil || len(sig) != ffi.SignatureBytes || len(payload) != ffi.PublicKeyBytes { - return fmt.Errorf("bls signature failed to verify") - } - - pk := new(PublicKey) - copy(pk[:], payload[:ffi.PublicKeyBytes]) - - sigS := new(Signature) - copy(sigS[:], sig[:ffi.SignatureBytes]) - - msgs := [1]ffi.Message{msg} - pks := [1]PublicKey{*pk} - - if !ffi.HashVerify(sigS, msgs[:], pks[:]) { - return fmt.Errorf("bls signature failed to verify") - } - - return nil -} - -func init() { - sigs.RegisterSignature(crypto.SigTypeBLS, blsSigner{}) -} diff --git a/lib/sigs/doc.go b/lib/sigs/doc.go deleted file mode 100644 index 1e48725..0000000 --- a/lib/sigs/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package sigs allows for signing, verifying signatures and key generation -// using key types selected by package user. -// -// For support of secp256k1 import: -// _ "github.com/filecoin-project/venus-miner/lib/sigs/secp" -// -// For support of Filecoin BLS import: -// _ "github.com/filecoin-project/venus-miner/lib/sigs/bls" -package sigs diff --git a/lib/sigs/secp/init.go b/lib/sigs/secp/init.go deleted file mode 100644 index 2be17d8..0000000 --- a/lib/sigs/secp/init.go +++ /dev/null @@ -1,59 +0,0 @@ -package secp - -import ( - "fmt" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-crypto" - crypto2 "github.com/filecoin-project/go-state-types/crypto" - "github.com/minio/blake2b-simd" - - "github.com/filecoin-project/venus-miner/lib/sigs" -) - -type secpSigner struct{} - -func (secpSigner) GenPrivate() ([]byte, error) { - priv, err := crypto.GenerateKey() - if err != nil { - return nil, err - } - return priv, nil -} - -func (secpSigner) ToPublic(pk []byte) ([]byte, error) { - return crypto.PublicKey(pk), nil -} - -func (secpSigner) Sign(pk []byte, msg []byte) ([]byte, error) { - b2sum := blake2b.Sum256(msg) - sig, err := crypto.Sign(pk, b2sum[:]) - if err != nil { - return nil, err - } - - return sig, nil -} - -func (secpSigner) Verify(sig []byte, a address.Address, msg []byte) error { - b2sum := blake2b.Sum256(msg) - pubk, err := crypto.EcRecover(b2sum[:], sig) - if err != nil { - return err - } - - maybeaddr, err := address.NewSecp256k1Address(pubk) - if err != nil { - return err - } - - if a != maybeaddr { - return fmt.Errorf("signature did not match") - } - - return nil -} - -func init() { - sigs.RegisterSignature(crypto2.SigTypeSecp256k1, secpSigner{}) -} diff --git a/lib/sigs/sigs.go b/lib/sigs/sigs.go deleted file mode 100644 index ae383cc..0000000 --- a/lib/sigs/sigs.go +++ /dev/null @@ -1,112 +0,0 @@ -package sigs - -import ( - "context" - "errors" - "fmt" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/crypto" - "go.opencensus.io/trace" - - "github.com/filecoin-project/venus/venus-shared/types" -) - -// Sign takes in signature type, private key and message. Returns a signature for that message. -// Valid sigTypes are: "secp256k1" and "bls" -func Sign(sigType crypto.SigType, privkey []byte, msg []byte) (*crypto.Signature, error) { - sv, ok := sigs[sigType] - if !ok { - return nil, fmt.Errorf("cannot sign message with signature of unsupported type: %v", sigType) - } - - sb, err := sv.Sign(privkey, msg) - if err != nil { - return nil, err - } - return &crypto.Signature{ - Type: sigType, - Data: sb, - }, nil -} - -// Verify verifies signatures -func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error { - if sig == nil { - return fmt.Errorf("signature is nil") - } - - if addr.Protocol() == address.ID { - return fmt.Errorf("must resolve ID addresses before using them to verify a signature") - } - - sv, ok := sigs[sig.Type] - if !ok { - return fmt.Errorf("cannot verify signature of unsupported type: %v", sig.Type) - } - - return sv.Verify(sig.Data, addr, msg) -} - -// Generate generates private key of given type -func Generate(sigType crypto.SigType) ([]byte, error) { - sv, ok := sigs[sigType] - if !ok { - return nil, fmt.Errorf("cannot generate private key of unsupported type: %v", sigType) - } - - return sv.GenPrivate() -} - -// ToPublic converts private key to public key -func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error) { - sv, ok := sigs[sigType] - if !ok { - return nil, fmt.Errorf("cannot generate public key of unsupported type: %v", sigType) - } - - return sv.ToPublic(pk) -} - -func CheckBlockSignature(ctx context.Context, blk *types.BlockHeader, worker address.Address) error { - _, span := trace.StartSpan(ctx, "checkBlockSignature") - defer span.End() - - if blk.IsValidated() { - return nil - } - - if blk.BlockSig == nil { - return errors.New("block signature not present") - } - - sigb, err := blk.SignatureData() - if err != nil { - return fmt.Errorf("failed to get block signing bytes: %w", err) - } - - err = Verify(blk.BlockSig, worker, sigb) - if err == nil { - blk.SetValidated() - } - - return err -} - -// SigShim is used for introducing signature functions -type SigShim interface { - GenPrivate() ([]byte, error) - ToPublic(pk []byte) ([]byte, error) - Sign(pk []byte, msg []byte) ([]byte, error) - Verify(sig []byte, a address.Address, msg []byte) error -} - -var sigs map[crypto.SigType]SigShim - -// RegisterSignature should be only used during init -func RegisterSignature(typ crypto.SigType, vs SigShim) { - if sigs == nil { - sigs = make(map[crypto.SigType]SigShim) - } - sigs[typ] = vs -} diff --git a/system/resources.go b/lib/system/resources.go similarity index 100% rename from system/resources.go rename to lib/system/resources.go diff --git a/lib/venuslog/levels.go b/lib/venuslog/levels.go deleted file mode 100644 index 7d190a1..0000000 --- a/lib/venuslog/levels.go +++ /dev/null @@ -1,23 +0,0 @@ -package venuslog - -import ( - "os" - - logging "github.com/ipfs/go-log/v2" -) - -func SetupLogLevels() { - if _, set := os.LookupEnv("GOLOG_LOG_LEVEL"); !set { - _ = logging.SetLogLevel("*", "INFO") - _ = logging.SetLogLevel("dht", "ERROR") - _ = logging.SetLogLevel("swarm2", "WARN") - _ = logging.SetLogLevel("bitswap", "WARN") - //_ = logging.SetLogLevel("pubsub", "WARN") - _ = logging.SetLogLevel("connmgr", "WARN") - _ = logging.SetLogLevel("advmgr", "DEBUG") - _ = logging.SetLogLevel("stores", "DEBUG") - _ = logging.SetLogLevel("nat", "INFO") - } - // Always mute RtRefreshManager because it breaks terminals - _ = logging.SetLogLevel("dht/RtRefreshManager", "FATAL") -} diff --git a/miner/minerwpp.go b/miner/minerwpp.go index 21e15f8..75e8777 100644 --- a/miner/minerwpp.go +++ b/miner/minerwpp.go @@ -14,8 +14,8 @@ import ( "github.com/filecoin-project/venus-miner/chain" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/sector-storage/ffiwrapper" + "github.com/filecoin-project/venus/pkg/util/ffiwrapper" "github.com/filecoin-project/venus/venus-shared/actors/builtin" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/types" @@ -73,7 +73,7 @@ func (wpp *MiningWpp) ComputeProof(ctx context.Context, ssi []builtin.ExtendedSe start := build.Clock.Now() // todo call gateway api - api, closer, err := client.NewGatewayRPC(wpp.gatewayNode) + api, closer, err := client.NewGatewayRPC(ctx, wpp.gatewayNode) if err != nil { return nil, err } diff --git a/miner/multiminer.go b/miner/multiminer.go index eee787f..a22a651 100644 --- a/miner/multiminer.go +++ b/miner/multiminer.go @@ -24,13 +24,13 @@ import ( "github.com/filecoin-project/venus-miner/chain" "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/journal" + "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/block_recorder" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/modules/minermanage" - "github.com/filecoin-project/venus-miner/sector-storage/ffiwrapper" + "github.com/filecoin-project/venus/pkg/util/ffiwrapper" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" types2 "github.com/filecoin-project/venus/venus-shared/types" "github.com/filecoin-project/venus/venus-shared/types/wallet" @@ -665,7 +665,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, a var sign chain.SignFunc if _, ok := m.minerWPPMap[addr]; ok { - walletAPI, closer, err := client.NewGatewayRPC(m.gatewayNode) + walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("create wallet RPC failed: %w", err) out <- &winPoStRes{addr: addr, err: err} @@ -772,7 +772,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types2.BeaconEntry, ba accout := "" if val, ok := m.minerWPPMap[addr]; ok { accout = val.account - walletAPI, closer, err := client.NewGatewayRPC(m.gatewayNode) + walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("create wallet RPC failed: %w", err) return nil, err @@ -823,7 +823,7 @@ func (m *Miner) createBlock(ctx context.Context, base *MiningBase, addr, waddr a account := "" if val, ok := m.minerWPPMap[addr]; ok { account = val.account - walletAPI, closer, err := client.NewGatewayRPC(m.gatewayNode) + walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("create wallet RPC failed: %w", err) return nil, err @@ -1030,7 +1030,7 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start account := "" if val, ok := m.minerWPPMap[tAddr]; ok { account = val.account - walletAPI, closer, err := client.NewGatewayRPC(m.gatewayNode) + walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("[%v] create wallet RPC failed: %w", tAddr, err) res = append(res, dtypes.CountWinners{Msg: err.Error(), Miner: tAddr}) diff --git a/node/builder.go b/node/builder.go index 8442f64..e35861e 100644 --- a/node/builder.go +++ b/node/builder.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/journal" + "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/impl" @@ -29,11 +29,9 @@ import ( "github.com/filecoin-project/venus-miner/node/modules/minermanage/local" "github.com/filecoin-project/venus-miner/node/modules/minermanage/mysql" "github.com/filecoin-project/venus-miner/node/repo" - "github.com/filecoin-project/venus-miner/sector-storage/ffiwrapper" - "github.com/filecoin-project/venus-miner/system" - _ "github.com/filecoin-project/venus-miner/lib/sigs/bls" - _ "github.com/filecoin-project/venus-miner/lib/sigs/secp" + "github.com/filecoin-project/venus/pkg/util/ffiwrapper" + fwpimpl "github.com/filecoin-project/venus/pkg/util/ffiwrapper/impl" ) //nolint:deadcode,varcheck @@ -87,16 +85,11 @@ func defaults() []Option { Override(new(journal.DisabledEvents), journal.EnvDisabledEvents), Override(new(journal.Journal), modules.OpenFilesystemJournal), - Override(new(system.MemoryConstraints), modules.MemoryConstraints), - Override(InitMemoryWatchdog, modules.MemoryWatchdog), - Override(new(helpers.MetricsCtx), func() context.Context { return metricsi.CtxScope(context.Background(), "venus-miner") }), Override(new(dtypes.ShutdownChan), make(chan struct{})), - - // Filecoin modules } } @@ -130,13 +123,6 @@ func ConfigCommon(cfg *config.Common) Option { Override(SetApiEndpointKey, func(lr repo.LockedRepo, e dtypes.APIEndpoint) error { return lr.SetAPIEndpoint(e) }), - Override(new(ffiwrapper.URLs), func(e dtypes.APIEndpoint) (ffiwrapper.URLs, error) { - ip := cfg.API.RemoteListenAddress - - var urls ffiwrapper.URLs - urls = append(urls, "http://"+ip+"/remote") // TODO: This makes no assumptions, and probably could... - return urls, nil - }), ) } @@ -198,7 +184,7 @@ func ConfigPostOptions(cctx *cli.Context, c interface{}) Option { Override(new(*config.MinerConfig), scfg), Override(new(api.Common), From(new(common.CommonAPI))), - Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier), + Override(new(ffiwrapper.Verifier), fwpimpl.ProofVerifier), ) opt, err := PostWinningOptions(scfg) diff --git a/node/fxlog.go b/node/fxlog.go deleted file mode 100644 index d5d1a3e..0000000 --- a/node/fxlog.go +++ /dev/null @@ -1,17 +0,0 @@ -package node - -import ( - logging "github.com/ipfs/go-log/v2" - - "go.uber.org/fx" -) - -type debugPrinter struct { - l logging.StandardLogger -} - -func (p *debugPrinter) Printf(f string, a ...interface{}) { - p.l.Debugf(f, a...) -} - -var _ fx.Printer = new(debugPrinter) diff --git a/node/modules/core.go b/node/modules/core.go index 9cbeb62..ce1b4f1 100644 --- a/node/modules/core.go +++ b/node/modules/core.go @@ -1,39 +1,20 @@ package modules import ( - "context" "crypto/rand" "errors" "fmt" "io" "io/ioutil" - "os" - "path/filepath" - "time" + "github.com/filecoin-project/go-jsonrpc/auth" "github.com/gbrlsnchs/jwt/v3" logging "github.com/ipfs/go-log/v2" - "github.com/libp2p/go-libp2p-core/peerstore" - record "github.com/libp2p/go-libp2p-record" - "github.com/raulk/go-watchdog" - "go.uber.org/fx" - - "github.com/filecoin-project/go-jsonrpc/auth" - - types2 "github.com/filecoin-project/venus/venus-shared/types" "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/repo" - "github.com/filecoin-project/venus-miner/system" -) - -const ( - // EnvWatchdogDisabled is an escape hatch to disable the watchdog explicitly - // in case an OS/kernel appears to report incorrect information. The - // watchdog will be disabled if the value of this env variable is 1. - EnvWatchdogDisabled = "LOTUS_DISABLE_WATCHDOG" ) const ( @@ -42,98 +23,9 @@ const ( ) var ( - log = logging.Logger("modules") - logWatchdog = logging.Logger("watchdog") + log = logging.Logger("modules") ) -type Genesis func() (*types2.BlockHeader, error) - -// RecordValidator provides namesys compatible routing record validator -func RecordValidator(ps peerstore.Peerstore) record.Validator { - return record.NamespacedValidator{ - "pk": record.PublicKeyValidator{}, - } -} - -// MemoryConstraints returns the memory constraints configured for this system. -func MemoryConstraints() system.MemoryConstraints { - constraints := system.GetMemoryConstraints() - log.Infow("memory limits initialized", - "max_mem_heap", constraints.MaxHeapMem, - "total_system_mem", constraints.TotalSystemMem, - "effective_mem_limit", constraints.EffectiveMemLimit) - return constraints -} - -// MemoryWatchdog starts the memory watchdog, applying the computed resource -// constraints. -func MemoryWatchdog(lr repo.LockedRepo, lc fx.Lifecycle, constraints system.MemoryConstraints) { - if os.Getenv(EnvWatchdogDisabled) == "1" { - log.Infof("memory watchdog is disabled via %s", EnvWatchdogDisabled) - return - } - - // configure heap profile capture so that one is captured per episode where - // utilization climbs over 90% of the limit. A maximum of 10 heapdumps - // will be captured during life of this process. - watchdog.HeapProfileDir = filepath.Join(lr.Path(), "heapprof") - watchdog.HeapProfileMaxCaptures = 10 - watchdog.HeapProfileThreshold = 0.9 - watchdog.Logger = logWatchdog - - policy := watchdog.NewWatermarkPolicy(0.50, 0.60, 0.70, 0.85, 0.90, 0.925, 0.95) - - // Try to initialize a watchdog in the following order of precedence: - // 1. If a max heap limit has been provided, initialize a heap-driven watchdog. - // 2. Else, try to initialize a cgroup-driven watchdog. - // 3. Else, try to initialize a system-driven watchdog. - // 4. Else, log a warning that the system is flying solo, and return. - - addStopHook := func(stopFn func()) { - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - stopFn() - return nil - }, - }) - } - - // 1. If user has set max heap limit, apply it. - if maxHeap := constraints.MaxHeapMem; maxHeap != 0 { - const minGOGC = 10 - err, stopFn := watchdog.HeapDriven(maxHeap, minGOGC, policy) - if err == nil { - log.Infof("initialized heap-driven watchdog; max heap: %d bytes", maxHeap) - addStopHook(stopFn) - return - } - log.Warnf("failed to initialize heap-driven watchdog; err: %s", err) - log.Warnf("trying a cgroup-driven watchdog") - } - - // 2. cgroup-driven watchdog. - err, stopFn := watchdog.CgroupDriven(5*time.Second, policy) - if err == nil { - log.Infof("initialized cgroup-driven watchdog") - addStopHook(stopFn) - return - } - log.Warnf("failed to initialize cgroup-driven watchdog; err: %s", err) - log.Warnf("trying a system-driven watchdog") - - // 3. system-driven watchdog. - err, stopFn = watchdog.SystemDriven(0, 5*time.Second, policy) // 0 calculates the limit automatically. - if err == nil { - log.Infof("initialized system-driven watchdog") - addStopHook(stopFn) - return - } - - // 4. log the failure - log.Warnf("failed to initialize system-driven watchdog; err: %s", err) - log.Warnf("system running without a memory watchdog") -} - type JwtPayload struct { Allow []auth.Permission } diff --git a/node/modules/miner.go b/node/modules/miner.go index b758d15..5efa410 100644 --- a/node/modules/miner.go +++ b/node/modules/miner.go @@ -6,13 +6,13 @@ import ( "go.uber.org/fx" "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" - "github.com/filecoin-project/venus-miner/journal" + "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/block_recorder" "github.com/filecoin-project/venus-miner/node/modules/minermanage" - "github.com/filecoin-project/venus-miner/sector-storage/ffiwrapper" + "github.com/filecoin-project/venus/pkg/util/ffiwrapper" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) diff --git a/node/modules/services.go b/node/modules/services.go index a37b360..46abd2f 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -4,12 +4,13 @@ import ( "context" "go.uber.org/fx" - "github.com/filecoin-project/venus-miner/journal" + "github.com/filecoin-project/venus-miner/lib/journal" + "github.com/filecoin-project/venus-miner/lib/journal/fsjournal" "github.com/filecoin-project/venus-miner/node/repo" ) func OpenFilesystemJournal(lr repo.LockedRepo, lc fx.Lifecycle, disabled journal.DisabledEvents) (journal.Journal, error) { - jrnl, err := journal.OpenFSJournal(lr, disabled) + jrnl, err := fsjournal.OpenFSJournal(lr, disabled) if err != nil { return nil, err } diff --git a/node/modules/storage.go b/node/modules/storage.go index db5e165..dda8eda 100644 --- a/node/modules/storage.go +++ b/node/modules/storage.go @@ -2,13 +2,12 @@ package modules import ( "context" - "github.com/filecoin-project/venus-miner/node/modules/helpers" "go.uber.org/fx" "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/lib/backupds" "github.com/filecoin-project/venus-miner/node/modules/dtypes" + "github.com/filecoin-project/venus-miner/node/modules/helpers" "github.com/filecoin-project/venus-miner/node/repo" ) @@ -35,5 +34,5 @@ func Datastore(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRepo) (dty return nil, err } - return backupds.Wrap(mds), nil + return mds, nil } diff --git a/node/repo/blockstore_opts.go b/node/repo/blockstore_opts.go deleted file mode 100644 index 444e170..0000000 --- a/node/repo/blockstore_opts.go +++ /dev/null @@ -1,50 +0,0 @@ -package repo - -import badgerbs "github.com/filecoin-project/venus-miner/lib/blockstore/badger" - -// BadgerBlockstoreOptions returns the badger options to apply for the provided -// domain. -func BadgerBlockstoreOptions(domain BlockstoreDomain, path string, readonly bool) (badgerbs.Options, error) { - if domain != BlockstoreChain { - return badgerbs.Options{}, ErrInvalidBlockstoreDomain - } - - opts := badgerbs.DefaultOptions(path) - - // Due to legacy usage of blockstore.Blockstore, over a datastore, all - // blocks are prefixed with this namespace. In the future, this can go away, - // in order to shorten keys, but it'll require a migration. - opts.Prefix = "/blocks/" - - // Blockstore values are immutable; therefore we do not expect any - // conflicts to emerge. - opts.DetectConflicts = false - - // This is to optimize the database on close so it can be opened - // read-only and efficiently queried. - opts.CompactL0OnClose = true - - // The alternative is "crash on start and tell the user to fix it". This - // will truncate corrupt and unsynced data, which we don't guarantee to - // persist anyways. - opts.Truncate = true - - // We mmap the index and the value logs; this is important to enable - // zero-copy value access. - opts.ValueLogLoadingMode = badgerbs.MemoryMap - opts.TableLoadingMode = badgerbs.MemoryMap - - // Embed only values < 128 bytes in the LSM tree; larger values are stored - // in value logs. - opts.ValueThreshold = 128 - - // Default table size is already 64MiB. This is here to make it explicit. - opts.MaxTableSize = 64 << 20 - - // NOTE: The chain blockstore doesn't require any GC (blocks are never - // deleted). This will change if we move to a tiered blockstore. - - opts.ReadOnly = readonly - - return opts, nil -} diff --git a/node/repo/fsrepo.go b/node/repo/fsrepo.go index 5ff0572..cb5a5ea 100644 --- a/node/repo/fsrepo.go +++ b/node/repo/fsrepo.go @@ -2,7 +2,6 @@ package repo import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -22,9 +21,6 @@ import ( "github.com/multiformats/go-multiaddr" "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/lib/blockstore" - lblockstore "github.com/filecoin-project/venus-miner/lib/blockstore" - badgerbs "github.com/filecoin-project/venus-miner/lib/blockstore/badger" "github.com/filecoin-project/venus-miner/node/config" ) @@ -276,10 +272,6 @@ type fsLockedRepo struct { dsErr error dsOnce sync.Once - bs blockstore.Blockstore - bsErr error - bsOnce sync.Once - configLk sync.Mutex } @@ -301,13 +293,6 @@ func (fsr *fsLockedRepo) Close() error { } } - // type assertion will return ok=false if fsr.bs is nil altogether. - if c, ok := fsr.bs.(io.Closer); ok && c != nil { - if err := c.Close(); err != nil { - return fmt.Errorf("could not close blockstore: %w", err) - } - } - if fsr.closer != nil { err = fsr.closer.Close() fsr.closer = nil @@ -316,38 +301,6 @@ func (fsr *fsLockedRepo) Close() error { return err } -// Blockstore returns a blockstore for the provided data domain. -func (fsr *fsLockedRepo) Blockstore(ctx context.Context, domain BlockstoreDomain) (blockstore.Blockstore, error) { - if domain != BlockstoreChain { - return nil, ErrInvalidBlockstoreDomain - } - - fsr.bsOnce.Do(func() { - path := fsr.join(filepath.Join(fsDatastore, "chain")) - readonly := fsr.readonly - - if err := os.MkdirAll(path, 0755); err != nil { - fsr.bsErr = err - return - } - - opts, err := BadgerBlockstoreOptions(domain, path, readonly) - if err != nil { - fsr.bsErr = err - return - } - - bs, err := badgerbs.Open(opts) - if err != nil { - fsr.bsErr = err - return - } - fsr.bs = lblockstore.WrapIDStore(bs) - }) - - return fsr.bs, fsr.bsErr -} - // join joins path elements with fsr.path func (fsr *fsLockedRepo) join(paths ...string) string { return filepath.Join(append([]string{fsr.path}, paths...)...) diff --git a/node/repo/interface.go b/node/repo/interface.go index 8aaf098..9e6de24 100644 --- a/node/repo/interface.go +++ b/node/repo/interface.go @@ -8,29 +8,11 @@ import ( "github.com/multiformats/go-multiaddr" "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/lib/blockstore" -) - -// BlockstoreDomain represents the domain of a blockstore. -type BlockstoreDomain string - -const ( - // BlockstoreChain represents the blockstore domain for chain data. - // Right now, this includes chain objects (tipsets, blocks, messages), as - // well as state. In the future, they may get segregated into different - // domains. - BlockstoreChain = BlockstoreDomain("chain") ) var ( ErrNoAPIEndpoint = errors.New("API not running (no endpoint)") - ErrNoAPIToken = errors.New("API token not set") ErrRepoAlreadyLocked = errors.New("repo is already locked") - ErrClosedRepo = errors.New("repo is no longer open") - - // ErrInvalidBlockstoreDomain is returned by LockedRepo#Blockstore() when - // an unrecognized domain is requested. - ErrInvalidBlockstoreDomain = errors.New("invalid blockstore domain") ) type Repo interface { @@ -54,12 +36,6 @@ type LockedRepo interface { // the lifecycle. Datastore(ctx context.Context, namespace string) (datastore.Batching, error) - // Blockstore returns an IPLD blockstore for the requested domain. - // The supplied context must only be used to initialize the blockstore. - // The implementation should not retain the context for usage throughout - // the lifecycle. - Blockstore(ctx context.Context, domain BlockstoreDomain) (blockstore.Blockstore, error) - // Returns config in this repo Config() (interface{}, error) SetConfig(func(interface{})) error diff --git a/node/repo/memrepo.go b/node/repo/memrepo.go deleted file mode 100644 index 0435a44..0000000 --- a/node/repo/memrepo.go +++ /dev/null @@ -1,318 +0,0 @@ -package repo - -import ( - "context" - "fmt" - "io/ioutil" - "os" - "sync" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/namespace" - dssync "github.com/ipfs/go-datastore/sync" - "github.com/multiformats/go-multiaddr" - - "github.com/filecoin-project/venus-miner/chain/types" - "github.com/filecoin-project/venus-miner/lib/blockstore" -) - -type MemRepo struct { - api struct { - sync.Mutex - ma multiaddr.Multiaddr - token []byte - } - - repoLock chan struct{} - token *byte - - datastore datastore.Datastore - keystore map[string]types.KeyInfo - blockstore blockstore.Blockstore - - // given a repo type, produce the default config - configF func(t RepoType) interface{} - - // holds the current config value - config struct { - sync.Mutex - val interface{} - } -} - -type lockedMemRepo struct { - mem *MemRepo - t RepoType - sync.RWMutex - - tempDir string - token *byte -} - -func (lmem *lockedMemRepo) Path() string { - lmem.Lock() - defer lmem.Unlock() - - if lmem.tempDir != "" { - return lmem.tempDir - } - - t, err := ioutil.TempDir(os.TempDir(), "venus-memrepo-temp-") - if err != nil { - panic(err) // only used in tests, probably fine - } - - lmem.tempDir = t - return t -} - -var _ Repo = &MemRepo{} - -// MemRepoOptions contains options for memory repo -type MemRepoOptions struct { - Ds datastore.Datastore - ConfigF func(RepoType) interface{} - KeyStore map[string]types.KeyInfo -} - -// NewMemory creates new memory based repo with provided options. -// opts can be nil, it will be replaced with defaults. -// Any field in opts can be nil, they will be replaced by defaults. -func NewMemory(opts *MemRepoOptions) *MemRepo { - if opts == nil { - opts = &MemRepoOptions{} - } - if opts.ConfigF == nil { - opts.ConfigF = defConfForType - } - if opts.Ds == nil { - opts.Ds = dssync.MutexWrap(datastore.NewMapDatastore()) - } - if opts.KeyStore == nil { - opts.KeyStore = make(map[string]types.KeyInfo) - } - - return &MemRepo{ - repoLock: make(chan struct{}, 1), - blockstore: blockstore.WrapIDStore(blockstore.NewMemorySync()), - datastore: opts.Ds, - configF: opts.ConfigF, - keystore: opts.KeyStore, - } -} - -func (mem *MemRepo) APIEndpoint() (multiaddr.Multiaddr, error) { - mem.api.Lock() - defer mem.api.Unlock() - if mem.api.ma == nil { - return nil, ErrNoAPIEndpoint - } - return mem.api.ma, nil -} - -func (mem *MemRepo) APIToken() ([]byte, error) { - mem.api.Lock() - defer mem.api.Unlock() - if mem.api.ma == nil { - return nil, ErrNoAPIToken - } - return mem.api.token, nil -} - -func (mem *MemRepo) Lock(t RepoType) (LockedRepo, error) { - select { - case mem.repoLock <- struct{}{}: - default: - return nil, ErrRepoAlreadyLocked - } - mem.token = new(byte) - - return &lockedMemRepo{ - mem: mem, - t: t, - token: mem.token, - }, nil -} - -func (lmem *lockedMemRepo) checkToken() error { - lmem.RLock() - defer lmem.RUnlock() - if lmem.mem.token != lmem.token { - return ErrClosedRepo - } - return nil -} - -func (lmem *lockedMemRepo) Close() error { - if err := lmem.checkToken(); err != nil { - return err - } - lmem.Lock() - defer lmem.Unlock() - - if lmem.mem.token != lmem.token { - return ErrClosedRepo - } - - if lmem.tempDir != "" { - if err := os.RemoveAll(lmem.tempDir); err != nil { - return err - } - lmem.tempDir = "" - } - - lmem.mem.token = nil - lmem.mem.api.Lock() - lmem.mem.api.ma = nil - lmem.mem.api.Unlock() - <-lmem.mem.repoLock // unlock - return nil - -} - -func (lmem *lockedMemRepo) Datastore(_ context.Context, ns string) (datastore.Batching, error) { - if err := lmem.checkToken(); err != nil { - return nil, err - } - - return namespace.Wrap(lmem.mem.datastore, datastore.NewKey(ns)), nil -} - -func (lmem *lockedMemRepo) Blockstore(ctx context.Context, domain BlockstoreDomain) (blockstore.Blockstore, error) { - if domain != BlockstoreChain { - return nil, ErrInvalidBlockstoreDomain - } - return lmem.mem.blockstore, nil -} - -func (lmem *lockedMemRepo) ListDatastores(ns string) ([]int64, error) { - return nil, nil -} - -func (lmem *lockedMemRepo) DeleteDatastore(ns string) error { - /** poof **/ - return nil -} - -func (lmem *lockedMemRepo) Config() (interface{}, error) { - if err := lmem.checkToken(); err != nil { - return nil, err - } - - lmem.mem.config.Lock() - defer lmem.mem.config.Unlock() - - if lmem.mem.config.val == nil { - lmem.mem.config.val = lmem.mem.configF(lmem.t) - } - - return lmem.mem.config.val, nil -} - -func (lmem *lockedMemRepo) SetConfig(c func(interface{})) error { - if err := lmem.checkToken(); err != nil { - return err - } - - lmem.mem.config.Lock() - defer lmem.mem.config.Unlock() - - if lmem.mem.config.val == nil { - lmem.mem.config.val = lmem.mem.configF(lmem.t) - } - - c(lmem.mem.config.val) - - return nil -} - -func (lmem *lockedMemRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error { - if err := lmem.checkToken(); err != nil { - return err - } - lmem.mem.api.Lock() - lmem.mem.api.ma = ma - lmem.mem.api.Unlock() - return nil -} - -func (lmem *lockedMemRepo) SetAPIToken(token []byte) error { - if err := lmem.checkToken(); err != nil { - return err - } - lmem.mem.api.Lock() - lmem.mem.api.token = token - lmem.mem.api.Unlock() - return nil -} - -func (lmem *lockedMemRepo) KeyStore() (types.KeyStore, error) { - if err := lmem.checkToken(); err != nil { - return nil, err - } - return lmem, nil -} - -// Implement KeyStore on the same instance - -// List lists all the keys stored in the KeyStore -func (lmem *lockedMemRepo) List() ([]string, error) { - if err := lmem.checkToken(); err != nil { - return nil, err - } - lmem.RLock() - defer lmem.RUnlock() - - res := make([]string, 0, len(lmem.mem.keystore)) - for k := range lmem.mem.keystore { - res = append(res, k) - } - return res, nil -} - -// Get gets a key out of keystore and returns types.KeyInfo coresponding to named key -func (lmem *lockedMemRepo) Get(name string) (types.KeyInfo, error) { - if err := lmem.checkToken(); err != nil { - return types.KeyInfo{}, err - } - lmem.RLock() - defer lmem.RUnlock() - - key, ok := lmem.mem.keystore[name] - if !ok { - return types.KeyInfo{}, fmt.Errorf("getting key '%s': %w", name, types.ErrKeyInfoNotFound) - } - return key, nil -} - -// Put saves key info under given name -func (lmem *lockedMemRepo) Put(name string, key types.KeyInfo) error { - if err := lmem.checkToken(); err != nil { - return err - } - lmem.Lock() - defer lmem.Unlock() - - _, isThere := lmem.mem.keystore[name] - if isThere { - return fmt.Errorf("putting key '%s': %w", name, types.ErrKeyExists) - } - - lmem.mem.keystore[name] = key - return nil -} - -func (lmem *lockedMemRepo) Delete(name string) error { - if err := lmem.checkToken(); err != nil { - return err - } - lmem.Lock() - defer lmem.Unlock() - - _, isThere := lmem.mem.keystore[name] - if !isThere { - return fmt.Errorf("deleting key '%s': %w", name, types.ErrKeyInfoNotFound) - } - delete(lmem.mem.keystore, name) - return nil -} diff --git a/node/repo/memrepo_test.go b/node/repo/memrepo_test.go deleted file mode 100644 index 965bc02..0000000 --- a/node/repo/memrepo_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package repo - -import ( - "testing" -) - -func TestMemBasic(t *testing.T) { - repo := NewMemory(nil) - basicTest(t, repo) -} diff --git a/sector-storage/ffiwrapper/types.go b/sector-storage/ffiwrapper/types.go deleted file mode 100644 index d947fb9..0000000 --- a/sector-storage/ffiwrapper/types.go +++ /dev/null @@ -1,19 +0,0 @@ -package ffiwrapper - -import ( - "context" - - proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof" - - "github.com/filecoin-project/go-state-types/abi" -) - -type URLs []string - -type Verifier interface { - VerifySeal(proof2.SealVerifyInfo) (bool, error) - VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) - VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) - - GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error) -} diff --git a/sector-storage/ffiwrapper/verifier_cgo.go b/sector-storage/ffiwrapper/verifier_cgo.go deleted file mode 100644 index 30c6cc2..0000000 --- a/sector-storage/ffiwrapper/verifier_cgo.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build cgo -// +build cgo - -package ffiwrapper - -import ( - "context" - - ffi "github.com/filecoin-project/filecoin-ffi" - "github.com/filecoin-project/go-state-types/abi" - proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof" - "go.opencensus.io/trace" -) - -var _ Verifier = ProofVerifier - -type proofVerifier struct{} - -var ProofVerifier = proofVerifier{} - -func (proofVerifier) VerifySeal(info proof2.SealVerifyInfo) (bool, error) { - return ffi.VerifySeal(info) -} - -func (proofVerifier) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) { - info.Randomness[31] &= 0x3f - _, span := trace.StartSpan(ctx, "VerifyWinningPoSt") - defer span.End() - - return ffi.VerifyWinningPoSt(info) -} - -func (proofVerifier) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) { - info.Randomness[31] &= 0x3f - _, span := trace.StartSpan(ctx, "VerifyWindowPoSt") - defer span.End() - - return ffi.VerifyWindowPoSt(info) -} - -func (proofVerifier) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { - randomness[31] &= 0x3f - return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount) -} From 6b89737d9b2480e43b81164feae15a7b37339217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E9=A1=B5=E7=B4=A0=E4=B9=A6?= <2931107265@qq.com> Date: Wed, 15 Jun 2022 17:21:26 +0800 Subject: [PATCH 2/4] feat(CI): upgrade build maco --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 54c9a93..a6863a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -175,7 +175,7 @@ jobs: name: Install go command: | curl -O https://dl.google.com/go/go1.17.9.darwin-amd64.pkg && \ - sudo installer -pkg go1.16.4.darwin-amd64.pkg -target / + sudo installer -pkg go1.17.9.darwin-amd64.pkg -target / - run: name: Install pkg-config command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config @@ -196,7 +196,6 @@ jobs: - restore_cache: name: restore cargo cache key: v3-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/venus-miner/go.sum" }} - - install-deps - run: command: make miner no_output_timeout: 30m From 5263612103618d801e8b9f15b09ec0f566d20b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E9=A1=B5=E7=B4=A0=E4=B9=A6?= <2931107265@qq.com> Date: Thu, 16 Jun 2022 14:11:19 +0800 Subject: [PATCH 3/4] feat: request network params from fullnode --- .circleci/config.yml | 4 +- Makefile | 5 +- README.md | 2 +- build/isnearupgrade.go | 9 -- build/params.go | 8 ++ build/params_shared_funcs.go | 113 ---------------- build/params_shared_vals.go | 41 ------ build/testing_flags.go | 3 - build/version.go | 32 +---- cli/cmd.go | 43 +----- cli/helper.go | 43 +----- cli/log.go | 4 +- cli/version.go | 4 +- cmd/address.go | 35 ----- cmd/init.go | 102 +++----------- cmd/run.go | 63 ++------- cmd/stop.go | 2 +- go.mod | 58 +++++++- go.sum | 127 +++++++++++++++++- miner/minerwpp.go | 9 +- miner/multiminer.go | 92 ++++++------- .../slashfilter/mysql_slashfilter.go | 5 - .../gen => miner}/slashfilter/slashfilter.go | 5 - {chain => miner}/util.go | 50 +------ miner/warmup.go | 4 +- node/builder.go | 6 +- node/impl/common/common.go | 1 - node/modules/core.go | 8 +- node/modules/miner.go | 2 +- node/modules/storage.go | 4 +- node/repo/fsrepo.go | 28 ++-- node/repo/interface.go | 5 +- node/repo/repo_test.go | 12 +- {chain/types => types}/keystore.go | 0 {chain/types => types}/logs.go | 0 35 files changed, 303 insertions(+), 626 deletions(-) delete mode 100644 build/isnearupgrade.go create mode 100644 build/params.go delete mode 100644 build/params_shared_funcs.go delete mode 100644 build/params_shared_vals.go delete mode 100644 build/testing_flags.go rename {chain/gen => miner}/slashfilter/mysql_slashfilter.go (97%) rename {chain/gen => miner}/slashfilter/slashfilter.go (96%) rename {chain => miner}/util.go (54%) rename {chain/types => types}/keystore.go (100%) rename {chain/types => types}/logs.go (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index a6863a6..a9615f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -227,9 +227,9 @@ jobs: - install-deps - prepare - run: make deps - - run: go install golang.org/x/tools/cmd/goimports - - run: make api-gen - run: go generate -x ./... + - run: go install golang.org/x/tools/cmd/goimports + - run: make gen - run: git --no-pager diff - run: git --no-pager diff --quiet diff --git a/Makefile b/Makefile index 1572aae..2eda830 100644 --- a/Makefile +++ b/Makefile @@ -81,11 +81,10 @@ dist-clean: git submodule deinit --all -f .PHONY: dist-clean -api-gen: +gen: go run ./gen/api goimports -w api - goimports -w api -.PHONY: api-gen +.PHONY: gen print-%: @echo $*=$($*) diff --git a/README.md b/README.md index 57088c1..7cd93fd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

- +

diff --git a/build/isnearupgrade.go b/build/isnearupgrade.go deleted file mode 100644 index 4273f0e..0000000 --- a/build/isnearupgrade.go +++ /dev/null @@ -1,9 +0,0 @@ -package build - -import ( - "github.com/filecoin-project/go-state-types/abi" -) - -func IsNearUpgrade(epoch, upgradeEpoch abi.ChainEpoch) bool { - return epoch > upgradeEpoch-Finality && epoch < upgradeEpoch+Finality -} diff --git a/build/params.go b/build/params.go new file mode 100644 index 0000000..33fef97 --- /dev/null +++ b/build/params.go @@ -0,0 +1,8 @@ +//go:build !testground +// +build !testground + +package build + +var ( + PropagationDelaySecs = uint64(12) +) diff --git a/build/params_shared_funcs.go b/build/params_shared_funcs.go deleted file mode 100644 index a9566ae..0000000 --- a/build/params_shared_funcs.go +++ /dev/null @@ -1,113 +0,0 @@ -package build - -import ( - "fmt" - "os" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/abi" - builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" - - "github.com/filecoin-project/venus/venus-shared/actors/policy" -) - -func SetAddressNetwork(n address.Network) { - address.CurrentNetwork = n -} - -func InitNetWorkParams(nettype string) error { - fmt.Println("nettype: ", nettype) - switch nettype { - case "mainnet": - policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40)) - - if os.Getenv("MINING_USE_TEST_ADDRESSES") != "1" { - SetAddressNetwork(address.Mainnet) - } - BuildType = BuildMainnet - - UpgradeSmokeHeight = 51000 - UpgradeOrangeHeight = 336458 - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - PropagationDelaySecs = uint64(12) - case "debug", "2k": - { - policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) - policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) - - SetAddressNetwork(address.Testnet) - - switch nettype { - case "debug": - BuildType |= BuildDebug - case "2k": - BuildType |= Build2k - } - - UpgradeSmokeHeight = -1 - UpgradeOrangeHeight = -11 - BlockDelaySecs = uint64(4) - PropagationDelaySecs = uint64(1) - } - case "calibnet": - policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 30)) - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg512MiBV1, - abi.RegisteredSealProof_StackedDrg32GiBV1, - abi.RegisteredSealProof_StackedDrg64GiBV1, - ) - - SetAddressNetwork(address.Testnet) - BuildType = BuildCalibnet - - UpgradeSmokeHeight = -2 - UpgradeOrangeHeight = 300 - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - PropagationDelaySecs = uint64(12) - case "butterfly": - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30)) - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg512MiBV1, - abi.RegisteredSealProof_StackedDrg32GiBV1, - abi.RegisteredSealProof_StackedDrg64GiBV1, - ) - - SetAddressNetwork(address.Testnet) - BuildType = BuildButterflynet - - UpgradeSmokeHeight = -2 - UpgradeOrangeHeight = -12 - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - PropagationDelaySecs = uint64(12) - case "interop": - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg2KiBV1, - abi.RegisteredSealProof_StackedDrg8MiBV1, - abi.RegisteredSealProof_StackedDrg512MiBV1, - ) - policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) - - SetAddressNetwork(address.Testnet) - BuildType = BuildInteropnet - - UpgradeSmokeHeight = -2 - UpgradeOrangeHeight = -12 - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - PropagationDelaySecs = uint64(12) - default: - return fmt.Errorf("unknown nettype %s", nettype) - } - - return nil -} - -func MustParseAddress(addr string) address.Address { - ret, err := address.NewFromString(addr) - if err != nil { - panic(err) - } - - return ret -} diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go deleted file mode 100644 index b46fae5..0000000 --- a/build/params_shared_vals.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build !testground -// +build !testground - -package build - -import ( - "os" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/abi" - builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" - - "github.com/filecoin-project/venus/venus-shared/actors/policy" -) - -// Epochs -const Finality = policy.ChainFinality - -// Epochs -const TicketRandomnessLookback = abi.ChainEpoch(1) - -// ///// -// Address - -const AddressMainnetEnvVar = "_mainnet_" - -// Build Settings -var ( - UpgradeSmokeHeight abi.ChainEpoch = -1 - UpgradeOrangeHeight abi.ChainEpoch = 336458 - - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - - PropagationDelaySecs = uint64(12) -) - -func init() { - if os.Getenv("MINING_USE_TEST_ADDRESSES") != "1" || os.Getenv("VENUS_ADDRESS_TYPE") == AddressMainnetEnvVar { - SetAddressNetwork(address.Mainnet) - } -} diff --git a/build/testing_flags.go b/build/testing_flags.go deleted file mode 100644 index 1f26121..0000000 --- a/build/testing_flags.go +++ /dev/null @@ -1,3 +0,0 @@ -package build - -var InsecurePoStValidation = false diff --git a/build/version.go b/build/version.go index 6a1bdee..d0ab36f 100644 --- a/build/version.go +++ b/build/version.go @@ -1,40 +1,10 @@ package build var CurrentCommit string -var BuildType int - -const ( - BuildDefault = 0 - BuildMainnet = 0x1 - Build2k = 0x2 - BuildDebug = 0x3 - BuildCalibnet = 0x4 - BuildButterflynet = 0x7 - BuildInteropnet = 0x8 -) - -func buildType() string { - switch BuildType { - case BuildDefault: - return "" - case BuildMainnet: - return "+mainnet" - case Build2k: - return "+2k" - case BuildDebug: - return "+debug" - case BuildCalibnet: - return "+calibnet" - case BuildButterflynet: - return "+butterflynet" - default: - return "+huh?" - } -} // BuildVersion is the local build version, set by build system const BuildVersion = "1.6.0-rc1" func UserVersion() string { - return BuildVersion + buildType() + CurrentCommit + return BuildVersion + CurrentCommit } diff --git a/cli/cmd.go b/cli/cmd.go index 28d391d..eb53f22 100644 --- a/cli/cmd.go +++ b/cli/cmd.go @@ -21,7 +21,6 @@ import ( "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/repo" - "github.com/filecoin-project/venus/venus-shared/api/chain/v0" "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) @@ -114,36 +113,8 @@ func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http. return addr, ainfo.AuthHeader(), nil } -func GetAPI(ctx *cli.Context) (api.Common, jsonrpc.ClientCloser, error) { - ti, ok := ctx.App.Metadata["repoType"] - if !ok { - log.Errorf("unknown repo type, are you sure you want to use GetAPI?") - ti = repo.Miner - } - t, ok := ti.(repo.RepoType) - if !ok { - log.Errorf("repoType type does not match the type of repo.RepoType") - } - - addr, headers, err := GetRawAPI(ctx, t, "v0") - if err != nil { - return nil, nil, err - } - - return client.NewCommonRPC(ctx.Context, addr, headers) -} - -func GetFullNodeAPI(ctx *cli.Context, fn config.FullNode) (v0.FullNode, jsonrpc.ClientCloser, error) { - addr, err := fn.DialArgs("v0") - if err != nil { - return nil, nil, fmt.Errorf("could not get DialArgs: %w", err) - } - - return v0.NewFullNodeRPC(ctx.Context, addr, fn.AuthHeader()) -} - -func GetFullNodeAPIV1(ctx *cli.Context, fn config.FullNode) (v1.FullNode, jsonrpc.ClientCloser, error) { - addr, err := fn.DialArgs("v1") +func GetFullNodeAPI(ctx *cli.Context, fn config.FullNode, version string) (v1.FullNode, jsonrpc.ClientCloser, error) { + addr, err := fn.DialArgs(version) if err != nil { return nil, nil, fmt.Errorf("could not get DialArgs: %w", err) } @@ -187,15 +158,5 @@ func ReqContext(cctx *cli.Context) context.Context { var CommonCommands = []*cli.Command{ logCmd, -} - -var Commands = []*cli.Command{ - WithCategory("developer", logCmd), - VersionCmd, } - -func WithCategory(cat string, cmd *cli.Command) *cli.Command { - cmd.Category = cat - return cmd -} diff --git a/cli/helper.go b/cli/helper.go index 724ec1a..30003f4 100644 --- a/cli/helper.go +++ b/cli/helper.go @@ -3,7 +3,6 @@ package cli import ( "errors" "fmt" - "io" "os" ufcli "github.com/urfave/cli/v2" @@ -27,17 +26,9 @@ func (e *PrintHelpErr) Is(o error) bool { return ok } -func ShowHelp(cctx *ufcli.Context, err error) error { - return &PrintHelpErr{Err: err, Ctx: cctx} -} - func RunApp(app *ufcli.App) { if err := app.Run(os.Args); err != nil { - if os.Getenv("LOTUS_DEV") != "" { - log.Warnf("%+v", err) - } else { - fmt.Fprintf(os.Stderr, "ERROR: %s\n\n", err) // nolint:errcheck - } + fmt.Fprintf(os.Stderr, "ERROR: %s\n\n", err) // nolint:errcheck var phe *PrintHelpErr if errors.As(err, &phe) { _ = ufcli.ShowCommandHelp(phe.Ctx, phe.Ctx.Command.Name) @@ -45,35 +36,3 @@ func RunApp(app *ufcli.App) { os.Exit(1) } } - -type AppFmt struct { - app *ufcli.App - Stdin io.Reader -} - -func NewAppFmt(a *ufcli.App) *AppFmt { - var stdin io.Reader - istdin, ok := a.Metadata["stdin"] - if ok { - stdin = istdin.(io.Reader) - } else { - stdin = os.Stdin - } - return &AppFmt{app: a, Stdin: stdin} -} - -func (a *AppFmt) Print(args ...interface{}) { - fmt.Fprint(a.app.Writer, args...) -} - -func (a *AppFmt) Println(args ...interface{}) { - fmt.Fprintln(a.app.Writer, args...) -} - -func (a *AppFmt) Printf(fmtstr string, args ...interface{}) { - fmt.Fprintf(a.app.Writer, fmtstr, args...) -} - -func (a *AppFmt) Scan(args ...interface{}) (int, error) { - return fmt.Fscan(a.Stdin, args...) -} diff --git a/cli/log.go b/cli/log.go index 9da41b4..bfd91cf 100644 --- a/cli/log.go +++ b/cli/log.go @@ -19,7 +19,7 @@ var logList = &cli.Command{ Name: "list", Usage: "List log systems", Action: func(cctx *cli.Context) error { - api, closer, err := GetAPI(cctx) + api, closer, err := GetMinerAPI(cctx) if err != nil { return err } @@ -70,7 +70,7 @@ var logSetLevel = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - api, closer, err := GetAPI(cctx) + api, closer, err := GetMinerAPI(cctx) if err != nil { return err } diff --git a/cli/version.go b/cli/version.go index 1cdc9c5..baaef77 100644 --- a/cli/version.go +++ b/cli/version.go @@ -10,15 +10,13 @@ var VersionCmd = &cli.Command{ Name: "version", Usage: "Print version", Action: func(cctx *cli.Context) error { - api, closer, err := GetAPI(cctx) + api, closer, err := GetMinerAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) - // TODO: print more useful things - v, err := api.Version(ctx) if err != nil { return err diff --git a/cmd/address.go b/cmd/address.go index d2a5b40..0ffb98a 100644 --- a/cmd/address.go +++ b/cmd/address.go @@ -7,45 +7,10 @@ import ( "github.com/urfave/cli/v2" "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/abi" - - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - lcli "github.com/filecoin-project/venus-miner/cli" "github.com/filecoin-project/venus-miner/node/modules/dtypes" ) -func isSupportedSectorSize(ssize abi.SectorSize) bool { // nolint - for spf := range miner0.SupportedProofTypes { - switch spf { - case abi.RegisteredSealProof_StackedDrg2KiBV1: - if ssize == 2048 { - return true - } - case abi.RegisteredSealProof_StackedDrg8MiBV1: - if ssize == 8<<20 { - return true - } - case abi.RegisteredSealProof_StackedDrg512MiBV1: - if ssize == 512<<20 { - return true - } - case abi.RegisteredSealProof_StackedDrg32GiBV1: - if ssize == 32<<30 { - return true - } - case abi.RegisteredSealProof_StackedDrg64GiBV1: - if ssize == 64<<30 { - return true - } - default: - - } - } - - return false -} - var addressCmd = &cli.Command{ Name: "address", Usage: "manage the miner address", diff --git a/cmd/init.go b/cmd/init.go index 776d7b7..b2bcc16 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -2,14 +2,12 @@ package main import ( "context" - "crypto/rand" "fmt" "os" "time" "github.com/filecoin-project/go-state-types/abi" "github.com/ipfs/go-cid" - "github.com/libp2p/go-libp2p-core/crypto" "github.com/mitchellh/go-homedir" "github.com/urfave/cli/v2" @@ -17,8 +15,6 @@ import ( v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" types2 "github.com/filecoin-project/venus/venus-shared/types" - "github.com/filecoin-project/venus-miner/build" - "github.com/filecoin-project/venus-miner/chain/types" lcli "github.com/filecoin-project/venus-miner/cli" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/repo" @@ -28,41 +24,24 @@ var initCmd = &cli.Command{ Name: "init", Usage: "Initialize a venus miner repo", Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "nettype", - Usage: "network type, one of: mainnet, debug, 2k, calibnet, butterfly, interop", - Value: "mainnet", - DefaultText: "mainnet", - Required: false, - }, &cli.StringFlag{ Name: "api", Usage: "full node api", Required: true, }, - &cli.StringFlag{ - Name: "token", - Usage: "full node token", - Required: true, - }, &cli.StringFlag{ Name: "auth-api", Usage: "auth node api", Required: true, }, - &cli.StringFlag{ - Name: "auth-token", - Usage: "auth node token", - Value: "", - }, &cli.StringSliceFlag{ Name: "gateway-api", Usage: "gateway api", }, &cli.StringFlag{ - Name: "gateway-token", - Usage: "gateway token", - Value: "", + Name: "token", + Usage: "full node token", + Required: true, }, &cli.StringFlag{ Name: "slash-filter", @@ -80,12 +59,6 @@ var initCmd = &cli.Command{ ctx := lcli.ReqContext(cctx) - log.Info("Initializing build params") - - if err := build.InitNetWorkParams(cctx.String("nettype")); err != nil { - return err - } - log.Info("Trying to connect to full node RPC") fullnode := config.FullNode{} @@ -94,7 +67,7 @@ var initCmd = &cli.Command{ fullnode.Token = cctx.String("token") } - fullNodeAPI, closer, err := lcli.GetFullNodeAPIV1(cctx, fullnode) + fullNodeAPI, closer, err := lcli.GetFullNodeAPI(cctx, fullnode, "v1") if err != nil { return err } @@ -124,7 +97,7 @@ var initCmd = &cli.Command{ } if !v.APIVersion.EqMajorMinor(api.FullAPIVersion1) { - return fmt.Errorf("Remote API version didn't match (expected %s, remote %s)", api.FullAPIVersion1, v.APIVersion) + return fmt.Errorf("RemoteAPI version didn't match (expected %s, remote %s)", api.FullAPIVersion1, v.APIVersion) } log.Info("Initializing repo") @@ -143,7 +116,7 @@ var initCmd = &cli.Command{ if err := os.RemoveAll(path); err != nil { log.Errorf("Failed to clean up failed storage repo: %s", err) } - return fmt.Errorf("Storage-miner init failed") + return fmt.Errorf("init failed") } log.Info("Miner successfully init, you can now start it with 'venus-miner run'") @@ -159,24 +132,6 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error } defer lr.Close() //nolint:errcheck - //log.Info("Initializing libp2p identity") - // - //p2pSk, err := makeHostKey(lr) - //if err != nil { - // return fmt.Errorf("make host key: %w", err) - //} - // - //peerID, err := peer.IDFromPrivateKey(p2pSk) - //if err != nil { - // return fmt.Errorf("peer ID from private key: %w", err) - //} - //log.Infow("init new peer: %s", peerID) - - //mds, err := lr.Datastore(context.TODO(), "/metadata") - //if err != nil { - // return err - //} - // modify config log.Info("modify config ...") sfType := cctx.String("slash-filter") @@ -188,11 +143,8 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error cfg := i.(*config.MinerConfig) cfg.FullNode = fn + gt := cctx.String("token") if cctx.IsSet("gateway-api") { - gt := cctx.String("gateway-token") - if gt == "" { - gt = cctx.String("token") - } cfg.Gateway = &config.GatewayNode{ ListenAPI: cctx.StringSlice("gateway-api"), Token: gt, @@ -203,7 +155,7 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error cfg.Db.Type = "auth" cfg.Db.Auth = &config.AuthConfig{ ListenAPI: cctx.String("auth-api"), - Token: cctx.String("auth-token"), + Token: gt, } } @@ -218,35 +170,13 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error return nil } -func makeHostKey(ctx context.Context, lr repo.LockedRepo) (crypto.PrivKey, error) { //nolint - pk, _, err := crypto.GenerateEd25519Key(rand.Reader) - if err != nil { - return nil, err - } - - ks, err := lr.KeyStore() - if err != nil { - return nil, err - } - - kbytes, err := crypto.MarshalPrivateKey(pk) +func SyncWait(ctx context.Context, fullNode v1.FullNode, watch bool) error { + tick := time.Second / 4 + netParams, err := fullNode.StateGetNetworkParams(ctx) if err != nil { - return nil, err - } - - if err := ks.Put("libp2p-host", types.KeyInfo{ - Type: "libp2p-host", - PrivateKey: kbytes, - }); err != nil { - return nil, err + return err } - return pk, nil -} - -func SyncWait(ctx context.Context, napi v1.FullNode, watch bool) error { - tick := time.Second / 4 - lastLines := 0 ticker := time.NewTicker(tick) defer ticker.Stop() @@ -255,14 +185,14 @@ func SyncWait(ctx context.Context, napi v1.FullNode, watch bool) error { i := 0 var firstApp, app, lastApp uint64 - state, err := napi.SyncState(ctx) + state, err := fullNode.SyncState(ctx) if err != nil { return err } firstApp = state.VMApplied for { - state, err := napi.SyncState(ctx) + state, err := fullNode.SyncState(ctx) if err != nil { return err } @@ -272,7 +202,7 @@ func SyncWait(ctx context.Context, napi v1.FullNode, watch bool) error { continue } - head, err := napi.ChainHead(ctx) + head, err := fullNode.ChainHead(ctx) if err != nil { return err } @@ -331,7 +261,7 @@ func SyncWait(ctx context.Context, napi v1.FullNode, watch bool) error { _ = target // todo: maybe print? (creates a bunch of line wrapping issues with most tipsets) - if !watch && time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs) { + if !watch && time.Now().Unix()-int64(head.MinTimestamp()) < int64(netParams.BlockDelaySecs) { fmt.Println("\nDone!") return nil } diff --git a/cmd/run.go b/cmd/run.go index 8672e4b..eea0f7f 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -16,11 +16,11 @@ import ( "github.com/urfave/cli/v2" "go.opencensus.io/tag" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/go-jsonrpc/auth" lapi "github.com/filecoin-project/venus-miner/api" - "github.com/filecoin-project/venus-miner/build" lcli "github.com/filecoin-project/venus-miner/cli" "github.com/filecoin-project/venus-miner/lib/metrics" "github.com/filecoin-project/venus-miner/lib/tracing" @@ -29,6 +29,7 @@ import ( "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/repo" + "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/venus-shared/api" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) @@ -41,18 +42,6 @@ var runCmd = &cli.Command{ Name: "miner-api", Usage: "12308", }, - &cli.StringFlag{ - Name: "nettype", - Usage: "network type, one of: mainnet, debug, 2k, calibnet, butterfly", - Value: "mainnet", - DefaultText: "mainnet", - Required: false, - }, - &cli.BoolFlag{ - Name: "enable-gpu-proving", - Usage: "enable use of GPU for mining operations", - Value: true, - }, &cli.BoolFlag{ Name: "nosync", Usage: "don't check full-node sync status", @@ -68,28 +57,6 @@ var runCmd = &cli.Command{ ctx := lcli.ReqContext(cctx) - if err := build.InitNetWorkParams(cctx.String("nettype")); err != nil { - return err - } - - // default enlarge max os threads to 20000 - //maxOSThreads := 20000 - //if fMaxOSThreads := os.Getenv("FORCE_MAX_OS_THREADS"); fMaxOSThreads != "" { - // var err error - // maxOSThreads, err = strconv.Atoi(fMaxOSThreads) - // if err != nil { - // return err - // } - //} - //debug.SetMaxThreads(maxOSThreads) - - if !cctx.Bool("enable-gpu-proving") { - err := os.Setenv("BELLMAN_NO_GPU", "true") - if err != nil { - return err - } - } - minerRepoPath := cctx.String(FlagMinerRepo) r, err := repo.NewFS(minerRepoPath) if err != nil { @@ -104,12 +71,6 @@ var runCmd = &cli.Command{ return fmt.Errorf("repo at '%s' is not initialized, run 'venus-miner init' to set it up", minerRepoPath) } - //log.Info("Checking proof parameters") - // - //if err := fetchingProofParameters(ctx); err != nil { - // return fmt.Errorf("fetching proof parameters: %w", err) - //} - lr, err := r.Lock(repo.Miner) if err != nil { return err @@ -120,13 +81,21 @@ var runCmd = &cli.Command{ } cfg := cfgV.(*config.MinerConfig) - nodeApi, ncloser, err := lcli.GetFullNodeAPIV1(cctx, cfg.FullNode) + nodeApi, ncloser, err := lcli.GetFullNodeAPI(cctx, cfg.FullNode, "v1") lr.Close() //nolint:errcheck if err != nil { return fmt.Errorf("getting full node api: %w", err) } defer ncloser() + netName, err := nodeApi.StateNetworkName(ctx) + if err != nil { + return err + } + if netName == "mainnet" { + constants.SetAddressNetwork(address.Mainnet) + } + v, err := nodeApi.Version(ctx) if err != nil { return err @@ -168,16 +137,6 @@ var runCmd = &cli.Command{ return fmt.Errorf("getting API endpoint: %w", err) } - //// Bootstrap with full node - //remoteAddrs, err := nodeApi.NetAddrsListen(ctx) - //if err != nil { - // return fmt.Errorf("getting full node libp2p address: %w", err) - //} - // - //if err := minerAPI.NetConnect(ctx, remoteAddrs); err != nil { - // return fmt.Errorf("connecting to full node (libp2p): %w", err) - //} - log.Infof("Remote version %s", v) // setup jaeger tracing diff --git a/cmd/stop.go b/cmd/stop.go index 288c199..dd71794 100644 --- a/cmd/stop.go +++ b/cmd/stop.go @@ -13,7 +13,7 @@ var stopCmd = &cli.Command{ Usage: "Stop a running venus miner", Flags: []cli.Flag{}, Action: func(cctx *cli.Context) error { - api, closer, err := lcli.GetAPI(cctx) + api, closer, err := lcli.GetMinerAPI(cctx) if err != nil { return err } diff --git a/go.mod b/go.mod index e927049..d0fd678 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/filecoin-project/go-bitfield v0.2.4 github.com/filecoin-project/go-jsonrpc v0.1.5 github.com/filecoin-project/go-state-types v0.1.8 - github.com/filecoin-project/specs-actors v0.9.15 github.com/filecoin-project/specs-actors/v2 v2.3.6 github.com/filecoin-project/specs-actors/v7 v7.0.1 github.com/filecoin-project/venus v1.6.0-rc1 @@ -32,8 +31,6 @@ require ( github.com/ipfs/go-log/v2 v2.5.1 github.com/ipfs/go-metrics-interface v0.0.1 github.com/kelseyhightower/envconfig v1.4.0 - github.com/libp2p/go-libp2p-core v0.15.1 - github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-base32 v0.0.4 github.com/multiformats/go-multiaddr v0.5.0 @@ -53,8 +50,10 @@ require ( require ( github.com/DataDog/zstd v1.4.1 // indirect - github.com/ahmetb/go-linq/v3 v3.2.0 // indirect + github.com/awnumar/memcall v0.0.0-20191004114545-73db50fd9f80 // indirect + github.com/awnumar/memguard v0.22.2 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 // indirect github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect @@ -63,22 +62,28 @@ require ( github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e // indirect github.com/dgraph-io/ristretto v0.0.4-0.20210122082011-bb5d392ed82d // indirect github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect + github.com/drand/drand v1.3.0 // indirect + github.com/drand/kyber v1.1.7 // indirect + github.com/drand/kyber-bls12381 v0.2.1 // indirect github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f // indirect github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect github.com/filecoin-project/go-amt-ipld/v3 v3.1.0 // indirect github.com/filecoin-project/go-amt-ipld/v4 v4.0.0 // indirect + github.com/filecoin-project/go-cbor-util v0.0.1 // indirect github.com/filecoin-project/go-commp-utils v0.1.3 // indirect github.com/filecoin-project/go-fil-commcid v0.1.0 // indirect github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 // indirect + github.com/filecoin-project/pubsub v1.0.0 // indirect + github.com/filecoin-project/specs-actors v0.9.15 // indirect github.com/filecoin-project/specs-actors/v3 v3.1.2 // indirect github.com/filecoin-project/specs-actors/v4 v4.0.2 // indirect github.com/filecoin-project/specs-actors/v5 v5.0.6 // indirect github.com/filecoin-project/specs-actors/v6 v6.0.2 // indirect github.com/filecoin-project/specs-actors/v8 v8.0.0 // indirect github.com/filecoin-project/specs-storage v0.4.1 // indirect - github.com/fxamacker/cbor/v2 v2.4.0 // indirect + github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect @@ -86,33 +91,66 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.3 // indirect + github.com/google/gopacket v1.1.19 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/go-block-format v0.0.3 // indirect + github.com/ipfs/go-blockservice v0.2.1 // indirect github.com/ipfs/go-ipfs-blockstore v1.1.2 // indirect github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect + github.com/ipfs/go-ipfs-exchange-interface v0.1.0 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipld-cbor v0.0.6 // indirect github.com/ipfs/go-ipld-format v0.2.0 // indirect + github.com/ipfs/go-ipld-legacy v0.1.1 // indirect + github.com/ipfs/go-ipns v0.1.2 // indirect github.com/ipfs/go-log v1.0.5 // indirect + github.com/ipfs/go-merkledag v0.5.1 // indirect + github.com/ipfs/go-verifcid v0.0.1 // indirect + github.com/ipld/go-car v0.3.3 // indirect + github.com/ipld/go-codec-dagpb v1.3.2 // indirect + github.com/ipld/go-ipld-prime v0.16.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.2 // indirect + github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391 // indirect github.com/klauspost/cpuid/v2 v2.0.12 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/libp2p/go-cidranger v1.1.0 // 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.1.0 // indirect + github.com/libp2p/go-libp2p-core v0.15.1 // indirect + github.com/libp2p/go-libp2p-discovery v0.6.0 // indirect + github.com/libp2p/go-libp2p-kad-dht v0.15.0 // indirect + github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect + github.com/libp2p/go-libp2p-peerstore v0.6.0 // indirect + github.com/libp2p/go-libp2p-pubsub v0.6.1 // indirect + github.com/libp2p/go-libp2p-record v0.1.3 // indirect + github.com/libp2p/go-libp2p-swarm v0.10.2 // indirect + github.com/libp2p/go-msgio v0.2.0 // indirect + github.com/libp2p/go-netroute v0.2.0 // indirect github.com/libp2p/go-openssl v0.0.7 // indirect github.com/magefile/mage v1.11.0 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/miekg/dns v1.1.48 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-multicodec v0.4.1 // indirect github.com/multiformats/go-multihash v0.1.0 // indirect github.com/multiformats/go-varint v0.0.6 // indirect + github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect + github.com/pborman/uuid v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect github.com/prometheus/client_model v0.2.0 // indirect @@ -124,10 +162,13 @@ require ( github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect + github.com/warpfork/go-testmark v0.9.0 // indirect github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 // indirect - github.com/x448/float16 v0.8.4 // 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/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect go.uber.org/atomic v1.9.0 // indirect - go.uber.org/dig v1.13.0 // indirect + go.uber.org/dig v1.12.0 // indirect go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go4.org v0.0.0-20200411211856-f5505b9728dd // indirect @@ -137,8 +178,11 @@ require ( golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/api v0.43.0 // indirect + google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect + google.golang.org/grpc v1.45.0 // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect diff --git a/go.sum b/go.sum index ba668d7..8b179fb 100644 --- a/go.sum +++ b/go.sum @@ -74,7 +74,6 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= 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/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE= github.com/ahmetb/go-linq/v3 v3.2.0/go.mod h1:haQ3JfOeWK8HpVxMtHHEMPVgBKiYyQ+f1/kLZh/cj9U= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/akrylysov/pogreb v0.10.1/go.mod h1:pNs6QmpQ1UlTJKDezuRWmaqkgUE2TuU0YTWyqJZ7+lI= @@ -97,7 +96,9 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/awnumar/memcall v0.0.0-20191004114545-73db50fd9f80 h1:8kObYoBO4LNmQ+fLiScBfxEdxF1w2MHlvH/lr9MLaTg= github.com/awnumar/memcall v0.0.0-20191004114545-73db50fd9f80/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGaWsWsoJo= +github.com/awnumar/memguard v0.22.2 h1:tMxcq1WamhG13gigK8Yaj9i/CHNUO3fFlpS9ABBQAxw= github.com/awnumar/memguard v0.22.2/go.mod h1:33OwJBHC+T4eEfFcDrQb78TMlBMBvcOPCXWU9xE34gM= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -121,6 +122,7 @@ github.com/bep/debounce v1.2.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3IS github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 h1:yCfXxYaelOyqnia8F/Yng47qhmfC9nKTRIbYRrRueq4= github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833/go.mod h1:8c4/i2VlovMO2gBnHGQPN5EJw+H0lx1u/5p+cgsXtCk= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/briandowns/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= @@ -156,6 +158,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf 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/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -179,6 +182,7 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH 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/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBdAP4= github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= 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= @@ -190,9 +194,11 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee 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 v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= 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/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -205,6 +211,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= 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/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -212,6 +219,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs 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/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.3.13/go.mod h1:WAmG5dWY8/PYHt4vKxlt90NsbHMAOCiteYKZMiIRfOo= @@ -238,12 +246,15 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/drand/bls12-381 v0.3.2/go.mod h1:dtcLgPtYT38L3NO6mPDYH0nbpc5tjPassDqiniuAt4Y= +github.com/drand/drand v1.3.0 h1:k/w/PtHzmlU6OmfoAqgirWyrJ4FZH8ESlJrsKF20UkM= github.com/drand/drand v1.3.0/go.mod h1:D6kAVlxufq1gi71YCGfzN455JrXF4Q272ZJEG975fzo= github.com/drand/kyber v1.0.1-0.20200110225416-8de27ed8c0e2/go.mod h1:UpXoA0Upd1N9l4TvRPHr1qAUBBERj6JQ/mnKI3BPEmw= github.com/drand/kyber v1.0.2/go.mod h1:x6KOpK7avKj0GJ4emhXFP5n7M7W7ChAPmnQh/OL6vRw= github.com/drand/kyber v1.1.4/go.mod h1:9+IgTq7kadePhZg7eRwSD7+bA+bmvqRK+8DtmoV5a3U= +github.com/drand/kyber v1.1.7 h1:YnOshFoGYSOdhf4K8BiDw4XL/l6caL92vsodAsVQbJI= github.com/drand/kyber v1.1.7/go.mod h1:UkHLsI4W6+jT5PvNxmc0cvQAgppjTUpX+XCsN9TXmRo= github.com/drand/kyber-bls12381 v0.2.0/go.mod h1:zQip/bHdeEB6HFZSU3v+d3cQE0GaBVQw9aR2E7AdoeI= +github.com/drand/kyber-bls12381 v0.2.1 h1:/d5/YAdaCmHpYjF1NZevOEcKGaq6LBbyvkCTIdGqDjs= github.com/drand/kyber-bls12381 v0.2.1/go.mod h1:JwWn4nHO9Mp4F5qCie5sVIPQZ0X6cw8XAeMRvc/GXBE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -291,6 +302,7 @@ github.com/filecoin-project/go-bitfield v0.2.3/go.mod h1:CNl9WG8hgR5mttCnUErjcQj github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW8p9au0C68JPgk= github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= +github.com/filecoin-project/go-cbor-util v0.0.1 h1:E1LYZYTtjfAQwCReho0VXvbu8t3CYAVPiMx8EiV/VAs= github.com/filecoin-project/go-cbor-util v0.0.1/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= github.com/filecoin-project/go-commp-utils v0.1.3 h1:rTxbkNXZU7FLgdkBk8RsQIEOuPONHykEoX3xGk41Fkw= github.com/filecoin-project/go-commp-utils v0.1.3/go.mod h1:3ENlD1pZySaUout0p9ANQrY3fDFoXdqyX04J+dWpK30= @@ -340,6 +352,7 @@ github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4 github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo= github.com/filecoin-project/index-provider v0.5.0/go.mod h1:KHVrP2vU3YuScb+fawObwTFoR882up9U07kk0ZrfP0c= +github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM= github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg= github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= github.com/filecoin-project/specs-actors v0.9.15-0.20220514164640-94e0d5e123bd/go.mod h1:pjGEe3QlWtK20ju/aFRsiArbMX6Cn8rqEhhsiCM9xYE= @@ -376,20 +389,22 @@ github.com/filecoin-project/venus v1.6.0-rc1/go.mod h1:c3Y75K2YbMQFuE7Jfh7QfmHe6 github.com/filecoin-project/venus-auth v1.6.0-pre-rc1/go.mod h1:x/Cv3zz9z5O+/uqIKgYtk5UsL7nYu+CtiPjyVQ8Lywg= 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/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +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/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= 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.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= +github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/gammazero/keymutex v0.0.2/go.mod h1:qtzWCCLMisQUmVa4dvqHVgwfh4BP2YB7JxNDGXnsKrs= @@ -413,6 +428,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= @@ -442,14 +458,18 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +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-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 h1:s+PDl6lozQ+dEUtUtQnO7+A2iPG3sK1pI4liU+jxn90= github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= 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/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.0 h1:zgVt4UpGxcqVOw97aRGxT4svlcmdK35fynLNctY32zI= github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= 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= @@ -459,6 +479,7 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.0.3/go.mod h1:SavQ51ycCLnc7dGyJxp8YAmudx8xqiVrRf+6IXRsugc= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= @@ -529,6 +550,7 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u 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.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= @@ -577,11 +599,14 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg 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/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= +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 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= 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.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= @@ -596,6 +621,7 @@ github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +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-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -607,6 +633,7 @@ github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh 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/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +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-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= @@ -636,6 +663,7 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= +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= @@ -657,6 +685,7 @@ github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSA github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs= github.com/ipfs/go-bitswap v0.1.8/go.mod h1:TOWoxllhccevbWFUR2N7B1MTSVVge1s6XSMiCSA4MzM= github.com/ipfs/go-bitswap v0.3.4/go.mod h1:4T7fvNv/LmOys+21tnLzGKncMeeXUYUd1nUiJ2teMvI= +github.com/ipfs/go-bitswap v0.5.1 h1:721YAEDBnLIrvcIMkCHCdqp34hA8jwL9yKMkyJpSpco= github.com/ipfs/go-bitswap v0.5.1/go.mod h1:P+ckC87ri1xFLvk74NlXdP0Kj9RmWAh4+H78sC6Qopo= github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= @@ -666,6 +695,7 @@ github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbR github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= github.com/ipfs/go-blockservice v0.1.4/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU= github.com/ipfs/go-blockservice v0.1.7/go.mod h1:GmS+BAt4hrwBKkzE11AFDQUrnvqjwFatGS2MY7wOjEM= +github.com/ipfs/go-blockservice v0.2.1 h1:NJ4j/cwEfIg60rzAWcCIxRtOwbf6ZPK49MewNxObCPQ= github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8= 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= @@ -733,6 +763,7 @@ github.com/ipfs/go-ipfs-blockstore v1.0.4/go.mod h1:uL7/gTJ8QIZ3MtA3dWf+s1a0U3fJ github.com/ipfs/go-ipfs-blockstore v1.1.1/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY= github.com/ipfs/go-ipfs-blockstore v1.1.2 h1:WCXoZcMYnvOTmlpX+RSSnhVN0uCmbWTeepTGX5lgiXw= github.com/ipfs/go-ipfs-blockstore v1.1.2/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY= +github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8= @@ -741,6 +772,7 @@ github.com/ipfs/go-ipfs-cmds v0.6.0/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTH github.com/ipfs/go-ipfs-cmds v0.6.1-0.20220212012746-40b8fddb899f/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0= github.com/ipfs/go-ipfs-config v0.18.0/go.mod h1:wz2lKzOjgJeYJa6zx8W9VT7mz+iSd0laBMqS/9wmX6A= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= +github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= github.com/ipfs/go-ipfs-ds-help v0.1.1/go.mod h1:SbBafGJuGsPI/QL3j9Fc5YPLeAu+SzOkI0gFwAg+mOs= @@ -748,8 +780,10 @@ github.com/ipfs/go-ipfs-ds-help v1.0.0/go.mod h1:ujAbkeIgkKAWtxxNkoZHWLCyk5JpPoK github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR994w4Q= github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU= github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= +github.com/ipfs/go-ipfs-exchange-interface v0.1.0 h1:TiMekCrOGQuWYtZO3mf4YJXDIdNgnKWZ9IE3fGlnWfo= github.com/ipfs/go-ipfs-exchange-interface v0.1.0/go.mod h1:ych7WPlyHqFvCi/uQI48zLZuAWVP5iTQPXEfVaw5WEI= github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= +github.com/ipfs/go-ipfs-exchange-offline v0.1.1 h1:mEiXWdbMN6C7vtDG21Fphx8TGCbZPpQnz/496w/PL4g= github.com/ipfs/go-ipfs-exchange-offline v0.1.1/go.mod h1:vTiBRIbzSwDD0OWm+i3xeT0mO7jG2cbJYatp3HPk5XY= github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= @@ -759,10 +793,12 @@ github.com/ipfs/go-ipfs-keystore v0.0.2/go.mod h1:H49tRmibOEs7gLMgbOsjC4dqh1u5e0 github.com/ipfs/go-ipfs-pinner v0.2.1/go.mod h1:l1AtLL5bovb7opnG77sh4Y10waINz3Y1ni6CvTzx7oo= github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= +github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY= github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= github.com/ipfs/go-ipfs-provider v0.7.1/go.mod h1:QwdDYRYnC5sYGLlOwVDY/0ZB6T3zcMtu+5+GdGeUuw8= github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= +github.com/ipfs/go-ipfs-routing v0.2.1 h1:E+whHWhJkdN9YeoHZNj5itzc+OR292AJ2uE9FFiW0BY= github.com/ipfs/go-ipfs-routing v0.2.1/go.mod h1:xiNNiwgjmLqPS1cimvAw6EyB9rkVDbiocA4yY+wRNLM= 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= @@ -780,7 +816,9 @@ github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL3 github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs= github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYDpKUkJubI= github.com/ipfs/go-ipld-legacy v0.1.0/go.mod h1:86f5P/srAmh9GcIcWQR9lfFLZPrIyyXQeVlOWeeWEuI= +github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2cdcc= github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg= +github.com/ipfs/go-ipns v0.1.2 h1:O/s/0ht+4Jl9+VoxoUo0zaHjnZUS+aBQIKTuzdZ/ucI= github.com/ipfs/go-ipns v0.1.2/go.mod h1:ioQ0j02o6jdIVW+bmi18f4k2gRf0AV3kZ9KeHYHICnQ= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= @@ -808,6 +846,7 @@ github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-merkledag v0.4.0/go.mod h1:XshXBkhyeS63YNGisLL1uDSfuTyrQIxVUOg3ojR5MOE= +github.com/ipfs/go-merkledag v0.5.1 h1:tr17GPP5XtPhvPPiWtu20tSGZiZDuTaJRXBLcr79Umk= github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= @@ -823,6 +862,7 @@ github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3 github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= github.com/ipfs/go-peertaskqueue v0.2.0/go.mod h1:5/eNrBEbtSKWCG+kQK8K8fGNixoYUnr+P7jivavs9lY= github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= +github.com/ipfs/go-peertaskqueue v0.7.1 h1:7PLjon3RZwRQMgOTvYccZ+mjzkmds/7YzSWKFlBAypE= github.com/ipfs/go-peertaskqueue v0.7.1/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= github.com/ipfs/go-pinning-service-http-client v0.1.0/go.mod h1:tcCKmlkWWH9JUUkKs8CrOZBanacNc1dmKLfjlyXAMu4= github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k= @@ -833,6 +873,7 @@ github.com/ipfs/go-unixfsnode v1.1.2/go.mod h1:5dcE2x03pyjHk4JjamXmunTMzz+VUtqvP github.com/ipfs/go-unixfsnode v1.1.3/go.mod h1:ZZxUM5wXBC+G0Co9FjrYTOm+UlhZTjxLfRYdWY9veZ4= github.com/ipfs/go-unixfsnode v1.2.0/go.mod h1:mQEgLjxkV/1mohkC4p7taRRBYPBeXu97SA3YaerT2q0= github.com/ipfs/go-unixfsnode v1.4.0/go.mod h1:qc7YFFZ8tABc58p62HnIYbUMwj9chhUuFWmxSokfePo= +github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= github.com/ipfs/interface-go-ipfs-core v0.4.0/go.mod h1:UJBcU6iNennuI05amq3FQ7g0JHUkibHFAfhfUIy927o= github.com/ipfs/interface-go-ipfs-core v0.5.2/go.mod h1:lNBJrdXHtWS46evMPBdWtDQMDsrKcGbxCOGoKLkztOE= @@ -840,11 +881,13 @@ github.com/ipfs/tar-utils v0.0.2/go.mod h1:4qlnRWgTVljIMhSG2SqRYn66NT+3wrv/kZt9V github.com/ipld/go-car v0.1.0/go.mod h1:RCWzaUh2i4mOEkB3W45Vc+9jnS/M6Qay5ooytiBHl3g= github.com/ipld/go-car v0.3.2/go.mod h1:WEjynkVt04dr0GwJhry0KlaTeSDEiEYyMPOxDBQ17KE= github.com/ipld/go-car v0.3.3-0.20211210032800-e6f244225a16/go.mod h1:/wkKF4908ULT4dFIFIUZYcfjAnj+KFnJvlh8Hsz1FbQ= +github.com/ipld/go-car v0.3.3 h1:D6y+jvg9h2ZSv7GLUMWUwg5VTLy1E7Ak+uQw5orOg3I= github.com/ipld/go-car v0.3.3/go.mod h1:/wkKF4908ULT4dFIFIUZYcfjAnj+KFnJvlh8Hsz1FbQ= github.com/ipld/go-car/v2 v2.1.1/go.mod h1:+2Yvf0Z3wzkv7NeI69i8tuZ+ft7jyjPYIWZzeVNeFcI= github.com/ipld/go-codec-dagpb v1.2.0/go.mod h1:6nBN7X7h8EOsEejZGqC7tej5drsdBAXbMHyBT+Fne5s= github.com/ipld/go-codec-dagpb v1.3.0/go.mod h1:ga4JTU3abYApDC3pZ00BC2RSvC3qfBb9MSJkMLSwnhA= github.com/ipld/go-codec-dagpb v1.3.1/go.mod h1:ErNNglIi5KMur/MfFE/svtgQthzVvf+43MrzLbpcIZY= +github.com/ipld/go-codec-dagpb v1.3.2 h1:MZQUIjanHXXfDuYmtWYT8nFbqfFsZuyHClj6VDmSXr4= github.com/ipld/go-codec-dagpb v1.3.2/go.mod h1:ga4JTU3abYApDC3pZ00BC2RSvC3qfBb9MSJkMLSwnhA= github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= @@ -856,6 +899,7 @@ github.com/ipld/go-ipld-prime v0.14.1/go.mod h1:QcE4Y9n/ZZr8Ijg5bGPT0GqYWgZ1704n github.com/ipld/go-ipld-prime v0.14.2/go.mod h1:QcE4Y9n/ZZr8Ijg5bGPT0GqYWgZ1704nH0RDcQtgTP0= github.com/ipld/go-ipld-prime v0.14.3-0.20211207234443-319145880958/go.mod h1:QcE4Y9n/ZZr8Ijg5bGPT0GqYWgZ1704nH0RDcQtgTP0= github.com/ipld/go-ipld-prime v0.14.4/go.mod h1:QcE4Y9n/ZZr8Ijg5bGPT0GqYWgZ1704nH0RDcQtgTP0= +github.com/ipld/go-ipld-prime v0.16.0 h1:RS5hhjB/mcpeEPJvfyj0qbOj/QL+/j05heZ0qa97dVo= github.com/ipld/go-ipld-prime v0.16.0/go.mod h1:axSCuOCBPqrH+gvXr2w9uAOulJqBPhHPT2PjoiiU1qA= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd73/go.mod h1:2PJ0JgxyB08t0b2WKrcuqI3di0V+5n6RS/LTUJhkoxY= @@ -864,11 +908,13 @@ github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6 github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4= 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/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/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c/go.mod h1:sdx1xVM9UuLw1tXnhJWN3piypTUO3vCIHYmG15KE/dU= 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= @@ -887,6 +933,7 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.1.1-0.20190114141812-62fb9bc030d1/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= 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= @@ -914,6 +961,7 @@ github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dv github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s= github.com/kilic/bls12-381 v0.0.0-20200731194930-64c428e1bff5/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s= +github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391 h1:51kHw7l/dUDdOdW06AlUGT5jnpj6nqQSILebcsikSjA= github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -923,6 +971,7 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= @@ -933,6 +982,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv 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-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= +github.com/koron/go-ssdp v0.0.2 h1:fL3wAoyT6hXHQlORyXUW4Q23kkQpJRgEAYcZB5BR71o= github.com/koron/go-ssdp v0.0.2/go.mod h1:XoLfkAiA2KeZsYh4DbHxD7h3nR2AZNqVQOa+LJuqPYs= 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= @@ -955,15 +1005,18 @@ github.com/libp2p/go-addr-util v0.1.0/go.mod h1:6I3ZYuFr2O/9D+SoyM0zEw0EF3YkldtT 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-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 v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE= 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/go.mod h1:cR1d8gA0Hr59Fj6NhaTpFhJZrjSYuNmhpT2r25zYR70= +github.com/libp2p/go-conn-security-multistream v0.3.0 h1:9UCIKlBL1hC9u7nkMXpD1nkc/T53PKMAn3/k9ivBAVc= github.com/libp2p/go-conn-security-multistream v0.3.0/go.mod h1:EEP47t4fw/bTelVmEzIDqSe69hO/ip52xBEhZMLWAHM= github.com/libp2p/go-doh-resolver v0.3.1/go.mod h1:y5go1ZppAq9N2eppbX0xON01CyPBeUg2yS6BTssssog= 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= @@ -985,8 +1038,10 @@ github.com/libp2p/go-libp2p v0.16.0/go.mod h1:ump42BsirwAWxKzsCiFnTtN1Yc+DuPu76f github.com/libp2p/go-libp2p v0.17.0/go.mod h1:Fkin50rsGdv5mm5BshBUtPRZknt9esfmYXBOYcwOTgw= github.com/libp2p/go-libp2p v0.18.0-rc1/go.mod h1:RgYlH7IIWHXREimC92bw5Lg1V2R5XmSzuLHb5fTnr+8= github.com/libp2p/go-libp2p v0.18.0-rc3/go.mod h1:WYL+Xw1iuwi6rdfzw5VIEpD+HqzYucHZ6fcUuumbI3M= +github.com/libp2p/go-libp2p v0.19.4 h1:50YL0YwPhWKDd+qbZQDEdnsmVAAkaCQrWUjpdHv4hNA= github.com/libp2p/go-libp2p v0.19.4/go.mod h1:MIt8y481VDhUe4ErWi1a4bvt/CjjFfOq6kZTothWIXY= 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-asn-util v0.1.0 h1:rABPCO77SjdbJ/eJ/ynIo8vWICy1VEnL5JAxJbQLo1E= github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I= github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= @@ -1002,6 +1057,7 @@ github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv 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/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= +github.com/libp2p/go-libp2p-blankhost v0.3.0 h1:kTnLArltMabZlzY63pgGDA4kkUcLkBFSM98zBssn/IY= github.com/libp2p/go-libp2p-blankhost v0.3.0/go.mod h1:urPC+7U01nCGgJ3ZsV8jdwTp6Ji9ID0dMTvq+aJ+nZU= github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= @@ -1011,6 +1067,7 @@ github.com/libp2p/go-libp2p-circuit v0.4.0/go.mod h1:t/ktoFIUzM6uLQ+o1G6NuBl2ANh github.com/libp2p/go-libp2p-circuit v0.6.0/go.mod h1:kB8hY+zCpMeScyvFrKrGicRdid6vNXbunKE4rXATZ0M= github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0= github.com/libp2p/go-libp2p-connmgr v0.3.0/go.mod h1:RVoyPjJm0J9Vd1m6qUN2Tn7kJm4rL1Ml20pFsFgPGik= +github.com/libp2p/go-libp2p-connmgr v0.3.1 h1:alEy2fpGKFu+7ZhQF4GF0dvKLyVHeLtIfS/KziwoiZw= github.com/libp2p/go-libp2p-connmgr v0.3.1/go.mod h1:RVoyPjJm0J9Vd1m6qUN2Tn7kJm4rL1Ml20pFsFgPGik= github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= @@ -1054,6 +1111,7 @@ github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFT 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.6.0 h1:1XdPmhMJr8Tmj/yUfkJMIi8mgwWrLUsCB3bMxdT+DSo= github.com/libp2p/go-libp2p-discovery v0.6.0/go.mod h1:/u1voHt0tKIe5oIA1RHBKQLVCWPna2dXmPNHc2zR9S8= github.com/libp2p/go-libp2p-gostream v0.3.0/go.mod h1:pLBQu8db7vBMNINGsAwLL/ZCE8wng5V1FThoaE5rNjc= github.com/libp2p/go-libp2p-gostream v0.3.1/go.mod h1:1V3b+u4Zhaq407UUY9JLCpboaeufAeVQbnvAt12LRsI= @@ -1064,10 +1122,13 @@ github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= github.com/libp2p/go-libp2p-interface-connmgr v0.0.5/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k= +github.com/libp2p/go-libp2p-kad-dht v0.15.0 h1:Ke+Oj78gX5UDXnA6HBdrgvi+fStJxgYTDa51U0TsCLo= github.com/libp2p/go-libp2p-kad-dht v0.15.0/go.mod h1:rZtPxYu1TnHHz6n1RggdGrxUX/tA1C2/Wiw3ZMUDrU0= github.com/libp2p/go-libp2p-kbucket v0.3.1/go.mod h1:oyjT5O7tS9CQurok++ERgc46YLwEpuGoFq9ubvoUOio= +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.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg= +github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= github.com/libp2p/go-libp2p-mplex v0.1.1/go.mod h1:KUQWpGkCzfV7UIpi8SKsAVxyBgz1c9R5EvxgnwLsb/I= @@ -1083,14 +1144,17 @@ github.com/libp2p/go-libp2p-mplex v0.6.0/go.mod h1:i3usuPrBbh9FD2fLZjGpotyNkwr42 github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE= github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw= +github.com/libp2p/go-libp2p-nat v0.1.0 h1:vigUi2MEN+fwghe5ijpScxtbbDz+L/6y8XwlzYOJgSY= github.com/libp2p/go-libp2p-nat v0.1.0/go.mod h1:DQzAG+QbDYjN1/C3B6vXucLtz3u9rEonLVPtZVzQqks= github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q= +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/go.mod h1:IEbYhBBzGyvdLBoxxULL/SGbJARhUeqlO8lVSREYu2Q= github.com/libp2p/go-libp2p-noise v0.3.0/go.mod h1:JNjHbociDJKHD64KTkzGnzqJ0FEV5gHJa6AB00kbCNQ= +github.com/libp2p/go-libp2p-noise v0.4.0 h1:khcMsGhHNdGqKE5LDLrnHwZvdGVMsrnD4GTkTWkwmLU= github.com/libp2p/go-libp2p-noise v0.4.0/go.mod h1:BzzY5pyzCYSyJbQy9oD8z5oP2idsafjt4/X42h9DjZU= github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= @@ -1107,11 +1171,14 @@ github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuD github.com/libp2p/go-libp2p-peerstore v0.2.7/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.2.8/go.mod h1:gGiPlXdz7mIHd2vfAsHzBNAMqSDkt2UBFwgcITgw1lA= github.com/libp2p/go-libp2p-peerstore v0.4.0/go.mod h1:rDJUFyzEWPpXpEwywkcTYYzDHlwza8riYMaUzaN6hX0= +github.com/libp2p/go-libp2p-peerstore v0.6.0 h1:HJminhQSGISBIRb93N6WK3t6Fa8OOTnHd/VBjL4mY5A= github.com/libp2p/go-libp2p-peerstore v0.6.0/go.mod h1:DGEmKdXrcYpK9Jha3sS7MhqYdInxJy84bIPtSu65bKc= +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-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= github.com/libp2p/go-libp2p-pubsub v0.6.0/go.mod h1:nJv87QM2cU0w45KPR1rZicq+FmFIOD16zmT+ep1nOmg= +github.com/libp2p/go-libp2p-pubsub v0.6.1 h1:wycbV+f4rreCoVY61Do6g/BUk0RIrbNRcYVbn+QkjGk= github.com/libp2p/go-libp2p-pubsub v0.6.1/go.mod h1:nJv87QM2cU0w45KPR1rZicq+FmFIOD16zmT+ep1nOmg= github.com/libp2p/go-libp2p-pubsub-router v0.5.0/go.mod h1:TRJKskSem3C0aSb3CmRgPwq6IleVFzds6hS09fmZbGM= github.com/libp2p/go-libp2p-quic-transport v0.10.0/go.mod h1:RfJbZ8IqXIhxBRm5hqUEJqjiiY8xmEuq3HUDS993MkA= @@ -1120,14 +1187,17 @@ github.com/libp2p/go-libp2p-quic-transport v0.13.0/go.mod h1:39/ZWJ1TW/jx1iFkKzz github.com/libp2p/go-libp2p-quic-transport v0.15.0/go.mod h1:wv4uGwjcqe8Mhjj7N/Ic0aKjA+/10UnMlSzLO0yRpYQ= github.com/libp2p/go-libp2p-quic-transport v0.15.2/go.mod h1:wv4uGwjcqe8Mhjj7N/Ic0aKjA+/10UnMlSzLO0yRpYQ= github.com/libp2p/go-libp2p-quic-transport v0.16.0/go.mod h1:1BXjVMzr+w7EkPfiHkKnwsWjPjtfaNT0q8RS3tGDvEQ= +github.com/libp2p/go-libp2p-quic-transport v0.17.0 h1:yFh4Gf5MlToAYLuw/dRvuzYd1EnE2pX3Lq1N6KDiWRQ= github.com/libp2p/go-libp2p-quic-transport v0.17.0/go.mod h1:x4pw61P3/GRCcSLypcQJE/Q2+E9f4X+5aRcZLXf20LM= github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= github.com/libp2p/go-libp2p-record v0.1.1/go.mod h1:VRgKajOyMVgP/F0L5g3kH7SVskp17vFi2xheb5uMJtg= 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-resource-manager v0.1.0/go.mod h1:wJPNjeE4XQlxeidwqVY5G6DLOKqFK33u2n8blpl0I6Y= github.com/libp2p/go-libp2p-resource-manager v0.1.3/go.mod h1:wJPNjeE4XQlxeidwqVY5G6DLOKqFK33u2n8blpl0I6Y= +github.com/libp2p/go-libp2p-resource-manager v0.2.1 h1:/0yqQQ4oT+3fEhUGGP2PhuIhdv10+pu5jLhvFNfUx/w= github.com/libp2p/go-libp2p-resource-manager v0.2.1/go.mod h1:K+eCkiapf+ey/LADO4TaMpMTP9/Qde/uLlrnRqV4PLQ= github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= github.com/libp2p/go-libp2p-routing-helpers v0.2.3/go.mod h1:795bh+9YeoFl99rMASoiVgHdi5bjack0N1+AFAdbvBw= @@ -1150,6 +1220,7 @@ github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL github.com/libp2p/go-libp2p-swarm v0.9.0/go.mod h1:2f8d8uxTJmpeqHF/1ujjdXZp+98nNIbujVOMEZxCbZ8= github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= github.com/libp2p/go-libp2p-swarm v0.10.1/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= +github.com/libp2p/go-libp2p-swarm v0.10.2 h1:UaXf+CTq6Ns1N2V1EgqJ9Q3xaRsiN7ImVlDMpirMAWw= github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -1166,10 +1237,12 @@ github.com/libp2p/go-libp2p-testing v0.6.0/go.mod h1:QBk8fqIL1XNcno/l3/hhaIEn4aL github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2Cl+FAjoWIA2pa0X6E= github.com/libp2p/go-libp2p-testing v0.8.0/go.mod h1:gRdsNxQSxAZowTgcLY7CC33xPmleZzoBpqSYbWenqPc= github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= +github.com/libp2p/go-libp2p-testing v0.9.2 h1:dCpODRtRaDZKF8HXT9qqqgON+OMEB423Knrgeod8j84= github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40sKitV4c50uI1M= github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.3.1/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= +github.com/libp2p/go-libp2p-tls v0.4.1 h1:1ByJUbyoMXvYXDoW6lLsMxqMViQNXmt+CfQqlnCpY+M= github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= @@ -1184,6 +1257,7 @@ github.com/libp2p/go-libp2p-transport-upgrader v0.4.6/go.mod h1:JE0WQuQdy+uLZ5zO github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= github.com/libp2p/go-libp2p-transport-upgrader v0.6.0/go.mod h1:1e07y1ZSZdHo9HPbuU8IztM1Cj+DR5twgycb4pnRzRo= github.com/libp2p/go-libp2p-transport-upgrader v0.7.0/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= +github.com/libp2p/go-libp2p-transport-upgrader v0.7.1 h1:MSMe+tUfxpC9GArTz7a4G5zQKQgGh00Vio87d3j3xIg= github.com/libp2p/go-libp2p-transport-upgrader v0.7.1/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= github.com/libp2p/go-libp2p-xor v0.0.0-20210714161855-5c005aca55db/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY= github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8= @@ -1203,6 +1277,7 @@ github.com/libp2p/go-libp2p-yamux v0.6.0/go.mod h1:MRhd6mAYnFRnSISp4M8i0ClV/j+mW github.com/libp2p/go-libp2p-yamux v0.7.0/go.mod h1:fMyA0CsPfHkIuBU0wjRGrCjTBFiXTXxG0k5M4ETv+08= github.com/libp2p/go-libp2p-yamux v0.8.0/go.mod h1:yTkPgN2ib8FHyU1ZcVD7aelzyAqXXwEPbyx+aSKm9h8= github.com/libp2p/go-libp2p-yamux v0.8.1/go.mod h1:rUozF8Jah2dL9LLGyBaBeTQeARdwhefMCTQVQt6QobE= +github.com/libp2p/go-libp2p-yamux v0.9.1 h1:oplewiRix8s45SOrI30rCPZG5mM087YZp+VYhXAh4+c= github.com/libp2p/go-libp2p-yamux v0.9.1/go.mod h1:wRc6wvyxQINFcKe7daL4BeQ02Iyp+wxyC8WCNfngBrA= github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= @@ -1222,15 +1297,18 @@ github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+ github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= github.com/libp2p/go-msgio v0.1.0/go.mod h1:eNlv2vy9V2X/kNldcZ+SShFE++o2Yjxwx6RAYsmgJnE= +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.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU= +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/go.mod h1:AqhkMh0VuWmfgtxKPp3Oc1LdU5QSWS7wl0QLhSZqXxQ= +github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= 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= @@ -1240,11 +1318,13 @@ github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGN 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/go.mod h1:SPD+5RwGC7rcnzngoYC86GjPzjSywuQyMVAheVBD9nQ= +github.com/libp2p/go-reuseport v0.1.0 h1:0ooKOx2iwyIkf339WCZ2HN3ujTDbkK0PjC7JVoP1AiM= github.com/libp2p/go-reuseport v0.1.0/go.mod h1:bQVn9hmfcTaoo0c9v5pBhOarsU1eNOBZdaAd2hzXRKU= 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/go.mod h1:TC62hhPc8qs5c/RoXDZG6YmjK+/YWUPC0yYmeUecbjc= +github.com/libp2p/go-reuseport-transport v0.1.0 h1:C3PHeHjmnz8m6f0uydObj02tMEoi7CyD1zuN7xQT8gc= github.com/libp2p/go-reuseport-transport v0.1.0/go.mod h1:vev0C0uMkzriDY59yFHD9v+ujJvYmDQVLowvAjEOmfw= 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= @@ -1255,6 +1335,7 @@ github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqX github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw= 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/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= +github.com/libp2p/go-stream-muxer-multistream v0.4.0 h1:HsM/9OdtqnIzjVXcxTXjmqKrj3gJ8kacaOJwJS1ipaY= github.com/libp2p/go-stream-muxer-multistream v0.4.0/go.mod h1:nb+dGViZleRP4XcyHuZSVrJCBl55nRBOMmiSL/dyziw= github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o= github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= @@ -1266,6 +1347,7 @@ github.com/libp2p/go-tcp-transport v0.2.4/go.mod h1:9dvr03yqrPyYGIEN6Dy5UvdJZjyP github.com/libp2p/go-tcp-transport v0.2.7/go.mod h1:lue9p1b3VmZj1MhhEGB/etmvF/nBQ0X9CW2DutBT3MM= github.com/libp2p/go-tcp-transport v0.4.0/go.mod h1:0y52Rwrn4076xdJYu/51/qJIdxz+EWDAOG2S45sV3VI= github.com/libp2p/go-tcp-transport v0.5.0/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= +github.com/libp2p/go-tcp-transport v0.5.1 h1:edOOs688VLZAozWC7Kj5/6HHXKNwi9M6wgRmmLa8M6Q= github.com/libp2p/go-tcp-transport v0.5.1/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc= @@ -1276,6 +1358,7 @@ github.com/libp2p/go-ws-transport v0.3.0/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1f github.com/libp2p/go-ws-transport v0.3.1/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= github.com/libp2p/go-ws-transport v0.4.0/go.mod h1:EcIEKqf/7GDjth6ksuS/6p7R49V4CBY6/E7R/iyhYUA= github.com/libp2p/go-ws-transport v0.5.0/go.mod h1:I2juo1dNTbl8BKSBYo98XY85kU2xds1iamArLvl8kNg= +github.com/libp2p/go-ws-transport v0.6.0 h1:326XBL6Q+5CQ2KtjXz32+eGu02W/Kz2+Fm4SpXdr0q4= github.com/libp2p/go-ws-transport v0.6.0/go.mod h1:dXqtI9e2JV9FtF1NOtWVZSKXh5zXvnuwPXfj8GPBbYU= github.com/libp2p/go-yamux v1.2.1/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= @@ -1285,6 +1368,7 @@ github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZ 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 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI= github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= github.com/libp2p/go-yamux/v2 v2.0.0/go.mod h1:NVWira5+sVUIU6tu1JWvaRn1dRnG+cawOJiflsAM+7U= github.com/libp2p/go-yamux/v2 v2.1.1/go.mod h1:3So6P6TV6r75R9jiBpiIKgU/66lOarCZjqROGxzPpPQ= @@ -1293,6 +1377,7 @@ github.com/libp2p/go-yamux/v2 v2.3.0/go.mod h1:iTU+lOIn/2h0AgKcL49clNTwfEw+WSfDY github.com/libp2p/go-yamux/v3 v3.0.1/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= github.com/libp2p/go-yamux/v3 v3.0.2/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= github.com/libp2p/go-yamux/v3 v3.1.1/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= +github.com/libp2p/go-yamux/v3 v3.1.2 h1:lNEy28MBk1HavUAlzKgShp+F6mn/ea1nDYWftZhFW9Q= github.com/libp2p/go-yamux/v3 v3.1.2/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= @@ -1303,6 +1388,7 @@ github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2 github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= +github.com/lucas-clemente/quic-go v0.27.1 h1:sOw+4kFSVrdWOYmUjufQ9GBVPqZ+tu+jMtXxXNmRJyk= github.com/lucas-clemente/quic-go v0.27.1/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= @@ -1320,12 +1406,16 @@ github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1j 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/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= github.com/marten-seemann/qtls-go1-17 v0.1.0-rc.1/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= +github.com/marten-seemann/qtls-go1-17 v0.1.1 h1:DQjHPq+aOzUeh9/lixAGunn6rIOQyWChPSI4+hgW7jc= github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= +github.com/marten-seemann/qtls-go1-18 v0.1.1 h1:qp7p7XXUFL7fpBvSS1sWD+uSqPvzNQK43DH+/qEkj0Y= github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= +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/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -1370,9 +1460,12 @@ github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7 github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= +github.com/miekg/dns v1.1.48 h1:Ucfr7IIVyMBz4lRE8qmGUuZ4Wt3/ZGu9hmcMT3Uu4tQ= github.com/miekg/dns v1.1.48/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= 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= @@ -1432,8 +1525,10 @@ github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/94 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-dns v0.3.0/go.mod h1:mNzQ4eTGDg0ll1N9jKPOUogZPoJ30W8a7zk66FQPpdQ= +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= @@ -1471,6 +1566,7 @@ github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9 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/go.mod h1:UIcnm7Zuo8HKG+HkWgfQsGL+/MIEhyTqbODbIUwSXKs= +github.com/multiformats/go-multistream v0.3.0 h1:yX1v4IWseLPmr0rmnDo148wWJbNx40JxBZGmQb5fUP4= github.com/multiformats/go-multistream v0.3.0/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= @@ -1495,6 +1591,7 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c h1:5bFTChQxSKNwy8ALwOebjekYExl9HTT9urdawqC95tA= github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c/go.mod h1:7qN3Y0BvzRUf4LofcoJplQL10lsFDb4PYlePTVwrP28= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= @@ -1526,11 +1623,14 @@ github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 h1:3snG66yBm59tKhhSPQrQ/0bCrv1LQbKt40LnUPiUxdc= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc= +github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df h1:vdYtBU6zvL7v+Tr+0xFM/qhahw/EvY8DMMunZHKH6eE= github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w= +github.com/opentracing-contrib/go-stdlib v1.0.0 h1:TBS7YuVotp8myLon4Pv7BtCBzOTo1DeZCld0Z63mW2w= github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -1546,8 +1646,11 @@ github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa 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/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +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 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/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -1632,6 +1735,7 @@ github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3M github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/raulk/clock v1.1.0 h1:dpb29+UKMbLqiU/jqIJptgLR1nn23HLgMY0sTCDza5Y= github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= +github.com/raulk/go-watchdog v1.2.0 h1:konN75pw2BMmZ+AfuAm5rtFsWcJpKF3m02rKituuXNo= github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -1653,6 +1757,7 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb 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/sercand/kuberesolver v2.1.0+incompatible/go.mod h1:lWF3GL0xptCB/vCiJPl/ZshwPsX/n4Y7u0CW9E7aQIQ= +github.com/sercand/kuberesolver v2.4.0+incompatible h1:WE2OlRf6wjLxHwNkkFLQGaZcVLEXjMjBPjjEU5vksH8= github.com/sercand/kuberesolver v2.4.0+incompatible/go.mod h1:lWF3GL0xptCB/vCiJPl/ZshwPsX/n4Y7u0CW9E7aQIQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= @@ -1684,6 +1789,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 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/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -1753,6 +1859,7 @@ github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMW github.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24szfsn/3LvK9QHCq9oQw8+U= github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v1.5.1-0.20181102163054-1fc5c315e03c/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw= github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -1772,12 +1879,15 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE= github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= +github.com/warpfork/go-testmark v0.9.0 h1:nc+uaCiv5lFQLYjhuC2LTYeJ7JaC+gdDmsz9r0ISy0Y= github.com/warpfork/go-testmark v0.9.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= 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/weaveworks/common v0.0.0-20200512154658-384f10054ec5 h1:EYxr08r8x6r/5fLEAMMkida1BVgxVXE4LfZv/XV+znU= github.com/weaveworks/common v0.0.0-20200512154658-384f10054ec5/go.mod h1:c98fKi5B9u8OsKGiWHLRKus6ToQ1Tubeow44ECO1uxY= +github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M= github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA= github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc/go.mod h1:r45hJU7yEoA81k6MWNhpMj/kms0n14dkzkxYHoB96UM= github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11/go.mod h1:Wlo/SzPmxVp6vXpGt/zaXhHH0fn4IxgqZc82aKg6bpQ= @@ -1800,6 +1910,7 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20220302191723-37c43cae8e14/go.mod h1:f github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 h1:DOOT2B85S0tHoLGTzV+FakaSSihgRCVwZkjqKQP5L/w= github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= +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= @@ -1808,10 +1919,11 @@ github.com/whyrusleeping/go-sysinfo v0.0.0-20190219211824-4a357d4b90b1/go.mod h1 github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= 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/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= -github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xorcare/golden v0.6.0 h1:E8emU8bhyMIEpYmgekkTUaw4vtcrRE+Wa0c5wYIcgXc= @@ -1824,15 +1936,18 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de 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/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs= go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw= go.dedis.ch/kyber/v3 v3.0.4/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ= go.dedis.ch/kyber/v3 v3.0.9/go.mod h1:rhNjUUg6ahf8HEg5HUvVBYoWY4boAafX8tYxX+PS+qg= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= +go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= 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/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -1872,9 +1987,8 @@ 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/dig v1.12.0 h1:l1GQeZpEbss0/M4l/ZotuBndCrkMdjnygzgcuOjAdaY= go.uber.org/dig v1.12.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw= -go.uber.org/dig v1.13.0 h1:bb9lVW3gtpQsNb07d0xL5vFwsjHidPJxaR/zSsbmfVQ= -go.uber.org/dig v1.13.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw= go.uber.org/fx v1.15.0 h1:kcfBpAm98n0ksanyyZLFE/Q3T7yPi13Ge2liu3TxR+A= go.uber.org/fx v1.15.0/go.mod h1:jI3RazQUhGv5KkpZIRv+kuP4CcgX3fnc0qX8bLnzbx8= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= @@ -2411,6 +2525,7 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/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-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -2441,6 +2556,7 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG 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.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 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= @@ -2496,7 +2612,6 @@ gorm.io/driver/mysql v1.1.1/go.mod h1:KdrTanmfLPPyAOeYGyG+UpDys7/7eeWT1zCq+oekYn gorm.io/gorm v1.21.9/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= gorm.io/gorm v1.21.12 h1:3fQM0Eiz7jcJEhPggHEpoYnsGZqynMzverL77DV40RM= gorm.io/gorm v1.21.12/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= 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= diff --git a/miner/minerwpp.go b/miner/minerwpp.go index 75e8777..6da890e 100644 --- a/miner/minerwpp.go +++ b/miner/minerwpp.go @@ -11,10 +11,10 @@ import ( "github.com/filecoin-project/venus-miner/api/client" "github.com/filecoin-project/venus-miner/build" - "github.com/filecoin-project/venus-miner/chain" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/dtypes" + "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/pkg/util/ffiwrapper" "github.com/filecoin-project/venus/venus-shared/actors/builtin" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" @@ -36,7 +36,7 @@ func NewWinningPoStProver(api v1.FullNode, gatewayNode *config.GatewayNode, mine return nil, fmt.Errorf("getting sector size: %w", err) } - if build.InsecurePoStValidation { + if constants.InsecurePoStValidation { log.Warn("*****************************************************************************") log.Warn(" Generating fake PoSt proof! You should only see this while running tests! ") log.Warn("*****************************************************************************") @@ -50,7 +50,7 @@ func NewWinningPoStProver(api v1.FullNode, gatewayNode *config.GatewayNode, mine return &MiningWpp{gatewayNode: gatewayNode, minerInfo: minerInfo, verifier: verifier, miner: abi.ActorID(minerId), winnRpt: mi.WindowPoStProofType}, nil } -var _ chain.WinningPoStProver = (*MiningWpp)(nil) +var _ WinningPoStProver = (*MiningWpp)(nil) func (wpp *MiningWpp) GenerateCandidates(ctx context.Context, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { start := build.Clock.Now() @@ -64,7 +64,7 @@ func (wpp *MiningWpp) GenerateCandidates(ctx context.Context, randomness abi.PoS } func (wpp *MiningWpp) ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, currEpoch abi.ChainEpoch, nv network.Version) ([]builtin.PoStProof, error) { - if build.InsecurePoStValidation { + if constants.InsecurePoStValidation { return []builtin.PoStProof{{ProofBytes: []byte("valid proof")}}, nil } @@ -72,7 +72,6 @@ func (wpp *MiningWpp) ComputeProof(ctx context.Context, ssi []builtin.ExtendedSe start := build.Clock.Now() - // todo call gateway api api, closer, err := client.NewGatewayRPC(ctx, wpp.gatewayNode) if err != nil { return nil, err diff --git a/miner/multiminer.go b/miner/multiminer.go index a22a651..71e053e 100644 --- a/miner/multiminer.go +++ b/miner/multiminer.go @@ -6,6 +6,7 @@ import ( "crypto/rand" "encoding/binary" "fmt" + types3 "github.com/filecoin-project/venus-miner/types" "sync" "time" @@ -21,19 +22,18 @@ import ( "github.com/filecoin-project/venus-miner/api/client" "github.com/filecoin-project/venus-miner/build" - "github.com/filecoin-project/venus-miner/chain" - "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/lib/journal" + "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/block_recorder" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/modules/minermanage" + "github.com/filecoin-project/venus/pkg/chain" + "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/pkg/util/ffiwrapper" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" types2 "github.com/filecoin-project/venus/venus-shared/types" - "github.com/filecoin-project/venus/venus-shared/types/wallet" ) var log = logging.Logger("miner") @@ -66,9 +66,15 @@ func randTimeOffset(width time.Duration) time.Duration { // address (which can be different from the worker's address). func NewMiner(api v1api.FullNode, gtNode *config.GatewayNode, verifier ffiwrapper.Verifier, minerManager minermanage.MinerManageAPI, sf slashfilter.SlashFilterAPI, j journal.Journal, blockRecord block_recorder.IBlockRecord) *Miner { + networkParams, err := api.StateGetNetworkParams(context.TODO()) + if err != nil { + return nil + } + miner := &Miner{ - api: api, - gatewayNode: gtNode, + api: api, + networkParams: networkParams, + gatewayNode: gtNode, waitFunc: func(ctx context.Context, baseTime uint64) (func(bool, abi.ChainEpoch, error), abi.ChainEpoch, error) { // wait around for half the block time in case other parents come in // @@ -104,13 +110,10 @@ func NewMiner(api v1api.FullNode, gtNode *config.GatewayNode, verifier ffiwrappe verifier: verifier, } - switch build.BuildType { - case build.BuildMainnet, build.BuildCalibnet, build.BuildButterflynet: // The time to wait for the latest block is counted in - miner.mineTimeout = 12 * time.Second - // miner.mineTimeout = time.Duration(build.BlockDelaySecs-build.PropagationDelaySecs*2) * time.Second - default: - miner.mineTimeout = time.Millisecond * 2800 // 0.2S is used to select messages and generate blocks - } + // The time to wait for the latest block is counted in + miner.mineTimeout = 12 * time.Second + // miner.mineTimeout = time.Duration(build.BlockDelaySecs-build.PropagationDelaySecs*2) * time.Second + //miner.mineTimeout = time.Millisecond * 2800 // 0.2S is used to select messages and generate blocks return miner } @@ -122,14 +125,14 @@ type syncStatus struct { type minerWPP struct { account string - epp chain.WinningPoStProver + epp WinningPoStProver isMining bool err []string } -// Refer to the godocs on mineOne and mine methods for more detail. type Miner struct { - api v1api.FullNode + api v1api.FullNode + networkParams *types2.NetworkParams gatewayNode *config.GatewayNode @@ -143,7 +146,6 @@ type Miner struct { sf slashfilter.SlashFilterAPI blockRecord block_recorder.IBlockRecord - // minedBlockHeights *lru.ARCCache evtTypes [1]journal.EventType journal journal.Journal @@ -337,7 +339,7 @@ minerLoop: if base.TipSet.Equals(lastBase.TipSet) && lastBase.NullRounds == base.NullRounds { log.Warnf("BestMiningCandidate from the previous round: %s (nulls:%d)", lastBase.TipSet.Cids(), lastBase.NullRounds) - if !m.niceSleep(time.Duration(build.BlockDelaySecs) * time.Second) { + if !m.niceSleep(time.Duration(m.networkParams.BlockDelaySecs) * time.Second) { continue minerLoop } continue @@ -436,7 +438,7 @@ minerLoop: } log.Infow("mined new block", "cid", b.Cid(), "height", b.Header.Height, "miner", b.Header.Miner, "parents", parentMiners, "took", dur) - if dur > time.Second*time.Duration(build.BlockDelaySecs) { + if dur > time.Second*time.Duration(m.networkParams.BlockDelaySecs) { log.Warnw("CAUTION: block production took longer than the block delay. Your computer may not be fast enough to keep up", "miner", tRes.addr, "tMinerBaseInfo ", tRes.timetable.tMBI.Sub(tRes.timetable.tStart), @@ -526,7 +528,7 @@ minerLoop: // has enough time to form. // // See: https://github.com/filecoin-project/venus-miner/issues/1845 - nextRound := time.Unix(int64(base.TipSet.MinTimestamp()+build.BlockDelaySecs*uint64(base.NullRounds))+int64(build.PropagationDelaySecs), 0) + nextRound := time.Unix(int64(base.TipSet.MinTimestamp()+m.networkParams.BlockDelaySecs*uint64(base.NullRounds))+int64(build.PropagationDelaySecs), 0) select { case <-build.Clock.After(build.Clock.Until(nextRound)): @@ -613,8 +615,8 @@ type winPoStRes struct { // This method does the following: // // 1. -func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, addr address.Address, epp chain.WinningPoStProver) (<-chan *winPoStRes, error) { - log.Infow("attempting to mine a block", "tipset", types.LogCids(base.TipSet.Cids()), "miner", addr) +func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, addr address.Address, epp WinningPoStProver) (<-chan *winPoStRes, error) { + log.Infow("attempting to mine a block", "tipset", types3.LogCids(base.TipSet.Cids()), "miner", addr) start := build.Clock.Now() round := base.TipSet.Height() + base.NullRounds + 1 @@ -663,7 +665,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, a tTicket := build.Clock.Now() log.Infow("mine one", "miner", addr, "compute ticket", tTicket.Sub(tMBI)) - var sign chain.SignFunc + var sign SignFunc if _, ok := m.minerWPPMap[addr]; ok { walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { @@ -678,7 +680,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, a out <- &winPoStRes{addr: addr, err: errors.New("miner not exist")} return } - winner, err := chain.IsRoundWinner(ctx, round, account, addr, rbase, mbi, sign) + winner, err := IsRoundWinner(ctx, round, account, addr, rbase, mbi, sign) if err != nil { log.Errorf("failed to check for %s if we win next round: %w", addr, err) out <- &winPoStRes{addr: addr, err: err} @@ -701,13 +703,12 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase, account string, a return } - r, err := chain.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_WinningPoStChallengeSeed, round, buf.Bytes()) + r, err := chain.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-constants.TicketRandomnessLookback, buf.Bytes()) if err != nil { - log.Errorf("failed to get randomness for winning post: %w, miner: %s", err, addr) + log.Errorf("failed to draw randomness: %w, miner: %s", err, addr) out <- &winPoStRes{addr: addr, err: err} return } - prand := abi.PoStRandomness(r) tSeed := build.Clock.Now() @@ -748,30 +749,19 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types2.BeaconEntry, ba } round := base.TipSet.Height() + base.NullRounds + 1 - if round > build.UpgradeSmokeHeight { + if round > m.networkParams.ForkUpgradeParams.UpgradeSmokeHeight { buf.Write(base.TipSet.MinTicket().VRFProof) } - input := new(bytes.Buffer) - drp := &wallet.DrawRandomParams{ - Rbase: brand.Data, - Pers: crypto.DomainSeparationTag_TicketProduction, - Round: round - build.TicketRandomnessLookback, - Entropy: buf.Bytes(), - } - err := drp.MarshalCBOR(input) + input, err := chain.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-constants.TicketRandomnessLookback, buf.Bytes()) if err != nil { - return nil, fmt.Errorf("failed to marshal randomness: %w", err) + return nil, err } - //input, err := chain.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes()) - //if err != nil { - // return nil, err - //} - var sign chain.SignFunc - accout := "" + var sign SignFunc + account := "" if val, ok := m.minerWPPMap[addr]; ok { - accout = val.account + account = val.account walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("create wallet RPC failed: %w", err) @@ -784,7 +774,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types2.BeaconEntry, ba return nil, errors.New("miner not exist") } - vrfOut, err := chain.ComputeVRF(ctx, sign, accout, mbi.WorkerKey, input.Bytes()) + vrfOut, err := ComputeVRF(ctx, sign, account, mbi.WorkerKey, input) if err != nil { return nil, err } @@ -796,7 +786,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types2.BeaconEntry, ba func (m *Miner) createBlock(ctx context.Context, base *MiningBase, addr, waddr address.Address, ticket *types2.Ticket, eproof *types2.ElectionProof, bvals []types2.BeaconEntry, wpostProof []proof2.PoStProof, msgs []*types2.SignedMessage) (*types2.BlockMsg, error) { - uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1) + uts := base.TipSet.MinTimestamp() + m.networkParams.BlockDelaySecs*(uint64(base.NullRounds)+1) nheight := base.TipSet.Height() + base.NullRounds + 1 @@ -819,7 +809,7 @@ func (m *Miner) createBlock(ctx context.Context, base *MiningBase, addr, waddr a // ToDo check if BlockHeader is signed if blockMsg.Header.BlockSig == nil { - var sign chain.SignFunc + var sign SignFunc account := "" if val, ok := m.minerWPPMap[addr]; ok { account = val.account @@ -955,7 +945,7 @@ func (m *Miner) StatesForMining(ctx context.Context, addrs []address.Address) ([ return res, nil } -func (m *Miner) winCountInRound(ctx context.Context, account string, mAddr address.Address, api chain.SignFunc, epoch abi.ChainEpoch) (*types2.ElectionProof, error) { +func (m *Miner) winCountInRound(ctx context.Context, account string, mAddr address.Address, api SignFunc, epoch abi.ChainEpoch) (*types2.ElectionProof, error) { ts, err := m.api.ChainGetTipSetByHeight(ctx, abi.ChainEpoch(epoch), types2.EmptyTSK) if err != nil { return nil, err @@ -979,7 +969,7 @@ func (m *Miner) winCountInRound(ctx context.Context, account string, mAddr addre rbase = mbi.BeaconEntries[len(mbi.BeaconEntries)-1] } - return chain.IsRoundWinner(ctx, ts.Height()+1, account, mAddr, rbase, mbi, api) + return IsRoundWinner(ctx, ts.Height()+1, account, mAddr, rbase, mbi, api) } func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]dtypes.CountWinners, error) { @@ -1026,7 +1016,7 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start winInfo := make([]dtypes.SimpleWinInfo, 0) totalWinCount := int64(0) - var sign chain.SignFunc = nil + var sign SignFunc = nil account := "" if val, ok := m.minerWPPMap[tAddr]; ok { account = val.account @@ -1119,7 +1109,7 @@ func (m *Miner) SyncStatus(ctx context.Context) { heightDiff = int64(ss.Target.Height() - head.Height()) } - if time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs) { + if time.Now().Unix()-int64(head.MinTimestamp()) < int64(m.networkParams.BlockDelaySecs) { heightDiff = 0 } m.st = syncStatus{heightDiff: heightDiff} diff --git a/chain/gen/slashfilter/mysql_slashfilter.go b/miner/slashfilter/mysql_slashfilter.go similarity index 97% rename from chain/gen/slashfilter/mysql_slashfilter.go rename to miner/slashfilter/mysql_slashfilter.go index 1431842..c479696 100644 --- a/chain/gen/slashfilter/mysql_slashfilter.go +++ b/miner/slashfilter/mysql_slashfilter.go @@ -12,7 +12,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/venus-miner/build" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus/venus-shared/types" @@ -117,10 +116,6 @@ func (f *MysqlSlashFilter) checkSameParentFault(bh *types.BlockHeader) error { } func (f *MysqlSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { - if build.IsNearUpgrade(bh.Height, build.UpgradeOrangeHeight) { - return nil - } - if err := f.checkSameHeightFault(bh); err != nil { return err } diff --git a/chain/gen/slashfilter/slashfilter.go b/miner/slashfilter/slashfilter.go similarity index 96% rename from chain/gen/slashfilter/slashfilter.go rename to miner/slashfilter/slashfilter.go index 91134e1..093fee8 100644 --- a/chain/gen/slashfilter/slashfilter.go +++ b/miner/slashfilter/slashfilter.go @@ -10,7 +10,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/venus-miner/build" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus/venus-shared/types" ) @@ -36,10 +35,6 @@ func New(dstore ds.Batching) *SlashFilter { } func (f *SlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { - if build.IsNearUpgrade(bh.Height, build.UpgradeOrangeHeight) { - return nil - } - epochKey := ds.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, bh.Height)) { // double-fork mining (2 blocks at one epoch) diff --git a/chain/util.go b/miner/util.go similarity index 54% rename from chain/util.go rename to miner/util.go index 8e1c4fc..c39e389 100644 --- a/chain/util.go +++ b/miner/util.go @@ -1,24 +1,19 @@ -package chain +package miner import ( "bytes" "context" - "encoding/binary" "fmt" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/network" - "github.com/minio/blake2b-simd" - + "github.com/filecoin-project/venus/pkg/chain" "github.com/filecoin-project/venus/venus-shared/actors/builtin" "github.com/filecoin-project/venus/venus-shared/types" - "github.com/filecoin-project/venus/venus-shared/types/wallet" ) -//var log = logging.Logger("API") - type WinningPoStProver interface { GenerateCandidates(context.Context, abi.PoStRandomness, uint64) ([]uint64, error) ComputeProof(context.Context, []builtin.ExtendedSectorInfo, abi.PoStRandomness, abi.ChainEpoch, network.Version) ([]builtin.PoStProof, error) @@ -26,31 +21,7 @@ type WinningPoStProver interface { type SignFunc func(ctx context.Context, account string, signer address.Address, toSign []byte, meta types.MsgMeta) (*crypto.Signature, error) -// type SignFunc func(context.Context, address.Address, []byte) (*crypto.Signature, error) - -func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) { - h := blake2b.New256() - if err := binary.Write(h, binary.BigEndian, int64(pers)); err != nil { - return nil, fmt.Errorf("deriving randomness: %w", err) - } - VRFDigest := blake2b.Sum256(rbase) - _, err := h.Write(VRFDigest[:]) - if err != nil { - return nil, fmt.Errorf("hashing VRFDigest: %w", err) - } - if err := binary.Write(h, binary.BigEndian, round); err != nil { - return nil, fmt.Errorf("deriving randomness: %w", err) - } - _, err = h.Write(entropy) - if err != nil { - return nil, fmt.Errorf("hashing entropy: %w", err) - } - - return h.Sum(nil), nil -} - func ComputeVRF(ctx context.Context, sign SignFunc, account string, worker address.Address, sigInput []byte) ([]byte, error) { - // log.Infof("sigInput: %s", hex.EncodeToString(sigInput)) sig, err := sign(ctx, account, worker, sigInput, types.MsgMeta{Type: types.MTDrawRandomParam}) if err != nil { return nil, err @@ -71,23 +42,12 @@ func IsRoundWinner(ctx context.Context, round abi.ChainEpoch, account string, return nil, fmt.Errorf("failed to cbor marshal address: %w", err) } - electionRand := new(bytes.Buffer) - drp := &wallet.DrawRandomParams{ - Rbase: brand.Data, - Pers: crypto.DomainSeparationTag_ElectionProofProduction, - Round: round, - Entropy: buf.Bytes(), - } - err := drp.MarshalCBOR(electionRand) + electionRand, err := chain.DrawRandomness(brand.Data, crypto.DomainSeparationTag_ElectionProofProduction, round, buf.Bytes()) if err != nil { - return nil, fmt.Errorf("failed to marshal randomness: %w", err) + return nil, fmt.Errorf("failed to draw randomness: %w", err) } - //electionRand, err := DrawRandomness(brand.Data, crypto.DomainSeparationTag_ElectionProofProduction, round, buf.Bytes()) - //if err != nil { - // return nil, fmt.Errorf("failed to draw randomness: %w", err) - //} - vrfout, err := ComputeVRF(ctx, sign, account, mbi.WorkerKey, electionRand.Bytes()) + vrfout, err := ComputeVRF(ctx, sign, account, mbi.WorkerKey, electionRand) if err != nil { return nil, fmt.Errorf("failed to compute VRF: %w", err) } diff --git a/miner/warmup.go b/miner/warmup.go index ba9a73a..032c544 100644 --- a/miner/warmup.go +++ b/miner/warmup.go @@ -12,8 +12,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/venus-miner/chain" - "github.com/filecoin-project/venus/venus-shared/types" ) @@ -34,7 +32,7 @@ func (m *Miner) winPoStWarmup(ctx context.Context) error { return nil } -func (m *Miner) winPostWarmupForMiner(ctx context.Context, addr address.Address, epp chain.WinningPoStProver) error { +func (m *Miner) winPostWarmupForMiner(ctx context.Context, addr address.Address, epp WinningPoStProver) error { deadlines, err := m.api.StateMinerDeadlines(ctx, addr, types.EmptyTSK) if err != nil { return fmt.Errorf("getting deadlines: %w", err) diff --git a/node/builder.go b/node/builder.go index e35861e..475bb66 100644 --- a/node/builder.go +++ b/node/builder.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + types2 "github.com/filecoin-project/venus-miner/types" logging "github.com/ipfs/go-log/v2" metricsi "github.com/ipfs/go-metrics-interface" @@ -13,10 +14,9 @@ import ( "go.uber.org/fx" "github.com/filecoin-project/venus-miner/api" - "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" + "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/impl" "github.com/filecoin-project/venus-miner/node/impl/common" @@ -142,7 +142,7 @@ func Repo(cctx *cli.Context, r repo.Repo) Option { Override(new(dtypes.MetadataDS), modules.Datastore), - Override(new(types.KeyStore), modules.KeyStore), + Override(new(types2.KeyStore), modules.KeyStore), Override(new(*dtypes.APIAlg), modules.APISecret), diff --git a/node/impl/common/common.go b/node/impl/common/common.go index 395d2e0..8638d77 100644 --- a/node/impl/common/common.go +++ b/node/impl/common/common.go @@ -54,7 +54,6 @@ func (a *CommonAPI) Version(context.Context) (api.APIVersion, error) { return api.APIVersion{ Version: build.UserVersion(), APIVersion: apiVersion, - BlockDelay: build.BlockDelaySecs, }, nil } diff --git a/node/modules/core.go b/node/modules/core.go index ce1b4f1..6c3ea85 100644 --- a/node/modules/core.go +++ b/node/modules/core.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "errors" "fmt" + types2 "github.com/filecoin-project/venus-miner/types" "io" "io/ioutil" @@ -12,7 +13,6 @@ import ( logging "github.com/ipfs/go-log/v2" "github.com/filecoin-project/venus-miner/api" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/repo" ) @@ -30,10 +30,10 @@ type JwtPayload struct { Allow []auth.Permission } -func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) { +func APISecret(keystore types2.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) { key, err := keystore.Get(JWTSecretName) - if errors.Is(err, types.ErrKeyInfoNotFound) { + if errors.Is(err, types2.ErrKeyInfoNotFound) { log.Warn("Generating new API secret") sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32)) @@ -41,7 +41,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err return nil, err } - key = types.KeyInfo{ + key = types2.KeyInfo{ Type: KTJwtHmacSecret, PrivateKey: sk, } diff --git a/node/modules/miner.go b/node/modules/miner.go index 5efa410..2416f6c 100644 --- a/node/modules/miner.go +++ b/node/modules/miner.go @@ -5,9 +5,9 @@ import ( "go.uber.org/fx" - "github.com/filecoin-project/venus-miner/chain/gen/slashfilter" "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" + "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/modules/block_recorder" "github.com/filecoin-project/venus-miner/node/modules/minermanage" diff --git a/node/modules/storage.go b/node/modules/storage.go index dda8eda..e9cb0b1 100644 --- a/node/modules/storage.go +++ b/node/modules/storage.go @@ -2,10 +2,10 @@ package modules import ( "context" + types2 "github.com/filecoin-project/venus-miner/types" "go.uber.org/fx" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/modules/helpers" "github.com/filecoin-project/venus-miner/node/repo" @@ -23,7 +23,7 @@ func LockedRepo(lr repo.LockedRepo) func(lc fx.Lifecycle) repo.LockedRepo { } } -func KeyStore(lr repo.LockedRepo) (types.KeyStore, error) { +func KeyStore(lr repo.LockedRepo) (types2.KeyStore, error) { return lr.KeyStore() } diff --git a/node/repo/fsrepo.go b/node/repo/fsrepo.go index cb5a5ea..b30b309 100644 --- a/node/repo/fsrepo.go +++ b/node/repo/fsrepo.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + types2 "github.com/filecoin-project/venus-miner/types" "io" "io/ioutil" "os" @@ -20,7 +21,6 @@ import ( "github.com/multiformats/go-base32" "github.com/multiformats/go-multiaddr" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/node/config" ) @@ -372,7 +372,7 @@ func (fsr *fsLockedRepo) SetAPIToken(token []byte) error { return ioutil.WriteFile(fsr.join(fsAPIToken), token, 0600) } -func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) { +func (fsr *fsLockedRepo) KeyStore() (types2.KeyStore, error) { if err := fsr.stillValid(); err != nil { return nil, err } @@ -413,9 +413,9 @@ func (fsr *fsLockedRepo) List() ([]string, error) { } // Get gets a key out of keystore and returns types.KeyInfo coresponding to named key -func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) { +func (fsr *fsLockedRepo) Get(name string) (types2.KeyInfo, error) { if err := fsr.stillValid(); err != nil { - return types.KeyInfo{}, err + return types2.KeyInfo{}, err } encName := base32.RawStdEncoding.EncodeToString([]byte(name)) @@ -423,37 +423,37 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) { fstat, err := os.Stat(keyPath) if os.IsNotExist(err) { - return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, types.ErrKeyInfoNotFound) + return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, types2.ErrKeyInfoNotFound) } else if err != nil { - return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) + return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) } if fstat.Mode()&0077 != 0 { - return types.KeyInfo{}, fmt.Errorf(kstrPermissionMsg, name, fstat.Mode()) + return types2.KeyInfo{}, fmt.Errorf(kstrPermissionMsg, name, fstat.Mode()) } file, err := os.Open(keyPath) if err != nil { - return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) + return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) } defer file.Close() //nolint: errcheck // read only op data, err := ioutil.ReadAll(file) if err != nil { - return types.KeyInfo{}, fmt.Errorf("reading key '%s': %w", name, err) + return types2.KeyInfo{}, fmt.Errorf("reading key '%s': %w", name, err) } - var res types.KeyInfo + var res types2.KeyInfo err = json.Unmarshal(data, &res) if err != nil { - return types.KeyInfo{}, fmt.Errorf("decoding key '%s': %w", name, err) + return types2.KeyInfo{}, fmt.Errorf("decoding key '%s': %w", name, err) } return res, nil } // Put saves key info under given name -func (fsr *fsLockedRepo) Put(name string, info types.KeyInfo) error { +func (fsr *fsLockedRepo) Put(name string, info types2.KeyInfo) error { if err := fsr.stillValid(); err != nil { return err } @@ -463,7 +463,7 @@ func (fsr *fsLockedRepo) Put(name string, info types.KeyInfo) error { _, err := os.Stat(keyPath) if err == nil { - return fmt.Errorf("checking key before put '%s': %w", name, types.ErrKeyExists) + return fmt.Errorf("checking key before put '%s': %w", name, types2.ErrKeyExists) } else if !os.IsNotExist(err) { return fmt.Errorf("checking key before put '%s': %w", name, err) } @@ -490,7 +490,7 @@ func (fsr *fsLockedRepo) Delete(name string) error { _, err := os.Stat(keyPath) if os.IsNotExist(err) { - return fmt.Errorf("checking key before delete '%s': %w", name, types.ErrKeyInfoNotFound) + return fmt.Errorf("checking key before delete '%s': %w", name, types2.ErrKeyInfoNotFound) } else if err != nil { return fmt.Errorf("checking key before delete '%s': %w", name, err) } diff --git a/node/repo/interface.go b/node/repo/interface.go index 9e6de24..d74e862 100644 --- a/node/repo/interface.go +++ b/node/repo/interface.go @@ -3,11 +3,10 @@ package repo import ( "context" "errors" + types2 "github.com/filecoin-project/venus-miner/types" "github.com/ipfs/go-datastore" "github.com/multiformats/go-multiaddr" - - "github.com/filecoin-project/venus-miner/chain/types" ) var ( @@ -48,7 +47,7 @@ type LockedRepo interface { SetAPIToken([]byte) error // KeyStore returns store of private keys for Filecoin transactions - KeyStore() (types.KeyStore, error) + KeyStore() (types2.KeyStore, error) // Path returns absolute path of the repo Path() string diff --git a/node/repo/repo_test.go b/node/repo/repo_test.go index 8dfe3ed..8e1665b 100644 --- a/node/repo/repo_test.go +++ b/node/repo/repo_test.go @@ -2,12 +2,12 @@ package repo import ( "errors" + types2 "github.com/filecoin-project/venus-miner/types" "testing" "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/assert" - "github.com/filecoin-project/venus-miner/chain/types" "github.com/filecoin-project/venus-miner/node/config" ) @@ -61,8 +61,8 @@ func basicTest(t *testing.T, repo Repo) { } assert.Nil(t, apima, "with closed repo, apima should be set back to nil") - k1 := types.KeyInfo{Type: "foo"} - k2 := types.KeyInfo{Type: "bar"} + k1 := types2.KeyInfo{Type: "foo"} + k2 := types2.KeyInfo{Type: "bar"} lrepo, err = repo.Lock(Miner) assert.NoError(t, err, "should be able to relock") @@ -81,7 +81,7 @@ func basicTest(t *testing.T, repo Repo) { err = kstr.Put("k1", k1) if assert.Error(t, err, "putting key under the same name should error") { - assert.True(t, errors.Is(err, types.ErrKeyExists), "returned error is ErrKeyExists") + assert.True(t, errors.Is(err, types2.ErrKeyExists), "returned error is ErrKeyExists") } k1prim, err := kstr.Get("k1") @@ -90,7 +90,7 @@ func basicTest(t *testing.T, repo Repo) { k2prim, err := kstr.Get("k2") if assert.Error(t, err, "should not be able to get k2") { - assert.True(t, errors.Is(err, types.ErrKeyInfoNotFound), "returned error is ErrKeyNotFound") + assert.True(t, errors.Is(err, types2.ErrKeyInfoNotFound), "returned error is ErrKeyNotFound") } assert.Empty(t, k2prim, "there should be no output for k2") @@ -110,6 +110,6 @@ func basicTest(t *testing.T, repo Repo) { err = kstr.Delete("k2") if assert.Error(t, err) { - assert.True(t, errors.Is(err, types.ErrKeyInfoNotFound), "returned errror is ErrKeyNotFound") + assert.True(t, errors.Is(err, types2.ErrKeyInfoNotFound), "returned errror is ErrKeyNotFound") } } diff --git a/chain/types/keystore.go b/types/keystore.go similarity index 100% rename from chain/types/keystore.go rename to types/keystore.go diff --git a/chain/types/logs.go b/types/logs.go similarity index 100% rename from chain/types/logs.go rename to types/logs.go From b4ff30145f07e42b447c8e07d7aac9242eed8c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E9=A1=B5=E7=B4=A0=E4=B9=A6?= <2931107265@qq.com> Date: Mon, 20 Jun 2022 09:59:40 +0800 Subject: [PATCH 4/4] refactor: config & builder daemon --- .circleci/config.yml | 4 +- api/api_common.go | 5 - api/api_miner.go | 16 +- api/proxy_gen.go | 55 ++--- build/params.go | 3 - cli/cmd.go | 80 ++----- cmd/address.go | 45 ---- cmd/init.go | 33 ++- cmd/main.go | 8 +- cmd/run.go | 10 +- lib/tracing/setup.go | 3 +- miner/api.go | 24 +- miner/minerwpp.go | 7 +- miner/multiminer.go | 84 +++---- node/builder.go | 198 +++------------ {cli/util => node/config}/apiinfo.go | 30 +-- node/config/authdef.go | 13 - node/config/def.go | 130 ++-------- node/config/load.go | 6 - node/config/load_test.go | 8 +- node/impl/common/common.go | 7 +- node/impl/miner.go | 16 +- node/modules/block_recorder/block_record.go | 69 ------ node/modules/core.go | 8 +- node/modules/miner-manager/api.go | 17 ++ .../auth.go => miner-manager/auth_manager.go} | 60 ++--- node/modules/miner.go | 16 +- node/modules/minermanage/local/local.go | 225 ------------------ node/modules/minermanage/minermanger.go | 26 -- node/modules/minermanage/mysql/mysql.go | 204 ---------------- node/modules/services.go | 1 + node/modules/slashfilter/api.go | 22 ++ .../modules/slashfilter/local.go | 65 +++-- .../modules/slashfilter/mysql.go | 64 +++-- node/modules/storage.go | 4 +- node/repo/fsrepo.go | 71 ++---- node/repo/fsrepo_ds.go | 5 - node/repo/fsrepo_test.go | 2 +- node/repo/interface.go | 7 +- node/repo/repo_test.go | 11 +- {node/modules/dtypes => types}/api.go | 2 +- {node/modules/dtypes => types}/miner.go | 2 +- {node/modules/dtypes => types}/shutdown.go | 2 +- {node/modules/dtypes => types}/storage.go | 2 +- 44 files changed, 378 insertions(+), 1292 deletions(-) rename {cli/util => node/config}/apiinfo.go (66%) delete mode 100644 node/config/authdef.go delete mode 100644 node/modules/block_recorder/block_record.go create mode 100644 node/modules/miner-manager/api.go rename node/modules/{minermanage/auth/auth.go => miner-manager/auth_manager.go} (60%) delete mode 100644 node/modules/minermanage/local/local.go delete mode 100644 node/modules/minermanage/minermanger.go delete mode 100644 node/modules/minermanage/mysql/mysql.go create mode 100644 node/modules/slashfilter/api.go rename miner/slashfilter/slashfilter.go => node/modules/slashfilter/local.go (55%) rename miner/slashfilter/mysql_slashfilter.go => node/modules/slashfilter/mysql.go (74%) rename {node/modules/dtypes => types}/api.go (90%) rename {node/modules/dtypes => types}/miner.go (98%) rename {node/modules/dtypes => types}/shutdown.go (92%) rename {node/modules/dtypes => types}/storage.go (92%) diff --git a/.circleci/config.yml b/.circleci/config.yml index a9615f7..9e8dbce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -118,7 +118,7 @@ jobs: description: gotestsum format. https://github.com/gotestyourself/gotestsum#format coverage: type: string - default: -coverprofile=coverage.txt -coverpkg=github.com/filecoin-project/venus-miner/... + default: -coverprofile=coverage.txt -coverpkg=./... description: Coverage flag. Set to the empty string to disable. codecov-upload: type: boolean @@ -131,7 +131,7 @@ jobs: - install-deps - prepare - run: - command: make deps miner + command: make deps no_output_timeout: 30m - run: name: go test diff --git a/api/api_common.go b/api/api_common.go index 8499512..7afce8c 100644 --- a/api/api_common.go +++ b/api/api_common.go @@ -42,11 +42,6 @@ type APIVersion struct { // // See APIVersion in build/version.go APIVersion api.Version - - // TODO: git commit / os / genesis cid? - - // Seconds - BlockDelay uint64 } func (v APIVersion) String() string { diff --git a/api/api_miner.go b/api/api_miner.go index 2d2531f..35ca91e 100644 --- a/api/api_miner.go +++ b/api/api_miner.go @@ -2,21 +2,19 @@ package api import ( "context" + "github.com/filecoin-project/venus-miner/types" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - - "github.com/filecoin-project/venus-miner/node/modules/dtypes" ) type MinerAPI interface { Common - UpdateAddress(context.Context, int64, int64) ([]dtypes.MinerInfo, error) //perm:write - ListAddress(context.Context) ([]dtypes.MinerInfo, error) //perm:read - StatesForMining(context.Context, []address.Address) ([]dtypes.MinerState, error) //perm:read - CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]dtypes.CountWinners, error) //perm:read - Start(context.Context, []address.Address) error //perm:admin - Stop(context.Context, []address.Address) error //perm:admin - AddAddress(context.Context, dtypes.MinerInfo) error //perm:admin + UpdateAddress(context.Context, int64, int64) ([]types.MinerInfo, error) //perm:write + ListAddress(context.Context) ([]types.MinerInfo, error) //perm:read + StatesForMining(context.Context, []address.Address) ([]types.MinerState, error) //perm:read + CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]types.CountWinners, error) //perm:read + Start(context.Context, []address.Address) error //perm:admin + Stop(context.Context, []address.Address) error //perm:admin } diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 196df4c..41491a5 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -5,11 +5,11 @@ package api import ( "context" "errors" + "github.com/filecoin-project/venus-miner/types" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/google/uuid" ) @@ -42,19 +42,17 @@ type MinerAPIStruct struct { CommonStruct Internal struct { - AddAddress func(p0 context.Context, p1 dtypes.MinerInfo) error `perm:"admin"` + CountWinners func(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]types.CountWinners, error) `perm:"read"` - CountWinners func(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) `perm:"read"` - - ListAddress func(p0 context.Context) ([]dtypes.MinerInfo, error) `perm:"read"` + ListAddress func(p0 context.Context) ([]types.MinerInfo, error) `perm:"read"` Start func(p0 context.Context, p1 []address.Address) error `perm:"admin"` - StatesForMining func(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) `perm:"read"` + StatesForMining func(p0 context.Context, p1 []address.Address) ([]types.MinerState, error) `perm:"read"` Stop func(p0 context.Context, p1 []address.Address) error `perm:"admin"` - UpdateAddress func(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) `perm:"write"` + UpdateAddress func(p0 context.Context, p1 int64, p2 int64) ([]types.MinerInfo, error) `perm:"write"` } } @@ -150,37 +148,26 @@ func (s *CommonStub) Version(p0 context.Context) (APIVersion, error) { return *new(APIVersion), ErrNotSupported } -func (s *MinerAPIStruct) AddAddress(p0 context.Context, p1 dtypes.MinerInfo) error { - if s.Internal.AddAddress == nil { - return ErrNotSupported - } - return s.Internal.AddAddress(p0, p1) -} - -func (s *MinerAPIStub) AddAddress(p0 context.Context, p1 dtypes.MinerInfo) error { - return ErrNotSupported -} - -func (s *MinerAPIStruct) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) { +func (s *MinerAPIStruct) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]types.CountWinners, error) { if s.Internal.CountWinners == nil { - return *new([]dtypes.CountWinners), ErrNotSupported + return *new([]types.CountWinners), ErrNotSupported } return s.Internal.CountWinners(p0, p1, p2, p3) } -func (s *MinerAPIStub) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]dtypes.CountWinners, error) { - return *new([]dtypes.CountWinners), ErrNotSupported +func (s *MinerAPIStub) CountWinners(p0 context.Context, p1 []address.Address, p2 abi.ChainEpoch, p3 abi.ChainEpoch) ([]types.CountWinners, error) { + return *new([]types.CountWinners), ErrNotSupported } -func (s *MinerAPIStruct) ListAddress(p0 context.Context) ([]dtypes.MinerInfo, error) { +func (s *MinerAPIStruct) ListAddress(p0 context.Context) ([]types.MinerInfo, error) { if s.Internal.ListAddress == nil { - return *new([]dtypes.MinerInfo), ErrNotSupported + return *new([]types.MinerInfo), ErrNotSupported } return s.Internal.ListAddress(p0) } -func (s *MinerAPIStub) ListAddress(p0 context.Context) ([]dtypes.MinerInfo, error) { - return *new([]dtypes.MinerInfo), ErrNotSupported +func (s *MinerAPIStub) ListAddress(p0 context.Context) ([]types.MinerInfo, error) { + return *new([]types.MinerInfo), ErrNotSupported } func (s *MinerAPIStruct) Start(p0 context.Context, p1 []address.Address) error { @@ -194,15 +181,15 @@ func (s *MinerAPIStub) Start(p0 context.Context, p1 []address.Address) error { return ErrNotSupported } -func (s *MinerAPIStruct) StatesForMining(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) { +func (s *MinerAPIStruct) StatesForMining(p0 context.Context, p1 []address.Address) ([]types.MinerState, error) { if s.Internal.StatesForMining == nil { - return *new([]dtypes.MinerState), ErrNotSupported + return *new([]types.MinerState), ErrNotSupported } return s.Internal.StatesForMining(p0, p1) } -func (s *MinerAPIStub) StatesForMining(p0 context.Context, p1 []address.Address) ([]dtypes.MinerState, error) { - return *new([]dtypes.MinerState), ErrNotSupported +func (s *MinerAPIStub) StatesForMining(p0 context.Context, p1 []address.Address) ([]types.MinerState, error) { + return *new([]types.MinerState), ErrNotSupported } func (s *MinerAPIStruct) Stop(p0 context.Context, p1 []address.Address) error { @@ -216,15 +203,15 @@ func (s *MinerAPIStub) Stop(p0 context.Context, p1 []address.Address) error { return ErrNotSupported } -func (s *MinerAPIStruct) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) { +func (s *MinerAPIStruct) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]types.MinerInfo, error) { if s.Internal.UpdateAddress == nil { - return *new([]dtypes.MinerInfo), ErrNotSupported + return *new([]types.MinerInfo), ErrNotSupported } return s.Internal.UpdateAddress(p0, p1, p2) } -func (s *MinerAPIStub) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]dtypes.MinerInfo, error) { - return *new([]dtypes.MinerInfo), ErrNotSupported +func (s *MinerAPIStub) UpdateAddress(p0 context.Context, p1 int64, p2 int64) ([]types.MinerInfo, error) { + return *new([]types.MinerInfo), ErrNotSupported } var _ Common = new(CommonStruct) diff --git a/build/params.go b/build/params.go index 33fef97..6c1d7f8 100644 --- a/build/params.go +++ b/build/params.go @@ -1,6 +1,3 @@ -//go:build !testground -// +build !testground - package build var ( diff --git a/cli/cmd.go b/cli/cmd.go index eb53f22..501d20b 100644 --- a/cli/cmd.go +++ b/cli/cmd.go @@ -6,7 +6,6 @@ import ( "net/http" "os" "os/signal" - "strings" "syscall" logging "github.com/ipfs/go-log/v2" @@ -17,11 +16,10 @@ import ( "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/api/client" - cliutil "github.com/filecoin-project/venus-miner/cli/util" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/repo" - "github.com/filecoin-project/venus/venus-shared/api/chain/v1" + v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) var log = logging.Logger("cli") @@ -30,62 +28,20 @@ const ( metadataTraceContext = "traceContext" ) -// custom CLI error - -type ErrCmdFailed struct { - msg string -} - -func (e *ErrCmdFailed) Error() string { - return e.msg -} - -// The flag passed on the command line with the listen address of the API -// server (only used by the tests) -func flagForAPI(t repo.RepoType) string { - switch t { - case repo.Miner: - return "miner-api-url" - default: - panic(fmt.Sprintf("Unknown repo type: %v", t)) - } -} - -func flagForRepo(t repo.RepoType) string { - switch t { - case repo.Miner: - return "miner-repo" - default: - panic(fmt.Sprintf("Unknown repo type: %v", t)) - } -} - -func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (cliutil.APIInfo, error) { - // Check if there was a flag passed with the listen address of the API - // server (only used by the tests) - apiFlag := flagForAPI(t) - if ctx.IsSet(apiFlag) { - strma := ctx.String(apiFlag) - strma = strings.TrimSpace(strma) - - return cliutil.APIInfo{Addr: strma}, nil - } - - repoFlag := flagForRepo(t) - - p, err := homedir.Expand(ctx.String(repoFlag)) +func GetAPIInfo(ctx *cli.Context) (config.APIInfo, error) { + p, err := homedir.Expand(ctx.String("miner-repo")) if err != nil { - return cliutil.APIInfo{}, fmt.Errorf("could not expand home dir (%s): %w", repoFlag, err) + return config.APIInfo{}, fmt.Errorf("could not expand home dir: %w", err) } r, err := repo.NewFS(p) if err != nil { - return cliutil.APIInfo{}, fmt.Errorf("could not open repo at path: %s; %w", p, err) + return config.APIInfo{}, fmt.Errorf("could not open repo at path: %s; %w", p, err) } ma, err := r.APIEndpoint() if err != nil { - return cliutil.APIInfo{}, fmt.Errorf("could not get api endpoint: %w", err) + return config.APIInfo{}, fmt.Errorf("could not get api endpoint: %w", err) } token, err := r.APIToken() @@ -93,14 +49,14 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (cliutil.APIInfo, error) { log.Warnf("Couldn't load CLI token, capabilities may be limited: %v", err) } - return cliutil.APIInfo{ + return config.APIInfo{ Addr: ma.String(), - Token: token, + Token:string(token), }, nil } -func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http.Header, error) { - ainfo, err := GetAPIInfo(ctx, t) +func GetRawAPI(ctx *cli.Context, version string) (string, http.Header, error) { + ainfo, err := GetAPIInfo(ctx) if err != nil { return "", nil, fmt.Errorf("could not get API info: %w", err) } @@ -113,22 +69,22 @@ func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http. return addr, ainfo.AuthHeader(), nil } -func GetFullNodeAPI(ctx *cli.Context, fn config.FullNode, version string) (v1.FullNode, jsonrpc.ClientCloser, error) { - addr, err := fn.DialArgs(version) +func GetMinerAPI(ctx *cli.Context) (api.MinerAPI, jsonrpc.ClientCloser, error) { + addr, headers, err := GetRawAPI(ctx, "v0") if err != nil { - return nil, nil, fmt.Errorf("could not get DialArgs: %w", err) + return nil, nil, err } - return v1.NewFullNodeRPC(ctx.Context, addr, fn.AuthHeader()) + return client.NewMinerRPC(ctx.Context, addr, headers) } -func GetMinerAPI(ctx *cli.Context) (api.MinerAPI, jsonrpc.ClientCloser, error) { - addr, headers, err := GetRawAPI(ctx, repo.Miner, "v0") +func GetFullNodeAPI(ctx *cli.Context, fn *config.APIInfo, version string) (v1.FullNode, jsonrpc.ClientCloser, error) { + addr, err := fn.DialArgs(version) if err != nil { - return nil, nil, err + return nil, nil, fmt.Errorf("could not get DialArgs: %w", err) } - return client.NewMinerRPC(ctx.Context, addr, headers) + return v1.NewFullNodeRPC(ctx.Context, addr, fn.AuthHeader()) } func DaemonContext(cctx *cli.Context) context.Context { diff --git a/cmd/address.go b/cmd/address.go index 0ffb98a..2956a03 100644 --- a/cmd/address.go +++ b/cmd/address.go @@ -8,7 +8,6 @@ import ( "github.com/filecoin-project/go-address" lcli "github.com/filecoin-project/venus-miner/cli" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" ) var addressCmd = &cli.Command{ @@ -20,7 +19,6 @@ var addressCmd = &cli.Command{ stateCmd, startMiningCmd, stopMiningCmd, - addCmd, }, } @@ -62,49 +60,6 @@ var updateCmd = &cli.Command{ }, } -var addCmd = &cli.Command{ - Name: "add", - Usage: "add a miner", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "miner", - Required: true, - }, - &cli.StringFlag{ - Name: "id", - Required: false, - }, - &cli.StringFlag{ - Name: "name", - Required: false, - }, - }, - Action: func(cctx *cli.Context) error { - mi := dtypes.MinerInfo{Id: cctx.String("id"), Name: cctx.String("name")} - - addr, err := address.NewFromString(cctx.String("miner")) - if err != nil { - return nil - } - mi.Addr = addr - - postApi, closer, err := lcli.GetMinerAPI(cctx) - if err != nil { - return err - } - defer closer() - - err = postApi.AddAddress(cctx.Context, mi) - if err != nil { - return err - } - - fmt.Println("add miner success.") - return nil - - }, -} - var listCmd = &cli.Command{ Name: "list", Usage: "print miners", diff --git a/cmd/init.go b/cmd/init.go index b2bcc16..ccd498c 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -13,7 +13,7 @@ import ( "github.com/filecoin-project/venus/venus-shared/api" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" - types2 "github.com/filecoin-project/venus/venus-shared/types" + "github.com/filecoin-project/venus/venus-shared/types" lcli "github.com/filecoin-project/venus-miner/cli" "github.com/filecoin-project/venus-miner/node/config" @@ -61,13 +61,13 @@ var initCmd = &cli.Command{ log.Info("Trying to connect to full node RPC") - fullnode := config.FullNode{} + fullnode := config.APIInfo{} if cctx.String("api") != "" && cctx.String("token") != "" { - fullnode.ListenAPI = cctx.String("api") + fullnode.Addr = cctx.String("api") fullnode.Token = cctx.String("token") } - fullNodeAPI, closer, err := lcli.GetFullNodeAPI(cctx, fullnode, "v1") + fullNodeAPI, closer, err := lcli.GetFullNodeAPI(cctx, &fullnode, "v1") if err != nil { return err } @@ -102,11 +102,11 @@ var initCmd = &cli.Command{ log.Info("Initializing repo") - if err := r.Init(repo.Miner); err != nil { + if err := r.Init(); err != nil { return err } - if err := storageMinerInit(cctx, r, fullnode); err != nil { + if err := storageMinerInit(cctx, r, &fullnode); err != nil { log.Errorf("Failed to initialize venus-miner: %+v", err) path, err := homedir.Expand(repoPath) if err != nil { @@ -125,8 +125,8 @@ var initCmd = &cli.Command{ }, } -func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error { - lr, err := r.Lock(repo.Miner) +func storageMinerInit(cctx *cli.Context, r repo.Repo, fn *config.APIInfo) error { + lr, err := r.Lock() if err != nil { return err } @@ -152,17 +152,14 @@ func storageMinerInit(cctx *cli.Context, r repo.Repo, fn config.FullNode) error } if cctx.String("auth-api") != "" { - cfg.Db.Type = "auth" - cfg.Db.Auth = &config.AuthConfig{ - ListenAPI: cctx.String("auth-api"), - Token: gt, + cfg.Auth = &config.APIInfo{ + Addr: cctx.String("auth-api"), + Token: gt, } } - cfg.Db.SFType = sfType - if cfg.Db.SFType == "mysql" { - cfg.Db.MySQL.Conn = cctx.String("mysql-conn") - } + cfg.SlashFilter.Type = sfType + cfg.SlashFilter.MySQL.Conn = cctx.String("mysql-conn") }); err != nil { return fmt.Errorf("modify config failed: %w", err) } @@ -210,10 +207,10 @@ func SyncWait(ctx context.Context, fullNode v1.FullNode, watch bool) error { working := -1 for i, ss := range state.ActiveSyncs { switch ss.Stage { - case types2.StageSyncComplete: + case types.StageSyncComplete: default: working = i - case types2.StageIdle: + case types.StageIdle: // not complete, not actively working } } diff --git a/cmd/main.go b/cmd/main.go index 3109994..293f0ce 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -9,16 +9,12 @@ import ( "github.com/filecoin-project/venus-miner/build" lcli "github.com/filecoin-project/venus-miner/cli" "github.com/filecoin-project/venus-miner/lib/logger" - "github.com/filecoin-project/venus-miner/node/repo" ) var log = logging.Logger("main") const FlagMinerRepo = "miner-repo" -// TODO remove after deprecation period -const FlagMinerRepoDeprecation = "storagerepo" - func main() { logger.SetupLogLevels() @@ -42,17 +38,15 @@ func main() { }, &cli.StringFlag{ Name: FlagMinerRepo, - Aliases: []string{FlagMinerRepoDeprecation}, EnvVars: []string{"VENUS_MINER_PATH"}, Value: "~/.venusminer", // TODO: Consider XDG_DATA_HOME - Usage: fmt.Sprintf("Specify miner repo path. flag(%s) and env(VENUS_MINER_PATH) are DEPRECATION, will REMOVE SOON", FlagMinerRepoDeprecation), + Usage: fmt.Sprintf("Specify miner repo path, env VENUS_MINER_PATH"), }, }, Commands: append(local, lcli.CommonCommands...), } app.Setup() - app.Metadata["repoType"] = repo.Miner lcli.RunApp(app) } diff --git a/cmd/run.go b/cmd/run.go index eea0f7f..c466753 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -26,8 +26,8 @@ import ( "github.com/filecoin-project/venus-miner/lib/tracing" "github.com/filecoin-project/venus-miner/node" "github.com/filecoin-project/venus-miner/node/config" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/repo" + "github.com/filecoin-project/venus-miner/types" "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/venus-shared/api" @@ -50,7 +50,6 @@ var runCmd = &cli.Command{ Name: "api-max-req-size", Usage: "maximum API request size accepted by the JSON RPC server", }, - node.CLIFLAGBlockRecord, }, Action: func(cctx *cli.Context) error { log.Info("Initializing build params") @@ -71,7 +70,7 @@ var runCmd = &cli.Command{ return fmt.Errorf("repo at '%s' is not initialized, run 'venus-miner init' to set it up", minerRepoPath) } - lr, err := r.Lock(repo.Miner) + lr, err := r.Lock() if err != nil { return err } @@ -118,12 +117,11 @@ var runCmd = &cli.Command{ var minerAPI lapi.MinerAPI stop, err := node.New(ctx, node.MinerAPI(&minerAPI), - node.Override(new(dtypes.ShutdownChan), shutdownChan), - node.Online(), node.Repo(cctx, r), + node.Override(new(types.ShutdownChan), shutdownChan), node.ApplyIf(func(s *node.Settings) bool { return cctx.IsSet("miner-api") }, - node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) { + node.Override(new(types.APIEndpoint), func() (types.APIEndpoint, error) { return multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/" + cctx.String("miner-api")) })), node.Override(new(v1.FullNode), nodeApi), diff --git a/lib/tracing/setup.go b/lib/tracing/setup.go index e648786..09f0336 100644 --- a/lib/tracing/setup.go +++ b/lib/tracing/setup.go @@ -1,10 +1,11 @@ package tracing import ( + "os" + "contrib.go.opencensus.io/exporter/jaeger" logging "github.com/ipfs/go-log/v2" "go.opencensus.io/trace" - "os" "github.com/filecoin-project/venus-miner/node/config" ) diff --git a/miner/api.go b/miner/api.go index 45a9f08..4821e30 100644 --- a/miner/api.go +++ b/miner/api.go @@ -2,12 +2,11 @@ package miner import ( "context" + "github.com/filecoin-project/venus-miner/types" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-address" - - "github.com/filecoin-project/venus-miner/node/modules/dtypes" ) type MiningAPI interface { @@ -23,11 +22,10 @@ type IMinerMining interface { } type IMinerManager interface { - UpdateAddress(context.Context, int64, int64) ([]dtypes.MinerInfo, error) - ListAddress(context.Context) ([]dtypes.MinerInfo, error) - StatesForMining(context.Context, []address.Address) ([]dtypes.MinerState, error) - CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]dtypes.CountWinners, error) - AddAddress(ctx context.Context, mi dtypes.MinerInfo) error + UpdateAddress(context.Context, int64, int64) ([]types.MinerInfo, error) + ListAddress(context.Context) ([]types.MinerInfo, error) + StatesForMining(context.Context, []address.Address) ([]types.MinerState, error) + CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]types.CountWinners, error) } type MockMinerMgr struct { @@ -35,22 +33,18 @@ type MockMinerMgr struct { var _ IMinerManager = &MockMinerMgr{} -func (m MockMinerMgr) UpdateAddress(context.Context, int64, int64) ([]dtypes.MinerInfo, error) { +func (m MockMinerMgr) UpdateAddress(context.Context, int64, int64) ([]types.MinerInfo, error) { return nil, nil } -func (m MockMinerMgr) ListAddress(context.Context) ([]dtypes.MinerInfo, error) { +func (m MockMinerMgr) ListAddress(context.Context) ([]types.MinerInfo, error) { return nil, nil } -func (m MockMinerMgr) StatesForMining(context.Context, []address.Address) ([]dtypes.MinerState, error) { +func (m MockMinerMgr) StatesForMining(context.Context, []address.Address) ([]types.MinerState, error) { return nil, nil } -func (m MockMinerMgr) CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]dtypes.CountWinners, error) { +func (m MockMinerMgr) CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]types.CountWinners, error) { return nil, nil } - -func (m MockMinerMgr) AddAddress(context.Context, dtypes.MinerInfo) error { - return nil -} diff --git a/miner/minerwpp.go b/miner/minerwpp.go index 6da890e..3b88df9 100644 --- a/miner/minerwpp.go +++ b/miner/minerwpp.go @@ -3,6 +3,7 @@ package miner import ( "context" "fmt" + types2 "github.com/filecoin-project/venus-miner/types" "time" "github.com/filecoin-project/go-address" @@ -12,8 +13,6 @@ import ( "github.com/filecoin-project/venus-miner/api/client" "github.com/filecoin-project/venus-miner/build" "github.com/filecoin-project/venus-miner/node/config" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/pkg/util/ffiwrapper" "github.com/filecoin-project/venus/venus-shared/actors/builtin" @@ -22,7 +21,7 @@ import ( ) type MiningWpp struct { - minerInfo dtypes.MinerInfo + minerInfo types2.MinerInfo gatewayNode *config.GatewayNode verifier ffiwrapper.Verifier @@ -30,7 +29,7 @@ type MiningWpp struct { winnRpt abi.RegisteredPoStProof } -func NewWinningPoStProver(api v1.FullNode, gatewayNode *config.GatewayNode, minerInfo dtypes.MinerInfo, verifier ffiwrapper.Verifier) (*MiningWpp, error) { +func NewWinningPoStProver(api v1.FullNode, gatewayNode *config.GatewayNode, minerInfo types2.MinerInfo, verifier ffiwrapper.Verifier) (*MiningWpp, error) { mi, err := api.StateMinerInfo(context.TODO(), minerInfo.Addr, types.EmptyTSK) if err != nil { return nil, fmt.Errorf("getting sector size: %w", err) diff --git a/miner/multiminer.go b/miner/multiminer.go index 71e053e..5030f98 100644 --- a/miner/multiminer.go +++ b/miner/multiminer.go @@ -6,10 +6,12 @@ import ( "crypto/rand" "encoding/binary" "fmt" - types3 "github.com/filecoin-project/venus-miner/types" + "github.com/filecoin-project/venus-miner/node/modules/miner-manager" "sync" "time" + types3 "github.com/filecoin-project/venus-miner/types" + logging "github.com/ipfs/go-log/v2" "github.com/pkg/errors" "go.opencensus.io/trace" @@ -23,11 +25,8 @@ import ( "github.com/filecoin-project/venus-miner/api/client" "github.com/filecoin-project/venus-miner/build" "github.com/filecoin-project/venus-miner/lib/journal" - "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" - "github.com/filecoin-project/venus-miner/node/modules/block_recorder" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" + "github.com/filecoin-project/venus-miner/node/modules/slashfilter" "github.com/filecoin-project/venus/pkg/chain" "github.com/filecoin-project/venus/pkg/constants" @@ -64,8 +63,8 @@ func randTimeOffset(width time.Duration) time.Duration { // NewMiner instantiates a miner with a concrete WinningPoStProver and a miner // address (which can be different from the worker's address). -func NewMiner(api v1api.FullNode, gtNode *config.GatewayNode, verifier ffiwrapper.Verifier, minerManager minermanage.MinerManageAPI, - sf slashfilter.SlashFilterAPI, j journal.Journal, blockRecord block_recorder.IBlockRecord) *Miner { +func NewMiner(api v1api.FullNode, gtNode *config.GatewayNode, verifier ffiwrapper.Verifier, minerManager miner_manager.MinerManageAPI, + sf slashfilter.SlashFilterAPI, j journal.Journal) *Miner { networkParams, err := api.StateGetNetworkParams(context.TODO()) if err != nil { return nil @@ -96,8 +95,7 @@ func NewMiner(api v1api.FullNode, gtNode *config.GatewayNode, verifier ffiwrappe return func(bool, abi.ChainEpoch, error) {}, 0, nil }, - sf: sf, - blockRecord: blockRecord, + sf: sf, evtTypes: [...]journal.EventType{ evtTypeBlockMined: j.RegisterEventType("miner", "block_mined"), @@ -144,8 +142,7 @@ type Miner struct { lastWork *MiningBase - sf slashfilter.SlashFilterAPI - blockRecord block_recorder.IBlockRecord + sf slashfilter.SlashFilterAPI evtTypes [1]journal.EventType journal journal.Journal @@ -154,7 +151,7 @@ type Miner struct { lkWPP sync.Mutex minerWPPMap map[address.Address]*minerWPP - minerManager minermanage.MinerManageAPI + minerManager miner_manager.MinerManageAPI verifier ffiwrapper.Verifier @@ -481,24 +478,26 @@ minerLoop: // broadcast all blocks for _, b := range blks { go func(bm *types2.BlockMsg) { - if err := m.sf.MinedBlock(ctx, bm.Header, base.TipSet.Height()+base.NullRounds); err != nil { + if exists, err := m.sf.HasBlock(ctx, bm.Header); err != nil { log.Errorf(" SLASH FILTER ERROR: %s", err) return - } - - has := m.blockRecord.Has(bm.Header.Miner, uint64(bm.Header.Height)) - if has { - log.Warnw("Created a block at the same height as another block we've created", "height", bm.Header.Height, "miner", bm.Header.Miner, "parents", bm.Header.Parents) + } else if exists { + log.Error(" SLASH FILTER ERROR: double-fork mining faults") return } - err = m.blockRecord.MarkAsProduced(bm.Header.Miner, uint64(bm.Header.Height)) - if err != nil { - log.Errorf("failed to write db: %s", err) + if err := m.sf.MinedBlock(ctx, bm.Header, base.TipSet.Height()+base.NullRounds); err != nil { + log.Errorf(" SLASH FILTER ERROR: %s", err) + return } if err := m.api.SyncSubmitBlock(ctx, bm); err != nil { log.Errorf("failed to submit newly mined block: %s", err) + return + } + + if err := m.sf.PutBlock(ctx, bm.Header, base.TipSet.Height()+base.NullRounds); err != nil { + log.Errorf(" SLASH FILTER ERROR: %s", err) } }(b) } @@ -884,7 +883,7 @@ func (m *Miner) ManualStop(ctx context.Context, addrs []address.Address) error { return nil } -func (m *Miner) UpdateAddress(ctx context.Context, skip, limit int64) ([]dtypes.MinerInfo, error) { +func (m *Miner) UpdateAddress(ctx context.Context, skip, limit int64) ([]types3.MinerInfo, error) { miners, err := m.minerManager.Update(ctx, skip, limit) if err != nil { return nil, err @@ -907,38 +906,27 @@ func (m *Miner) UpdateAddress(ctx context.Context, skip, limit int64) ([]dtypes. return miners, nil } -func (m *Miner) AddAddress(ctx context.Context, mi dtypes.MinerInfo) error { - epp, err := NewWinningPoStProver(m.api, m.gatewayNode, mi, m.verifier) - if err != nil { - return err - } - - m.minerWPPMap[mi.Addr] = &minerWPP{epp: epp, account: mi.Name, isMining: true} - - return m.minerManager.Put(ctx, mi) -} - -func (m *Miner) ListAddress(ctx context.Context) ([]dtypes.MinerInfo, error) { +func (m *Miner) ListAddress(ctx context.Context) ([]types3.MinerInfo, error) { m.lkWPP.Lock() defer m.lkWPP.Unlock() return m.minerManager.List(ctx) } -func (m *Miner) StatesForMining(ctx context.Context, addrs []address.Address) ([]dtypes.MinerState, error) { +func (m *Miner) StatesForMining(ctx context.Context, addrs []address.Address) ([]types3.MinerState, error) { m.lkWPP.Lock() defer m.lkWPP.Unlock() - res := make([]dtypes.MinerState, 0) + res := make([]types3.MinerState, 0) if len(addrs) > 0 { for _, addr := range addrs { if val, ok := m.minerWPPMap[addr]; ok { - res = append(res, dtypes.MinerState{Addr: addr, IsMining: val.isMining, Err: val.err}) + res = append(res, types3.MinerState{Addr: addr, IsMining: val.isMining, Err: val.err}) } } } else { for k, v := range m.minerWPPMap { - res = append(res, dtypes.MinerState{Addr: k, IsMining: v.isMining, Err: v.err}) + res = append(res, types3.MinerState{Addr: k, IsMining: v.isMining, Err: v.err}) } } @@ -972,20 +960,20 @@ func (m *Miner) winCountInRound(ctx context.Context, account string, mAddr addre return IsRoundWinner(ctx, ts.Height()+1, account, mAddr, rbase, mbi, api) } -func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]dtypes.CountWinners, error) { +func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]types3.CountWinners, error) { log.Infof("count winners, addrs: %v, start: %v, end: %v", addrs, start, end) ts, err := m.api.ChainHead(ctx) if err != nil { log.Error("get chain head", err) - return []dtypes.CountWinners{}, err + return []types3.CountWinners{}, err } if start > ts.Height() || end > ts.Height() { - return []dtypes.CountWinners{}, fmt.Errorf("start or end greater than cur tipset height: %v", ts.Height()) + return []types3.CountWinners{}, fmt.Errorf("start or end greater than cur tipset height: %v", ts.Height()) } - res := make([]dtypes.CountWinners, 0) + res := make([]types3.CountWinners, 0) wg := sync.WaitGroup{} mAddrs := make([]address.Address, 0) @@ -995,7 +983,7 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start if _, ok := m.minerWPPMap[addr]; ok { mAddrs = append(mAddrs, addr) } else { - res = append(res, dtypes.CountWinners{Msg: "miner not exist", Miner: addr}) + res = append(res, types3.CountWinners{Msg: "miner not exist", Miner: addr}) } } } else { @@ -1013,7 +1001,7 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start go func() { defer wg.Done() - winInfo := make([]dtypes.SimpleWinInfo, 0) + winInfo := make([]types3.SimpleWinInfo, 0) totalWinCount := int64(0) var sign SignFunc = nil @@ -1023,13 +1011,13 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start walletAPI, closer, err := client.NewGatewayRPC(ctx, m.gatewayNode) if err != nil { log.Errorf("[%v] create wallet RPC failed: %w", tAddr, err) - res = append(res, dtypes.CountWinners{Msg: err.Error(), Miner: tAddr}) + res = append(res, types3.CountWinners{Msg: err.Error(), Miner: tAddr}) return } defer closer() sign = walletAPI.WalletSign } else { - res = append(res, dtypes.CountWinners{Msg: "miner not exist", Miner: tAddr}) + res = append(res, types3.CountWinners{Msg: "miner not exist", Miner: tAddr}) return } @@ -1048,12 +1036,12 @@ func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start if winner != nil { totalWinCount += winner.WinCount - winInfo = append(winInfo, dtypes.SimpleWinInfo{Epoch: epoch + 1, WinCount: winner.WinCount}) + winInfo = append(winInfo, types3.SimpleWinInfo{Epoch: epoch + 1, WinCount: winner.WinCount}) } }(epoch) } wgWin.Wait() - res = append(res, dtypes.CountWinners{Miner: tAddr, TotalWinCount: totalWinCount, WinEpochList: winInfo}) + res = append(res, types3.CountWinners{Miner: tAddr, TotalWinCount: totalWinCount, WinEpochList: winInfo}) }() } wg.Wait() diff --git a/node/builder.go b/node/builder.go index 475bb66..da3f280 100644 --- a/node/builder.go +++ b/node/builder.go @@ -3,32 +3,25 @@ package node import ( "context" "encoding/json" - "errors" "fmt" - types2 "github.com/filecoin-project/venus-miner/types" + "github.com/filecoin-project/venus-miner/node/modules/miner-manager" logging "github.com/ipfs/go-log/v2" metricsi "github.com/ipfs/go-metrics-interface" - "github.com/multiformats/go-multiaddr" "github.com/urfave/cli/v2" "go.uber.org/fx" "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" - "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" "github.com/filecoin-project/venus-miner/node/impl" "github.com/filecoin-project/venus-miner/node/impl/common" "github.com/filecoin-project/venus-miner/node/modules" - "github.com/filecoin-project/venus-miner/node/modules/block_recorder" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/modules/helpers" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" - "github.com/filecoin-project/venus-miner/node/modules/minermanage/auth" - "github.com/filecoin-project/venus-miner/node/modules/minermanage/local" - "github.com/filecoin-project/venus-miner/node/modules/minermanage/mysql" + "github.com/filecoin-project/venus-miner/node/modules/slashfilter" "github.com/filecoin-project/venus-miner/node/repo" + "github.com/filecoin-project/venus-miner/types" "github.com/filecoin-project/venus/pkg/util/ffiwrapper" fwpimpl "github.com/filecoin-project/venus/pkg/util/ffiwrapper/impl" @@ -50,9 +43,6 @@ const ( // the system starts, so that it's available for all other components. InitJournalKey = invoke(iota) - // System processes. - InitMemoryWatchdog - // daemon ExtractApiKey @@ -72,11 +62,6 @@ type Settings struct { // invokes are separate from modules as they can't be referenced by return // type, and must be applied in correct order invokes []fx.Option - - nodeType repo.RepoType - - Online bool // Online option applied - Config bool // Config option applied } func defaults() []Option { @@ -89,46 +74,13 @@ func defaults() []Option { return metricsi.CtxScope(context.Background(), "venus-miner") }), - Override(new(dtypes.ShutdownChan), make(chan struct{})), + Override(new(types.ShutdownChan), make(chan struct{})), } } -func isType(t repo.RepoType) func(s *Settings) bool { - return func(s *Settings) bool { return s.nodeType == t } -} - -// Online sets up basic libp2p node -func Online() Option { - - return Options( - // make sure that online is applied before Config. - // This is important because Config overrides some of Online units - func(s *Settings) error { s.Online = true; return nil }, - ApplyIf(func(s *Settings) bool { return s.Config }, - Error(errors.New("the Online option must be set before Config option")), - ), - - // miner - ApplyIf(isType(repo.Miner)), - ) -} - -// Config sets up constructors based on the provided Config -func ConfigCommon(cfg *config.Common) Option { - return Options( - func(s *Settings) error { s.Config = true; return nil }, - Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) { - return multiaddr.NewMultiaddr(cfg.API.ListenAddress) - }), - Override(SetApiEndpointKey, func(lr repo.LockedRepo, e dtypes.APIEndpoint) error { - return lr.SetAPIEndpoint(e) - }), - ) -} - func Repo(cctx *cli.Context, r repo.Repo) Option { return func(settings *Settings) error { - lr, err := r.Lock(settings.nodeType) + lr, err := r.Lock() if err != nil { return err } @@ -140,104 +92,68 @@ func Repo(cctx *cli.Context, r repo.Repo) Option { return Options( Override(new(repo.LockedRepo), modules.LockedRepo(lr)), // module handles closing - Override(new(dtypes.MetadataDS), modules.Datastore), + Override(new(types.MetadataDS), modules.Datastore), - Override(new(types2.KeyStore), modules.KeyStore), + Override(new(types.KeyStore), modules.KeyStore), - Override(new(*dtypes.APIAlg), modules.APISecret), + Override(new(*types.APIAlg), modules.APISecret), - ApplyIf(isType(repo.Miner), ConfigPostOptions(cctx, c)), + ConfigMinerOptions(cctx, c), )(settings) } } -var ( - CLIFLAGBlockRecord = &cli.StringFlag{ - Name: "block_record", - Usage: "the way to record the blocks that have been generated, optional: local, cache", - EnvVars: []string{"BLOCK_RECORD_WAY"}, - Value: "", - } -) +func newSlashFilterAPI(sfCfg *config.SlashFilterConfig) Option { + return func(settings *Settings) error { + switch slashfilter.BlockStoreType(sfCfg.Type) { + case slashfilter.Local: + Override(new(slashfilter.SlashFilterAPI), slashfilter.NewLocal) + case slashfilter.MySQL: + Override(new(slashfilter.SlashFilterAPI), slashfilter.NewMysql(&sfCfg.MySQL)) + default: -func ConfigPostConfig(cctx *cli.Context, cfg *config.MinerConfig) (*config.MinerConfig, error) { - if cctx.IsSet(CLIFLAGBlockRecord.Name) { - cfg.BlockRecord = cctx.String(CLIFLAGBlockRecord.Name) - } + } - configStr, _ := json.MarshalIndent(cfg, "", "\t") - log.Warnf("final config: \n%v", string(configStr)) - return cfg, nil + return fmt.Errorf("unsupported block store type [%s]", sfCfg.Type) + } } -func ConfigPostOptions(cctx *cli.Context, c interface{}) Option { - postCfg, ok := c.(*config.MinerConfig) +func ConfigMinerOptions(cctx *cli.Context, c interface{}) Option { + cfg, ok := c.(*config.MinerConfig) if !ok { return Error(fmt.Errorf("invalid config from repo, got: %T", c)) } - scfg, err := ConfigPostConfig(cctx, postCfg) - if err != nil { - return Error(fmt.Errorf("error to parse config and flag %v", err)) - } + configStr, _ := json.MarshalIndent(cfg, "", "\t") + log.Infof("final config: \n%v", string(configStr)) + shareOps := Options( - Override(new(*config.MinerConfig), scfg), + Override(new(*config.MinerConfig), cfg), Override(new(api.Common), From(new(common.CommonAPI))), Override(new(ffiwrapper.Verifier), fwpimpl.ProofVerifier), ) - opt, err := PostWinningOptions(scfg) - if err != nil { - return Error(fmt.Errorf("error to constructor poster %v", err)) - } - - return Options( - ConfigCommon(&postCfg.Common), - shareOps, - opt, - ) -} - -func PostWinningOptions(postCfg *config.MinerConfig) (Option, error) { - blockRecordOp, err := newBlockRecord(postCfg.BlockRecord) - if err != nil { - return nil, err - } + minerOps := Options( + newSlashFilterAPI(cfg.SlashFilter), - minerManageAPIOp, err := newMinerManageAPI(postCfg.Db) - if err != nil { - return nil, err - } + Override(new(*config.GatewayNode), cfg.Gateway), - slashFilterAPIOp, err := newSlashFilterAPI(postCfg.Db) - if err != nil { - return nil, err - } + Override(new(miner_manager.MinerManageAPI), miner_manager.NewMinerManager(cfg.Auth.Addr, cfg.Auth.Token)), + Override(new(miner.MiningAPI), modules.NewMinerProcessor), + ) return Options( - blockRecordOp, - minerManageAPIOp, - slashFilterAPIOp, - Override(new(*config.GatewayNode), postCfg.Gateway), - Override(new(miner.MiningAPI), modules.NewWiningPoster), - ), nil + shareOps, + minerOps, + Override(SetApiEndpointKey, func(lr repo.LockedRepo, e types.APIEndpoint) error { + return lr.SetAPIEndpoint(e) + }), + ) } func MinerAPI(out *api.MinerAPI) Option { return Options( - ApplyIf(func(s *Settings) bool { return s.Config }, - Error(errors.New("the Poster option must be set before Config option")), - ), - ApplyIf(func(s *Settings) bool { return s.Online }, - Error(errors.New("the Poster option must be set before Online option")), - ), - - func(s *Settings) error { - s.nodeType = repo.Miner - return nil - }, - func(s *Settings) error { resAPI := &impl.MinerAPI{} s.invokes[ExtractApiKey] = fx.Populate(resAPI) @@ -247,44 +163,6 @@ func MinerAPI(out *api.MinerAPI) Option { ) } -func newMinerManageAPI(dbConfig *config.MinerDbConfig) (Option, error) { - switch dbConfig.Type { - case minermanage.Local: - return Override(new(minermanage.MinerManageAPI), local.NewMinerManger), nil - case minermanage.MySQL: - return Override(new(minermanage.MinerManageAPI), mysql.NewMinerManger(&dbConfig.MySQL)), nil - case minermanage.Auth: - return Override(new(minermanage.MinerManageAPI), auth.NewMinerManager(dbConfig.Auth.ListenAPI, dbConfig.Auth.Token)), nil - default: - - } - - return nil, fmt.Errorf("unsupported db type [%s]", dbConfig.Type) -} - -func newSlashFilterAPI(dbConfig *config.MinerDbConfig) (Option, error) { - switch dbConfig.SFType { - case minermanage.Local: - return Override(new(slashfilter.SlashFilterAPI), slashfilter.NewLocal), nil - case minermanage.MySQL: - return Override(new(slashfilter.SlashFilterAPI), slashfilter.NewMysqlSlashFilter(&dbConfig.MySQL)), nil - default: - - } - - return nil, fmt.Errorf("unsupported db type [%s]", dbConfig.SFType) -} - -func newBlockRecord(t string) (Option, error) { - if t == block_recorder.Local { - return Override(new(block_recorder.IBlockRecord), block_recorder.NewLocalDBRecord), nil - } else if t == block_recorder.Cache { - return Override(new(block_recorder.IBlockRecord), block_recorder.NewCacheRecord), nil - } else { - return nil, fmt.Errorf("unsupport block record type") - } -} - type FullOption = Option type StopFunc func(context.Context) error diff --git a/cli/util/apiinfo.go b/node/config/apiinfo.go similarity index 66% rename from cli/util/apiinfo.go rename to node/config/apiinfo.go index df6c5ff..ea267d4 100644 --- a/cli/util/apiinfo.go +++ b/node/config/apiinfo.go @@ -1,38 +1,22 @@ -package cliutil +package config import ( "net/http" "net/url" - "regexp" - "strings" - logging "github.com/ipfs/go-log/v2" "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr/net" ) -var log = logging.Logger("cliutil") - -var ( - infoWithToken = regexp.MustCompile(`^[a-zA-Z0-9\\-_]+?\\.[a-zA-Z0-9\\-_]+?\\.([a-zA-Z0-9\\-_]+)?:.+$`) -) - type APIInfo struct { Addr string - Token []byte + Token string } -func ParseApiInfo(s string) APIInfo { - var tok []byte - if infoWithToken.Match([]byte(s)) { - sp := strings.SplitN(s, ":", 2) - tok = []byte(sp[0]) - s = sp[1] - } - - return APIInfo{ - Addr: s, - Token: tok, +func defaultAPIInfo() *APIInfo { + return &APIInfo{ + Addr: "/ip4/0.0.0.0/tcp/12308/http", + Token: "", } } @@ -78,6 +62,6 @@ func (a APIInfo) AuthHeader() http.Header { headers.Add("Authorization", "Bearer "+string(a.Token)) return headers } - log.Warn("API Token not set and requested, capabilities might be limited.") + log.Warn("Sealer API Token not set and requested, capabilities might be limited.") return nil } diff --git a/node/config/authdef.go b/node/config/authdef.go deleted file mode 100644 index c6581eb..0000000 --- a/node/config/authdef.go +++ /dev/null @@ -1,13 +0,0 @@ -package config - -type AuthConfig struct { - ListenAPI string // http://[ip]:[port] - Token string -} - -func newDefaultAuthConfig() *AuthConfig { - return &AuthConfig{ - ListenAPI: "", - Token: "", - } -} diff --git a/node/config/def.go b/node/config/def.go index a8656a9..d5fb8d5 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -1,70 +1,13 @@ package config import ( - "encoding" - "net/http" - "net/url" "time" logging "github.com/ipfs/go-log/v2" - "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr/net" ) var log = logging.Logger("config") -// Common is common config between full node and miner -type Common struct { - API API -} - -// API contains configs for API endpoint -type API struct { - ListenAddress string - RemoteListenAddress string - Timeout Duration -} - -type FullNode struct { - ListenAPI string - Token string -} - -func (sn FullNode) DialArgs(version string) (string, error) { - ma, err := multiaddr.NewMultiaddr(sn.ListenAPI) - if err == nil { - _, addr, err := manet.DialArgs(ma) - if err != nil { - return "", err - } - - return "ws://" + addr + "/rpc/" + version, nil - } - - _, err = url.Parse(sn.ListenAPI) - if err != nil { - return "", err - } - return sn.ListenAPI + "/rpc/" + version, nil -} - -func (sn FullNode) AuthHeader() http.Header { - if len(sn.Token) != 0 { - headers := http.Header{} - headers.Add("Authorization", "Bearer "+string(sn.Token)) - return headers - } - log.Warn("Sealer API Token not set and requested, capabilities might be limited.") - return nil -} - -func defFullNode() FullNode { - return FullNode{ - ListenAPI: "/ip4/127.0.0.1/tcp/1234/http", - Token: "", - } -} - type MySQLConfig struct { Conn string `json:"conn"` MaxOpenConn int `json:"maxOpenConn"` // 100 @@ -73,17 +16,19 @@ type MySQLConfig struct { Debug bool `json:"debug"` } -type MinerDbConfig struct { - Type string `json:"type"` - SFType string `json:"sfType"` - MySQL MySQLConfig `json:"mysql"` - Auth *AuthConfig `json:"auth"` +type BlockRecordConfig struct { + Type string `json:"type"` + MySQL MySQLConfig `json:"mysql"` } -func newDefaultMinerDbConfig() *MinerDbConfig { - return &MinerDbConfig{ - Type: "auth", - SFType: "mysql", +type SlashFilterConfig struct { + Type string `json:"type"` + MySQL MySQLConfig `json:"mysql"` +} + +func newSlashFilterConfig() *SlashFilterConfig { + return &SlashFilterConfig{ + Type: "local", MySQL: MySQLConfig{ Conn: "", MaxOpenConn: 100, @@ -91,7 +36,6 @@ func newDefaultMinerDbConfig() *MinerDbConfig { ConnMaxLifeTime: 60, Debug: false, }, - Auth: newDefaultAuthConfig(), } } @@ -118,61 +62,23 @@ func newDefaultTraceConfig() *TraceConfig { } type MinerConfig struct { - Common - - FullNode - - BlockRecord string - - Gateway *GatewayNode `json:"gateway"` + FullNode *APIInfo `json:"fullnode"` + Gateway *GatewayNode `json:"gateway"` + Auth *APIInfo `json:"auth"` - Db *MinerDbConfig `json:"db"` + SlashFilter *SlashFilterConfig Tracing *TraceConfig `json:"tracing"` } -func defCommon() Common { - return Common{ - API: API{ - ListenAddress: "/ip4/127.0.0.1/tcp/1234/http", - Timeout: Duration(30 * time.Second), - }, - } -} - func DefaultMinerConfig() *MinerConfig { minerCfg := &MinerConfig{ - Common: defCommon(), - FullNode: defFullNode(), - BlockRecord: "cache", + FullNode: defaultAPIInfo(), Gateway: newDefaultGatewayNode(), - Db: newDefaultMinerDbConfig(), + Auth: defaultAPIInfo(), + SlashFilter: newSlashFilterConfig(), Tracing: newDefaultTraceConfig(), } - minerCfg.Common.API.ListenAddress = "/ip4/0.0.0.0/tcp/12308/http" //change default address - return minerCfg } - -var _ encoding.TextMarshaler = (*Duration)(nil) -var _ encoding.TextUnmarshaler = (*Duration)(nil) - -// Duration is a wrapper type for time.Duration -// for decoding and encoding from/to TOML -type Duration time.Duration - -// UnmarshalText implements interface for TOML decoding -func (dur *Duration) UnmarshalText(text []byte) error { - d, err := time.ParseDuration(string(text)) - if err != nil { - return err - } - *dur = Duration(d) - return err -} - -func (dur Duration) MarshalText() ([]byte, error) { - d := time.Duration(dur) - return []byte(d.String()), nil -} diff --git a/node/config/load.go b/node/config/load.go index 67ce1bf..54aa1e6 100644 --- a/node/config/load.go +++ b/node/config/load.go @@ -7,7 +7,6 @@ import ( "os" "github.com/BurntSushi/toml" - "github.com/kelseyhightower/envconfig" ) // FromFile loads config from a specified file overriding defaults specified in @@ -33,11 +32,6 @@ func FromReader(reader io.Reader, def interface{}) (interface{}, error) { return nil, err } - err = envconfig.Process("LOTUS", cfg) - if err != nil { - return nil, fmt.Errorf("processing env vars overrides: %s", err) - } - return cfg, nil } diff --git a/node/config/load_test.go b/node/config/load_test.go index 73f9533..a50dbe9 100644 --- a/node/config/load_test.go +++ b/node/config/load_test.go @@ -2,12 +2,10 @@ package config import ( "bytes" + "github.com/stretchr/testify/assert" "io/ioutil" "os" "testing" - "time" - - "github.com/stretchr/testify/assert" ) func TestDecodeNothing(t *testing.T) { @@ -31,11 +29,9 @@ func TestDecodeNothing(t *testing.T) { func TestParitalConfig(t *testing.T) { assert := assert.New(t) cfgString := ` - [API] - Timeout = "10s" + [FullNode] ` expected := DefaultMinerConfig() - expected.API.Timeout = Duration(10 * time.Second) { cfg, err := FromReader(bytes.NewReader([]byte(cfgString)), DefaultMinerConfig()) diff --git a/node/impl/common/common.go b/node/impl/common/common.go index 8638d77..9c77356 100644 --- a/node/impl/common/common.go +++ b/node/impl/common/common.go @@ -3,6 +3,7 @@ package common import ( "context" "fmt" + "github.com/filecoin-project/venus-miner/types" "github.com/gbrlsnchs/jwt/v3" "github.com/google/uuid" @@ -13,8 +14,6 @@ import ( "github.com/filecoin-project/venus-miner/api" "github.com/filecoin-project/venus-miner/build" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - vapi "github.com/filecoin-project/venus/venus-shared/api" ) @@ -23,8 +22,8 @@ var session = uuid.New() type CommonAPI struct { fx.In - APISecret *dtypes.APIAlg - ShutdownChan dtypes.ShutdownChan + APISecret *types.APIAlg + ShutdownChan types.ShutdownChan } type jwtPayload struct { diff --git a/node/impl/miner.go b/node/impl/miner.go index 4ec5bb0..caa28e9 100644 --- a/node/impl/miner.go +++ b/node/impl/miner.go @@ -8,30 +8,28 @@ import ( "github.com/filecoin-project/venus-miner/miner" "github.com/filecoin-project/venus-miner/node/impl/common" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" + "github.com/filecoin-project/venus-miner/types" ) type MinerAPI struct { common.CommonAPI - MinerManager minermanage.MinerManageAPI miner.MiningAPI } -func (m *MinerAPI) UpdateAddress(ctx context.Context, skip int64, limit int64) ([]dtypes.MinerInfo, error) { +func (m *MinerAPI) UpdateAddress(ctx context.Context, skip int64, limit int64) ([]types.MinerInfo, error) { return m.MiningAPI.UpdateAddress(ctx, skip, limit) } -func (m *MinerAPI) ListAddress(ctx context.Context) ([]dtypes.MinerInfo, error) { +func (m *MinerAPI) ListAddress(ctx context.Context) ([]types.MinerInfo, error) { return m.MiningAPI.ListAddress(ctx) } -func (m *MinerAPI) StatesForMining(ctx context.Context, addrs []address.Address) ([]dtypes.MinerState, error) { +func (m *MinerAPI) StatesForMining(ctx context.Context, addrs []address.Address) ([]types.MinerState, error) { return m.MiningAPI.StatesForMining(ctx, addrs) } -func (m *MinerAPI) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]dtypes.CountWinners, error) { +func (m *MinerAPI) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]types.CountWinners, error) { return m.MiningAPI.CountWinners(ctx, addrs, start, end) } @@ -42,7 +40,3 @@ func (m *MinerAPI) Start(ctx context.Context, addrs []address.Address) error { func (m *MinerAPI) Stop(ctx context.Context, addrs []address.Address) error { return m.MiningAPI.ManualStop(ctx, addrs) } - -func (s *MinerAPI) AddAddress(ctx context.Context, mi dtypes.MinerInfo) error { - return s.MiningAPI.AddAddress(ctx, mi) -} diff --git a/node/modules/block_recorder/block_record.go b/node/modules/block_recorder/block_record.go deleted file mode 100644 index a54399a..0000000 --- a/node/modules/block_recorder/block_record.go +++ /dev/null @@ -1,69 +0,0 @@ -package block_recorder - -import ( - "context" - "fmt" - - "github.com/filecoin-project/go-address" - lru "github.com/hashicorp/golang-lru" - "github.com/ipfs/go-datastore" - - "github.com/filecoin-project/venus-miner/node/modules/dtypes" -) - -const ( - Local = "local" - Cache = "cache" - MySQL = "mysql" -) - -type IBlockRecord interface { - MarkAsProduced(miner address.Address, height uint64) error - Has(miner address.Address, height uint64) bool -} - -type LocalDBRecord struct { - da dtypes.MetadataDS -} - -func NewLocalDBRecord(da dtypes.MetadataDS) *LocalDBRecord { - return &LocalDBRecord{da: da} -} - -func (l *LocalDBRecord) MarkAsProduced(ctx context.Context, miner address.Address, height uint64) error { - blkKey := datastore.NewKey(fmt.Sprintf("%s-%d", miner, height)) - return l.da.Put(ctx, blkKey, []byte{1}) -} - -func (l *LocalDBRecord) Has(ctx context.Context, miner address.Address, height uint64) bool { - blkKey := datastore.NewKey(fmt.Sprintf("%s-%d", miner, height)) - has, err := l.da.Has(ctx, blkKey) - if err != nil { - return false - } - return has -} - -type CacheRecord struct { - cache *lru.ARCCache -} - -func NewCacheRecord() (*CacheRecord, error) { - cache, err := lru.NewARC(100000) - if err != nil { - return nil, err - } - return &CacheRecord{cache: cache}, nil -} - -func (c *CacheRecord) MarkAsProduced(miner address.Address, height uint64) error { - blkKey := datastore.NewKey(fmt.Sprintf("%s-%d", miner, height)) - c.cache.Add(blkKey, true) - return nil -} - -func (c *CacheRecord) Has(miner address.Address, height uint64) bool { - blkKey := datastore.NewKey(fmt.Sprintf("%s-%d", miner, height)) - _, has := c.cache.Get(blkKey) - return has -} diff --git a/node/modules/core.go b/node/modules/core.go index 6c3ea85..fa6d49c 100644 --- a/node/modules/core.go +++ b/node/modules/core.go @@ -4,16 +4,16 @@ import ( "crypto/rand" "errors" "fmt" - types2 "github.com/filecoin-project/venus-miner/types" "io" "io/ioutil" + types2 "github.com/filecoin-project/venus-miner/types" + "github.com/filecoin-project/go-jsonrpc/auth" "github.com/gbrlsnchs/jwt/v3" logging "github.com/ipfs/go-log/v2" "github.com/filecoin-project/venus-miner/api" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/repo" ) @@ -30,7 +30,7 @@ type JwtPayload struct { Allow []auth.Permission } -func APISecret(keystore types2.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) { +func APISecret(keystore types2.KeyStore, lr repo.LockedRepo) (*types2.APIAlg, error) { key, err := keystore.Get(JWTSecretName) if errors.Is(err, types2.ErrKeyInfoNotFound) { @@ -67,5 +67,5 @@ func APISecret(keystore types2.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, er return nil, fmt.Errorf("could not get JWT Token: %w", err) } - return (*dtypes.APIAlg)(jwt.NewHS256(key.PrivateKey)), nil + return (*types2.APIAlg)(jwt.NewHS256(key.PrivateKey)), nil } diff --git a/node/modules/miner-manager/api.go b/node/modules/miner-manager/api.go new file mode 100644 index 0000000..f71df73 --- /dev/null +++ b/node/modules/miner-manager/api.go @@ -0,0 +1,17 @@ +package miner_manager + +import ( + "context" + + "github.com/filecoin-project/go-address" + + "github.com/filecoin-project/venus-miner/types" +) + +type MinerManageAPI interface { + Has(ctx context.Context, checkAddr address.Address) bool + Get(ctx context.Context, checkAddr address.Address) *types.MinerInfo + List(ctx context.Context) ([]types.MinerInfo, error) + Update(ctx context.Context, skip, limit int64) ([]types.MinerInfo, error) + Count(ctx context.Context) int +} diff --git a/node/modules/minermanage/auth/auth.go b/node/modules/miner-manager/auth_manager.go similarity index 60% rename from node/modules/minermanage/auth/auth.go rename to node/modules/miner-manager/auth_manager.go index 77bd88d..e7add11 100644 --- a/node/modules/minermanage/auth/auth.go +++ b/node/modules/miner-manager/auth_manager.go @@ -1,4 +1,4 @@ -package auth +package miner_manager import ( "context" @@ -7,30 +7,29 @@ import ( "strconv" "sync" + "github.com/filecoin-project/go-address" "github.com/go-resty/resty/v2" logging "github.com/ipfs/go-log/v2" - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" + "github.com/filecoin-project/venus-miner/types" ) const CoMinersLimit = 200 var log = logging.Logger("auth-miners") -type MinerManagerForAuth struct { +type MinerManage struct { cli *resty.Client token string - miners []dtypes.MinerInfo + miners []types.MinerInfo lk sync.Mutex } -func NewMinerManager(url, token string) func() (minermanage.MinerManageAPI, error) { - return func() (minermanage.MinerManageAPI, error) { +func NewMinerManager(url, token string) func() (MinerManageAPI, error) { + return func() (MinerManageAPI, error) { cli := resty.New().SetHostURL(url).SetHeader("Accept", "application/json") - m := &MinerManagerForAuth{cli: cli, token: token} + m := &MinerManage{cli: cli, token: token} miners, err := m.Update(context.TODO(), 0, 0) if err != nil { @@ -42,20 +41,7 @@ func NewMinerManager(url, token string) func() (minermanage.MinerManageAPI, erro } } -func (m *MinerManagerForAuth) Put(ctx context.Context, mi dtypes.MinerInfo) error { - m.lk.Lock() - defer m.lk.Unlock() - - if m.Has(ctx, mi.Addr) { - log.Warnf("addr %s has exit", mi.Addr) - return nil - } - - m.miners = append(m.miners, mi) - return nil -} - -func (m *MinerManagerForAuth) Has(ctx context.Context, addr address.Address) bool { +func (m *MinerManage) Has(ctx context.Context, addr address.Address) bool { m.lk.Lock() defer m.lk.Unlock() @@ -68,7 +54,7 @@ func (m *MinerManagerForAuth) Has(ctx context.Context, addr address.Address) boo return false } -func (m *MinerManagerForAuth) Get(ctx context.Context, addr address.Address) *dtypes.MinerInfo { +func (m *MinerManage) Get(ctx context.Context, addr address.Address) *types.MinerInfo { m.lk.Lock() defer m.lk.Unlock() @@ -81,14 +67,14 @@ func (m *MinerManagerForAuth) Get(ctx context.Context, addr address.Address) *dt return nil } -func (m *MinerManagerForAuth) List(ctx context.Context) ([]dtypes.MinerInfo, error) { +func (m *MinerManage) List(ctx context.Context) ([]types.MinerInfo, error) { m.lk.Lock() defer m.lk.Unlock() return m.miners, nil } -func (m *MinerManagerForAuth) Update(ctx context.Context, skip, limit int64) ([]dtypes.MinerInfo, error) { +func (m *MinerManage) Update(ctx context.Context, skip, limit int64) ([]types.MinerInfo, error) { if limit == 0 { limit = CoMinersLimit } @@ -96,7 +82,7 @@ func (m *MinerManagerForAuth) Update(ctx context.Context, skip, limit int64) ([] if err != nil { return nil, err } - var mInfos = make([]dtypes.MinerInfo, 0) + var mInfos = make([]types.MinerInfo, 0) for _, u := range users { if u.State != 1 { @@ -115,7 +101,7 @@ func (m *MinerManagerForAuth) Update(ctx context.Context, skip, limit int64) ([] continue } - mInfos = append(mInfos, dtypes.MinerInfo{ + mInfos = append(mInfos, types.MinerInfo{ Addr: addr, Id: u.ID, Name: u.Name, @@ -128,17 +114,15 @@ func (m *MinerManagerForAuth) Update(ctx context.Context, skip, limit int64) ([] return m.miners, nil } -func (m *MinerManagerForAuth) Count(ctx context.Context) int { +func (m *MinerManage) Count(ctx context.Context) int { m.lk.Lock() defer m.lk.Unlock() return len(m.miners) } -var _ minermanage.MinerManageAPI = &MinerManagerForAuth{} - -func (m *MinerManagerForAuth) listUsers(skip, limit int64) ([]*dtypes.User, error) { - var users []*dtypes.User +func (m *MinerManage) listUsers(skip, limit int64) ([]*types.User, error) { + var users []*types.User resp, err := m.cli.R().SetQueryParams(map[string]string{ "skip": strconv.FormatInt(skip, 10), "limit": strconv.FormatInt(limit, 10), @@ -147,20 +131,20 @@ func (m *MinerManagerForAuth) listUsers(skip, limit int64) ([]*dtypes.User, erro return nil, err } if resp.StatusCode() == http.StatusOK { - return *(resp.Result().(*[]*dtypes.User)), nil + return *(resp.Result().(*[]*types.User)), nil } return nil, resp.Error().(*apiErr).Err() } -func (m *MinerManagerForAuth) listMiners(user string) ([]*dtypes.Miner, error) { - var res []*dtypes.Miner +func (m *MinerManage) listMiners(user string) ([]*types.Miner, error) { + var res []*types.Miner resp, err := m.cli.R().SetQueryParams(map[string]string{"user": user}). SetResult(&res).SetError(&apiErr{}).Get("/miner/list-by-user") if err != nil { return nil, err } if resp.StatusCode() == http.StatusOK { - return *(resp.Result().(*[]*dtypes.Miner)), nil + return *(resp.Result().(*[]*types.Miner)), nil } return nil, resp.Error().(*apiErr).Err() } @@ -172,3 +156,5 @@ type apiErr struct { func (err *apiErr) Err() error { return fmt.Errorf(err.Error) } + +var _ MinerManageAPI = &MinerManage{} diff --git a/node/modules/miner.go b/node/modules/miner.go index 2416f6c..97b8f41 100644 --- a/node/modules/miner.go +++ b/node/modules/miner.go @@ -2,30 +2,28 @@ package modules import ( "context" + "github.com/filecoin-project/venus-miner/node/modules/miner-manager" "go.uber.org/fx" "github.com/filecoin-project/venus-miner/lib/journal" "github.com/filecoin-project/venus-miner/miner" - "github.com/filecoin-project/venus-miner/miner/slashfilter" "github.com/filecoin-project/venus-miner/node/config" - "github.com/filecoin-project/venus-miner/node/modules/block_recorder" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" + "github.com/filecoin-project/venus-miner/node/modules/slashfilter" "github.com/filecoin-project/venus/pkg/util/ffiwrapper" - v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" + fullnode "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) -func NewWiningPoster(lc fx.Lifecycle, - api v1api.FullNode, +func NewMinerProcessor(lc fx.Lifecycle, + api fullnode.FullNode, gtNode *config.GatewayNode, sfAPI slashfilter.SlashFilterAPI, verifier ffiwrapper.Verifier, - minerManager minermanage.MinerManageAPI, + minerManager miner_manager.MinerManageAPI, j journal.Journal, - blockRecord block_recorder.IBlockRecord, ) (miner.MiningAPI, error) { - m := miner.NewMiner(api, gtNode, verifier, minerManager, sfAPI, j, blockRecord) + m := miner.NewMiner(api, gtNode, verifier, minerManager, sfAPI, j) lc.Append(fx.Hook{ OnStart: func(ctx context.Context) error { diff --git a/node/modules/minermanage/local/local.go b/node/modules/minermanage/local/local.go deleted file mode 100644 index 7abc40c..0000000 --- a/node/modules/minermanage/local/local.go +++ /dev/null @@ -1,225 +0,0 @@ -package local - -import ( - "context" - "encoding/json" - "fmt" - "sync" - - "github.com/ipfs/go-datastore" - logging "github.com/ipfs/go-log/v2" - - "github.com/filecoin-project/go-address" - - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" -) - -var log = logging.Logger("local_minermgr") - -const actorKey = "miner-actors" -const defaultKey = "default-actor" - -var ErrNoDefault = fmt.Errorf("not set default key") - -type MinerManager struct { - miners []dtypes.MinerInfo - - da dtypes.MetadataDS - lk sync.Mutex -} - -func NewMinerManger(ds dtypes.MetadataDS) (minermanage.MinerManageAPI, error) { - addrBytes, err := ds.Get(context.TODO(), datastore.NewKey(actorKey)) - if err != nil && err != datastore.ErrNotFound { - return nil, err - } - - var miners []dtypes.MinerInfo - - if err != datastore.ErrNotFound { - err = json.Unmarshal(addrBytes, &miners) - if err != nil { - return nil, err - } - } - - return &MinerManager{da: ds, miners: miners}, nil -} - -func (m *MinerManager) Put(ctx context.Context, miner dtypes.MinerInfo) error { - m.lk.Lock() - defer m.lk.Unlock() - - if m.Has(ctx, miner.Addr) { - log.Warnf("addr %s has exit", miner.Addr) - return nil - } - - newMiner := append(m.miners, miner) - addrBytes, err := json.Marshal(newMiner) - if err != nil { - return err - } - err = m.da.Put(ctx, datastore.NewKey(actorKey), addrBytes) - if err != nil { - return err - } - - m.miners = newMiner - return nil -} - -func (m *MinerManager) Set(ctx context.Context, miner dtypes.MinerInfo) error { - m.lk.Lock() - defer m.lk.Unlock() - - for _, addr := range m.miners { - if addr.Addr.String() == miner.Addr.String() { - //if miner.Sealer.ListenAPI != "" && miner.Sealer.ListenAPI != m.miners[k].Sealer.ListenAPI { - // m.miners[k].Sealer.ListenAPI = miner.Sealer.ListenAPI - //} - // - //if miner.Sealer.Token != "" && miner.Sealer.Token != m.miners[k].Sealer.Token { - // m.miners[k].Sealer.Token = miner.Sealer.Token - //} - // - //if miner.Wallet.ListenAPI != "" && miner.Wallet.ListenAPI != m.miners[k].Wallet.ListenAPI { - // m.miners[k].Wallet.ListenAPI = miner.Wallet.ListenAPI - //} - // - //if miner.Wallet.Token != "" && miner.Wallet.Token != m.miners[k].Wallet.Token { - // m.miners[k].Wallet.Token = miner.Wallet.Token - //} - - addrBytes, err := json.Marshal(m.miners) - if err != nil { - return err - } - - err = m.da.Put(ctx, datastore.NewKey(actorKey), addrBytes) - if err != nil { - return err - } - - break - } - } - - return nil -} - -func (m *MinerManager) Has(ctx context.Context, addr address.Address) bool { - for _, miner := range m.miners { - if miner.Addr.String() == addr.String() { - return true - } - } - - return false -} - -func (m *MinerManager) Get(ctx context.Context, addr address.Address) *dtypes.MinerInfo { - m.lk.Lock() - defer m.lk.Unlock() - - for k := range m.miners { - if m.miners[k].Addr.String() == addr.String() { - return &m.miners[k] - } - } - - return nil -} - -func (m *MinerManager) List(ctx context.Context) ([]dtypes.MinerInfo, error) { - m.lk.Lock() - defer m.lk.Unlock() - - return m.miners, nil -} - -func (m *MinerManager) Remove(ctx context.Context, rmAddr address.Address) error { - m.lk.Lock() - defer m.lk.Unlock() - - if !m.Has(ctx, rmAddr) { - return nil - } - - var newMiners []dtypes.MinerInfo - for _, miner := range m.miners { - if miner.Addr.String() != rmAddr.String() { - newMiners = append(newMiners, miner) - } - } - - addrBytes, err := json.Marshal(newMiners) - if err != nil { - return err - } - err = m.da.Put(ctx, datastore.NewKey(actorKey), addrBytes) - if err != nil { - return err - } - - m.miners = newMiners - - //rm default if rmAddr == defaultAddr - defaultAddr, err := m.Default(ctx) - if err != nil { - if err == ErrNoDefault { - return nil - } - return err - } - - if rmAddr == defaultAddr { - err := m.rmDefault(ctx) - if err != nil { - return err - } - } - - return nil -} - -func (m *MinerManager) rmDefault(ctx context.Context) error { - return m.da.Delete(ctx, datastore.NewKey(defaultKey)) -} - -func (m *MinerManager) SetDefault(ctx context.Context, addr address.Address) error { - return m.da.Put(ctx, datastore.NewKey(defaultKey), addr.Bytes()) -} - -func (m *MinerManager) Default(ctx context.Context) (address.Address, error) { - bytes, err := m.da.Get(ctx, datastore.NewKey(defaultKey)) - if err != nil { - // set the address with index 0 as the default address - if len(m.miners) == 0 { - return address.Undef, ErrNoDefault - } - - err = m.SetDefault(ctx, m.miners[0].Addr) - if err != nil { - return address.Undef, err - } - - return m.miners[0].Addr, nil - } - - return address.NewFromBytes(bytes) -} - -func (m *MinerManager) Update(ctx context.Context, skip, limit int64) ([]dtypes.MinerInfo, error) { - return nil, nil -} - -func (m *MinerManager) Count(ctx context.Context) int { - m.lk.Lock() - defer m.lk.Unlock() - - return len(m.miners) -} - -var _ minermanage.MinerManageAPI = &MinerManager{} diff --git a/node/modules/minermanage/minermanger.go b/node/modules/minermanage/minermanger.go deleted file mode 100644 index baf085d..0000000 --- a/node/modules/minermanage/minermanger.go +++ /dev/null @@ -1,26 +0,0 @@ -package minermanage - -import ( - "context" - - "github.com/filecoin-project/go-address" - - "github.com/filecoin-project/venus-miner/node/modules/dtypes" -) - -const ( - Local = "local" - MySQL = "mysql" - Auth = "auth" -) - -type MinerManageAPI interface { - Put(ctx context.Context, addr dtypes.MinerInfo) error - //Set(ctx context.Context, addr dtypes.MinerInfo) error - Has(ctx context.Context, checkAddr address.Address) bool - Get(ctx context.Context, checkAddr address.Address) *dtypes.MinerInfo - List(ctx context.Context) ([]dtypes.MinerInfo, error) - Update(ctx context.Context, skip, limit int64) ([]dtypes.MinerInfo, error) - //Remove(ctx context.Context, rmAddr address.Address) error - Count(ctx context.Context) int -} diff --git a/node/modules/minermanage/mysql/mysql.go b/node/modules/minermanage/mysql/mysql.go deleted file mode 100644 index 305858f..0000000 --- a/node/modules/minermanage/mysql/mysql.go +++ /dev/null @@ -1,204 +0,0 @@ -package mysql - -import ( - "context" - "fmt" - "sync" - "time" - - logging "github.com/ipfs/go-log/v2" - "gorm.io/driver/mysql" - "gorm.io/gorm" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/venus-miner/node/config" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus-miner/node/modules/minermanage" -) - -var log = logging.Logger("mysql") - -type mysqlMinerInfo struct { - Addr string `gorm:"column:addr;type:varchar(20);uniqueIndex;NOT NULL"` - Name string `gorm:"column:name;type:varchar(50);"` - Comment string `gorm:"column:comment;type:varchar(50);"` - State int `gorm:"column:state;type:int(10);comment:'0 for init,1 for active'"` - CreateTime uint64 `gorm:"column:create_time;not null;type:bigint(20) unsigned" json:"createTime"` - UpdateTime uint64 `gorm:"column:update_time;not null;type:bigint(20) unsigned" json:"updateTime"` -} - -func (m *mysqlMinerInfo) TableName() string { - return "miner_infos" -} - -type MinerManagerForMySQL struct { - miners []dtypes.MinerInfo - - _db *gorm.DB - lk sync.Mutex -} - -func NewMinerManger(cfg *config.MySQLConfig) func() (minermanage.MinerManageAPI, error) { - return func() (minermanage.MinerManageAPI, error) { - // root:123456@tcp(ip:3306)/venus_miner?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s - db, err := gorm.Open(mysql.Open(cfg.Conn), &gorm.Config{ - //Logger: logger.Default.LogMode(logger.Info), - }) - if err != nil { - return nil, fmt.Errorf("[db connection failed] conn: %s %w", cfg.Conn, err) - } - - db.Set("gorm:table_options", "CHARSET=utf8mb4") - if cfg.Debug { - db = db.Debug() - } - - if err := db.AutoMigrate(mysqlMinerInfo{}); err != nil { - return nil, err - } - - sqlDB, err := db.DB() - if err != nil { - return nil, err - } - - // Set the maximum number of idle connections in the connection pool. - sqlDB.SetMaxIdleConns(cfg.MaxIdleConn) - // Set the maximum number of open database connections. - sqlDB.SetMaxOpenConns(cfg.MaxOpenConn) - // The maximum time that the connection can be reused is set. - sqlDB.SetConnMaxLifetime(time.Second * cfg.ConnMaxLifeTime) - - log.Info("init mysql success for MinerManger!") - m := &MinerManagerForMySQL{ - _db: db, - } - - if err := m.init(); err != nil { - return nil, err - } - - return m, nil - } -} - -func (m *MinerManagerForMySQL) init() error { - var res []mysqlMinerInfo - if err := m._db.Find(&res).Error; err != nil { - return err - } - - for _, val := range res { - addr, err := address.NewFromString(val.Addr) - if err != nil { - return err - } - m.miners = append(m.miners, dtypes.MinerInfo{ - Addr: addr, - }) - } - - return nil -} - -func (m *MinerManagerForMySQL) Put(ctx context.Context, miner dtypes.MinerInfo) error { - m.lk.Lock() - defer m.lk.Unlock() - - err := m._db.Create(&mysqlMinerInfo{Addr: miner.Addr.String()}).Error - if err != nil { - return err - } - - m.miners = append(m.miners, miner) - return nil -} - -func (m *MinerManagerForMySQL) Set(ctx context.Context, miner dtypes.MinerInfo) error { - m.lk.Lock() - defer m.lk.Unlock() - - for _, addr := range m.miners { - if addr.Addr.String() == miner.Addr.String() { - // ToDo other changes - - err := m.Put(ctx, miner) - if err != nil { - return err - } - break - } - } - - return nil -} - -func (m *MinerManagerForMySQL) Has(ctx context.Context, addr address.Address) bool { - for _, miner := range m.miners { - if miner.Addr.String() == addr.String() { - return true - } - } - - return false -} - -func (m *MinerManagerForMySQL) Get(ctx context.Context, addr address.Address) *dtypes.MinerInfo { - m.lk.Lock() - defer m.lk.Unlock() - - for k := range m.miners { - if m.miners[k].Addr.String() == addr.String() { - return &m.miners[k] - } - } - - return nil -} - -func (m *MinerManagerForMySQL) List(ctx context.Context) ([]dtypes.MinerInfo, error) { - m.lk.Lock() - defer m.lk.Unlock() - - return m.miners, nil -} - -func (m *MinerManagerForMySQL) Remove(ctx context.Context, rmAddr address.Address) error { - m.lk.Lock() - defer m.lk.Unlock() - - if !m.Has(ctx, rmAddr) { - return nil - } - - var res mysqlMinerInfo - m._db.Where("`addr` = ?", rmAddr.String()).Take(&res) - - if err := m._db.Delete(&res).Error; err != nil { - return err - } - - var newMiners []dtypes.MinerInfo - for _, miner := range m.miners { - if miner.Addr.String() != rmAddr.String() { - newMiners = append(newMiners, miner) - } - } - - m.miners = newMiners - - return nil -} - -func (m *MinerManagerForMySQL) Update(ctx context.Context, skip, limit int64) ([]dtypes.MinerInfo, error) { - return nil, nil -} - -func (m *MinerManagerForMySQL) Count(ctx context.Context) int { - m.lk.Lock() - defer m.lk.Unlock() - - return len(m.miners) -} - -var _ minermanage.MinerManageAPI = &MinerManagerForMySQL{} diff --git a/node/modules/services.go b/node/modules/services.go index 46abd2f..5781ce1 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -2,6 +2,7 @@ package modules import ( "context" + "go.uber.org/fx" "github.com/filecoin-project/venus-miner/lib/journal" diff --git a/node/modules/slashfilter/api.go b/node/modules/slashfilter/api.go new file mode 100644 index 0000000..efabcae --- /dev/null +++ b/node/modules/slashfilter/api.go @@ -0,0 +1,22 @@ +package slashfilter + +import ( + "context" + + "github.com/filecoin-project/go-state-types/abi" + + vtypes "github.com/filecoin-project/venus/venus-shared/types" +) + +type BlockStoreType string + +const ( + Local BlockStoreType = "local" + MySQL BlockStoreType = "mysql" +) + +type SlashFilterAPI interface { + HasBlock(ctx context.Context, bh *vtypes.BlockHeader) (bool, error) + MinedBlock(ctx context.Context, bh *vtypes.BlockHeader, parentEpoch abi.ChainEpoch) error + PutBlock(ctx context.Context, bh *vtypes.BlockHeader, parentEpoch abi.ChainEpoch) error +} diff --git a/miner/slashfilter/slashfilter.go b/node/modules/slashfilter/local.go similarity index 55% rename from miner/slashfilter/slashfilter.go rename to node/modules/slashfilter/local.go index 093fee8..567ee36 100644 --- a/miner/slashfilter/slashfilter.go +++ b/node/modules/slashfilter/local.go @@ -5,45 +5,52 @@ import ( "fmt" "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" - "github.com/filecoin-project/venus/venus-shared/types" + vtypes "github.com/filecoin-project/venus/venus-shared/types" + + "github.com/filecoin-project/venus-miner/types" ) -type SlashFilterAPI interface { - MinedBlock(context.Context, *types.BlockHeader, abi.ChainEpoch) error +type localSlashFilter struct { + byEpoch datastore.Datastore // double-fork mining faults, parent-grinding fault + byParents datastore.Datastore // time-offset mining faults } -type SlashFilter struct { - byEpoch ds.Datastore // double-fork mining faults, parent-grinding fault - byParents ds.Datastore // time-offset mining faults +func NewLocal(ds types.MetadataDS) SlashFilterAPI { + return &localSlashFilter{ + byEpoch: namespace.Wrap(ds, datastore.NewKey("/slashfilter/epoch")), + byParents: namespace.Wrap(ds, datastore.NewKey("/slashfilter/parents")), + } } -func NewLocal(ds dtypes.MetadataDS) SlashFilterAPI { - return New(ds) +func (f *localSlashFilter) HasBlock(ctx context.Context, bh *vtypes.BlockHeader) (bool, error) { + epochKey := datastore.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, bh.Height)) + + return f.byEpoch.Has(ctx, epochKey) } -func New(dstore ds.Batching) *SlashFilter { - return &SlashFilter{ - byEpoch: namespace.Wrap(dstore, ds.NewKey("/slashfilter/epoch")), - byParents: namespace.Wrap(dstore, ds.NewKey("/slashfilter/parents")), +func (f *localSlashFilter) PutBlock(ctx context.Context, bh *vtypes.BlockHeader, parentEpoch abi.ChainEpoch) error { + parentsKey := datastore.NewKey(fmt.Sprintf("/%s/%x", bh.Miner, vtypes.NewTipSetKey(bh.Parents...).Bytes())) + if err := f.byParents.Put(ctx, parentsKey, bh.Cid().Bytes()); err != nil { + return fmt.Errorf("putting byEpoch entry: %w", err) } -} -func (f *SlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { - epochKey := ds.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, bh.Height)) - { - // double-fork mining (2 blocks at one epoch) - if err := checkFault(ctx, f.byEpoch, epochKey, bh, "double-fork mining faults"); err != nil { - return err - } + epochKey := datastore.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, bh.Height)) + if err := f.byEpoch.Put(ctx, epochKey, bh.Cid().Bytes()); err != nil { + return fmt.Errorf("putting byEpoch entry: %w", err) } - parentsKey := ds.NewKey(fmt.Sprintf("/%s/%x", bh.Miner, types.NewTipSetKey(bh.Parents...).Bytes())) + return nil +} + +func (f *localSlashFilter) MinedBlock(ctx context.Context, bh *vtypes.BlockHeader, parentEpoch abi.ChainEpoch) error { + // double-fork mining (2 blocks at one epoch) --> HasBlock + + parentsKey := datastore.NewKey(fmt.Sprintf("/%s/%x", bh.Miner, vtypes.NewTipSetKey(bh.Parents...).Bytes())) { // time-offset mining faults (2 blocks with the same parents) if err := checkFault(ctx, f.byParents, parentsKey, bh, "time-offset mining faults"); err != nil { @@ -55,7 +62,7 @@ func (f *SlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, par // parent-grinding fault (didn't mine on top of our own block) // First check if we have mined a block on the parent epoch - parentEpochKey := ds.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, parentEpoch)) + parentEpochKey := datastore.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, parentEpoch)) have, err := f.byEpoch.Has(ctx, parentEpochKey) if err != nil { return err @@ -86,18 +93,10 @@ func (f *SlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, par } } - if err := f.byParents.Put(ctx, parentsKey, bh.Cid().Bytes()); err != nil { - return fmt.Errorf("putting byEpoch entry: %w", err) - } - - if err := f.byEpoch.Put(ctx, epochKey, bh.Cid().Bytes()); err != nil { - return fmt.Errorf("putting byEpoch entry: %w", err) - } - return nil } -func checkFault(ctx context.Context, t ds.Datastore, key ds.Key, bh *types.BlockHeader, faultType string) error { +func checkFault(ctx context.Context, t datastore.Datastore, key datastore.Key, bh *vtypes.BlockHeader, faultType string) error { fault, err := t.Has(ctx, key) if err != nil { return err diff --git a/miner/slashfilter/mysql_slashfilter.go b/node/modules/slashfilter/mysql.go similarity index 74% rename from miner/slashfilter/mysql_slashfilter.go rename to node/modules/slashfilter/mysql.go index c479696..1ba1e1d 100644 --- a/miner/slashfilter/mysql_slashfilter.go +++ b/node/modules/slashfilter/mysql.go @@ -19,7 +19,7 @@ import ( var log = logging.Logger("mysql_slashFilter") -type MysqlSlashFilter struct { +type mysqlSlashFilter struct { _db *gorm.DB } @@ -27,18 +27,18 @@ type MinedBlock struct { ParentEpoch int64 `gorm:"column:parent_epoch;type:bigint(20);NOT NULL"` ParentKey string `gorm:"column:parent_key;type:varchar(256);NOT NULL"` - Epoch int64 `gorm:"column:epoch;type:bigint(20);NOT NULL"` - Miner string `gorm:"column:miner;type:varchar(256);NOT NULL"` - Cid string `gorm:"column:cid;type:varchar(256);NOT NULL"` + Epoch int64 `gorm:"column:epoch;type:bigint(20);NOT NULL;primary_key"` + Miner string `gorm:"column:miner;type:varchar(256);NOT NULL;primary_key"` + Cid string `gorm:"column:cid;type:varchar(256)"` } func (m *MinedBlock) TableName() string { return "miner_blocks" } -var _ SlashFilterAPI = (*MysqlSlashFilter)(nil) +var _ SlashFilterAPI = (*mysqlSlashFilter)(nil) -func NewMysqlSlashFilter(cfg *config.MySQLConfig) func() (SlashFilterAPI, error) { +func NewMysql(cfg *config.MySQLConfig) func() (SlashFilterAPI, error) { return func() (SlashFilterAPI, error) { db, err := gorm.Open(mysql.Open(cfg.Conn)) if err != nil { @@ -67,19 +67,22 @@ func NewMysqlSlashFilter(cfg *config.MySQLConfig) func() (SlashFilterAPI, error) sqlDB.SetConnMaxLifetime(time.Second * cfg.ConnMaxLifeTime) log.Info("init mysql success for mysqlSlashFilter!") - return &MysqlSlashFilter{ + return &mysqlSlashFilter{ _db: db, }, nil } } // double-fork mining (2 blocks at one epoch) -func (f *MysqlSlashFilter) checkSameHeightFault(bh *types.BlockHeader) error { +func (f *mysqlSlashFilter) checkSameHeightFault(bh *types.BlockHeader) error { // nolint: unused var bk MinedBlock err := f._db.Model(&MinedBlock{}).Take(&bk, "miner=? and epoch=?", bh.Miner.String(), bh.Height).Error if err == gorm.ErrRecordNotFound { return nil } + if err != nil { + return err + } other, err := cid.Decode(bk.Cid) if err != nil { @@ -91,16 +94,18 @@ func (f *MysqlSlashFilter) checkSameHeightFault(bh *types.BlockHeader) error { } return fmt.Errorf("produced block would trigger double-fork mining faults consensus fault; miner: %s; bh: %s, other: %s", bh.Miner, bh.Cid(), other) - } // time-offset mining faults (2 blocks with the same parents) -func (f *MysqlSlashFilter) checkSameParentFault(bh *types.BlockHeader) error { +func (f *mysqlSlashFilter) checkSameParentFault(bh *types.BlockHeader) error { var bk MinedBlock err := f._db.Model(&MinedBlock{}).Take(&bk, "miner=? and parent_key=?", bh.Miner.String(), types.NewTipSetKey(bh.Parents...).String()).Error if err == gorm.ErrRecordNotFound { return nil } + if err != nil { + return err + } other, err := cid.Decode(bk.Cid) if err != nil { @@ -112,13 +117,36 @@ func (f *MysqlSlashFilter) checkSameParentFault(bh *types.BlockHeader) error { } return fmt.Errorf("produced block would trigger time-offset mining faults consensus fault; miner: %s; bh: %s, other: %s", bh.Miner, bh.Cid(), other) - } -func (f *MysqlSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { - if err := f.checkSameHeightFault(bh); err != nil { - return err +func (f *mysqlSlashFilter) HasBlock(ctx context.Context, bh *types.BlockHeader) (bool, error) { + var bk MinedBlock + err := f._db.Model(&MinedBlock{}).Take(&bk, "miner=? and epoch=?", bh.Miner.String(), bh.Height).Error + if err == gorm.ErrRecordNotFound { + return false, nil } + if err != nil { + return false, err + } + + return true, nil +} + +func (f *mysqlSlashFilter) PutBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { + return f._db.Save(&MinedBlock{ + ParentEpoch: int64(parentEpoch), + ParentKey: types.NewTipSetKey(bh.Parents...).String(), + Epoch: int64(bh.Height), + Miner: bh.Miner.String(), + Cid: bh.Cid().String(), + }).Error +} + +func (f *mysqlSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { + // double-fork mining (2 blocks at one epoch) --> HasBlock + //if err := f.checkSameHeightFault(bh); err != nil { + // return err + //} if err := f.checkSameParentFault(bh); err != nil { return err @@ -154,11 +182,5 @@ func (f *MysqlSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader //if not exit good block } - return f._db.Create(&MinedBlock{ - ParentEpoch: int64(parentEpoch), - ParentKey: types.NewTipSetKey(bh.Parents...).String(), - Epoch: int64(bh.Height), - Miner: bh.Miner.String(), - Cid: bh.Cid().String(), - }).Error + return nil } diff --git a/node/modules/storage.go b/node/modules/storage.go index e9cb0b1..41fcf13 100644 --- a/node/modules/storage.go +++ b/node/modules/storage.go @@ -2,11 +2,11 @@ package modules import ( "context" + types2 "github.com/filecoin-project/venus-miner/types" "go.uber.org/fx" - "github.com/filecoin-project/venus-miner/node/modules/dtypes" "github.com/filecoin-project/venus-miner/node/modules/helpers" "github.com/filecoin-project/venus-miner/node/repo" ) @@ -27,7 +27,7 @@ func KeyStore(lr repo.LockedRepo) (types2.KeyStore, error) { return lr.KeyStore() } -func Datastore(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRepo) (dtypes.MetadataDS, error) { +func Datastore(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRepo) (types2.MetadataDS, error) { ctx := helpers.LifecycleCtx(mctx, lc) mds, err := r.Datastore(ctx, "/metadata") if err != nil { diff --git a/node/repo/fsrepo.go b/node/repo/fsrepo.go index b30b309..3265d7b 100644 --- a/node/repo/fsrepo.go +++ b/node/repo/fsrepo.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - types2 "github.com/filecoin-project/venus-miner/types" "io" "io/ioutil" "os" @@ -22,6 +21,7 @@ import ( "github.com/multiformats/go-multiaddr" "github.com/filecoin-project/venus-miner/node/config" + "github.com/filecoin-project/venus-miner/types" ) const ( @@ -33,22 +33,6 @@ const ( fsKeystore = "keystore" ) -type RepoType int - -const ( - _ = iota // Default is invalid - Miner RepoType = iota -) - -func defConfForType(t RepoType) interface{} { - switch t { - case Miner: - return config.DefaultMinerConfig() - default: - panic(fmt.Sprintf("unknown RepoType(%d)", int(t))) - } -} - var log = logging.Logger("repo") var ErrRepoExists = errors.New("repo exists") @@ -92,7 +76,7 @@ func (fsr *FsRepo) Exists() (bool, error) { //nolint return !notexist, err } -func (fsr *FsRepo) Init(t RepoType) error { +func (fsr *FsRepo) Init() error { exist, err := fsr.Exists() if err != nil { return err @@ -107,7 +91,7 @@ func (fsr *FsRepo) Init(t RepoType) error { return err } - if err := fsr.initConfig(t); err != nil { + if err := fsr.initConfig(); err != nil { return fmt.Errorf("init config: %w", err) } @@ -115,7 +99,7 @@ func (fsr *FsRepo) Init(t RepoType) error { } -func (fsr *FsRepo) initConfig(t RepoType) error { +func (fsr *FsRepo) initConfig() error { _, err := os.Stat(fsr.configPath) if err == nil { // exists @@ -129,7 +113,7 @@ func (fsr *FsRepo) initConfig(t RepoType) error { return err } - comm, err := config.ConfigComment(defConfForType(t)) + comm, err := config.ConfigComment(config.DefaultMinerConfig()) if err != nil { return fmt.Errorf("comment: %w", err) } @@ -225,11 +209,11 @@ func (fsr *FsRepo) APIToken() ([]byte, error) { } func (fsr *FsRepo) Config() (interface{}, error) { - return config.FromFile(fsr.configPath, defConfForType(Miner)) + return config.FromFile(fsr.configPath, config.DefaultMinerConfig()) } // Lock acquires exclusive lock on this repo -func (fsr *FsRepo) Lock(repoType RepoType) (LockedRepo, error) { +func (fsr *FsRepo) Lock() (LockedRepo, error) { locked, err := fslock.Locked(fsr.path, fsLock) if err != nil { return nil, fmt.Errorf("could not check lock status: %w", err) @@ -245,26 +229,13 @@ func (fsr *FsRepo) Lock(repoType RepoType) (LockedRepo, error) { return &fsLockedRepo{ path: fsr.path, configPath: fsr.configPath, - repoType: repoType, closer: closer, }, nil } -// Like Lock, except datastores will work in read-only mode -func (fsr *FsRepo) LockRO(repoType RepoType) (LockedRepo, error) { - lr, err := fsr.Lock(repoType) - if err != nil { - return nil, err - } - - lr.(*fsLockedRepo).readonly = true - return lr, nil -} - type fsLockedRepo struct { path string configPath string - repoType RepoType closer io.Closer readonly bool @@ -321,7 +292,7 @@ func (fsr *fsLockedRepo) Config() (interface{}, error) { } func (fsr *fsLockedRepo) loadConfigFromDisk() (interface{}, error) { - return config.FromFile(fsr.configPath, defConfForType(fsr.repoType)) + return config.FromFile(fsr.configPath, config.DefaultMinerConfig()) } func (fsr *fsLockedRepo) SetConfig(c func(interface{})) error { @@ -372,7 +343,7 @@ func (fsr *fsLockedRepo) SetAPIToken(token []byte) error { return ioutil.WriteFile(fsr.join(fsAPIToken), token, 0600) } -func (fsr *fsLockedRepo) KeyStore() (types2.KeyStore, error) { +func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) { if err := fsr.stillValid(); err != nil { return nil, err } @@ -413,9 +384,9 @@ func (fsr *fsLockedRepo) List() ([]string, error) { } // Get gets a key out of keystore and returns types.KeyInfo coresponding to named key -func (fsr *fsLockedRepo) Get(name string) (types2.KeyInfo, error) { +func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) { if err := fsr.stillValid(); err != nil { - return types2.KeyInfo{}, err + return types.KeyInfo{}, err } encName := base32.RawStdEncoding.EncodeToString([]byte(name)) @@ -423,37 +394,37 @@ func (fsr *fsLockedRepo) Get(name string) (types2.KeyInfo, error) { fstat, err := os.Stat(keyPath) if os.IsNotExist(err) { - return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, types2.ErrKeyInfoNotFound) + return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, types.ErrKeyInfoNotFound) } else if err != nil { - return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) + return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) } if fstat.Mode()&0077 != 0 { - return types2.KeyInfo{}, fmt.Errorf(kstrPermissionMsg, name, fstat.Mode()) + return types.KeyInfo{}, fmt.Errorf(kstrPermissionMsg, name, fstat.Mode()) } file, err := os.Open(keyPath) if err != nil { - return types2.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) + return types.KeyInfo{}, fmt.Errorf("opening key '%s': %w", name, err) } defer file.Close() //nolint: errcheck // read only op data, err := ioutil.ReadAll(file) if err != nil { - return types2.KeyInfo{}, fmt.Errorf("reading key '%s': %w", name, err) + return types.KeyInfo{}, fmt.Errorf("reading key '%s': %w", name, err) } - var res types2.KeyInfo + var res types.KeyInfo err = json.Unmarshal(data, &res) if err != nil { - return types2.KeyInfo{}, fmt.Errorf("decoding key '%s': %w", name, err) + return types.KeyInfo{}, fmt.Errorf("decoding key '%s': %w", name, err) } return res, nil } // Put saves key info under given name -func (fsr *fsLockedRepo) Put(name string, info types2.KeyInfo) error { +func (fsr *fsLockedRepo) Put(name string, info types.KeyInfo) error { if err := fsr.stillValid(); err != nil { return err } @@ -463,7 +434,7 @@ func (fsr *fsLockedRepo) Put(name string, info types2.KeyInfo) error { _, err := os.Stat(keyPath) if err == nil { - return fmt.Errorf("checking key before put '%s': %w", name, types2.ErrKeyExists) + return fmt.Errorf("checking key before put '%s': %w", name, types.ErrKeyExists) } else if !os.IsNotExist(err) { return fmt.Errorf("checking key before put '%s': %w", name, err) } @@ -490,7 +461,7 @@ func (fsr *fsLockedRepo) Delete(name string) error { _, err := os.Stat(keyPath) if os.IsNotExist(err) { - return fmt.Errorf("checking key before delete '%s': %w", name, types2.ErrKeyInfoNotFound) + return fmt.Errorf("checking key before delete '%s': %w", name, types.ErrKeyInfoNotFound) } else if err != nil { return fmt.Errorf("checking key before delete '%s': %w", name, err) } diff --git a/node/repo/fsrepo_ds.go b/node/repo/fsrepo_ds.go index d47fe40..5972b3c 100644 --- a/node/repo/fsrepo_ds.go +++ b/node/repo/fsrepo_ds.go @@ -19,11 +19,6 @@ type dsCtor func(path string, readonly bool) (datastore.Batching, error) var fsDatastores = map[string]dsCtor{ "metadata": levelDs, - - // Those need to be fast for large writes... but also need a really good GC :c - "staging": badgerDs, // miner specific - - "client": badgerDs, // client specific } func badgerDs(path string, readonly bool) (datastore.Batching, error) { diff --git a/node/repo/fsrepo_test.go b/node/repo/fsrepo_test.go index 03677be..c9e37db 100644 --- a/node/repo/fsrepo_test.go +++ b/node/repo/fsrepo_test.go @@ -17,7 +17,7 @@ func genFsRepo(t *testing.T) (*FsRepo, func()) { t.Fatal(err) } - err = repo.Init(Miner) + err = repo.Init() if err != ErrRepoExists && err != nil { t.Fatal(err) } diff --git a/node/repo/interface.go b/node/repo/interface.go index d74e862..8f7570f 100644 --- a/node/repo/interface.go +++ b/node/repo/interface.go @@ -3,10 +3,11 @@ package repo import ( "context" "errors" - types2 "github.com/filecoin-project/venus-miner/types" "github.com/ipfs/go-datastore" "github.com/multiformats/go-multiaddr" + + "github.com/filecoin-project/venus-miner/types" ) var ( @@ -22,7 +23,7 @@ type Repo interface { APIToken() ([]byte, error) // Lock locks the repo for exclusive use. - Lock(RepoType) (LockedRepo, error) + Lock() (LockedRepo, error) } type LockedRepo interface { @@ -47,7 +48,7 @@ type LockedRepo interface { SetAPIToken([]byte) error // KeyStore returns store of private keys for Filecoin transactions - KeyStore() (types2.KeyStore, error) + KeyStore() (types.KeyStore, error) // Path returns absolute path of the repo Path() string diff --git a/node/repo/repo_test.go b/node/repo/repo_test.go index 8e1665b..325918a 100644 --- a/node/repo/repo_test.go +++ b/node/repo/repo_test.go @@ -2,9 +2,10 @@ package repo import ( "errors" - types2 "github.com/filecoin-project/venus-miner/types" "testing" + types2 "github.com/filecoin-project/venus-miner/types" + "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/assert" @@ -18,12 +19,12 @@ func basicTest(t *testing.T, repo Repo) { } assert.Nil(t, apima, "with no api endpoint, return should be nil") - lrepo, err := repo.Lock(Miner) + lrepo, err := repo.Lock() assert.NoError(t, err, "should be able to lock once") assert.NotNil(t, lrepo, "locked repo shouldn't be nil") { - lrepo2, err := repo.Lock(Miner) + lrepo2, err := repo.Lock() if assert.Error(t, err) { assert.Equal(t, ErrRepoAlreadyLocked, err) } @@ -33,7 +34,7 @@ func basicTest(t *testing.T, repo Repo) { err = lrepo.Close() assert.NoError(t, err, "should be able to unlock") - lrepo, err = repo.Lock(Miner) + lrepo, err = repo.Lock() assert.NoError(t, err, "should be able to relock") assert.NotNil(t, lrepo, "locked repo shouldn't be nil") @@ -64,7 +65,7 @@ func basicTest(t *testing.T, repo Repo) { k1 := types2.KeyInfo{Type: "foo"} k2 := types2.KeyInfo{Type: "bar"} - lrepo, err = repo.Lock(Miner) + lrepo, err = repo.Lock() assert.NoError(t, err, "should be able to relock") assert.NotNil(t, lrepo, "locked repo shouldn't be nil") diff --git a/node/modules/dtypes/api.go b/types/api.go similarity index 90% rename from node/modules/dtypes/api.go rename to types/api.go index d57b05c..09ee68c 100644 --- a/node/modules/dtypes/api.go +++ b/types/api.go @@ -1,4 +1,4 @@ -package dtypes +package types import ( "github.com/gbrlsnchs/jwt/v3" diff --git a/node/modules/dtypes/miner.go b/types/miner.go similarity index 98% rename from node/modules/dtypes/miner.go rename to types/miner.go index 32d818f..01cc462 100644 --- a/node/modules/dtypes/miner.go +++ b/types/miner.go @@ -1,4 +1,4 @@ -package dtypes +package types import ( "time" diff --git a/node/modules/dtypes/shutdown.go b/types/shutdown.go similarity index 92% rename from node/modules/dtypes/shutdown.go rename to types/shutdown.go index d87c212..d8adcb0 100644 --- a/node/modules/dtypes/shutdown.go +++ b/types/shutdown.go @@ -1,4 +1,4 @@ -package dtypes +package types // ShutdownChan is a channel to which you send a value if you intend to shut // down the daemon (or miner), including the node and RPC server. diff --git a/node/modules/dtypes/storage.go b/types/storage.go similarity index 92% rename from node/modules/dtypes/storage.go rename to types/storage.go index 241a2d8..2f78e02 100644 --- a/node/modules/dtypes/storage.go +++ b/types/storage.go @@ -1,4 +1,4 @@ -package dtypes +package types import ( "github.com/ipfs/go-datastore"