From 7cc32c4ddaf62fea84846cbdf2a5423dd2733d88 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Mon, 12 Oct 2020 01:11:05 -0700 Subject: [PATCH] Various code inspection resolutions (#7438) * remove unused code * remove defer use in loop * Remove unused methods and constants * gofmt and gaz * nilness check * remove unused args * Add TODO for refactoring subscribeWithBase to remove unused arg. It seems too involved to include in this sweeping PR. https://github.com/prysmaticlabs/prysm/issues/7437 * replace empty slice declaration * Remove unnecessary type conversions * remove redundant type declaration * rename receivers to be consistent * Remove bootnode query tool. It is now obsolete by discv5 * Remove relay node. It is no longer used or supported * Revert "Remove relay node. It is no longer used or supported" This reverts commit 4bd7717334dad85ef4766ed9bc4da711fb5fa810. * Delete unused test directory * Delete unsupported gcp startup script * Delete old k8s script * build fixes * fix build * go mod tidy * revert slasher/db/kv/block_header.go * fix build * remove redundant nil check * combine func args Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Victor Farazdagi --- beacon-chain/blockchain/metrics.go | 23 --- .../blockchain/process_attestation.go | 2 +- .../blockchain/process_attestation_helpers.go | 2 +- beacon-chain/blockchain/process_block_test.go | 4 +- beacon-chain/blockchain/testing/mock.go | 30 ++-- beacon-chain/cache/attestation_data.go | 2 +- beacon-chain/cache/checkpoint_state.go | 5 - beacon-chain/cache/common.go | 2 +- beacon-chain/cache/skip_slot_cache.go | 2 +- beacon-chain/cache/subnet_ids.go | 2 +- beacon-chain/core/blocks/attestation.go | 4 +- beacon-chain/core/blocks/attestation_test.go | 2 +- .../core/blocks/attester_slashing_test.go | 4 +- .../core/blocks/block_operations_fuzz_test.go | 10 +- .../core/blocks/block_regression_test.go | 2 +- beacon-chain/core/blocks/deposit.go | 5 +- beacon-chain/core/blocks/eth1_data.go | 2 +- beacon-chain/core/blocks/exit.go | 2 +- beacon-chain/core/blocks/header.go | 2 +- beacon-chain/core/blocks/proposer_slashing.go | 2 +- beacon-chain/core/blocks/randao.go | 2 +- .../epoch/precompute/reward_penalty_test.go | 2 +- beacon-chain/core/helpers/shuffle_test.go | 4 +- beacon-chain/core/helpers/signing_root.go | 2 +- .../core/helpers/signing_root_test.go | 6 +- beacon-chain/core/state/state.go | 2 +- beacon-chain/core/state/transition.go | 2 +- beacon-chain/core/validators/validator.go | 2 +- beacon-chain/db/kv/archived_point.go | 16 +- beacon-chain/db/kv/backup.go | 8 +- beacon-chain/db/kv/blocks.go | 70 ++++---- beacon-chain/db/kv/checkpoint.go | 22 +-- beacon-chain/db/kv/deposit_contract.go | 8 +- beacon-chain/db/kv/finalized_block_roots.go | 16 +- beacon-chain/db/kv/kv.go | 18 +-- beacon-chain/db/kv/operations.go | 20 +-- beacon-chain/db/kv/powchain.go | 8 +- beacon-chain/db/kv/slashings.go | 40 ++--- beacon-chain/db/kv/state.go | 70 ++++---- beacon-chain/db/kv/state_summary.go | 20 +-- beacon-chain/flags/config.go | 2 +- beacon-chain/interop-cold-start/service.go | 10 +- .../slashings/service_attester_test.go | 6 +- beacon-chain/p2p/BUILD.bazel | 1 - beacon-chain/p2p/connection_gater.go | 6 +- beacon-chain/p2p/encoder/varint_test.go | 2 +- beacon-chain/p2p/fork_test.go | 4 +- beacon-chain/p2p/service_test.go | 2 +- beacon-chain/p2p/subnets.go | 2 +- beacon-chain/p2p/testing/fuzz_p2p.go | 30 ++-- beacon-chain/p2p/testing/mock_broadcaster.go | 2 +- beacon-chain/p2p/testing/mock_peermanager.go | 4 +- beacon-chain/p2p/testing/p2p.go | 10 +- beacon-chain/p2p/utils.go | 7 +- beacon-chain/p2p/watch_peers.go | 13 +- beacon-chain/powchain/block_cache.go | 2 +- beacon-chain/powchain/deposit_test.go | 4 +- beacon-chain/powchain/log_processing_test.go | 2 +- beacon-chain/powchain/service_test.go | 6 +- beacon-chain/powchain/testing/faulty_mock.go | 6 +- beacon-chain/rpc/beacon/attestations.go | 2 +- beacon-chain/rpc/beacon/committees_test.go | 11 +- beacon-chain/rpc/beacon/config.go | 2 +- beacon-chain/rpc/debug/forkchoice.go | 2 +- beacon-chain/rpc/debug/p2p.go | 8 +- beacon-chain/rpc/debug/server.go | 2 +- beacon-chain/rpc/node/server.go | 12 +- beacon-chain/rpc/validator/aggregator.go | 18 +-- beacon-chain/rpc/validator/assignments.go | 2 +- beacon-chain/rpc/validator/proposer.go | 6 +- beacon-chain/rpc/validator/server.go | 8 +- beacon-chain/state/setters.go | 2 +- .../stategen/epoch_boundary_state_cache.go | 2 +- beacon-chain/state/stategen/setter.go | 2 +- beacon-chain/state/stateutil/arrays.go | 5 +- beacon-chain/state/stateutil/attestations.go | 2 +- beacon-chain/state/stateutil/validators.go | 2 +- .../sync/pending_attestations_queue.go | 2 +- beacon-chain/sync/pending_blocks_queue.go | 2 +- .../sync/pending_blocks_queue_test.go | 10 +- .../sync/rpc_beacon_blocks_by_range_test.go | 14 +- .../sync/rpc_beacon_blocks_by_root_test.go | 4 +- beacon-chain/sync/rpc_goodbye.go | 2 +- beacon-chain/sync/rpc_goodbye_test.go | 2 +- beacon-chain/sync/rpc_metadata.go | 2 +- beacon-chain/sync/rpc_metadata_test.go | 2 +- beacon-chain/sync/rpc_ping.go | 2 +- beacon-chain/sync/rpc_ping_test.go | 2 +- beacon-chain/sync/rpc_status_test.go | 6 +- beacon-chain/sync/rpc_test.go | 6 +- beacon-chain/sync/subscriber.go | 3 +- .../sync/subscriber_beacon_aggregate_proof.go | 2 +- .../sync/subscriber_beacon_attestation.go | 6 +- beacon-chain/sync/utils_test.go | 8 +- endtoend/components/validator.go | 2 +- endtoend/endtoend_test.go | 2 +- endtoend/evaluators/validator.go | 2 +- endtoend/params/params.go | 3 - fuzz/common.go | 29 ---- go.mod | 7 +- go.sum | 151 ------------------ scripts/apply-all-eth2-k8.sh | 12 -- scripts/gcp_startup_script.sh | 74 --------- .../attestations/attestations_bench_test.go | 28 ++-- .../attestations/attestations_test.go | 10 +- shared/aggregation/maxcover_test.go | 6 +- shared/aggregation/testing/bitlistutils.go | 6 +- shared/bls/blst/stub.go | 6 +- shared/bytesutil/bytes.go | 9 -- shared/debug/debug.go | 26 --- shared/depositutil/BUILD.bazel | 1 - shared/depositutil/deposit.go | 19 --- shared/htrutils/helpers.go | 4 +- shared/iputils/external_ip.go | 2 +- shared/logutil/stream_test.go | 6 +- shared/params/testnet_onyx_config.go | 6 - shared/prereq/prereq.go | 6 +- shared/promptutil/prompt.go | 13 +- shared/rand/rand.go | 2 +- shared/testutil/block.go | 15 +- slasher/db/kv/BUILD.bazel | 1 - slasher/db/kv/attester_slashings_test.go | 22 +-- slasher/db/kv/benchmark_test.go | 10 +- slasher/db/kv/block_header_test.go | 22 +-- slasher/db/kv/chain_data_test.go | 6 +- slasher/db/kv/indexed_attestations_test.go | 30 +--- slasher/db/kv/kv_test.go | 3 +- slasher/db/kv/proposer_slashings_test.go | 22 +-- slasher/db/kv/spanner_new.go | 4 +- slasher/db/kv/spanner_new_test.go | 22 +-- slasher/db/kv/spanner_test.go | 39 ++--- slasher/db/kv/validator_id_pubkey_test.go | 17 +- slasher/db/types/types.go | 1 + .../detection/attestations/mock_spanner.go | 10 +- slasher/detection/detect.go | 2 +- slasher/rpc/server.go | 2 +- slasher/rpc/server_test.go | 2 +- test/fuzz/BUILD.bazel | 0 test/fuzz/main.cc | 0 tools/analyzers/maligned/maligned.go | 2 +- tools/benchmark-files-gen/main.go | 2 +- tools/bootnode-query/BUILD.bazel | 23 --- tools/bootnode-query/README.md | 9 -- tools/bootnode-query/main.go | 94 ----------- tools/bootnode/BUILD.bazel | 2 - tools/bootnode/bootnode.go | 7 +- tools/bootnode/bootnode_test.go | 3 +- tools/cluster-pk-manager/server/keyChecker.go | 2 +- tools/contract-addr/main.go | 2 +- tools/eth1exporter/main.go | 2 +- validator/accounts/v2/accounts_create.go | 2 +- validator/accounts/v2/accounts_create_test.go | 2 +- validator/accounts/v2/accounts_import.go | 2 +- validator/accounts/v2/accounts_list.go | 2 +- validator/accounts/v2/accounts_list_test.go | 2 +- validator/accounts/v2/prompt/prompt.go | 19 --- validator/accounts/v2/testing/mock.go | 10 +- validator/accounts/v2/wallet/wallet.go | 24 ++- validator/accounts/v2/wallet_create_test.go | 2 - validator/client/mock_validator.go | 18 +-- .../multiple_endpoints_grpc_resolver.go | 4 +- validator/keymanager/v1/direct.go | 2 +- validator/keymanager/v1/remote.go | 2 +- validator/keymanager/v2/derived/backup.go | 2 +- validator/keymanager/v2/derived/derived.go | 12 +- validator/keymanager/v2/direct/BUILD.bazel | 1 + validator/keymanager/v2/direct/backup.go | 2 +- validator/keymanager/v2/direct/direct.go | 16 +- validator/keymanager/v2/remote/remote.go | 4 +- validator/rpc/health_test.go | 4 +- validator/rpc/wallet.go | 6 +- validator/testing/protector_mock.go | 8 +- validator/testing/slasher_mock.go | 8 +- 173 files changed, 553 insertions(+), 1142 deletions(-) delete mode 100755 scripts/apply-all-eth2-k8.sh delete mode 100644 scripts/gcp_startup_script.sh delete mode 100644 test/fuzz/BUILD.bazel delete mode 100644 test/fuzz/main.cc delete mode 100644 tools/bootnode-query/BUILD.bazel delete mode 100644 tools/bootnode-query/README.md delete mode 100644 tools/bootnode-query/main.go diff --git a/beacon-chain/blockchain/metrics.go b/beacon-chain/blockchain/metrics.go index 720d5371b..b36a46c0f 100644 --- a/beacon-chain/blockchain/metrics.go +++ b/beacon-chain/blockchain/metrics.go @@ -1,17 +1,13 @@ package blockchain import ( - "time" - "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute" - "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/params" - "github.com/prysmaticlabs/prysm/shared/timeutils" ) var ( @@ -100,13 +96,6 @@ var ( Name: "beacon_reorg_total", Help: "Count the number of times beacon chain has a reorg", }) - sentBlockPropagationHistogram = promauto.NewHistogram( - prometheus.HistogramOpts{ - Name: "block_sent_latency_milliseconds", - Help: "Captures blocks broadcast time. Blocks sent in milliseconds distribution", - Buckets: []float64{1000, 2000, 3000, 4000, 5000, 6000}, - }, - ) attestationInclusionDelay = promauto.NewHistogram( prometheus.HistogramOpts{ Name: "attestation_inclusion_delay_slots", @@ -233,18 +222,6 @@ func reportEpochMetrics(state *stateTrie.BeaconState) { } } -// This captures metrics for block sent time by subtracts slot start time. -func captureSentTimeMetric(genesisTime uint64, currentSlot uint64) error { - startTime, err := helpers.SlotToTime(genesisTime, currentSlot) - if err != nil { - return err - } - diffMs := timeutils.Now().Sub(startTime) / time.Millisecond - sentBlockPropagationHistogram.Observe(float64(diffMs)) - - return nil -} - func reportAttestationInclusion(blk *ethpb.BeaconBlock) { for _, att := range blk.Body.Attestations { attestationInclusionDelay.Observe(float64(blk.Slot - att.Data.Slot)) diff --git a/beacon-chain/blockchain/process_attestation.go b/beacon-chain/blockchain/process_attestation.go index 9af262393..696133783 100644 --- a/beacon-chain/blockchain/process_attestation.go +++ b/beacon-chain/blockchain/process_attestation.go @@ -99,7 +99,7 @@ func (s *Service) onAttestation(ctx context.Context, a *ethpb.Attestation) ([]ui return nil, err } indices := indexedAtt.AttestingIndices - pubkeys := []bls.PublicKey{} + var pubkeys []bls.PublicKey for i := 0; i < len(indices); i++ { pubkeyAtIdx := c.PubKeys[indices[i]] pk, err := bls.PublicKeyFromBytes(pubkeyAtIdx) diff --git a/beacon-chain/blockchain/process_attestation_helpers.go b/beacon-chain/blockchain/process_attestation_helpers.go index b6e5227d5..346f2dbd2 100644 --- a/beacon-chain/blockchain/process_attestation_helpers.go +++ b/beacon-chain/blockchain/process_attestation_helpers.go @@ -126,7 +126,7 @@ func (s *Service) getAttCheckPtInfo(ctx context.Context, c *ethpb.Checkpoint, e } // verifyAttTargetEpoch validates attestation is from the current or previous epoch. -func (s *Service) verifyAttTargetEpoch(ctx context.Context, genesisTime uint64, nowTime uint64, c *ethpb.Checkpoint) error { +func (s *Service) verifyAttTargetEpoch(_ context.Context, genesisTime, nowTime uint64, c *ethpb.Checkpoint) error { currentSlot := (nowTime - genesisTime) / params.BeaconConfig().SecondsPerSlot currentEpoch := helpers.SlotToEpoch(currentSlot) var prevEpoch uint64 diff --git a/beacon-chain/blockchain/process_block_test.go b/beacon-chain/blockchain/process_block_test.go index a8493e22c..2d79a8bb2 100644 --- a/beacon-chain/blockchain/process_block_test.go +++ b/beacon-chain/blockchain/process_block_test.go @@ -146,8 +146,8 @@ func TestStore_OnBlockBatch(t *testing.T) { bState := st.Copy() - blks := []*ethpb.SignedBeaconBlock{} - blkRoots := [][32]byte{} + var blks []*ethpb.SignedBeaconBlock + var blkRoots [][32]byte var firstState *stateTrie.BeaconState for i := 1; i < 10; i++ { b, err := testutil.GenerateFullBlock(bState, keys, testutil.DefaultBlockGenConfig(), uint64(i)) diff --git a/beacon-chain/blockchain/testing/mock.go b/beacon-chain/blockchain/testing/mock.go index 7cf946ae1..891d9fbcf 100644 --- a/beacon-chain/blockchain/testing/mock.go +++ b/beacon-chain/blockchain/testing/mock.go @@ -141,7 +141,7 @@ func (mon *MockOperationNotifier) OperationFeed() *event.Feed { } // ReceiveBlockInitialSync mocks ReceiveBlockInitialSync method in chain service. -func (ms *ChainService) ReceiveBlockInitialSync(ctx context.Context, block *ethpb.SignedBeaconBlock, blockRoot [32]byte) error { +func (ms *ChainService) ReceiveBlockInitialSync(ctx context.Context, block *ethpb.SignedBeaconBlock, _ [32]byte) error { if ms.State == nil { ms.State = &stateTrie.BeaconState{} } @@ -168,7 +168,7 @@ func (ms *ChainService) ReceiveBlockInitialSync(ctx context.Context, block *ethp } // ReceiveBlockBatch processes blocks in batches from initial-sync. -func (ms *ChainService) ReceiveBlockBatch(ctx context.Context, blks []*ethpb.SignedBeaconBlock, roots [][32]byte) error { +func (ms *ChainService) ReceiveBlockBatch(ctx context.Context, blks []*ethpb.SignedBeaconBlock, _ [][32]byte) error { if ms.State == nil { ms.State = &stateTrie.BeaconState{} } @@ -197,7 +197,7 @@ func (ms *ChainService) ReceiveBlockBatch(ctx context.Context, blks []*ethpb.Sig } // ReceiveBlock mocks ReceiveBlock method in chain service. -func (ms *ChainService) ReceiveBlock(ctx context.Context, block *ethpb.SignedBeaconBlock, blockRoot [32]byte) error { +func (ms *ChainService) ReceiveBlock(ctx context.Context, block *ethpb.SignedBeaconBlock, _ [32]byte) error { if ms.State == nil { ms.State = &stateTrie.BeaconState{} } @@ -232,7 +232,7 @@ func (ms *ChainService) HeadSlot() uint64 { } // HeadRoot mocks HeadRoot method in chain service. -func (ms *ChainService) HeadRoot(ctx context.Context) ([]byte, error) { +func (ms *ChainService) HeadRoot(_ context.Context) ([]byte, error) { if len(ms.Root) > 0 { return ms.Root, nil } @@ -270,7 +270,7 @@ func (ms *ChainService) PreviousJustifiedCheckpt() *ethpb.Checkpoint { } // ReceiveAttestation mocks ReceiveAttestation method in chain service. -func (ms *ChainService) ReceiveAttestation(context.Context, *ethpb.Attestation) error { +func (ms *ChainService) ReceiveAttestation(_ context.Context, _ *ethpb.Attestation) error { return nil } @@ -280,12 +280,12 @@ func (ms *ChainService) ReceiveAttestationNoPubsub(context.Context, *ethpb.Attes } // AttestationPreState mocks AttestationPreState method in chain service. -func (ms *ChainService) AttestationPreState(ctx context.Context, att *ethpb.Attestation) (*stateTrie.BeaconState, error) { +func (ms *ChainService) AttestationPreState(_ context.Context, _ *ethpb.Attestation) (*stateTrie.BeaconState, error) { return ms.State, nil } // HeadValidatorsIndices mocks the same method in the chain service. -func (ms *ChainService) HeadValidatorsIndices(ctx context.Context, epoch uint64) ([]uint64, error) { +func (ms *ChainService) HeadValidatorsIndices(_ context.Context, epoch uint64) ([]uint64, error) { if ms.State == nil { return []uint64{}, nil } @@ -293,7 +293,7 @@ func (ms *ChainService) HeadValidatorsIndices(ctx context.Context, epoch uint64) } // HeadSeed mocks the same method in the chain service. -func (ms *ChainService) HeadSeed(ctx context.Context, epoch uint64) ([32]byte, error) { +func (ms *ChainService) HeadSeed(_ context.Context, epoch uint64) ([32]byte, error) { return helpers.Seed(ms.State, epoch, params.BeaconConfig().DomainBeaconAttester) } @@ -323,18 +323,18 @@ func (ms *ChainService) CurrentSlot() uint64 { } // Participation mocks the same method in the chain service. -func (ms *ChainService) Participation(epoch uint64) *precompute.Balance { +func (ms *ChainService) Participation(_ uint64) *precompute.Balance { return ms.Balance } // IsValidAttestation always returns true. -func (ms *ChainService) IsValidAttestation(ctx context.Context, att *ethpb.Attestation) bool { +func (ms *ChainService) IsValidAttestation(_ context.Context, _ *ethpb.Attestation) bool { return ms.ValidAttestation } // IsCanonical returns and determines whether a block with the provided root is part of // the canonical chain. -func (ms *ChainService) IsCanonical(ctx context.Context, blockRoot [32]byte) (bool, error) { +func (ms *ChainService) IsCanonical(_ context.Context, _ [32]byte) (bool, error) { return true, nil } @@ -342,7 +342,7 @@ func (ms *ChainService) IsCanonical(ctx context.Context, blockRoot [32]byte) (bo func (ms *ChainService) ClearCachedStates() {} // HasInitSyncBlock mocks the same method in the chain service. -func (ms *ChainService) HasInitSyncBlock(root [32]byte) bool { +func (ms *ChainService) HasInitSyncBlock(_ [32]byte) bool { return false } @@ -352,17 +352,17 @@ func (ms *ChainService) HeadGenesisValidatorRoot() [32]byte { } // VerifyBlkDescendant mocks VerifyBlkDescendant and always returns nil. -func (ms *ChainService) VerifyBlkDescendant(ctx context.Context, root [32]byte) error { +func (ms *ChainService) VerifyBlkDescendant(_ context.Context, _ [32]byte) error { return ms.VerifyBlkDescendantErr } // VerifyLmdFfgConsistency mocks VerifyLmdFfgConsistency and always returns nil. -func (ms *ChainService) VerifyLmdFfgConsistency(ctx context.Context, att *ethpb.Attestation) error { +func (ms *ChainService) VerifyLmdFfgConsistency(_ context.Context, _ *ethpb.Attestation) error { return nil } // AttestationCheckPtInfo mocks AttestationCheckPtInfo and always returns nil. -func (ms *ChainService) AttestationCheckPtInfo(ctx context.Context, att *ethpb.Attestation) (*pb.CheckPtInfo, error) { +func (ms *ChainService) AttestationCheckPtInfo(_ context.Context, att *ethpb.Attestation) (*pb.CheckPtInfo, error) { f := ms.State.Fork() g := bytesutil.ToBytes32(ms.State.GenesisValidatorRoot()) seed, err := helpers.Seed(ms.State, helpers.SlotToEpoch(att.Data.Slot), params.BeaconConfig().DomainBeaconAttester) diff --git a/beacon-chain/cache/attestation_data.go b/beacon-chain/cache/attestation_data.go index 243c56489..774824e02 100644 --- a/beacon-chain/cache/attestation_data.go +++ b/beacon-chain/cache/attestation_data.go @@ -138,7 +138,7 @@ func (c *AttestationCache) MarkNotInProgress(req *ethpb.AttestationDataRequest) } // Put the response in the cache. -func (c *AttestationCache) Put(ctx context.Context, req *ethpb.AttestationDataRequest, res *ethpb.AttestationData) error { +func (c *AttestationCache) Put(_ context.Context, req *ethpb.AttestationDataRequest, res *ethpb.AttestationData) error { data := &attestationReqResWrapper{ req, res, diff --git a/beacon-chain/cache/checkpoint_state.go b/beacon-chain/cache/checkpoint_state.go index 982097f99..7cb185270 100644 --- a/beacon-chain/cache/checkpoint_state.go +++ b/beacon-chain/cache/checkpoint_state.go @@ -1,7 +1,6 @@ package cache import ( - "errors" "sync" lru "github.com/hashicorp/golang-lru" @@ -13,10 +12,6 @@ import ( ) var ( - // ErrNotCheckpointState will be returned when a cache object is not a pointer to - // a CheckpointState struct. - ErrNotCheckpointState = errors.New("object is not a state by check point struct") - // maxCheckpointStateSize defines the max number of entries check point to state cache can contain. // Choosing 10 to account for multiple forks, this allows 5 forks per epoch boundary with 2 epochs // window to accept attestation based on latest spec. diff --git a/beacon-chain/cache/common.go b/beacon-chain/cache/common.go index a7e1b5f5c..d58f8a964 100644 --- a/beacon-chain/cache/common.go +++ b/beacon-chain/cache/common.go @@ -24,6 +24,6 @@ func trim(queue *cache.FIFO, maxSize uint64) { } // popProcessNoopFunc is a no-op function that never returns an error. -func popProcessNoopFunc(obj interface{}) error { +func popProcessNoopFunc(_ interface{}) error { return nil } diff --git a/beacon-chain/cache/skip_slot_cache.go b/beacon-chain/cache/skip_slot_cache.go index 2bb36675c..6f3722a0d 100644 --- a/beacon-chain/cache/skip_slot_cache.go +++ b/beacon-chain/cache/skip_slot_cache.go @@ -136,7 +136,7 @@ func (c *SkipSlotCache) MarkNotInProgress(slot uint64) error { } // Put the response in the cache. -func (c *SkipSlotCache) Put(ctx context.Context, slot uint64, state *stateTrie.BeaconState) error { +func (c *SkipSlotCache) Put(_ context.Context, slot uint64, state *stateTrie.BeaconState) error { if c.disabled { return nil } diff --git a/beacon-chain/cache/subnet_ids.go b/beacon-chain/cache/subnet_ids.go index 15764dfb0..43dcd2452 100644 --- a/beacon-chain/cache/subnet_ids.go +++ b/beacon-chain/cache/subnet_ids.go @@ -113,7 +113,7 @@ func (c *subnetIDs) GetAllSubnets() []uint64 { defer c.subnetsLock.RUnlock() itemsMap := c.persistentSubnets.Items() - committees := []uint64{} + var committees []uint64 for _, v := range itemsMap { if v.Expired() { diff --git a/beacon-chain/core/blocks/attestation.go b/beacon-chain/core/blocks/attestation.go index c99126cf2..53747fc78 100644 --- a/beacon-chain/core/blocks/attestation.go +++ b/beacon-chain/core/blocks/attestation.go @@ -314,7 +314,7 @@ func VerifyIndexedAttestation(ctx context.Context, beaconState *stateTrie.Beacon return err } indices := indexedAtt.AttestingIndices - pubkeys := []bls.PublicKey{} + var pubkeys []bls.PublicKey for i := 0; i < len(indices); i++ { pubkeyAtIdx := beaconState.PubkeyAtIndex(indices[i]) pk, err := bls.PublicKeyFromBytes(pubkeyAtIdx[:]) @@ -365,7 +365,7 @@ func VerifyAttSigUseCheckPt(ctx context.Context, c *pb.CheckPtInfo, att *ethpb.A return err } indices := indexedAtt.AttestingIndices - pubkeys := []bls.PublicKey{} + var pubkeys []bls.PublicKey for i := 0; i < len(indices); i++ { pubkeyAtIdx := c.PubKeys[indices[i]] pk, err := bls.PublicKeyFromBytes(pubkeyAtIdx) diff --git a/beacon-chain/core/blocks/attestation_test.go b/beacon-chain/core/blocks/attestation_test.go index 1ca5f5333..fdf451116 100644 --- a/beacon-chain/core/blocks/attestation_test.go +++ b/beacon-chain/core/blocks/attestation_test.go @@ -639,7 +639,7 @@ func TestValidateIndexedAttestation_BadAttestationsSignatureSet(t *testing.T) { sig := keys[0].Sign([]byte{'t', 'e', 's', 't'}) list := bitfield.Bitlist{0b11111111} - atts := []*ethpb.Attestation{} + var atts []*ethpb.Attestation for i := uint64(0); i < 1000; i++ { atts = append(atts, ðpb.Attestation{ Data: ðpb.AttestationData{ diff --git a/beacon-chain/core/blocks/attester_slashing_test.go b/beacon-chain/core/blocks/attester_slashing_test.go index 9fd136190..45721c1ea 100644 --- a/beacon-chain/core/blocks/attester_slashing_test.go +++ b/beacon-chain/core/blocks/attester_slashing_test.go @@ -57,7 +57,7 @@ func TestProcessAttesterSlashings_DataNotSlashable(t *testing.T) { }, }, } - registry := []*ethpb.Validator{} + var registry []*ethpb.Validator currentSlot := uint64(0) beaconState, err := stateTrie.InitializeFromProto(&pb.BeaconState{ @@ -77,7 +77,7 @@ func TestProcessAttesterSlashings_DataNotSlashable(t *testing.T) { } func TestProcessAttesterSlashings_IndexedAttestationFailedToVerify(t *testing.T) { - registry := []*ethpb.Validator{} + var registry []*ethpb.Validator currentSlot := uint64(0) beaconState, err := stateTrie.InitializeFromProto(&pb.BeaconState{ diff --git a/beacon-chain/core/blocks/block_operations_fuzz_test.go b/beacon-chain/core/blocks/block_operations_fuzz_test.go index ebf71ff5d..a2b0ca330 100644 --- a/beacon-chain/core/blocks/block_operations_fuzz_test.go +++ b/beacon-chain/core/blocks/block_operations_fuzz_test.go @@ -46,13 +46,13 @@ func TestFuzzProcessBlockHeader_10000(t *testing.T) { func TestFuzzverifyDepositDataSigningRoot_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - ba := []byte{} + var ba []byte pubkey := [48]byte{} sig := [96]byte{} domain := [4]byte{} - p := []byte{} - s := []byte{} - d := []byte{} + var p []byte + var s []byte + var d []byte for i := 0; i < 10000; i++ { fuzzer.Fuzz(&ba) fuzzer.Fuzz(&pubkey) @@ -98,7 +98,7 @@ func TestFuzzareEth1DataEqual_10000(t *testing.T) { func TestFuzzEth1DataHasEnoughSupport_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) eth1data := ð.Eth1Data{} - stateVotes := []*eth.Eth1Data{} + var stateVotes []*eth.Eth1Data for i := 0; i < 100000; i++ { fuzzer.Fuzz(eth1data) fuzzer.Fuzz(&stateVotes) diff --git a/beacon-chain/core/blocks/block_regression_test.go b/beacon-chain/core/blocks/block_regression_test.go index 75976aad6..c46cf3ed8 100644 --- a/beacon-chain/core/blocks/block_regression_test.go +++ b/beacon-chain/core/blocks/block_regression_test.go @@ -50,7 +50,7 @@ func TestProcessAttesterSlashings_RegressionSlashableIndices(t *testing.T) { require.NoError(t, err) signingRoot, err := helpers.ComputeSigningRoot(att1.Data, domain) require.NoError(t, err, "Could not get signing root of beacon block header") - aggSigs := []bls.Signature{} + var aggSigs []bls.Signature for _, index := range setA { sig := privKeys[index].Sign(signingRoot[:]) aggSigs = append(aggSigs, sig) diff --git a/beacon-chain/core/blocks/deposit.go b/beacon-chain/core/blocks/deposit.go index 38dc82ecf..563697d8e 100644 --- a/beacon-chain/core/blocks/deposit.go +++ b/beacon-chain/core/blocks/deposit.go @@ -158,8 +158,7 @@ func ProcessDeposit(beaconState *stateTrie.BeaconState, deposit *ethpb.Deposit, if err != nil { return nil, err } - depositSig := deposit.Data.Signature - if err := verifyDepositDataSigningRoot(deposit.Data, pubKey, depositSig, domain); err != nil { + if err := verifyDepositDataSigningRoot(deposit.Data, domain); err != nil { // Ignore this error as in the spec pseudo code. log.Debugf("Skipping deposit: could not verify deposit data signature: %v", err) return beaconState, nil @@ -223,7 +222,7 @@ func verifyDeposit(beaconState *stateTrie.BeaconState, deposit *ethpb.Deposit) e } // Deprecated: This method uses deprecated ssz.SigningRoot. -func verifyDepositDataSigningRoot(obj *ethpb.Deposit_Data, pub []byte, signature []byte, domain []byte) error { +func verifyDepositDataSigningRoot(obj *ethpb.Deposit_Data, domain []byte) error { return depositutil.VerifyDepositSignature(obj, domain) } diff --git a/beacon-chain/core/blocks/eth1_data.go b/beacon-chain/core/blocks/eth1_data.go index de5db3d20..047b0b82c 100644 --- a/beacon-chain/core/blocks/eth1_data.go +++ b/beacon-chain/core/blocks/eth1_data.go @@ -19,7 +19,7 @@ import ( // state.eth1_data_votes.append(body.eth1_data) // if state.eth1_data_votes.count(body.eth1_data) * 2 > EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH: // state.latest_eth1_data = body.eth1_data -func ProcessEth1DataInBlock(ctx context.Context, beaconState *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock) (*stateTrie.BeaconState, error) { +func ProcessEth1DataInBlock(_ context.Context, beaconState *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock) (*stateTrie.BeaconState, error) { block := b.Block if beaconState == nil { return nil, errors.New("nil state") diff --git a/beacon-chain/core/blocks/exit.go b/beacon-chain/core/blocks/exit.go index dba8d4a7c..e826138e8 100644 --- a/beacon-chain/core/blocks/exit.go +++ b/beacon-chain/core/blocks/exit.go @@ -37,7 +37,7 @@ import ( // # Initiate exit // initiate_validator_exit(state, exit.validator_index) func ProcessVoluntaryExits( - ctx context.Context, + _ context.Context, beaconState *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock, ) (*stateTrie.BeaconState, error) { diff --git a/beacon-chain/core/blocks/header.go b/beacon-chain/core/blocks/header.go index f13988094..4f8b24ea2 100644 --- a/beacon-chain/core/blocks/header.go +++ b/beacon-chain/core/blocks/header.go @@ -37,7 +37,7 @@ import ( // # Verify proposer signature // assert bls_verify(proposer.pubkey, signing_root(block), block.signature, get_domain(state, DOMAIN_BEACON_PROPOSER)) func ProcessBlockHeader( - ctx context.Context, + _ context.Context, beaconState *stateTrie.BeaconState, block *ethpb.SignedBeaconBlock, ) (*stateTrie.BeaconState, error) { diff --git a/beacon-chain/core/blocks/proposer_slashing.go b/beacon-chain/core/blocks/proposer_slashing.go index 17593d639..4af10206b 100644 --- a/beacon-chain/core/blocks/proposer_slashing.go +++ b/beacon-chain/core/blocks/proposer_slashing.go @@ -36,7 +36,7 @@ import ( // // slash_validator(state, proposer_slashing.proposer_index) func ProcessProposerSlashings( - ctx context.Context, + _ context.Context, beaconState *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock, ) (*stateTrie.BeaconState, error) { diff --git a/beacon-chain/core/blocks/randao.go b/beacon-chain/core/blocks/randao.go index b6b6d99f5..4e551542c 100644 --- a/beacon-chain/core/blocks/randao.go +++ b/beacon-chain/core/blocks/randao.go @@ -26,7 +26,7 @@ import ( // mix = xor(get_randao_mix(state, epoch), hash(body.randao_reveal)) // state.randao_mixes[epoch % EPOCHS_PER_HISTORICAL_VECTOR] = mix func ProcessRandao( - ctx context.Context, + _ context.Context, beaconState *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock, ) (*stateTrie.BeaconState, error) { diff --git a/beacon-chain/core/epoch/precompute/reward_penalty_test.go b/beacon-chain/core/epoch/precompute/reward_penalty_test.go index a71686f33..fdabc7e93 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty_test.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty_test.go @@ -122,7 +122,7 @@ func TestAttestationDeltaPrecompute(t *testing.T) { base, err := epoch.BaseReward(state, i) assert.NoError(t, err, "Could not get base reward") assert.Equal(t, uint64(0), rewards[i], "Unexpected slashed indices reward balance") - assert.Equal(t, uint64(3*base), penalties[i], "Unexpected slashed indices penalty balance") + assert.Equal(t, 3*base, penalties[i], "Unexpected slashed indices penalty balance") } nonAttestedIndices := []uint64{434, 677, 872, 791} diff --git a/beacon-chain/core/helpers/shuffle_test.go b/beacon-chain/core/helpers/shuffle_test.go index 193c9f30a..146678503 100644 --- a/beacon-chain/core/helpers/shuffle_test.go +++ b/beacon-chain/core/helpers/shuffle_test.go @@ -60,7 +60,7 @@ func TestSplitIndices_OK(t *testing.T) { } func TestShuffleList_Vs_ShuffleIndex(t *testing.T) { - list := []uint64{} + var list []uint64 listSize := uint64(1000) seed := [32]byte{123, 42} for i := uint64(0); i < listSize; i++ { @@ -124,7 +124,7 @@ func BenchmarkShuffleList(b *testing.B) { } func TestShuffledIndex(t *testing.T) { - list := []uint64{} + var list []uint64 listSize := uint64(399) for i := uint64(0); i < listSize; i++ { list = append(list, i) diff --git a/beacon-chain/core/helpers/signing_root.go b/beacon-chain/core/helpers/signing_root.go index 51657c903..b47bb4ad0 100644 --- a/beacon-chain/core/helpers/signing_root.go +++ b/beacon-chain/core/helpers/signing_root.go @@ -198,7 +198,7 @@ func ComputeDomain(domainType [DomainByteLength]byte, forkVersion []byte, genesi // This returns the bls domain given by the domain type and fork data root. func domain(domainType [DomainByteLength]byte, forkDataRoot []byte) []byte { - b := []byte{} + var b []byte b = append(b, domainType[:4]...) b = append(b, forkDataRoot[:28]...) return b diff --git a/beacon-chain/core/helpers/signing_root_test.go b/beacon-chain/core/helpers/signing_root_test.go index 1515cc148..8131037a5 100644 --- a/beacon-chain/core/helpers/signing_root_test.go +++ b/beacon-chain/core/helpers/signing_root_test.go @@ -63,9 +63,9 @@ func TestFuzzverifySigningRoot_10000(t *testing.T) { pubkey := [48]byte{} sig := [96]byte{} domain := [4]byte{} - p := []byte{} - s := []byte{} - d := []byte{} + var p []byte + var s []byte + var d []byte for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(&pubkey) diff --git a/beacon-chain/core/state/state.go b/beacon-chain/core/state/state.go index 501947c91..f8d53ef6f 100644 --- a/beacon-chain/core/state/state.go +++ b/beacon-chain/core/state/state.go @@ -64,7 +64,7 @@ func GenesisBeaconState(deposits []*ethpb.Deposit, genesisTime uint64, eth1Data return nil, err } // Process initial deposits. - leaves := [][]byte{} + var leaves [][]byte for _, deposit := range deposits { if deposit == nil || deposit.Data == nil { return nil, fmt.Errorf("nil deposit or deposit with nil data cannot be processed: %v", deposit) diff --git a/beacon-chain/core/state/transition.go b/beacon-chain/core/state/transition.go index 5ffc599a2..f3d1252e9 100644 --- a/beacon-chain/core/state/transition.go +++ b/beacon-chain/core/state/transition.go @@ -599,7 +599,7 @@ func ProcessOperationsNoVerifyAttsSigs( } // VerifyOperationLengths verifies that block operation lengths are valid. -func VerifyOperationLengths(ctx context.Context, state *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock) (*stateTrie.BeaconState, error) { +func VerifyOperationLengths(_ context.Context, state *stateTrie.BeaconState, b *ethpb.SignedBeaconBlock) (*stateTrie.BeaconState, error) { if b.Block == nil || b.Block.Body == nil { return nil, errors.New("block and block body can't be nil") } diff --git a/beacon-chain/core/validators/validator.go b/beacon-chain/core/validators/validator.go index 1ce16d661..2f25e1dd7 100644 --- a/beacon-chain/core/validators/validator.go +++ b/beacon-chain/core/validators/validator.go @@ -52,7 +52,7 @@ func InitiateValidatorExit(state *stateTrie.BeaconState, idx uint64) (*stateTrie if validator.ExitEpoch != params.BeaconConfig().FarFutureEpoch { return state, nil } - exitEpochs := []uint64{} + var exitEpochs []uint64 for _, val := range readOnlyVals { if val.ExitEpoch() != params.BeaconConfig().FarFutureEpoch { exitEpochs = append(exitEpochs, val.ExitEpoch()) diff --git a/beacon-chain/db/kv/archived_point.go b/beacon-chain/db/kv/archived_point.go index d1bd23d14..dd231fba7 100644 --- a/beacon-chain/db/kv/archived_point.go +++ b/beacon-chain/db/kv/archived_point.go @@ -9,11 +9,11 @@ import ( ) // LastArchivedSlot from the db. -func (kv *Store) LastArchivedSlot(ctx context.Context) (uint64, error) { +func (s *Store) LastArchivedSlot(ctx context.Context) (uint64, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.LastArchivedSlot") defer span.End() var index uint64 - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(stateSlotIndicesBucket) b, _ := bkt.Cursor().Last() index = bytesutil.BytesToUint64BigEndian(b) @@ -24,12 +24,12 @@ func (kv *Store) LastArchivedSlot(ctx context.Context) (uint64, error) { } // LastArchivedRoot from the db. -func (kv *Store) LastArchivedRoot(ctx context.Context) [32]byte { +func (s *Store) LastArchivedRoot(ctx context.Context) [32]byte { ctx, span := trace.StartSpan(ctx, "BeaconDB.LastArchivedRoot") defer span.End() var blockRoot []byte - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(stateSlotIndicesBucket) _, blockRoot = bkt.Cursor().Last() return nil @@ -42,12 +42,12 @@ func (kv *Store) LastArchivedRoot(ctx context.Context) [32]byte { // ArchivedPointRoot returns the block root of an archived point from the DB. // This is essential for cold state management and to restore a cold state. -func (kv *Store) ArchivedPointRoot(ctx context.Context, slot uint64) [32]byte { +func (s *Store) ArchivedPointRoot(ctx context.Context, slot uint64) [32]byte { ctx, span := trace.StartSpan(ctx, "BeaconDB.ArchivedPointRoot") defer span.End() var blockRoot []byte - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(stateSlotIndicesBucket) blockRoot = bucket.Get(bytesutil.Uint64ToBytesBigEndian(slot)) return nil @@ -59,11 +59,11 @@ func (kv *Store) ArchivedPointRoot(ctx context.Context, slot uint64) [32]byte { } // HasArchivedPoint returns true if an archived point exists in DB. -func (kv *Store) HasArchivedPoint(ctx context.Context, slot uint64) bool { +func (s *Store) HasArchivedPoint(ctx context.Context, slot uint64) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasArchivedPoint") defer span.End() var exists bool - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { iBucket := tx.Bucket(stateSlotIndicesBucket) exists = iBucket.Get(bytesutil.Uint64ToBytesBigEndian(slot)) != nil return nil diff --git a/beacon-chain/db/kv/backup.go b/beacon-chain/db/kv/backup.go index bc51d30ae..f7b7d6b4c 100644 --- a/beacon-chain/db/kv/backup.go +++ b/beacon-chain/db/kv/backup.go @@ -17,12 +17,12 @@ const backupsDirectoryName = "backups" // Backup the database to the datadir backup directory. // Example for backup at slot 345: $DATADIR/backups/prysm_beacondb_at_slot_0000345.backup -func (kv *Store) Backup(ctx context.Context) error { +func (s *Store) Backup(ctx context.Context) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.Backup") defer span.End() - backupsDir := path.Join(kv.databasePath, backupsDirectoryName) - head, err := kv.HeadBlock(ctx) + backupsDir := path.Join(s.databasePath, backupsDirectoryName) + head, err := s.HeadBlock(ctx) if err != nil { return err } @@ -46,7 +46,7 @@ func (kv *Store) Backup(ctx context.Context) error { } }() - return kv.db.View(func(tx *bolt.Tx) error { + return s.db.View(func(tx *bolt.Tx) error { return tx.ForEach(func(name []byte, b *bolt.Bucket) error { logrus.Debugf("Copying bucket %s\n", name) return copyDB.Update(func(tx2 *bolt.Tx) error { diff --git a/beacon-chain/db/kv/blocks.go b/beacon-chain/db/kv/blocks.go index ecba70e39..17857970d 100644 --- a/beacon-chain/db/kv/blocks.go +++ b/beacon-chain/db/kv/blocks.go @@ -17,15 +17,15 @@ import ( ) // Block retrieval by root. -func (kv *Store) Block(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) { +func (s *Store) Block(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.Block") defer span.End() // Return block from cache if it exists. - if v, ok := kv.blockCache.Get(string(blockRoot[:])); v != nil && ok { + if v, ok := s.blockCache.Get(string(blockRoot[:])); v != nil && ok { return v.(*ethpb.SignedBeaconBlock), nil } var block *ethpb.SignedBeaconBlock - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) enc := bkt.Get(blockRoot[:]) if enc == nil { @@ -38,11 +38,11 @@ func (kv *Store) Block(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBe } // HeadBlock returns the latest canonical block in eth2. -func (kv *Store) HeadBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) { +func (s *Store) HeadBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.HeadBlock") defer span.End() var headBlock *ethpb.SignedBeaconBlock - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) headRoot := bkt.Get(headBlockRootKey) if headRoot == nil { @@ -59,11 +59,11 @@ func (kv *Store) HeadBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error } // Blocks retrieves a list of beacon blocks by filter criteria. -func (kv *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.SignedBeaconBlock, error) { +func (s *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.Blocks") defer span.End() blocks := make([]*ethpb.SignedBeaconBlock, 0) - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) keys, err := getBlockRootsByFilter(ctx, tx, f) @@ -85,11 +85,11 @@ func (kv *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.S } // BlockRoots retrieves a list of beacon block roots by filter criteria. -func (kv *Store) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32]byte, error) { +func (s *Store) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.BlockRoots") defer span.End() blockRoots := make([][32]byte, 0) - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { keys, err := getBlockRootsByFilter(ctx, tx, f) if err != nil { return err @@ -107,14 +107,14 @@ func (kv *Store) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32] } // HasBlock checks if a block by root exists in the db. -func (kv *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool { +func (s *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasBlock") defer span.End() - if v, ok := kv.blockCache.Get(string(blockRoot[:])); v != nil && ok { + if v, ok := s.blockCache.Get(string(blockRoot[:])); v != nil && ok { return true } exists := false - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) exists = bkt.Get(blockRoot[:]) != nil return nil @@ -125,10 +125,10 @@ func (kv *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool { } // deleteBlock by block root. -func (kv *Store) deleteBlock(ctx context.Context, blockRoot [32]byte) error { +func (s *Store) deleteBlock(ctx context.Context, blockRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.deleteBlock") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) enc := bkt.Get(blockRoot[:]) if enc == nil { @@ -142,17 +142,17 @@ func (kv *Store) deleteBlock(ctx context.Context, blockRoot [32]byte) error { if err := deleteValueForIndices(ctx, indicesByBucket, blockRoot[:], tx); err != nil { return errors.Wrap(err, "could not delete root for DB indices") } - kv.blockCache.Del(string(blockRoot[:])) + s.blockCache.Del(string(blockRoot[:])) return bkt.Delete(blockRoot[:]) }) } // deleteBlocks by block roots. -func (kv *Store) deleteBlocks(ctx context.Context, blockRoots [][32]byte) error { +func (s *Store) deleteBlocks(ctx context.Context, blockRoots [][32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.deleteBlocks") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) for _, blockRoot := range blockRoots { enc := bkt.Get(blockRoot[:]) @@ -167,7 +167,7 @@ func (kv *Store) deleteBlocks(ctx context.Context, blockRoots [][32]byte) error if err := deleteValueForIndices(ctx, indicesByBucket, blockRoot[:], tx); err != nil { return errors.Wrap(err, "could not delete root for DB indices") } - kv.blockCache.Del(string(blockRoot[:])) + s.blockCache.Del(string(blockRoot[:])) if err := bkt.Delete(blockRoot[:]); err != nil { return err } @@ -177,26 +177,26 @@ func (kv *Store) deleteBlocks(ctx context.Context, blockRoots [][32]byte) error } // SaveBlock to the db. -func (kv *Store) SaveBlock(ctx context.Context, signed *ethpb.SignedBeaconBlock) error { +func (s *Store) SaveBlock(ctx context.Context, signed *ethpb.SignedBeaconBlock) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveBlock") defer span.End() blockRoot, err := signed.Block.HashTreeRoot() if err != nil { return err } - if v, ok := kv.blockCache.Get(string(blockRoot[:])); v != nil && ok { + if v, ok := s.blockCache.Get(string(blockRoot[:])); v != nil && ok { return nil } - return kv.SaveBlocks(ctx, []*ethpb.SignedBeaconBlock{signed}) + return s.SaveBlocks(ctx, []*ethpb.SignedBeaconBlock{signed}) } // SaveBlocks via bulk updates to the db. -func (kv *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.SignedBeaconBlock) error { +func (s *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.SignedBeaconBlock) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveBlocks") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) for _, block := range blocks { blockRoot, err := block.Block.HashTreeRoot() @@ -215,7 +215,7 @@ func (kv *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.SignedBeaconBlo if err := updateValueForIndices(ctx, indicesByBucket, blockRoot[:], tx); err != nil { return errors.Wrap(err, "could not update DB indices") } - kv.blockCache.Set(string(blockRoot[:]), block, int64(len(enc))) + s.blockCache.Set(string(blockRoot[:]), block, int64(len(enc))) if err := bkt.Put(blockRoot[:], enc); err != nil { return err @@ -226,11 +226,11 @@ func (kv *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.SignedBeaconBlo } // SaveHeadBlockRoot to the db. -func (kv *Store) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) error { +func (s *Store) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveHeadBlockRoot") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { - hasStateSummaryInCache := kv.stateSummaryCache.Has(blockRoot) + return s.db.Update(func(tx *bolt.Tx) error { + hasStateSummaryInCache := s.stateSummaryCache.Has(blockRoot) hasStateSummaryInDB := tx.Bucket(stateSummaryBucket).Get(blockRoot[:]) != nil hasStateInDB := tx.Bucket(stateBucket).Get(blockRoot[:]) != nil if !(hasStateInDB || hasStateSummaryInDB || hasStateSummaryInCache) { @@ -243,11 +243,11 @@ func (kv *Store) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) erro } // GenesisBlock retrieves the genesis block of the beacon chain. -func (kv *Store) GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) { +func (s *Store) GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.GenesisBlock") defer span.End() var block *ethpb.SignedBeaconBlock - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) root := bkt.Get(genesisBlockRootKey) enc := bkt.Get(root) @@ -261,22 +261,22 @@ func (kv *Store) GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, er } // SaveGenesisBlockRoot to the db. -func (kv *Store) SaveGenesisBlockRoot(ctx context.Context, blockRoot [32]byte) error { +func (s *Store) SaveGenesisBlockRoot(ctx context.Context, blockRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveGenesisBlockRoot") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(blocksBucket) return bucket.Put(genesisBlockRootKey, blockRoot[:]) }) } // HighestSlotBlocksBelow returns the block with the highest slot below the input slot from the db. -func (kv *Store) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error) { +func (s *Store) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.HighestSlotBlocksBelow") defer span.End() var best []byte - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(blockSlotIndicesBucket) // Iterate through the index, which is in byte sorted order. c := bkt.Cursor() @@ -298,13 +298,13 @@ func (kv *Store) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*et var blk *ethpb.SignedBeaconBlock var err error if best != nil { - blk, err = kv.Block(ctx, bytesutil.ToBytes32(best)) + blk, err = s.Block(ctx, bytesutil.ToBytes32(best)) if err != nil { return nil, err } } if blk == nil { - blk, err = kv.GenesisBlock(ctx) + blk, err = s.GenesisBlock(ctx) if err != nil { return nil, err } diff --git a/beacon-chain/db/kv/checkpoint.go b/beacon-chain/db/kv/checkpoint.go index 10c1a95e7..8f9c93485 100644 --- a/beacon-chain/db/kv/checkpoint.go +++ b/beacon-chain/db/kv/checkpoint.go @@ -14,11 +14,11 @@ import ( var errMissingStateForCheckpoint = errors.New("missing state summary for finalized root") // JustifiedCheckpoint returns the latest justified checkpoint in beacon chain. -func (kv *Store) JustifiedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error) { +func (s *Store) JustifiedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.JustifiedCheckpoint") defer span.End() var checkpoint *ethpb.Checkpoint - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(checkpointBucket) enc := bkt.Get(justifiedCheckpointKey) if enc == nil { @@ -32,11 +32,11 @@ func (kv *Store) JustifiedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, er } // FinalizedCheckpoint returns the latest finalized checkpoint in beacon chain. -func (kv *Store) FinalizedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error) { +func (s *Store) FinalizedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.FinalizedCheckpoint") defer span.End() var checkpoint *ethpb.Checkpoint - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(checkpointBucket) enc := bkt.Get(finalizedCheckpointKey) if enc == nil { @@ -50,7 +50,7 @@ func (kv *Store) FinalizedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, er } // SaveJustifiedCheckpoint saves justified checkpoint in beacon chain. -func (kv *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error { +func (s *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveJustifiedCheckpoint") defer span.End() @@ -58,10 +58,10 @@ func (kv *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb. if err != nil { return err } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(checkpointBucket) hasStateSummaryInDB := tx.Bucket(stateSummaryBucket).Get(checkpoint.Root) != nil - hasStateSummaryInCache := kv.stateSummaryCache.Has(bytesutil.ToBytes32(checkpoint.Root)) + hasStateSummaryInCache := s.stateSummaryCache.Has(bytesutil.ToBytes32(checkpoint.Root)) hasStateInDB := tx.Bucket(stateBucket).Get(checkpoint.Root) != nil if !(hasStateInDB || hasStateSummaryInDB || hasStateSummaryInCache) { return errMissingStateForCheckpoint @@ -71,7 +71,7 @@ func (kv *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb. } // SaveFinalizedCheckpoint saves finalized checkpoint in beacon chain. -func (kv *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error { +func (s *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveFinalizedCheckpoint") defer span.End() @@ -79,10 +79,10 @@ func (kv *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb. if err != nil { return err } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(checkpointBucket) hasStateSummaryInDB := tx.Bucket(stateSummaryBucket).Get(checkpoint.Root) != nil - hasStateSummaryInCache := kv.stateSummaryCache.Has(bytesutil.ToBytes32(checkpoint.Root)) + hasStateSummaryInCache := s.stateSummaryCache.Has(bytesutil.ToBytes32(checkpoint.Root)) hasStateInDB := tx.Bucket(stateBucket).Get(checkpoint.Root) != nil if !(hasStateInDB || hasStateSummaryInDB || hasStateSummaryInCache) { return errMissingStateForCheckpoint @@ -91,6 +91,6 @@ func (kv *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb. return err } - return kv.updateFinalizedBlockRoots(ctx, tx, checkpoint) + return s.updateFinalizedBlockRoots(ctx, tx, checkpoint) }) } diff --git a/beacon-chain/db/kv/deposit_contract.go b/beacon-chain/db/kv/deposit_contract.go index 1ad584812..caba31c70 100644 --- a/beacon-chain/db/kv/deposit_contract.go +++ b/beacon-chain/db/kv/deposit_contract.go @@ -11,11 +11,11 @@ import ( // DepositContractAddress returns contract address is the address of // the deposit contract on the proof of work chain. -func (kv *Store) DepositContractAddress(ctx context.Context) ([]byte, error) { +func (s *Store) DepositContractAddress(ctx context.Context) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.DepositContractAddress") defer span.End() var addr []byte - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { chainInfo := tx.Bucket(chainMetadataBucket) addr = chainInfo.Get(depositContractAddressKey) return nil @@ -26,11 +26,11 @@ func (kv *Store) DepositContractAddress(ctx context.Context) ([]byte, error) { } // SaveDepositContractAddress to the db. It returns an error if an address has been previously saved. -func (kv *Store) SaveDepositContractAddress(ctx context.Context, addr common.Address) error { +func (s *Store) SaveDepositContractAddress(ctx context.Context, addr common.Address) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.VerifyContractAddress") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { chainInfo := tx.Bucket(chainMetadataBucket) expectedAddress := chainInfo.Get(depositContractAddressKey) if expectedAddress != nil { diff --git a/beacon-chain/db/kv/finalized_block_roots.go b/beacon-chain/db/kv/finalized_block_roots.go index 5f01a3f71..47ec1d627 100644 --- a/beacon-chain/db/kv/finalized_block_roots.go +++ b/beacon-chain/db/kv/finalized_block_roots.go @@ -37,7 +37,7 @@ var containerFinalizedButNotCanonical = []byte("recent block needs reindexing to // // This method ensures that all blocks from the current finalized epoch are considered "final" while // maintaining only canonical and finalized blocks older than the current finalized epoch. -func (kv *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, checkpoint *ethpb.Checkpoint) error { +func (s *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, checkpoint *ethpb.Checkpoint) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.updateFinalizedBlockRoots") defer span.End() @@ -56,7 +56,7 @@ func (kv *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, che } } - blockRoots, err := kv.BlockRoots(ctx, filters.NewFilter(). + blockRoots, err := s.BlockRoots(ctx, filters.NewFilter(). SetStartEpoch(previousFinalizedCheckpoint.Epoch). SetEndEpoch(checkpoint.Epoch+1), ) @@ -78,7 +78,7 @@ func (kv *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, che break } - signedBlock, err := kv.Block(ctx, bytesutil.ToBytes32(root)) + signedBlock, err := s.Block(ctx, bytesutil.ToBytes32(root)) if err != nil { traceutil.AnnotateError(span, err) return err @@ -129,7 +129,7 @@ func (kv *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, che } // Upsert blocks from the current finalized epoch. - roots, err := kv.BlockRoots(ctx, filters.NewFilter().SetStartEpoch(checkpoint.Epoch).SetEndEpoch(checkpoint.Epoch+1)) + roots, err := s.BlockRoots(ctx, filters.NewFilter().SetStartEpoch(checkpoint.Epoch).SetEndEpoch(checkpoint.Epoch+1)) if err != nil { traceutil.AnnotateError(span, err) return err @@ -159,12 +159,12 @@ func (kv *Store) updateFinalizedBlockRoots(ctx context.Context, tx *bolt.Tx, che // A beacon block root contained exists in this index if it is considered finalized and canonical. // Note: beacon blocks from the latest finalized epoch return true, whether or not they are // considered canonical in the "head view" of the beacon node. -func (kv *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool { +func (s *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.IsFinalizedBlock") defer span.End() var exists bool - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { exists = tx.Bucket(finalizedBlockRootsIndexBucket).Get(blockRoot[:]) != nil // Check genesis block root. if !exists { @@ -182,12 +182,12 @@ func (kv *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool // FinalizedChildBlock returns the child block of a provided finalized block. If // no finalized block or its respective child block exists we return with a nil // block. -func (kv *Store) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) { +func (s *Store) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.FinalizedChildBlock") defer span.End() var blk *ethpb.SignedBeaconBlock - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { blkBytes := tx.Bucket(finalizedBlockRootsIndexBucket).Get(blockRoot[:]) if blkBytes == nil { return nil diff --git a/beacon-chain/db/kv/kv.go b/beacon-chain/db/kv/kv.go index fe638898d..d4cf9cad6 100644 --- a/beacon-chain/db/kv/kv.go +++ b/beacon-chain/db/kv/kv.go @@ -122,26 +122,26 @@ func NewKVStore(dirPath string, stateSummaryCache *cache.StateSummaryCache) (*St } // ClearDB removes the previously stored database in the data directory. -func (kv *Store) ClearDB() error { - if _, err := os.Stat(kv.databasePath); os.IsNotExist(err) { +func (s *Store) ClearDB() error { + if _, err := os.Stat(s.databasePath); os.IsNotExist(err) { return nil } - prometheus.Unregister(createBoltCollector(kv.db)) - if err := os.Remove(path.Join(kv.databasePath, databaseFileName)); err != nil { + prometheus.Unregister(createBoltCollector(s.db)) + if err := os.Remove(path.Join(s.databasePath, databaseFileName)); err != nil { return errors.Wrap(err, "could not remove database file") } return nil } // Close closes the underlying BoltDB database. -func (kv *Store) Close() error { - prometheus.Unregister(createBoltCollector(kv.db)) - return kv.db.Close() +func (s *Store) Close() error { + prometheus.Unregister(createBoltCollector(s.db)) + return s.db.Close() } // DatabasePath at which this database writes files. -func (kv *Store) DatabasePath() string { - return kv.databasePath +func (s *Store) DatabasePath() string { + return s.databasePath } func createBuckets(tx *bolt.Tx, buckets ...[]byte) error { diff --git a/beacon-chain/db/kv/operations.go b/beacon-chain/db/kv/operations.go index 9d5575b9b..0394b4aa2 100644 --- a/beacon-chain/db/kv/operations.go +++ b/beacon-chain/db/kv/operations.go @@ -9,10 +9,10 @@ import ( ) // VoluntaryExit retrieval by signing root. -func (kv *Store) VoluntaryExit(ctx context.Context, exitRoot [32]byte) (*ethpb.VoluntaryExit, error) { +func (s *Store) VoluntaryExit(ctx context.Context, exitRoot [32]byte) (*ethpb.VoluntaryExit, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.VoluntaryExit") defer span.End() - enc, err := kv.voluntaryExitBytes(ctx, exitRoot) + enc, err := s.voluntaryExitBytes(ctx, exitRoot) if err != nil { return nil, err } @@ -27,10 +27,10 @@ func (kv *Store) VoluntaryExit(ctx context.Context, exitRoot [32]byte) (*ethpb.V } // HasVoluntaryExit verifies if a voluntary exit is stored in the db by its signing root. -func (kv *Store) HasVoluntaryExit(ctx context.Context, exitRoot [32]byte) bool { +func (s *Store) HasVoluntaryExit(ctx context.Context, exitRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasVoluntaryExit") defer span.End() - enc, err := kv.voluntaryExitBytes(ctx, exitRoot) + enc, err := s.voluntaryExitBytes(ctx, exitRoot) if err != nil { panic(err) } @@ -38,7 +38,7 @@ func (kv *Store) HasVoluntaryExit(ctx context.Context, exitRoot [32]byte) bool { } // SaveVoluntaryExit to the db by its signing root. -func (kv *Store) SaveVoluntaryExit(ctx context.Context, exit *ethpb.VoluntaryExit) error { +func (s *Store) SaveVoluntaryExit(ctx context.Context, exit *ethpb.VoluntaryExit) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveVoluntaryExit") defer span.End() exitRoot, err := exit.HashTreeRoot() @@ -49,17 +49,17 @@ func (kv *Store) SaveVoluntaryExit(ctx context.Context, exit *ethpb.VoluntaryExi if err != nil { return err } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(voluntaryExitsBucket) return bucket.Put(exitRoot[:], enc) }) } -func (kv *Store) voluntaryExitBytes(ctx context.Context, exitRoot [32]byte) ([]byte, error) { +func (s *Store) voluntaryExitBytes(ctx context.Context, exitRoot [32]byte) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.voluntaryExitBytes") defer span.End() var dst []byte - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(voluntaryExitsBucket) dst = bkt.Get(exitRoot[:]) return nil @@ -68,10 +68,10 @@ func (kv *Store) voluntaryExitBytes(ctx context.Context, exitRoot [32]byte) ([]b } // deleteVoluntaryExit clears a voluntary exit from the db by its signing root. -func (kv *Store) deleteVoluntaryExit(ctx context.Context, exitRoot [32]byte) error { +func (s *Store) deleteVoluntaryExit(ctx context.Context, exitRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.deleteVoluntaryExit") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(voluntaryExitsBucket) return bucket.Delete(exitRoot[:]) }) diff --git a/beacon-chain/db/kv/powchain.go b/beacon-chain/db/kv/powchain.go index 5de1043d2..ca7c1cf6e 100644 --- a/beacon-chain/db/kv/powchain.go +++ b/beacon-chain/db/kv/powchain.go @@ -12,7 +12,7 @@ import ( ) // SavePowchainData saves the pow chain data. -func (kv *Store) SavePowchainData(ctx context.Context, data *db.ETH1ChainData) error { +func (s *Store) SavePowchainData(ctx context.Context, data *db.ETH1ChainData) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SavePowchainData") defer span.End() @@ -22,7 +22,7 @@ func (kv *Store) SavePowchainData(ctx context.Context, data *db.ETH1ChainData) e return err } - err := kv.db.Update(func(tx *bolt.Tx) error { + err := s.db.Update(func(tx *bolt.Tx) error { bkt := tx.Bucket(powchainBucket) enc, err := proto.Marshal(data) if err != nil { @@ -35,12 +35,12 @@ func (kv *Store) SavePowchainData(ctx context.Context, data *db.ETH1ChainData) e } // PowchainData retrieves the powchain data. -func (kv *Store) PowchainData(ctx context.Context) (*db.ETH1ChainData, error) { +func (s *Store) PowchainData(ctx context.Context) (*db.ETH1ChainData, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.PowchainData") defer span.End() var data *db.ETH1ChainData - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(powchainBucket) enc := bkt.Get(powchainDataKey) if len(enc) == 0 { diff --git a/beacon-chain/db/kv/slashings.go b/beacon-chain/db/kv/slashings.go index fec3d0cd4..93b36b606 100644 --- a/beacon-chain/db/kv/slashings.go +++ b/beacon-chain/db/kv/slashings.go @@ -9,10 +9,10 @@ import ( ) // ProposerSlashing retrieval by slashing root. -func (kv *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.ProposerSlashing, error) { +func (s *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.ProposerSlashing, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.ProposerSlashing") defer span.End() - enc, err := kv.proposerSlashingBytes(ctx, slashingRoot) + enc, err := s.proposerSlashingBytes(ctx, slashingRoot) if err != nil { return nil, err } @@ -27,10 +27,10 @@ func (kv *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (* } // HasProposerSlashing verifies if a slashing is stored in the db. -func (kv *Store) HasProposerSlashing(ctx context.Context, slashingRoot [32]byte) bool { +func (s *Store) HasProposerSlashing(ctx context.Context, slashingRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasProposerSlashing") defer span.End() - enc, err := kv.proposerSlashingBytes(ctx, slashingRoot) + enc, err := s.proposerSlashingBytes(ctx, slashingRoot) if err != nil { panic(err) } @@ -38,7 +38,7 @@ func (kv *Store) HasProposerSlashing(ctx context.Context, slashingRoot [32]byte) } // SaveProposerSlashing to the db by its hash tree root. -func (kv *Store) SaveProposerSlashing(ctx context.Context, slashing *ethpb.ProposerSlashing) error { +func (s *Store) SaveProposerSlashing(ctx context.Context, slashing *ethpb.ProposerSlashing) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveProposerSlashing") defer span.End() slashingRoot, err := slashing.HashTreeRoot() @@ -49,17 +49,17 @@ func (kv *Store) SaveProposerSlashing(ctx context.Context, slashing *ethpb.Propo if err != nil { return err } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(proposerSlashingsBucket) return bucket.Put(slashingRoot[:], enc) }) } -func (kv *Store) proposerSlashingBytes(ctx context.Context, slashingRoot [32]byte) ([]byte, error) { +func (s *Store) proposerSlashingBytes(ctx context.Context, slashingRoot [32]byte) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.proposerSlashingBytes") defer span.End() var dst []byte - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(proposerSlashingsBucket) dst = bkt.Get(slashingRoot[:]) return nil @@ -68,20 +68,20 @@ func (kv *Store) proposerSlashingBytes(ctx context.Context, slashingRoot [32]byt } // deleteProposerSlashing clears a proposer slashing from the db by its hash tree root. -func (kv *Store) deleteProposerSlashing(ctx context.Context, slashingRoot [32]byte) error { +func (s *Store) deleteProposerSlashing(ctx context.Context, slashingRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.deleteProposerSlashing") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(proposerSlashingsBucket) return bucket.Delete(slashingRoot[:]) }) } // AttesterSlashing retrieval by hash tree root. -func (kv *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.AttesterSlashing, error) { +func (s *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.AttesterSlashing, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.AttesterSlashing") defer span.End() - enc, err := kv.attesterSlashingBytes(ctx, slashingRoot) + enc, err := s.attesterSlashingBytes(ctx, slashingRoot) if err != nil { return nil, err } @@ -96,10 +96,10 @@ func (kv *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (* } // HasAttesterSlashing verifies if a slashing is stored in the db. -func (kv *Store) HasAttesterSlashing(ctx context.Context, slashingRoot [32]byte) bool { +func (s *Store) HasAttesterSlashing(ctx context.Context, slashingRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasAttesterSlashing") defer span.End() - enc, err := kv.attesterSlashingBytes(ctx, slashingRoot) + enc, err := s.attesterSlashingBytes(ctx, slashingRoot) if err != nil { panic(err) } @@ -107,7 +107,7 @@ func (kv *Store) HasAttesterSlashing(ctx context.Context, slashingRoot [32]byte) } // SaveAttesterSlashing to the db by its hash tree root. -func (kv *Store) SaveAttesterSlashing(ctx context.Context, slashing *ethpb.AttesterSlashing) error { +func (s *Store) SaveAttesterSlashing(ctx context.Context, slashing *ethpb.AttesterSlashing) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveAttesterSlashing") defer span.End() slashingRoot, err := slashing.HashTreeRoot() @@ -118,17 +118,17 @@ func (kv *Store) SaveAttesterSlashing(ctx context.Context, slashing *ethpb.Attes if err != nil { return err } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(attesterSlashingsBucket) return bucket.Put(slashingRoot[:], enc) }) } -func (kv *Store) attesterSlashingBytes(ctx context.Context, slashingRoot [32]byte) ([]byte, error) { +func (s *Store) attesterSlashingBytes(ctx context.Context, slashingRoot [32]byte) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.attesterSlashingBytes") defer span.End() var dst []byte - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(attesterSlashingsBucket) dst = bkt.Get(slashingRoot[:]) return nil @@ -137,10 +137,10 @@ func (kv *Store) attesterSlashingBytes(ctx context.Context, slashingRoot [32]byt } // deleteAttesterSlashing clears an attester slashing from the db by its hash tree root. -func (kv *Store) deleteAttesterSlashing(ctx context.Context, slashingRoot [32]byte) error { +func (s *Store) deleteAttesterSlashing(ctx context.Context, slashingRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.deleteAttesterSlashing") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(attesterSlashingsBucket) return bucket.Delete(slashingRoot[:]) }) diff --git a/beacon-chain/db/kv/state.go b/beacon-chain/db/kv/state.go index 3413abaa8..2d458020e 100644 --- a/beacon-chain/db/kv/state.go +++ b/beacon-chain/db/kv/state.go @@ -15,11 +15,11 @@ import ( // State returns the saved state using block's signing root, // this particular block was used to generate the state. -func (kv *Store) State(ctx context.Context, blockRoot [32]byte) (*state.BeaconState, error) { +func (s *Store) State(ctx context.Context, blockRoot [32]byte) (*state.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.State") defer span.End() - var s *pb.BeaconState - enc, err := kv.stateBytes(ctx, blockRoot) + var st *pb.BeaconState + enc, err := s.stateBytes(ctx, blockRoot) if err != nil { return nil, err } @@ -28,19 +28,19 @@ func (kv *Store) State(ctx context.Context, blockRoot [32]byte) (*state.BeaconSt return nil, nil } - s, err = createState(ctx, enc) + st, err = createState(ctx, enc) if err != nil { return nil, err } - return state.InitializeFromProtoUnsafe(s) + return state.InitializeFromProtoUnsafe(st) } // HeadState returns the latest canonical state in beacon chain. -func (kv *Store) HeadState(ctx context.Context) (*state.BeaconState, error) { +func (s *Store) HeadState(ctx context.Context) (*state.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.HeadState") defer span.End() - var s *pb.BeaconState - err := kv.db.View(func(tx *bolt.Tx) error { + var st *pb.BeaconState + err := s.db.View(func(tx *bolt.Tx) error { // Retrieve head block's signing root from blocks bucket, // to look up what the head state is. bucket := tx.Bucket(blocksBucket) @@ -53,28 +53,28 @@ func (kv *Store) HeadState(ctx context.Context) (*state.BeaconState, error) { } var err error - s, err = createState(ctx, enc) + st, err = createState(ctx, enc) return err }) if err != nil { return nil, err } - if s == nil { + if st == nil { return nil, nil } span.AddAttributes(trace.BoolAttribute("exists", s != nil)) - if s != nil { - span.AddAttributes(trace.Int64Attribute("slot", int64(s.Slot))) + if st != nil { + span.AddAttributes(trace.Int64Attribute("slot", int64(st.Slot))) } - return state.InitializeFromProtoUnsafe(s) + return state.InitializeFromProtoUnsafe(st) } // GenesisState returns the genesis state in beacon chain. -func (kv *Store) GenesisState(ctx context.Context) (*state.BeaconState, error) { +func (s *Store) GenesisState(ctx context.Context) (*state.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.GenesisState") defer span.End() - var s *pb.BeaconState - err := kv.db.View(func(tx *bolt.Tx) error { + var st *pb.BeaconState + err := s.db.View(func(tx *bolt.Tx) error { // Retrieve genesis block's signing root from blocks bucket, // to look up what the genesis state is. bucket := tx.Bucket(blocksBucket) @@ -87,28 +87,28 @@ func (kv *Store) GenesisState(ctx context.Context) (*state.BeaconState, error) { } var err error - s, err = createState(ctx, enc) + st, err = createState(ctx, enc) return err }) if err != nil { return nil, err } - if s == nil { + if st == nil { return nil, nil } - return state.InitializeFromProtoUnsafe(s) + return state.InitializeFromProtoUnsafe(st) } // SaveState stores a state to the db using block's signing root which was used to generate the state. -func (kv *Store) SaveState(ctx context.Context, st *state.BeaconState, blockRoot [32]byte) error { +func (s *Store) SaveState(ctx context.Context, st *state.BeaconState, blockRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveState") defer span.End() - return kv.SaveStates(ctx, []*state.BeaconState{st}, [][32]byte{blockRoot}) + return s.SaveStates(ctx, []*state.BeaconState{st}, [][32]byte{blockRoot}) } // SaveStates stores multiple states to the db using the provided corresponding roots. -func (kv *Store) SaveStates(ctx context.Context, states []*state.BeaconState, blockRoots [][32]byte) error { +func (s *Store) SaveStates(ctx context.Context, states []*state.BeaconState, blockRoots [][32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveStates") defer span.End() if states == nil { @@ -123,7 +123,7 @@ func (kv *Store) SaveStates(ctx context.Context, states []*state.BeaconState, bl } } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(stateBucket) for i, rt := range blockRoots { indicesByBucket := createStateIndicesFromStateSlot(ctx, states[i].Slot()) @@ -139,10 +139,10 @@ func (kv *Store) SaveStates(ctx context.Context, states []*state.BeaconState, bl } // HasState checks if a state by root exists in the db. -func (kv *Store) HasState(ctx context.Context, blockRoot [32]byte) bool { +func (s *Store) HasState(ctx context.Context, blockRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasState") defer span.End() - enc, err := kv.stateBytes(ctx, blockRoot) + enc, err := s.stateBytes(ctx, blockRoot) if err != nil { panic(err) } @@ -150,10 +150,10 @@ func (kv *Store) HasState(ctx context.Context, blockRoot [32]byte) bool { } // DeleteState by block root. -func (kv *Store) DeleteState(ctx context.Context, blockRoot [32]byte) error { +func (s *Store) DeleteState(ctx context.Context, blockRoot [32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.DeleteState") defer span.End() - return kv.DeleteStates(ctx, [][32]byte{blockRoot}) + return s.DeleteStates(ctx, [][32]byte{blockRoot}) } // DeleteStates by block roots. @@ -162,7 +162,7 @@ func (kv *Store) DeleteState(ctx context.Context, blockRoot [32]byte) error { // cursor is faster when there are a large set of keys to delete. This method is O(n) deletion where // n is the number of keys in the database. The alternative of calling bkt.Delete on each key to // delete would be O(m*log(n)) which would be much slower given a large set of keys to delete. -func (kv *Store) DeleteStates(ctx context.Context, blockRoots [][32]byte) error { +func (s *Store) DeleteStates(ctx context.Context, blockRoots [][32]byte) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.DeleteStates") defer span.End() @@ -171,7 +171,7 @@ func (kv *Store) DeleteStates(ctx context.Context, blockRoots [][32]byte) error rootMap[blockRoot] = true } - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bkt := tx.Bucket(blocksBucket) genesisBlockRoot := bkt.Get(genesisBlockRootKey) @@ -225,11 +225,11 @@ func createState(ctx context.Context, enc []byte) (*pb.BeaconState, error) { } // HasState checks if a state by root exists in the db. -func (kv *Store) stateBytes(ctx context.Context, blockRoot [32]byte) ([]byte, error) { +func (s *Store) stateBytes(ctx context.Context, blockRoot [32]byte) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.stateBytes") defer span.End() var dst []byte - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(stateBucket) dst = bkt.Get(blockRoot[:]) return nil @@ -287,12 +287,12 @@ func slotByBlockRoot(ctx context.Context, tx *bolt.Tx, blockRoot []byte) (uint64 // from the db. Ideally there should just be one state per slot, but given validator // can double propose, a single slot could have multiple block roots and // results states. This returns a list of states. -func (kv *Store) HighestSlotStatesBelow(ctx context.Context, slot uint64) ([]*state.BeaconState, error) { +func (s *Store) HighestSlotStatesBelow(ctx context.Context, slot uint64) ([]*state.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.HighestSlotStatesBelow") defer span.End() var best []byte - if err := kv.db.View(func(tx *bolt.Tx) error { + if err := s.db.View(func(tx *bolt.Tx) error { bkt := tx.Bucket(stateSlotIndicesBucket) c := bkt.Cursor() for s, root := c.First(); s != nil; s, root = c.Next() { @@ -313,13 +313,13 @@ func (kv *Store) HighestSlotStatesBelow(ctx context.Context, slot uint64) ([]*st var st *state.BeaconState var err error if best != nil { - st, err = kv.State(ctx, bytesutil.ToBytes32(best)) + st, err = s.State(ctx, bytesutil.ToBytes32(best)) if err != nil { return nil, err } } if st == nil { - st, err = kv.GenesisState(ctx) + st, err = s.GenesisState(ctx) if err != nil { return nil, err } diff --git a/beacon-chain/db/kv/state_summary.go b/beacon-chain/db/kv/state_summary.go index 40223100d..5cac49c31 100644 --- a/beacon-chain/db/kv/state_summary.go +++ b/beacon-chain/db/kv/state_summary.go @@ -9,19 +9,19 @@ import ( ) // SaveStateSummary saves a state summary object to the DB. -func (kv *Store) SaveStateSummary(ctx context.Context, summary *pb.StateSummary) error { +func (s *Store) SaveStateSummary(ctx context.Context, summary *pb.StateSummary) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveStateSummary") defer span.End() - return kv.SaveStateSummaries(ctx, []*pb.StateSummary{summary}) + return s.SaveStateSummaries(ctx, []*pb.StateSummary{summary}) } // SaveStateSummaries saves state summary objects to the DB. -func (kv *Store) SaveStateSummaries(ctx context.Context, summaries []*pb.StateSummary) error { +func (s *Store) SaveStateSummaries(ctx context.Context, summaries []*pb.StateSummary) error { ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveStateSummaries") defer span.End() - return kv.db.Update(func(tx *bolt.Tx) error { + return s.db.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket(stateSummaryBucket) for _, summary := range summaries { enc, err := encode(ctx, summary) @@ -37,10 +37,10 @@ func (kv *Store) SaveStateSummaries(ctx context.Context, summaries []*pb.StateSu } // StateSummary returns the state summary object from the db using input block root. -func (kv *Store) StateSummary(ctx context.Context, blockRoot [32]byte) (*pb.StateSummary, error) { +func (s *Store) StateSummary(ctx context.Context, blockRoot [32]byte) (*pb.StateSummary, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.StateSummary") defer span.End() - enc, err := kv.stateSummaryBytes(ctx, blockRoot) + enc, err := s.stateSummaryBytes(ctx, blockRoot) if err != nil { return nil, err } @@ -55,22 +55,22 @@ func (kv *Store) StateSummary(ctx context.Context, blockRoot [32]byte) (*pb.Stat } // HasStateSummary returns true if a state summary exists in DB. -func (kv *Store) HasStateSummary(ctx context.Context, blockRoot [32]byte) bool { +func (s *Store) HasStateSummary(ctx context.Context, blockRoot [32]byte) bool { ctx, span := trace.StartSpan(ctx, "BeaconDB.HasStateSummary") defer span.End() - enc, err := kv.stateSummaryBytes(ctx, blockRoot) + enc, err := s.stateSummaryBytes(ctx, blockRoot) if err != nil { panic(err) } return len(enc) > 0 } -func (kv *Store) stateSummaryBytes(ctx context.Context, blockRoot [32]byte) ([]byte, error) { +func (s *Store) stateSummaryBytes(ctx context.Context, blockRoot [32]byte) ([]byte, error) { ctx, span := trace.StartSpan(ctx, "BeaconDB.stateSummaryBytes") defer span.End() var enc []byte - err := kv.db.View(func(tx *bolt.Tx) error { + err := s.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(stateSummaryBucket) enc = bucket.Get(blockRoot[:]) return nil diff --git a/beacon-chain/flags/config.go b/beacon-chain/flags/config.go index d2201356d..93e482f50 100644 --- a/beacon-chain/flags/config.go +++ b/beacon-chain/flags/config.go @@ -54,7 +54,7 @@ func ConfigureGlobalFlags(ctx *cli.Context) { func configureMinimumPeers(ctx *cli.Context, cfg *GlobalFlags) { cfg.MinimumSyncPeers = ctx.Int(MinSyncPeers.Name) - maxPeers := int(ctx.Int(cmd.P2PMaxPeers.Name)) + maxPeers := ctx.Int(cmd.P2PMaxPeers.Name) if cfg.MinimumSyncPeers > maxPeers { log.Warnf("Changing Minimum Sync Peers to %d", maxPeers) cfg.MinimumSyncPeers = maxPeers diff --git a/beacon-chain/interop-cold-start/service.go b/beacon-chain/interop-cold-start/service.go index ba16a697f..b2d1a4ba7 100644 --- a/beacon-chain/interop-cold-start/service.go +++ b/beacon-chain/interop-cold-start/service.go @@ -121,7 +121,7 @@ func (s *Service) Status() error { } // AllDeposits mocks out the deposit cache functionality for interop. -func (s *Service) AllDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit { +func (s *Service) AllDeposits(_ context.Context, _ *big.Int) []*ethpb.Deposit { return []*ethpb.Deposit{} } @@ -146,22 +146,22 @@ func (s *Service) ClearPreGenesisData() { } // DepositByPubkey mocks out the deposit cache functionality for interop. -func (s *Service) DepositByPubkey(ctx context.Context, pubKey []byte) (*ethpb.Deposit, *big.Int) { +func (s *Service) DepositByPubkey(_ context.Context, _ []byte) (*ethpb.Deposit, *big.Int) { return ðpb.Deposit{}, nil } // DepositsNumberAndRootAtHeight mocks out the deposit cache functionality for interop. -func (s *Service) DepositsNumberAndRootAtHeight(ctx context.Context, blockHeight *big.Int) (uint64, [32]byte) { +func (s *Service) DepositsNumberAndRootAtHeight(_ context.Context, _ *big.Int) (uint64, [32]byte) { return 0, [32]byte{} } // FinalizedDeposits mocks out the deposit cache functionality for interop. -func (s *Service) FinalizedDeposits(ctx context.Context) *depositcache.FinalizedDeposits { +func (s *Service) FinalizedDeposits(_ context.Context) *depositcache.FinalizedDeposits { return nil } // NonFinalizedDeposits mocks out the deposit cache functionality for interop. -func (s *Service) NonFinalizedDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit { +func (s *Service) NonFinalizedDeposits(_ context.Context, _ *big.Int) []*ethpb.Deposit { return []*ethpb.Deposit{} } diff --git a/beacon-chain/operations/slashings/service_attester_test.go b/beacon-chain/operations/slashings/service_attester_test.go index 078fd8a72..febe999ac 100644 --- a/beacon-chain/operations/slashings/service_attester_test.go +++ b/beacon-chain/operations/slashings/service_attester_test.go @@ -15,14 +15,14 @@ import ( ) func validAttesterSlashingForValIdx(t *testing.T, beaconState *state.BeaconState, privs []bls.SecretKey, valIdx ...uint64) *ethpb.AttesterSlashing { - slashings := []*ethpb.AttesterSlashing{} + var slashings []*ethpb.AttesterSlashing for _, idx := range valIdx { slashing, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privs[idx], idx) require.NoError(t, err) slashings = append(slashings, slashing) } - allSig1 := []bls.Signature{} - allSig2 := []bls.Signature{} + var allSig1 []bls.Signature + var allSig2 []bls.Signature for _, slashing := range slashings { sig1 := slashing.Attestation_1.Signature sig2 := slashing.Attestation_2.Signature diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index f783c409b..ecda08602 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -56,7 +56,6 @@ go_library( "//shared/timeutils:go_default_library", "//shared/traceutil:go_default_library", "//shared/version:go_default_library", - "@com_github_btcsuite_btcd//btcec:go_default_library", "@com_github_dgraph_io_ristretto//:go_default_library", "@com_github_ethereum_go_ethereum//p2p/discover:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", diff --git a/beacon-chain/p2p/connection_gater.go b/beacon-chain/p2p/connection_gater.go index 9033982be..ee4829071 100644 --- a/beacon-chain/p2p/connection_gater.go +++ b/beacon-chain/p2p/connection_gater.go @@ -20,7 +20,7 @@ const ipLimit = 4 const ipBurst = 8 // InterceptPeerDial tests whether we're permitted to Dial the specified peer. -func (s *Service) InterceptPeerDial(p peer.ID) (allow bool) { +func (s *Service) InterceptPeerDial(_ peer.ID) (allow bool) { return true } @@ -51,12 +51,12 @@ func (s *Service) InterceptAccept(n network.ConnMultiaddrs) (allow bool) { // InterceptSecured tests whether a given connection, now authenticated, // is allowed. -func (s *Service) InterceptSecured(_ network.Direction, _ peer.ID, n network.ConnMultiaddrs) (allow bool) { +func (s *Service) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) (allow bool) { return true } // InterceptUpgraded tests whether a fully capable connection is allowed. -func (s *Service) InterceptUpgraded(n network.Conn) (allow bool, reason control.DisconnectReason) { +func (s *Service) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason) { return true, 0 } diff --git a/beacon-chain/p2p/encoder/varint_test.go b/beacon-chain/p2p/encoder/varint_test.go index 6170a0e5b..3b45bf1f2 100644 --- a/beacon-chain/p2p/encoder/varint_test.go +++ b/beacon-chain/p2p/encoder/varint_test.go @@ -22,7 +22,7 @@ func TestReadVarint_ExceedsMaxLength(t *testing.T) { fByte := byte(1 << 7) // Terminating byte. tByte := byte(1 << 6) - header := []byte{} + var header []byte for i := 0; i < 9; i++ { header = append(header, fByte) } diff --git a/beacon-chain/p2p/fork_test.go b/beacon-chain/p2p/fork_test.go index 8ae52b335..081640baf 100644 --- a/beacon-chain/p2p/fork_test.go +++ b/beacon-chain/p2p/fork_test.go @@ -93,7 +93,7 @@ func TestStartDiscv5_DifferentForkDigests(t *testing.T) { s.genesisTime = genesisTime s.genesisValidatorsRoot = make([]byte, 32) s.dv5Listener = lastListener - addrs := []ma.Multiaddr{} + var addrs []ma.Multiaddr for _, n := range nodes { if s.filterPeer(n) { @@ -182,7 +182,7 @@ func TestStartDiscv5_SameForkDigests_DifferentNextForkData(t *testing.T) { s.genesisTime = genesisTime s.genesisValidatorsRoot = make([]byte, 32) s.dv5Listener = lastListener - addrs := []ma.Multiaddr{} + var addrs []ma.Multiaddr for _, n := range nodes { if s.filterPeer(n) { diff --git a/beacon-chain/p2p/service_test.go b/beacon-chain/p2p/service_test.go index f7436caf8..34a9e74ff 100644 --- a/beacon-chain/p2p/service_test.go +++ b/beacon-chain/p2p/service_test.go @@ -36,7 +36,7 @@ func (mockListener) Lookup(enode.ID) []*enode.Node { panic("implement me") } -func (mockListener) ReadRandomNodes([]*enode.Node) int { +func (mockListener) ReadRandomNodes(_ []*enode.Node) int { panic("implement me") } diff --git a/beacon-chain/p2p/subnets.go b/beacon-chain/p2p/subnets.go index c1fb81aa9..179f3761a 100644 --- a/beacon-chain/p2p/subnets.go +++ b/beacon-chain/p2p/subnets.go @@ -112,7 +112,7 @@ func retrieveAttSubnets(record *enr.Record) ([]uint64, error) { if err != nil { return nil, err } - committeeIdxs := []uint64{} + var committeeIdxs []uint64 for i := uint64(0); i < attestationSubnetCount; i++ { if bitV.BitAt(i) { committeeIdxs = append(committeeIdxs, i) diff --git a/beacon-chain/p2p/testing/fuzz_p2p.go b/beacon-chain/p2p/testing/fuzz_p2p.go index 3ad0e21ca..d6085b70d 100644 --- a/beacon-chain/p2p/testing/fuzz_p2p.go +++ b/beacon-chain/p2p/testing/fuzz_p2p.go @@ -33,22 +33,22 @@ func (p *FakeP2P) Encoding() encoder.NetworkEncoding { } // AddConnectionHandler -- fake. -func (p *FakeP2P) AddConnectionHandler(f func(ctx context.Context, id peer.ID) error) { +func (p *FakeP2P) AddConnectionHandler(_ func(ctx context.Context, id peer.ID) error) { } // AddDisconnectionHandler -- fake. -func (p *FakeP2P) AddDisconnectionHandler(f func(ctx context.Context, id peer.ID) error) { +func (p *FakeP2P) AddDisconnectionHandler(_ func(ctx context.Context, id peer.ID) error) { } // AddPingMethod -- fake. -func (p *FakeP2P) AddPingMethod(reqFunc func(ctx context.Context, id peer.ID) error) { +func (p *FakeP2P) AddPingMethod(_ func(ctx context.Context, id peer.ID) error) { } // PeerID -- fake. func (p *FakeP2P) PeerID() peer.ID { - return peer.ID("fake") + return "fake" } // ENR returns the enr of the local peer. @@ -57,7 +57,7 @@ func (p *FakeP2P) ENR() *enr.Record { } // FindPeersWithSubnet mocks the p2p func. -func (p *FakeP2P) FindPeersWithSubnet(ctx context.Context, index uint64) (bool, error) { +func (p *FakeP2P) FindPeersWithSubnet(_ context.Context, _ uint64) (bool, error) { return false, nil } @@ -67,7 +67,7 @@ func (p *FakeP2P) RefreshENR() { } // LeaveTopic -- fake. -func (p *FakeP2P) LeaveTopic(topic string) error { +func (p *FakeP2P) LeaveTopic(_ string) error { return nil } @@ -83,12 +83,12 @@ func (p *FakeP2P) Peers() *peers.Status { } // PublishToTopic -- fake. -func (p *FakeP2P) PublishToTopic(ctx context.Context, topic string, data []byte, opts ...pubsub.PubOpt) error { +func (p *FakeP2P) PublishToTopic(_ context.Context, _ string, _ []byte, _ ...pubsub.PubOpt) error { return nil } // Send -- fake. -func (p *FakeP2P) Send(ctx context.Context, msg interface{}, topic string, pid peer.ID) (network.Stream, error) { +func (p *FakeP2P) Send(_ context.Context, _ interface{}, _ string, _ peer.ID) (network.Stream, error) { return nil, nil } @@ -103,17 +103,17 @@ func (p *FakeP2P) MetadataSeq() uint64 { } // SetStreamHandler -- fake. -func (p *FakeP2P) SetStreamHandler(topic string, handler network.StreamHandler) { +func (p *FakeP2P) SetStreamHandler(_ string, _ network.StreamHandler) { } // SubscribeToTopic -- fake. -func (p *FakeP2P) SubscribeToTopic(topic string, opts ...pubsub.SubOpt) (*pubsub.Subscription, error) { +func (p *FakeP2P) SubscribeToTopic(_ string, _ ...pubsub.SubOpt) (*pubsub.Subscription, error) { return nil, nil } // JoinTopic -- fake. -func (p *FakeP2P) JoinTopic(topic string, opts ...pubsub.TopicOpt) (*pubsub.Topic, error) { +func (p *FakeP2P) JoinTopic(_ string, _ ...pubsub.TopicOpt) (*pubsub.Topic, error) { return nil, nil } @@ -123,17 +123,17 @@ func (p *FakeP2P) Host() host.Host { } // Disconnect -- fake. -func (p *FakeP2P) Disconnect(pid peer.ID) error { +func (p *FakeP2P) Disconnect(_ peer.ID) error { return nil } // Broadcast -- fake. -func (p *FakeP2P) Broadcast(ctx context.Context, msg proto.Message) error { +func (p *FakeP2P) Broadcast(_ context.Context, _ proto.Message) error { return nil } // BroadcastAttestation -- fake. -func (p *FakeP2P) BroadcastAttestation(ctx context.Context, subnet uint64, att *ethpb.Attestation) error { +func (p *FakeP2P) BroadcastAttestation(_ context.Context, _ uint64, _ *ethpb.Attestation) error { return nil } @@ -148,7 +148,7 @@ func (p *FakeP2P) InterceptAddrDial(peer.ID, multiaddr.Multiaddr) (allow bool) { } // InterceptAccept -- fake. -func (p *FakeP2P) InterceptAccept(n network.ConnMultiaddrs) (allow bool) { +func (p *FakeP2P) InterceptAccept(_ network.ConnMultiaddrs) (allow bool) { return true } diff --git a/beacon-chain/p2p/testing/mock_broadcaster.go b/beacon-chain/p2p/testing/mock_broadcaster.go index 2fcbcfd66..9da04dcd4 100644 --- a/beacon-chain/p2p/testing/mock_broadcaster.go +++ b/beacon-chain/p2p/testing/mock_broadcaster.go @@ -19,7 +19,7 @@ func (m *MockBroadcaster) Broadcast(context.Context, proto.Message) error { } // BroadcastAttestation records a broadcast occurred. -func (m *MockBroadcaster) BroadcastAttestation(ctx context.Context, subnet uint64, att *ethpb.Attestation) error { +func (m *MockBroadcaster) BroadcastAttestation(_ context.Context, _ uint64, _ *ethpb.Attestation) error { m.BroadcastCalled = true return nil } diff --git a/beacon-chain/p2p/testing/mock_peermanager.go b/beacon-chain/p2p/testing/mock_peermanager.go index f27ecbdad..da1b09730 100644 --- a/beacon-chain/p2p/testing/mock_peermanager.go +++ b/beacon-chain/p2p/testing/mock_peermanager.go @@ -39,9 +39,9 @@ func (m MockPeerManager) ENR() *enr.Record { func (m MockPeerManager) RefreshENR() {} // FindPeersWithSubnet . -func (m MockPeerManager) FindPeersWithSubnet(ctx context.Context, index uint64) (bool, error) { +func (m MockPeerManager) FindPeersWithSubnet(_ context.Context, _ uint64) (bool, error) { return true, nil } // AddPingMethod . -func (m MockPeerManager) AddPingMethod(reqFunc func(ctx context.Context, id peer.ID) error) {} +func (m MockPeerManager) AddPingMethod(_ func(ctx context.Context, id peer.ID) error) {} diff --git a/beacon-chain/p2p/testing/p2p.go b/beacon-chain/p2p/testing/p2p.go index ce30ea865..d5ccd58c4 100644 --- a/beacon-chain/p2p/testing/p2p.go +++ b/beacon-chain/p2p/testing/p2p.go @@ -143,13 +143,13 @@ func (p *TestP2P) ReceivePubSub(topic string, msg proto.Message) { } // Broadcast a message. -func (p *TestP2P) Broadcast(ctx context.Context, msg proto.Message) error { +func (p *TestP2P) Broadcast(_ context.Context, _ proto.Message) error { p.BroadcastCalled = true return nil } // BroadcastAttestation broadcasts an attestation. -func (p *TestP2P) BroadcastAttestation(ctx context.Context, subnet uint64, att *ethpb.Attestation) error { +func (p *TestP2P) BroadcastAttestation(_ context.Context, _ uint64, _ *ethpb.Attestation) error { p.BroadcastCalled = true return nil } @@ -314,7 +314,7 @@ func (p *TestP2P) Peers() *peers.Status { } // FindPeersWithSubnet mocks the p2p func. -func (p *TestP2P) FindPeersWithSubnet(ctx context.Context, index uint64) (bool, error) { +func (p *TestP2P) FindPeersWithSubnet(_ context.Context, _ uint64) (bool, error) { return false, nil } @@ -337,7 +337,7 @@ func (p *TestP2P) MetadataSeq() uint64 { } // AddPingMethod mocks the p2p func. -func (p *TestP2P) AddPingMethod(reqFunc func(ctx context.Context, id peer.ID) error) { +func (p *TestP2P) AddPingMethod(_ func(ctx context.Context, id peer.ID) error) { // no-op } @@ -352,7 +352,7 @@ func (p *TestP2P) InterceptAddrDial(peer.ID, multiaddr.Multiaddr) (allow bool) { } // InterceptAccept . -func (p *TestP2P) InterceptAccept(n network.ConnMultiaddrs) (allow bool) { +func (p *TestP2P) InterceptAccept(_ network.ConnMultiaddrs) (allow bool) { return true } diff --git a/beacon-chain/p2p/utils.go b/beacon-chain/p2p/utils.go index 04490fe59..ca73455fe 100644 --- a/beacon-chain/p2p/utils.go +++ b/beacon-chain/p2p/utils.go @@ -13,7 +13,6 @@ import ( "path" "time" - "github.com/btcsuite/btcd/btcec" "github.com/ethereum/go-ethereum/p2p/enr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/pkg/errors" @@ -40,17 +39,17 @@ func SerializeENR(record *enr.Record) (string, error) { } func convertFromInterfacePrivKey(privkey crypto.PrivKey) *ecdsa.PrivateKey { - typeAssertedKey := (*ecdsa.PrivateKey)((*btcec.PrivateKey)(privkey.(*crypto.Secp256k1PrivateKey))) + typeAssertedKey := (*ecdsa.PrivateKey)(privkey.(*crypto.Secp256k1PrivateKey)) return typeAssertedKey } func convertToInterfacePrivkey(privkey *ecdsa.PrivateKey) crypto.PrivKey { - typeAssertedKey := crypto.PrivKey((*crypto.Secp256k1PrivateKey)((*btcec.PrivateKey)(privkey))) + typeAssertedKey := crypto.PrivKey((*crypto.Secp256k1PrivateKey)(privkey)) return typeAssertedKey } func convertToInterfacePubkey(pubkey *ecdsa.PublicKey) crypto.PubKey { - typeAssertedKey := crypto.PubKey((*crypto.Secp256k1PublicKey)((*btcec.PublicKey)(pubkey))) + typeAssertedKey := crypto.PubKey((*crypto.Secp256k1PublicKey)(pubkey)) return typeAssertedKey } diff --git a/beacon-chain/p2p/watch_peers.go b/beacon-chain/p2p/watch_peers.go index cefdd96e6..18e6b7514 100644 --- a/beacon-chain/p2p/watch_peers.go +++ b/beacon-chain/p2p/watch_peers.go @@ -4,6 +4,7 @@ import ( "context" "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/peer" ) // ensurePeerConnections will attempt to reestablish connection to the peers @@ -24,13 +25,17 @@ func ensurePeerConnections(ctx context.Context, h host.Host, peers ...string) { c := h.Network().ConnsToPeer(peer.ID) if len(c) == 0 { - log.WithField("peer", peer.ID).Debug("No connections to peer, reconnecting") - ctx, cancel := context.WithTimeout(ctx, maxDialTimeout) - defer cancel() - if err := h.Connect(ctx, *peer); err != nil { + if err := connectWithTimeout(ctx, h, peer); err != nil { log.WithField("peer", peer.ID).WithField("addrs", peer.Addrs).WithError(err).Errorf("Failed to reconnect to peer") continue } } } } + +func connectWithTimeout(ctx context.Context, h host.Host, peer *peer.AddrInfo) error { + log.WithField("peer", peer.ID).Debug("No connections to peer, reconnecting") + ctx, cancel := context.WithTimeout(ctx, maxDialTimeout) + defer cancel() + return h.Connect(ctx, *peer) +} diff --git a/beacon-chain/powchain/block_cache.go b/beacon-chain/powchain/block_cache.go index e7b9d5bd4..b6e23a491 100644 --- a/beacon-chain/powchain/block_cache.go +++ b/beacon-chain/powchain/block_cache.go @@ -179,6 +179,6 @@ func trim(queue *cache.FIFO, maxSize uint64) { } // popProcessNoopFunc is a no-op function that never returns an error. -func popProcessNoopFunc(obj interface{}) error { +func popProcessNoopFunc(_ interface{}) error { return nil } diff --git a/beacon-chain/powchain/deposit_test.go b/beacon-chain/powchain/deposit_test.go index 009af9fb5..e4221208d 100644 --- a/beacon-chain/powchain/deposit_test.go +++ b/beacon-chain/powchain/deposit_test.go @@ -41,7 +41,7 @@ func TestProcessDeposit_OK(t *testing.T) { valcount, err := helpers.ActiveValidatorCount(web3Service.preGenesisState, 0) require.NoError(t, err) - require.Equal(t, int(1), int(valcount), "Did not get correct active validator count") + require.Equal(t, 1, int(valcount), "Did not get correct active validator count") } func TestProcessDeposit_InvalidMerkleBranch(t *testing.T) { @@ -230,7 +230,7 @@ func TestProcessDeposit_IncompleteDeposit(t *testing.T) { valcount, err := helpers.ActiveValidatorCount(web3Service.preGenesisState, 0) require.NoError(t, err) - require.Equal(t, int(0), int(valcount), "Did not get correct active validator count") + require.Equal(t, 0, int(valcount), "Did not get correct active validator count") } } diff --git a/beacon-chain/powchain/log_processing_test.go b/beacon-chain/powchain/log_processing_test.go index 96a8d9f78..a185b47ca 100644 --- a/beacon-chain/powchain/log_processing_test.go +++ b/beacon-chain/powchain/log_processing_test.go @@ -158,7 +158,7 @@ func TestProcessDepositLog_InsertsPendingDeposit(t *testing.T) { require.NoError(t, err) pendingDeposits := web3Service.depositCache.PendingDeposits(context.Background(), nil /*blockNum*/) - require.Equal(t, int(2), len(pendingDeposits), "Unexpected number of deposits") + require.Equal(t, 2, len(pendingDeposits), "Unexpected number of deposits") hook.Reset() } diff --git a/beacon-chain/powchain/service_test.go b/beacon-chain/powchain/service_test.go index 2e9a7399e..3e284a628 100644 --- a/beacon-chain/powchain/service_test.go +++ b/beacon-chain/powchain/service_test.go @@ -74,7 +74,7 @@ type goodFetcher struct { backend *backends.SimulatedBackend } -func (g *goodFetcher) HeaderByHash(ctx context.Context, hash common.Hash) (*gethTypes.Header, error) { +func (g *goodFetcher) HeaderByHash(_ context.Context, hash common.Hash) (*gethTypes.Header, error) { if bytes.Equal(hash.Bytes(), common.BytesToHash([]byte{0}).Bytes()) { return nil, fmt.Errorf("expected block hash to be nonzero %v", hash) } @@ -91,7 +91,7 @@ func (g *goodFetcher) HeaderByHash(ctx context.Context, hash common.Hash) (*geth } -func (g *goodFetcher) HeaderByNumber(ctx context.Context, number *big.Int) (*gethTypes.Header, error) { +func (g *goodFetcher) HeaderByNumber(_ context.Context, number *big.Int) (*gethTypes.Header, error) { if g.backend == nil { return &gethTypes.Header{ Number: big.NewInt(15), @@ -110,7 +110,7 @@ func (g *goodFetcher) HeaderByNumber(ctx context.Context, number *big.Int) (*get return header, nil } -func (g *goodFetcher) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error) { +func (g *goodFetcher) SyncProgress(_ context.Context) (*ethereum.SyncProgress, error) { return nil, nil } diff --git a/beacon-chain/powchain/testing/faulty_mock.go b/beacon-chain/powchain/testing/faulty_mock.go index 72a1968ec..a951fd4ed 100644 --- a/beacon-chain/powchain/testing/faulty_mock.go +++ b/beacon-chain/powchain/testing/faulty_mock.go @@ -29,7 +29,7 @@ func (f *FaultyMockPOWChain) LatestBlockHeight() *big.Int { } // BlockExists -- -func (f *FaultyMockPOWChain) BlockExists(_ context.Context, hash common.Hash) (bool, *big.Int, error) { +func (f *FaultyMockPOWChain) BlockExists(_ context.Context, _ common.Hash) (bool, *big.Int, error) { if f.HashesByHeight == nil { return false, big.NewInt(1), errors.New("failed") } @@ -38,12 +38,12 @@ func (f *FaultyMockPOWChain) BlockExists(_ context.Context, hash common.Hash) (b } // BlockHashByHeight -- -func (f *FaultyMockPOWChain) BlockHashByHeight(_ context.Context, height *big.Int) (common.Hash, error) { +func (f *FaultyMockPOWChain) BlockHashByHeight(_ context.Context, _ *big.Int) (common.Hash, error) { return [32]byte{}, errors.New("failed") } // BlockTimeByHeight -- -func (f *FaultyMockPOWChain) BlockTimeByHeight(_ context.Context, height *big.Int) (uint64, error) { +func (f *FaultyMockPOWChain) BlockTimeByHeight(_ context.Context, _ *big.Int) (uint64, error) { return 0, errors.New("failed") } diff --git a/beacon-chain/rpc/beacon/attestations.go b/beacon-chain/rpc/beacon/attestations.go index 261a7ae8b..3c8c6bfe3 100644 --- a/beacon-chain/rpc/beacon/attestations.go +++ b/beacon-chain/rpc/beacon/attestations.go @@ -378,7 +378,7 @@ func (bs *Server) collectReceivedAttestations(ctx context.Context) { // attestations are processed and when they are no longer valid. // https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#attestations func (bs *Server) AttestationPool( - ctx context.Context, req *ethpb.AttestationPoolRequest, + _ context.Context, req *ethpb.AttestationPoolRequest, ) (*ethpb.AttestationPoolResponse, error) { if int(req.PageSize) > cmd.Get().MaxRPCPageSize { return nil, status.Errorf( diff --git a/beacon-chain/rpc/beacon/committees_test.go b/beacon-chain/rpc/beacon/committees_test.go index 5161615c7..880eefa27 100644 --- a/beacon-chain/rpc/beacon/committees_test.go +++ b/beacon-chain/rpc/beacon/committees_test.go @@ -11,7 +11,6 @@ import ( mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" - "github.com/prysmaticlabs/prysm/beacon-chain/db" dbTest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" @@ -30,7 +29,7 @@ func TestServer_ListBeaconCommittees_CurrentEpoch(t *testing.T) { numValidators := 128 ctx := context.Background() - headState := setupActiveValidators(t, db, numValidators) + headState := setupActiveValidators(t, numValidators) m := &mock.ChainService{ Genesis: timeutils.Now().Add(time.Duration(-1*int64(headState.Slot()*params.BeaconConfig().SecondsPerSlot)) * time.Second), @@ -76,7 +75,7 @@ func TestServer_ListBeaconCommittees_PreviousEpoch(t *testing.T) { helpers.ClearCache() numValidators := 128 - headState := setupActiveValidators(t, db, numValidators) + headState := setupActiveValidators(t, numValidators) mixes := make([][]byte, params.BeaconConfig().EpochsPerHistoricalVector) for i := 0; i < len(mixes); i++ { @@ -144,7 +143,7 @@ func TestRetrieveCommitteesForRoot(t *testing.T) { ctx := context.Background() numValidators := 128 - headState := setupActiveValidators(t, db, numValidators) + headState := setupActiveValidators(t, numValidators) m := &mock.ChainService{ Genesis: timeutils.Now().Add(time.Duration(-1*int64(headState.Slot()*params.BeaconConfig().SecondsPerSlot)) * time.Second), @@ -192,7 +191,7 @@ func TestRetrieveCommitteesForRoot(t *testing.T) { assert.DeepEqual(t, wantedRes, receivedRes) } -func setupActiveValidators(t *testing.T, db db.Database, count int) *stateTrie.BeaconState { +func setupActiveValidators(t *testing.T, count int) *stateTrie.BeaconState { balances := make([]uint64, count) validators := make([]*ethpb.Validator, 0, count) for i := 0; i < count; i++ { @@ -208,9 +207,11 @@ func setupActiveValidators(t *testing.T, db db.Database, count int) *stateTrie.B } s := testutil.NewBeaconState() if err := s.SetValidators(validators); err != nil { + t.Error(err) return nil } if err := s.SetBalances(balances); err != nil { + t.Error(err) return nil } return s diff --git a/beacon-chain/rpc/beacon/config.go b/beacon-chain/rpc/beacon/config.go index 5bb94e15c..1cb460411 100644 --- a/beacon-chain/rpc/beacon/config.go +++ b/beacon-chain/rpc/beacon/config.go @@ -11,7 +11,7 @@ import ( ) // GetBeaconConfig retrieves the current configuration parameters of the beacon chain. -func (bs *Server) GetBeaconConfig(ctx context.Context, _ *ptypes.Empty) (*ethpb.BeaconConfig, error) { +func (bs *Server) GetBeaconConfig(_ context.Context, _ *ptypes.Empty) (*ethpb.BeaconConfig, error) { conf := params.BeaconConfig() val := reflect.ValueOf(conf).Elem() numFields := val.Type().NumField() diff --git a/beacon-chain/rpc/debug/forkchoice.go b/beacon-chain/rpc/debug/forkchoice.go index 7f7810fd8..a33a37b9c 100644 --- a/beacon-chain/rpc/debug/forkchoice.go +++ b/beacon-chain/rpc/debug/forkchoice.go @@ -9,7 +9,7 @@ import ( ) // GetProtoArrayForkChoice returns proto array fork choice store. -func (ds *Server) GetProtoArrayForkChoice(ctx context.Context, _ *ptypes.Empty) (*pbrpc.ProtoArrayForkChoiceResponse, error) { +func (ds *Server) GetProtoArrayForkChoice(_ context.Context, _ *ptypes.Empty) (*pbrpc.ProtoArrayForkChoiceResponse, error) { store := ds.HeadFetcher.ProtoArrayStore() nodes := store.Nodes() diff --git a/beacon-chain/rpc/debug/p2p.go b/beacon-chain/rpc/debug/p2p.go index 287404e3e..12aac4bdb 100644 --- a/beacon-chain/rpc/debug/p2p.go +++ b/beacon-chain/rpc/debug/p2p.go @@ -14,7 +14,7 @@ import ( ) // GetPeer returns the data known about the peer defined by the provided peer id. -func (ds *Server) GetPeer(ctx context.Context, peerReq *ethpb.PeerRequest) (*pbrpc.DebugPeerResponse, error) { +func (ds *Server) GetPeer(_ context.Context, peerReq *ethpb.PeerRequest) (*pbrpc.DebugPeerResponse, error) { pid, err := peer.Decode(peerReq.PeerId) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "Unable to parse provided peer id: %v", err) @@ -24,8 +24,8 @@ func (ds *Server) GetPeer(ctx context.Context, peerReq *ethpb.PeerRequest) (*pbr // ListPeers returns all peers known to the host node, irregardless of if they are connected/ // disconnected. -func (ds *Server) ListPeers(ctx context.Context, _ *types.Empty) (*pbrpc.DebugPeerResponses, error) { - responses := []*pbrpc.DebugPeerResponse{} +func (ds *Server) ListPeers(_ context.Context, _ *types.Empty) (*pbrpc.DebugPeerResponses, error) { + var responses []*pbrpc.DebugPeerResponse for _, pid := range ds.PeersFetcher.Peers().All() { resp, err := ds.getPeer(pid) if err != nil { @@ -101,7 +101,7 @@ func (ds *Server) getPeer(pid peer.ID) (*pbrpc.DebugPeerResponse, error) { PeerLatency: uint64(peerStore.LatencyEWMA(pid).Milliseconds()), } addresses := peerStore.Addrs(pid) - stringAddrs := []string{} + var stringAddrs []string if addr != nil { stringAddrs = append(stringAddrs, addr.String()) } diff --git a/beacon-chain/rpc/debug/server.go b/beacon-chain/rpc/debug/server.go index 5c6df2d69..62fde76e4 100644 --- a/beacon-chain/rpc/debug/server.go +++ b/beacon-chain/rpc/debug/server.go @@ -34,7 +34,7 @@ type Server struct { // SetLoggingLevel of a beacon node according to a request type, // either INFO, DEBUG, or TRACE. -func (ds *Server) SetLoggingLevel(ctx context.Context, req *pbrpc.LoggingLevelRequest) (*ptypes.Empty, error) { +func (ds *Server) SetLoggingLevel(_ context.Context, req *pbrpc.LoggingLevelRequest) (*ptypes.Empty, error) { var verbosity string switch req.Level { case pbrpc.LoggingLevelRequest_INFO: diff --git a/beacon-chain/rpc/node/server.go b/beacon-chain/rpc/node/server.go index 834323f20..6d7059519 100644 --- a/beacon-chain/rpc/node/server.go +++ b/beacon-chain/rpc/node/server.go @@ -37,7 +37,7 @@ type Server struct { } // GetSyncStatus checks the current network sync status of the node. -func (ns *Server) GetSyncStatus(ctx context.Context, _ *ptypes.Empty) (*ethpb.SyncStatus, error) { +func (ns *Server) GetSyncStatus(_ context.Context, _ *ptypes.Empty) (*ethpb.SyncStatus, error) { return ðpb.SyncStatus{ Syncing: ns.SyncChecker.Syncing(), }, nil @@ -71,7 +71,7 @@ func (ns *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.Genes } // GetVersion checks the version information of the beacon node. -func (ns *Server) GetVersion(ctx context.Context, _ *ptypes.Empty) (*ethpb.Version, error) { +func (ns *Server) GetVersion(_ context.Context, _ *ptypes.Empty) (*ethpb.Version, error) { return ðpb.Version{ Version: version.GetVersion(), }, nil @@ -82,7 +82,7 @@ func (ns *Server) GetVersion(ctx context.Context, _ *ptypes.Empty) (*ethpb.Versi // Any service not present in this list may return UNIMPLEMENTED or // PERMISSION_DENIED. The server may also support fetching services by grpc // reflection. -func (ns *Server) ListImplementedServices(ctx context.Context, _ *ptypes.Empty) (*ethpb.ImplementedServices, error) { +func (ns *Server) ListImplementedServices(_ context.Context, _ *ptypes.Empty) (*ethpb.ImplementedServices, error) { serviceInfo := ns.Server.GetServiceInfo() serviceNames := make([]string, 0, len(serviceInfo)) for svc := range serviceInfo { @@ -95,8 +95,8 @@ func (ns *Server) ListImplementedServices(ctx context.Context, _ *ptypes.Empty) } // GetHost returns the p2p data on the current local and host peer. -func (ns *Server) GetHost(ctx context.Context, _ *ptypes.Empty) (*ethpb.HostData, error) { - stringAddr := []string{} +func (ns *Server) GetHost(_ context.Context, _ *ptypes.Empty) (*ethpb.HostData, error) { + var stringAddr []string for _, addr := range ns.PeerManager.Host().Addrs() { stringAddr = append(stringAddr, addr.String()) } @@ -118,7 +118,7 @@ func (ns *Server) GetHost(ctx context.Context, _ *ptypes.Empty) (*ethpb.HostData } // GetPeer returns the data known about the peer defined by the provided peer id. -func (ns *Server) GetPeer(ctx context.Context, peerReq *ethpb.PeerRequest) (*ethpb.Peer, error) { +func (ns *Server) GetPeer(_ context.Context, peerReq *ethpb.PeerRequest) (*ethpb.Peer, error) { pid, err := peer.Decode(peerReq.PeerId) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "Unable to parse provided peer id: %v", err) diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index fa0a90a38..96316b8c7 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -17,16 +17,16 @@ import ( // SubmitAggregateSelectionProof is called by a validator when its assigned to be an aggregator. // The aggregator submits the selection proof to obtain the aggregated attestation // object to sign over. -func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error) { +func (vs *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error) { ctx, span := trace.StartSpan(ctx, "AggregatorServer.SubmitAggregateSelectionProof") defer span.End() span.AddAttributes(trace.Int64Attribute("slot", int64(req.Slot))) - if as.SyncChecker.Syncing() { + if vs.SyncChecker.Syncing() { return nil, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond") } - st, err := as.HeadFetcher.HeadState(ctx) + st, err := vs.HeadFetcher.HeadState(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "Could not determine head state: %v", err) } @@ -59,14 +59,14 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. return nil, status.Errorf(codes.InvalidArgument, "Validator is not an aggregator") } - if err := as.AttPool.AggregateUnaggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex); err != nil { + if err := vs.AttPool.AggregateUnaggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex); err != nil { return nil, status.Errorf(codes.Internal, "Could not aggregate unaggregated attestations") } - aggregatedAtts := as.AttPool.AggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) + aggregatedAtts := vs.AttPool.AggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) // Filter out the best aggregated attestation (ie. the one with the most aggregated bits). if len(aggregatedAtts) == 0 { - aggregatedAtts = as.AttPool.UnaggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) + aggregatedAtts = vs.AttPool.UnaggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) if len(aggregatedAtts) == 0 { return nil, status.Errorf(codes.Internal, "Could not find attestation for slot and committee in pool") } @@ -108,7 +108,7 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. // SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed // aggregated and proof object. -func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) { +func (vs *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) { if req.SignedAggregateAndProof == nil || req.SignedAggregateAndProof.Message == nil || req.SignedAggregateAndProof.Message.Aggregate == nil || req.SignedAggregateAndProof.Message.Aggregate.Data == nil { return nil, status.Error(codes.InvalidArgument, "Signed aggregate request can't be nil") @@ -120,11 +120,11 @@ func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req * } // As a preventive measure, a beacon node shouldn't broadcast an attestation whose slot is out of range. - if err := helpers.ValidateAttestationTime(req.SignedAggregateAndProof.Message.Aggregate.Data.Slot, as.GenesisTimeFetcher.GenesisTime()); err != nil { + if err := helpers.ValidateAttestationTime(req.SignedAggregateAndProof.Message.Aggregate.Data.Slot, vs.GenesisTimeFetcher.GenesisTime()); err != nil { return nil, status.Error(codes.InvalidArgument, "Attestation slot is no longer valid from current time") } - if err := as.P2P.Broadcast(ctx, req.SignedAggregateAndProof); err != nil { + if err := vs.P2P.Broadcast(ctx, req.SignedAggregateAndProof); err != nil { return nil, status.Errorf(codes.Internal, "Could not broadcast signed aggregated attestation: %v", err) } diff --git a/beacon-chain/rpc/validator/assignments.go b/beacon-chain/rpc/validator/assignments.go index 6eeab1539..0fdfaaadd 100644 --- a/beacon-chain/rpc/validator/assignments.go +++ b/beacon-chain/rpc/validator/assignments.go @@ -203,7 +203,7 @@ func assignValidatorToSubnet(pubkey []byte, status ethpb.ValidatorStatus) { return } epochDuration := time.Duration(params.BeaconConfig().SlotsPerEpoch * params.BeaconConfig().SecondsPerSlot) - assignedIdxs := []uint64{} + var assignedIdxs []uint64 randGen := rand.NewGenerator() for i := uint64(0); i < params.BeaconNetworkConfig().RandomSubnetsPerValidator; i++ { assignedIdx := randGen.Intn(int(params.BeaconNetworkConfig().AttestationSubnetCount)) diff --git a/beacon-chain/rpc/validator/proposer.go b/beacon-chain/rpc/validator/proposer.go index ec6b5303c..cadedd631 100644 --- a/beacon-chain/rpc/validator/proposer.go +++ b/beacon-chain/rpc/validator/proposer.go @@ -348,7 +348,9 @@ func chosenEth1DataMajorityVote(votes []eth1DataSingleVote) eth1DataAggregatedVo voteCount = append(voteCount, eth1DataAggregatedVote{data: singleVote, votes: 1}) } } - + if len(voteCount) == 0 { + return eth1DataAggregatedVote{} + } currentVote := voteCount[0] for _, aggregatedVote := range voteCount[1:] { // Choose new eth1data if it has more votes or the same number of votes with a bigger block height. @@ -557,7 +559,7 @@ func (vs *Server) depositTrie(ctx context.Context, canonicalEth1DataHeight *big. } upToEth1DataDeposits := vs.DepositFetcher.AllDeposits(ctx, canonicalEth1DataHeight) - depositData := [][]byte{} + var depositData [][]byte for _, dep := range upToEth1DataDeposits { depHash, err := dep.Data.HashTreeRoot() if err != nil { diff --git a/beacon-chain/rpc/validator/server.go b/beacon-chain/rpc/validator/server.go index 68832a88a..0c4b66939 100644 --- a/beacon-chain/rpc/validator/server.go +++ b/beacon-chain/rpc/validator/server.go @@ -131,7 +131,7 @@ func (vs *Server) ValidatorIndex(ctx context.Context, req *ethpb.ValidatorIndexR } // DomainData fetches the current domain version information from the beacon state. -func (vs *Server) DomainData(ctx context.Context, request *ethpb.DomainRequest) (*ethpb.DomainResponse, error) { +func (vs *Server) DomainData(_ context.Context, request *ethpb.DomainRequest) (*ethpb.DomainResponse, error) { fork := vs.ForkFetcher.CurrentFork() headGenesisValidatorRoot := vs.HeadFetcher.HeadGenesisValidatorRoot() dv, err := helpers.Domain(fork, request.Epoch, bytesutil.ToBytes4(request.Domain), headGenesisValidatorRoot[:]) @@ -145,7 +145,7 @@ func (vs *Server) DomainData(ctx context.Context, request *ethpb.DomainRequest) // CanonicalHead of the current beacon chain. This method is requested on-demand // by a validator when it is their time to propose or attest. -func (vs *Server) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*ethpb.SignedBeaconBlock, error) { +func (vs *Server) CanonicalHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.SignedBeaconBlock, error) { headBlk, err := vs.HeadFetcher.HeadBlock(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "Could not get head block: %v", err) @@ -157,7 +157,7 @@ func (vs *Server) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*ethpb. // has started its runtime and validators begin their responsibilities. If it has not, it then // subscribes to an event stream triggered by the powchain service whenever the ChainStart log does // occur in the Deposit Contract on ETH 1.0. -func (vs *Server) WaitForChainStart(req *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error { +func (vs *Server) WaitForChainStart(_ *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error { head, err := vs.HeadFetcher.HeadState(stream.Context()) if err != nil { return status.Errorf(codes.Internal, "Could not retrieve head state: %v", err) @@ -212,7 +212,7 @@ func (vs *Server) WaitForChainStart(req *ptypes.Empty, stream ethpb.BeaconNodeVa // WaitForSynced subscribes to the state channel and ends the stream when the state channel // indicates the beacon node has been initialized and is ready -func (vs *Server) WaitForSynced(req *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForSyncedServer) error { +func (vs *Server) WaitForSynced(_ *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForSyncedServer) error { head, err := vs.HeadFetcher.HeadState(stream.Context()) if err != nil { return status.Errorf(codes.Internal, "Could not retrieve head state: %v", err) diff --git a/beacon-chain/state/setters.go b/beacon-chain/state/setters.go index a3eea044a..faeec9083 100644 --- a/beacon-chain/state/setters.go +++ b/beacon-chain/state/setters.go @@ -318,7 +318,7 @@ func (b *BeaconState) ApplyToEveryValidator(f func(idx int, val *ethpb.Validator b.sharedFieldReferences[validators] = &reference{refs: 1} } b.lock.Unlock() - changedVals := []uint64{} + var changedVals []uint64 for i, val := range v { changed, err := f(i, val) if err != nil { diff --git a/beacon-chain/state/stategen/epoch_boundary_state_cache.go b/beacon-chain/state/stategen/epoch_boundary_state_cache.go index e71b7a5ba..bb04ce78b 100644 --- a/beacon-chain/state/stategen/epoch_boundary_state_cache.go +++ b/beacon-chain/state/stategen/epoch_boundary_state_cache.go @@ -144,7 +144,7 @@ func trim(queue *cache.FIFO, maxSize uint64) { } // popProcessNoopFunc is a no-op function that never returns an error. -func popProcessNoopFunc(obj interface{}) error { +func popProcessNoopFunc(_ interface{}) error { return nil } diff --git a/beacon-chain/state/stategen/setter.go b/beacon-chain/state/stategen/setter.go index a648a5e10..722239761 100644 --- a/beacon-chain/state/stategen/setter.go +++ b/beacon-chain/state/stategen/setter.go @@ -43,7 +43,7 @@ func (s *State) ForceCheckpoint(ctx context.Context, root []byte) error { // SaveStateSummary saves the relevant state summary for a block and its corresponding state slot in the // state summary cache. -func (s *State) SaveStateSummary(ctx context.Context, blk *ethpb.SignedBeaconBlock, blockRoot [32]byte) { +func (s *State) SaveStateSummary(_ context.Context, blk *ethpb.SignedBeaconBlock, blockRoot [32]byte) { // Save State summary s.stateSummaryCache.Put(blockRoot, &pb.StateSummary{ Slot: blk.Block.Slot, diff --git a/beacon-chain/state/stateutil/arrays.go b/beacon-chain/state/stateutil/arrays.go index 30a557b1d..a22dce6a8 100644 --- a/beacon-chain/state/stateutil/arrays.go +++ b/beacon-chain/state/stateutil/arrays.go @@ -70,7 +70,7 @@ func (h *stateRootHasher) arraysRoot(input [][]byte, length uint64, fieldName st changedIndices = append(changedIndices, maxChangedIndex+1) } for i := 0; i < len(changedIndices); i++ { - rt, err = recomputeRoot(changedIndices[i], chunks, length, fieldName, hashFunc) + rt, err = recomputeRoot(changedIndices[i], chunks, fieldName, hashFunc) if err != nil { return [32]byte{}, err } @@ -133,8 +133,7 @@ func merkleizeTrieLeaves(layers [][][32]byte, hashLayer [][32]byte, return layers, hashLayer } -func recomputeRoot(idx int, chunks [][32]byte, length uint64, - fieldName string, hasher func([]byte) [32]byte) ([32]byte, error) { +func recomputeRoot(idx int, chunks [][32]byte, fieldName string, hasher func([]byte) [32]byte) ([32]byte, error) { items, ok := layersCache[fieldName] if !ok { return [32]byte{}, errors.New("could not recompute root as there was no cache found") diff --git a/beacon-chain/state/stateutil/attestations.go b/beacon-chain/state/stateutil/attestations.go index 8ebd0640c..c63f23e8e 100644 --- a/beacon-chain/state/stateutil/attestations.go +++ b/beacon-chain/state/stateutil/attestations.go @@ -16,7 +16,7 @@ import ( // PendingAttestationRoot describes a method from which the hash tree root // of a pending attestation is returned. func PendingAttestationRoot(hasher htrutils.HashFn, att *pb.PendingAttestation) ([32]byte, error) { - fieldRoots := [][32]byte{} + var fieldRoots [][32]byte if att != nil { // Bitfield. aggregationRoot, err := htrutils.BitlistRoot(hasher, att.AggregationBits, params.BeaconConfig().MaxValidatorsPerCommittee) diff --git a/beacon-chain/state/stateutil/validators.go b/beacon-chain/state/stateutil/validators.go index f011f18ba..461838332 100644 --- a/beacon-chain/state/stateutil/validators.go +++ b/beacon-chain/state/stateutil/validators.go @@ -64,7 +64,7 @@ func ValidatorBalancesRoot(balances []uint64) ([32]byte, error) { // ValidatorRoot describes a method from which the hash tree root // of a validator is returned. func ValidatorRoot(hasher htrutils.HashFn, validator *ethpb.Validator) ([32]byte, error) { - fieldRoots := [][32]byte{} + var fieldRoots [][32]byte if validator != nil { pubkey := bytesutil.ToBytes48(validator.PublicKey) withdrawCreds := bytesutil.ToBytes32(validator.WithdrawalCredentials) diff --git a/beacon-chain/sync/pending_attestations_queue.go b/beacon-chain/sync/pending_attestations_queue.go index d4317acee..6fde77991 100644 --- a/beacon-chain/sync/pending_attestations_queue.go +++ b/beacon-chain/sync/pending_attestations_queue.go @@ -54,7 +54,7 @@ func (s *Service) processPendingAtts(ctx context.Context) error { } s.pendingAttsLock.RUnlock() - pendingRoots := [][32]byte{} + var pendingRoots [][32]byte randGen := rand.NewGenerator() for _, bRoot := range roots { s.pendingAttsLock.RLock() diff --git a/beacon-chain/sync/pending_blocks_queue.go b/beacon-chain/sync/pending_blocks_queue.go index 9008634c6..5b3440048 100644 --- a/beacon-chain/sync/pending_blocks_queue.go +++ b/beacon-chain/sync/pending_blocks_queue.go @@ -49,7 +49,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error { return errors.Wrap(err, "could not validate pending slots") } slots := s.sortedPendingSlots() - parentRoots := [][32]byte{} + var parentRoots [][32]byte span.AddAttributes( trace.Int64Attribute("numSlots", int64(len(slots))), diff --git a/beacon-chain/sync/pending_blocks_queue_test.go b/beacon-chain/sync/pending_blocks_queue_test.go index 92980bd5e..42c831f4f 100644 --- a/beacon-chain/sync/pending_blocks_queue_test.go +++ b/beacon-chain/sync/pending_blocks_queue_test.go @@ -113,18 +113,18 @@ func TestRegularSync_InsertDuplicateBlocks(t *testing.T) { b1r := [32]byte{'b'} r.insertBlockToPendingQueue(b0.Block.Slot, b0, b0r) - require.Equal(t, int(1), len(r.slotToPendingBlocks[b0.Block.Slot]), "Block was not added to map") + require.Equal(t, 1, len(r.slotToPendingBlocks[b0.Block.Slot]), "Block was not added to map") r.insertBlockToPendingQueue(b1.Block.Slot, b1, b1r) - require.Equal(t, int(1), len(r.slotToPendingBlocks[b1.Block.Slot]), "Block was not added to map") + require.Equal(t, 1, len(r.slotToPendingBlocks[b1.Block.Slot]), "Block was not added to map") // Add duplicate block which should not be saved. r.insertBlockToPendingQueue(b0.Block.Slot, b0, b0r) - require.Equal(t, int(1), len(r.slotToPendingBlocks[b0.Block.Slot]), "Block was added to map") + require.Equal(t, 1, len(r.slotToPendingBlocks[b0.Block.Slot]), "Block was added to map") // Add duplicate block which should not be saved. r.insertBlockToPendingQueue(b1.Block.Slot, b1, b1r) - require.Equal(t, int(1), len(r.slotToPendingBlocks[b1.Block.Slot]), "Block was added to map") + require.Equal(t, 1, len(r.slotToPendingBlocks[b1.Block.Slot]), "Block was added to map") } @@ -379,7 +379,7 @@ func TestService_BatchRootRequest(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - out := [][32]byte{} + var out [][32]byte assert.NoError(t, p2.Encoding().DecodeWithMaxLength(stream, &out)) assert.DeepEqual(t, expectedRoots, out, "Did not receive expected message") response := []*ethpb.SignedBeaconBlock{b2, b3, b4, b5} diff --git a/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go b/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go index ec241ea12..0cb8d7cb7 100644 --- a/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go +++ b/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go @@ -52,7 +52,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsBlocks(t *testing.T) { p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() for i := req.StartSlot; i < req.StartSlot+req.Count*req.Step; i += req.Step { - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := testutil.NewBeaconBlock() assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, res)) if (res.Block.Slot-req.StartSlot)%req.Step != 0 { @@ -117,7 +117,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsSortedBlocks(t *testing.T) { prevSlot := uint64(0) require.Equal(t, uint64(len(expectedRoots)), req.Count, "Number of roots not expected") for i, j := req.StartSlot, 0; i < req.StartSlot+req.Count*req.Step; i += req.Step { - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := ðpb.SignedBeaconBlock{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, res)) if res.Block.Slot < prevSlot { @@ -177,12 +177,12 @@ func TestRPCBeaconBlocksByRange_ReturnsGenesisBlock(t *testing.T) { p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() // check for genesis block - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := ðpb.SignedBeaconBlock{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, res)) assert.Equal(t, uint64(0), res.Block.Slot, "genesis block was not returned") for i := req.StartSlot + req.Step; i < req.Count*req.Step; i += req.Step { - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := ðpb.SignedBeaconBlock{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, res)) } @@ -219,7 +219,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) { return } for i := req.StartSlot; i < req.StartSlot+req.Count*req.Step; i += req.Step { - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := testutil.NewBeaconBlock() assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, res)) if (res.Block.Slot-req.StartSlot)%req.Step != 0 { @@ -434,7 +434,7 @@ func TestRPCBeaconBlocksByRange_validateRangeRequest(t *testing.T) { name: "Valid Request", req: &pb.BeaconBlocksByRangeRequest{ Step: 1, - Count: uint64(params.BeaconNetworkConfig().MaxRequestBlocks) - 1, + Count: params.BeaconNetworkConfig().MaxRequestBlocks - 1, StartSlot: 50, }, errorToLog: "validation failed with valid params", @@ -472,7 +472,7 @@ func TestRPCBeaconBlocksByRange_EnforceResponseInvariants(t *testing.T) { defer wg.Done() blocks := make([]*ethpb.SignedBeaconBlock, 0, req.Count) for i := req.StartSlot; i < req.StartSlot+req.Count*req.Step; i += req.Step { - expectSuccess(t, r, stream) + expectSuccess(t, stream) blk := testutil.NewBeaconBlock() assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, blk)) if (blk.Block.Slot-req.StartSlot)%req.Step != 0 { diff --git a/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go b/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go index 48678f45c..2799fde07 100644 --- a/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go +++ b/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go @@ -53,7 +53,7 @@ func TestRecentBeaconBlocksRPCHandler_ReturnsBlocks(t *testing.T) { p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() for i := range blkRoots { - expectSuccess(t, r, stream) + expectSuccess(t, stream) res := testutil.NewBeaconBlock() assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, &res)) if res.Block.Slot != uint64(i+1) { @@ -119,7 +119,7 @@ func TestRecentBeaconBlocks_RPCRequestSent(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - out := [][32]byte{} + var out [][32]byte assert.NoError(t, p2.Encoding().DecodeWithMaxLength(stream, &out)) assert.DeepEqual(t, expectedRoots, out, "Did not receive expected message") response := []*ethpb.SignedBeaconBlock{blockB, blockA} diff --git a/beacon-chain/sync/rpc_goodbye.go b/beacon-chain/sync/rpc_goodbye.go index 95c097f26..ae31a5aa7 100644 --- a/beacon-chain/sync/rpc_goodbye.go +++ b/beacon-chain/sync/rpc_goodbye.go @@ -30,7 +30,7 @@ var goodByes = map[uint64]string{ const flushDelay = 50 * time.Millisecond // goodbyeRPCHandler reads the incoming goodbye rpc message from the peer. -func (s *Service) goodbyeRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { +func (s *Service) goodbyeRPCHandler(_ context.Context, msg interface{}, stream libp2pcore.Stream) error { defer func() { if err := stream.Close(); err != nil { log.WithError(err).Error("Failed to close stream") diff --git a/beacon-chain/sync/rpc_goodbye_test.go b/beacon-chain/sync/rpc_goodbye_test.go index 3f0a1557b..04ea98d3c 100644 --- a/beacon-chain/sync/rpc_goodbye_test.go +++ b/beacon-chain/sync/rpc_goodbye_test.go @@ -39,7 +39,7 @@ func TestGoodByeRPCHandler_Disconnects_With_Peer(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectResetStream(t, r, stream) + expectResetStream(t, stream) }) stream1, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl) require.NoError(t, err) diff --git a/beacon-chain/sync/rpc_metadata.go b/beacon-chain/sync/rpc_metadata.go index 0ccc7a96f..c8930063e 100644 --- a/beacon-chain/sync/rpc_metadata.go +++ b/beacon-chain/sync/rpc_metadata.go @@ -12,7 +12,7 @@ import ( ) // metaDataHandler reads the incoming metadata rpc request from the peer. -func (s *Service) metaDataHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { +func (s *Service) metaDataHandler(_ context.Context, _ interface{}, stream libp2pcore.Stream) error { defer func() { if err := stream.Close(); err != nil { log.WithError(err).Debug("Failed to close stream") diff --git a/beacon-chain/sync/rpc_metadata_test.go b/beacon-chain/sync/rpc_metadata_test.go index 816143193..f3a110d74 100644 --- a/beacon-chain/sync/rpc_metadata_test.go +++ b/beacon-chain/sync/rpc_metadata_test.go @@ -47,7 +47,7 @@ func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectSuccess(t, r, stream) + expectSuccess(t, stream) out := new(pb.MetaData) assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, out)) assert.DeepEqual(t, p1.LocalMetadata, out, "Metadata unequal") diff --git a/beacon-chain/sync/rpc_ping.go b/beacon-chain/sync/rpc_ping.go index 53e280eba..0a1239142 100644 --- a/beacon-chain/sync/rpc_ping.go +++ b/beacon-chain/sync/rpc_ping.go @@ -15,7 +15,7 @@ import ( ) // pingHandler reads the incoming ping rpc message from the peer. -func (s *Service) pingHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { +func (s *Service) pingHandler(_ context.Context, msg interface{}, stream libp2pcore.Stream) error { SetRPCStreamDeadlines(stream) m, ok := msg.(*uint64) diff --git a/beacon-chain/sync/rpc_ping_test.go b/beacon-chain/sync/rpc_ping_test.go index 351af14fd..a595a47bc 100644 --- a/beacon-chain/sync/rpc_ping_test.go +++ b/beacon-chain/sync/rpc_ping_test.go @@ -53,7 +53,7 @@ func TestPingRPCHandler_ReceivesPing(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectSuccess(t, r, stream) + expectSuccess(t, stream) out := new(uint64) assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, out)) assert.Equal(t, uint64(2), *out) diff --git a/beacon-chain/sync/rpc_status_test.go b/beacon-chain/sync/rpc_status_test.go index 30465da63..8de9572bd 100644 --- a/beacon-chain/sync/rpc_status_test.go +++ b/beacon-chain/sync/rpc_status_test.go @@ -60,7 +60,7 @@ func TestStatusRPCHandler_Disconnects_OnForkVersionMismatch(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectSuccess(t, r, stream) + expectSuccess(t, stream) out := &pb.Status{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, out)) if !bytes.Equal(out.FinalizedRoot, root[:]) { @@ -126,7 +126,7 @@ func TestStatusRPCHandler_ConnectsOnGenesis(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectSuccess(t, r, stream) + expectSuccess(t, stream) out := &pb.Status{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, out)) if !bytes.Equal(out.FinalizedRoot, root[:]) { @@ -206,7 +206,7 @@ func TestStatusRPCHandler_ReturnsHelloMessage(t *testing.T) { wg.Add(1) p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() - expectSuccess(t, r, stream) + expectSuccess(t, stream) out := &pb.Status{} assert.NoError(t, r.p2p.Encoding().DecodeWithMaxLength(stream, out)) expected := &pb.Status{ diff --git a/beacon-chain/sync/rpc_test.go b/beacon-chain/sync/rpc_test.go index 57b2437c2..18422a232 100644 --- a/beacon-chain/sync/rpc_test.go +++ b/beacon-chain/sync/rpc_test.go @@ -23,7 +23,7 @@ func init() { } // expectSuccess status code from a stream in regular sync. -func expectSuccess(t *testing.T, r *Service, stream network.Stream) { +func expectSuccess(t *testing.T, stream network.Stream) { code, errMsg, err := ReadStatusCode(stream, &encoder.SszNetworkEncoder{}) require.NoError(t, err) require.Equal(t, uint8(0), code, "Received non-zero response code") @@ -35,12 +35,12 @@ func expectFailure(t *testing.T, expectedCode uint8, expectedErrorMsg string, st code, errMsg, err := ReadStatusCode(stream, &encoder.SszNetworkEncoder{}) require.NoError(t, err) require.NotEqual(t, uint8(0), code, "Expected request to fail but got a 0 response code") - require.Equal(t, uint8(expectedCode), code, "Received incorrect response code") + require.Equal(t, expectedCode, code, "Received incorrect response code") require.Equal(t, expectedErrorMsg, errMsg) } // expectResetStream status code from a stream in regular sync. -func expectResetStream(t *testing.T, r *Service, stream network.Stream) { +func expectResetStream(t *testing.T, stream network.Stream) { expectedErr := "stream reset" _, _, err := ReadStatusCode(stream, &encoder.SszNetworkEncoder{}) require.ErrorContains(t, expectedErr, err) diff --git a/beacon-chain/sync/subscriber.go b/beacon-chain/sync/subscriber.go index 431706cce..26a61c931 100644 --- a/beacon-chain/sync/subscriber.go +++ b/beacon-chain/sync/subscriber.go @@ -29,7 +29,7 @@ const pubsubMessageTimeout = 30 * time.Second type subHandler func(context.Context, proto.Message) error // noopValidator is a no-op that only decodes the message, but does not check its contents. -func (s *Service) noopValidator(ctx context.Context, _ peer.ID, msg *pubsub.Message) pubsub.ValidationResult { +func (s *Service) noopValidator(_ context.Context, _ peer.ID, msg *pubsub.Message) pubsub.ValidationResult { m, err := s.decodePubsubMessage(msg) if err != nil { log.WithError(err).Debug("Failed to decode message") @@ -91,6 +91,7 @@ func (s *Service) subscribe(topic string, validator pubsub.ValidatorEx, handle s return s.subscribeWithBase(base, s.addDigestToTopic(topic), validator, handle) } +// TODO(7437): Refactor this method to remove unused arg "base". func (s *Service) subscribeWithBase(base proto.Message, topic string, validator pubsub.ValidatorEx, handle subHandler) *pubsub.Subscription { topic += s.p2p.Encoding().ProtocolSuffix() log := log.WithField("topic", topic) diff --git a/beacon-chain/sync/subscriber_beacon_aggregate_proof.go b/beacon-chain/sync/subscriber_beacon_aggregate_proof.go index 79dd8b3f4..a81ab1fbc 100644 --- a/beacon-chain/sync/subscriber_beacon_aggregate_proof.go +++ b/beacon-chain/sync/subscriber_beacon_aggregate_proof.go @@ -14,7 +14,7 @@ import ( // beaconAggregateProofSubscriber forwards the incoming validated aggregated attestation and proof to the // attestation pool for processing. -func (s *Service) beaconAggregateProofSubscriber(ctx context.Context, msg proto.Message) error { +func (s *Service) beaconAggregateProofSubscriber(_ context.Context, msg proto.Message) error { a, ok := msg.(*ethpb.SignedAggregateAttestationAndProof) if !ok { return fmt.Errorf("message was not type *eth.SignedAggregateAttestationAndProof, type=%T", msg) diff --git a/beacon-chain/sync/subscriber_beacon_attestation.go b/beacon-chain/sync/subscriber_beacon_attestation.go index 9436d9247..15f145c75 100644 --- a/beacon-chain/sync/subscriber_beacon_attestation.go +++ b/beacon-chain/sync/subscriber_beacon_attestation.go @@ -15,7 +15,7 @@ import ( "github.com/prysmaticlabs/prysm/shared/sliceutil" ) -func (s *Service) committeeIndexBeaconAttestationSubscriber(ctx context.Context, msg proto.Message) error { +func (s *Service) committeeIndexBeaconAttestationSubscriber(_ context.Context, msg proto.Message) error { a, ok := msg.(*eth.Attestation) if !ok { return fmt.Errorf("message was not type *eth.Attestation, type=%T", msg) @@ -53,7 +53,7 @@ func (s *Service) persistentSubnetIndices() []uint64 { func (s *Service) aggregatorSubnetIndices(currentSlot uint64) []uint64 { endEpoch := helpers.SlotToEpoch(currentSlot) + 1 endSlot := endEpoch * params.BeaconConfig().SlotsPerEpoch - commIds := []uint64{} + var commIds []uint64 for i := currentSlot; i <= endSlot; i++ { commIds = append(commIds, cache.SubnetIDs.GetAggregatorSubnetIDs(i)...) } @@ -63,7 +63,7 @@ func (s *Service) aggregatorSubnetIndices(currentSlot uint64) []uint64 { func (s *Service) attesterSubnetIndices(currentSlot uint64) []uint64 { endEpoch := helpers.SlotToEpoch(currentSlot) + 1 endSlot := endEpoch * params.BeaconConfig().SlotsPerEpoch - commIds := []uint64{} + var commIds []uint64 for i := currentSlot; i <= endSlot; i++ { commIds = append(commIds, cache.SubnetIDs.GetAttesterSubnetIDs(i)...) } diff --git a/beacon-chain/sync/utils_test.go b/beacon-chain/sync/utils_test.go index 3b56e6ad8..ab50608bf 100644 --- a/beacon-chain/sync/utils_test.go +++ b/beacon-chain/sync/utils_test.go @@ -12,8 +12,8 @@ import ( func TestSortedObj_SortBlocksRoots(t *testing.T) { source := rand.NewSource(33) randGen := rand.New(source) - blks := []*ethpb.SignedBeaconBlock{} - roots := [][32]byte{} + var blks []*ethpb.SignedBeaconBlock + var roots [][32]byte randFunc := func() int64 { return randGen.Int63n(50) } @@ -45,8 +45,8 @@ func TestSortedObj_SortBlocksRoots(t *testing.T) { func TestSortedObj_NoDuplicates(t *testing.T) { source := rand.NewSource(33) randGen := rand.New(source) - blks := []*ethpb.SignedBeaconBlock{} - roots := [][32]byte{} + var blks []*ethpb.SignedBeaconBlock + var roots [][32]byte randFunc := func() int64 { return randGen.Int63n(50) } diff --git a/endtoend/components/validator.go b/endtoend/components/validator.go index af755d526..c993b67a2 100644 --- a/endtoend/components/validator.go +++ b/endtoend/components/validator.go @@ -29,7 +29,7 @@ const depositGasLimit = 4000000 // StartValidatorClients starts the configured amount of validators, also sending and mining their validator deposits. // Should only be used on initialization. -func StartValidatorClients(t *testing.T, config *types.E2EConfig, keystorePath string) { +func StartValidatorClients(t *testing.T, config *types.E2EConfig) { // Always using genesis count since using anything else would be difficult to test for. validatorNum := int(params.BeaconConfig().MinGenesisActiveValidatorCount) beaconNodeNum := e2e.TestParams.BeaconNodeCount diff --git a/endtoend/endtoend_test.go b/endtoend/endtoend_test.go index 1ba56d49d..7d59ea84e 100644 --- a/endtoend/endtoend_test.go +++ b/endtoend/endtoend_test.go @@ -43,7 +43,7 @@ func runEndToEndTest(t *testing.T, config *types.E2EConfig) { go components.SendAndMineDeposits(t, keystorePath, minGenesisActiveCount, 0) bootnodeENR := components.StartBootnode(t) components.StartBeaconNodes(t, config, bootnodeENR) - components.StartValidatorClients(t, config, keystorePath) + components.StartValidatorClients(t, config) defer helpers.LogOutput(t, config) if config.UsePprof { defer func() { diff --git a/endtoend/evaluators/validator.go b/endtoend/evaluators/validator.go index f3e49960b..6d34bd7db 100644 --- a/endtoend/evaluators/validator.go +++ b/endtoend/evaluators/validator.go @@ -35,7 +35,7 @@ func afterNthEpoch(afterEpoch uint64) func(uint64) bool { } // All epochs. -func allEpochs(currentEpoch uint64) bool { +func allEpochs(_ uint64) bool { return true } diff --git a/endtoend/params/params.go b/endtoend/params/params.go index ea327cd99..97ac862cc 100644 --- a/endtoend/params/params.go +++ b/endtoend/params/params.go @@ -39,9 +39,6 @@ var BootNodeLogFileName = "bootnode.log" // BeaconNodeLogFileName is the file name used for the beacon chain node logs. var BeaconNodeLogFileName = "beacon-%d.log" -// BeaconNodeCPUProfileFileName is the file name used for the beacon chain cpu profiles. -var BeaconNodeCPUProfileFileName = "beacon-cpu-%d.out" - // SlasherLogFileName is the file name used for the slasher client logs. var SlasherLogFileName = "slasher-%d.log" diff --git a/fuzz/common.go b/fuzz/common.go index d4bea258e..8660e3677 100644 --- a/fuzz/common.go +++ b/fuzz/common.go @@ -1,10 +1,6 @@ package fuzz import ( - "os" - "strings" - - stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/featureconfig" ) @@ -13,28 +9,3 @@ func init() { SkipBLSVerify: true, }) } - -func fail(err error) ([]byte, bool) { - shouldPanic := false - if val, ok := os.LookupEnv("PANIC_ON_ERROR"); ok { - shouldPanic = strings.ToLower(val) == "true" - } - if shouldPanic { - panic(err) - } - return nil, false -} - -func success(post *stateTrie.BeaconState) ([]byte, bool) { - if val, ok := os.LookupEnv("RETURN_SSZ_POST_STATE"); ok { - if strings.ToLower(val) != "true" { - return nil, true - } - } - - result, err := post.InnerStateUnsafe().MarshalSSZ() - if err != nil { - panic(err) - } - return result, true -} diff --git a/go.mod b/go.mod index 197a8959a..470db2e41 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/aws/aws-sdk-go v1.33.15 // indirect github.com/bazelbuild/buildtools v0.0.0-20200528175155-f4e8394f069d github.com/bazelbuild/rules_go v0.23.2 - github.com/btcsuite/btcd v0.20.1-beta github.com/cespare/cp v1.1.1 // indirect github.com/confluentinc/confluent-kafka-go v1.4.2 // indirect github.com/d4l3k/messagediff v1.2.1 @@ -34,6 +33,7 @@ require ( github.com/golang/protobuf v1.4.2 github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26 github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa + github.com/google/gopacket v1.1.18 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/google/uuid v1.1.1 github.com/gorilla/websocket v1.4.2 @@ -59,9 +59,6 @@ require ( github.com/libp2p/go-libp2p-circuit v0.3.1 github.com/libp2p/go-libp2p-core v0.6.1 github.com/libp2p/go-libp2p-crypto v0.1.0 - github.com/libp2p/go-libp2p-host v0.1.0 - github.com/libp2p/go-libp2p-kad-dht v0.8.3 - github.com/libp2p/go-libp2p-net v0.1.0 github.com/libp2p/go-libp2p-noise v0.1.1 github.com/libp2p/go-libp2p-pubsub v0.3.3 github.com/libp2p/go-libp2p-secio v0.2.2 @@ -69,8 +66,10 @@ require ( github.com/libp2p/go-libp2p-tls v0.1.4-0.20200421131144-8a8ad624a291 // indirect github.com/libp2p/go-mplex v0.1.3 // indirect github.com/libp2p/go-reuseport-transport v0.0.4 // indirect + github.com/libp2p/go-sockaddr v0.1.0 // indirect github.com/libp2p/go-yamux v1.3.8 // indirect github.com/logrusorgru/aurora v2.0.3+incompatible + github.com/lunixbochs/vtclean v1.0.0 // indirect github.com/manifoldco/promptui v0.7.0 github.com/minio/highwayhash v1.0.0 github.com/minio/sha256-simd v0.1.1 diff --git a/go.sum b/go.sum index b32996a65..e1d4b91e1 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,6 @@ cloud.google.com/go v0.16.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= @@ -22,12 +20,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= contrib.go.opencensus.io/exporter/jaeger v0.2.0 h1:nhTv/Ry3lGmqbJ/JGvCjWxBl5ozRfqo86Ngz59UAlfk= contrib.go.opencensus.io/exporter/jaeger v0.2.0/go.mod h1:ukdzwIYYHgZ7QYtwVFQUjiT28BJHiMhTERo32s6qVgM= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= @@ -69,7 +62,6 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= @@ -100,7 +92,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -116,7 +107,6 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -127,8 +117,6 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/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/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= @@ -145,8 +133,6 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d h1:t5Wuyh53qYyg9eqn4BbnlIT+vmhyww0TatL+zT3uWgI= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= @@ -159,8 +145,6 @@ 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-20190912175916-7055855a373f h1:BOaYiTvg8p9vBUXpklC22XSK/mifLF7lG9jtmYYi3Tc= -github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= @@ -219,13 +203,10 @@ github.com/ferranbt/fastssz v0.0.0-20200826142241-3a913c5a1313/go.mod h1:DyEu2iu github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= -github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= github.com/fsnotify/fsnotify v1.4.3-0.20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= @@ -240,11 +221,9 @@ github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -288,11 +267,9 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 h1:5ZkaAPbicIKTF2I64qf5Fh8Aa83Q/dnOafMYV0OMwjA= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20170918230701-e5d664eb928e/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -328,8 +305,6 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -351,7 +326,6 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= @@ -372,16 +346,11 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 h1:0IKlLyQ3Hs9nDaiK5cSHAGmcQ github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= 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.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.14.6 h1:8ERzHx8aj1Sc47mu9n/AksaKCSWrMchFtkdrS4BIj5o= github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -428,8 +397,6 @@ github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqg github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw= github.com/ipfs/go-datastore v0.4.0/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= github.com/ipfs/go-datastore v0.4.4 h1:rjvQ9+muFaJ+QZ7dN5B1MSDNQ0JVZKkkES/rMZmA8X8= @@ -438,11 +405,9 @@ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= -github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk= github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8= github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= github.com/ipfs/go-ds-leveldb v0.4.2/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= github.com/ipfs/go-ipfs-addr v0.0.1 h1:DpDFybnho9v3/a1dzJ5KnWdThWD1HrFLpQ+tWIyBaFI= @@ -452,8 +417,6 @@ github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= -github.com/ipfs/go-ipns v0.0.2 h1:oq4ErrV4hNQ2Eim257RTYRgfOSV/s8BDaf9iIl4NwFs= -github.com/ipfs/go-ipns v0.0.2/go.mod h1:WChil4e0/m9cIINWLxZe1Jtf77oz5L05rO2ei/uKJ5U= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= @@ -480,7 +443,6 @@ github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZl github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -531,7 +493,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= @@ -550,36 +511,26 @@ github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UG github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-flow-metrics v0.0.2/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZkfEI5sT54= github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k= github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw= github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qDKwXujH5o= -github.com/libp2p/go-libp2p v0.8.3/go.mod h1:EsH1A+8yoWK+L4iKcbPYu6MPluZ+CHWI9El8cTaefiM= -github.com/libp2p/go-libp2p v0.10.0/go.mod h1:yBJNpb+mGJdgrwbKAKrhPU0u3ogyNFTfjJ6bdM+Q/G8= github.com/libp2p/go-libp2p v0.10.2 h1:VQOo/Pbj9Ijco9jiMYN5ImAg236IjTXfnUPJ2OvbpLM= github.com/libp2p/go-libp2p v0.10.2/go.mod h1:BYckt6lmS/oA1SlRETSPWSUulCQKiZuTVsymVMc//HQ= github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE= github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI= github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI= github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A= -github.com/libp2p/go-libp2p-autonat v0.2.3 h1:w46bKK3KTOUWDe5mDYMRjJu1uryqBp8HCNDp/TWMqKw= -github.com/libp2p/go-libp2p-autonat v0.2.3/go.mod h1:2U6bNWCNsAG9LEbwccBDQbjzQ8Krdjge1jLTE9rdoMM= github.com/libp2p/go-libp2p-autonat v0.3.1 h1:60sc3NuQz+RxEb4ZVCRp/7uPtD7gnlLcOIKYNulzSIo= github.com/libp2p/go-libp2p-autonat v0.3.1/go.mod h1:0OzOi1/cVc7UcxfOddemYD5vzEqi4fwRbnZcJGLi68U= 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.1.6 h1:CkPp1/zaCrCnBo0AdsQA0O1VkUYoUOtyHOnoa8gKIcE= -github.com/libp2p/go-libp2p-blankhost v0.1.6/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= github.com/libp2p/go-libp2p-blankhost v0.2.0 h1:3EsGAi0CBGcZ33GwRuXEYJLLPoVWyXJ1bcJzAJjINkk= github.com/libp2p/go-libp2p-blankhost v0.2.0/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= -github.com/libp2p/go-libp2p-circuit v0.2.2/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= -github.com/libp2p/go-libp2p-circuit v0.2.3 h1:3Uw1fPHWrp1tgIhBz0vSOxRUmnKL8L/NGUyEd5WfSGM= -github.com/libp2p/go-libp2p-circuit v0.2.3/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= github.com/libp2p/go-libp2p-circuit v0.3.1 h1:69ENDoGnNN45BNDnBd+8SXSetDuw0eJFcGmOvvtOgBw= github.com/libp2p/go-libp2p-circuit v0.3.1/go.mod h1:8RMIlivu1+RxhebipJwFDA45DasLx+kkrp4IlJj53F4= github.com/libp2p/go-libp2p-connmgr v0.2.4 h1:TMS0vc0TCBomtQJyWr7fYxcVYYhx+q/2gF++G5Jkl/w= @@ -589,14 +540,11 @@ github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7O github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= -github.com/libp2p/go-libp2p-core v0.2.5/go.mod h1:6+5zJmKhsf7yHn1RbmYDu08qDUpIUxGdqHuEZckmZOA= github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.2/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.3/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM= github.com/libp2p/go-libp2p-core v0.5.6 h1:IxFH4PmtLlLdPf4fF/i129SnK/C+/v8WEX644MxhC48= @@ -611,16 +559,8 @@ github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoA github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= -github.com/libp2p/go-libp2p-discovery v0.4.0 h1:dK78UhopBk48mlHtRCzbdLm3q/81g77FahEBTjcqQT8= -github.com/libp2p/go-libp2p-discovery v0.4.0/go.mod h1:bZ0aJSrFc/eX2llP0ryhb1kpgkPyTo23SJ5b7UQCMh4= github.com/libp2p/go-libp2p-discovery v0.5.0 h1:Qfl+e5+lfDgwdrXdu4YNCWyEo3fWuP+WgN9mN0iWviQ= github.com/libp2p/go-libp2p-discovery v0.5.0/go.mod h1:+srtPIU9gDaBNu//UHvcdliKBIcr4SfDcm0/PfPJLug= -github.com/libp2p/go-libp2p-host v0.1.0 h1:OZwENiFm6JOK3YR5PZJxkXlJE8a5u8g4YvAUrEV2MjM= -github.com/libp2p/go-libp2p-host v0.1.0/go.mod h1:5+fWuLbDn8OxoxPN3CV0vsLe1hAKScSMbT84qRfxum8= -github.com/libp2p/go-libp2p-kad-dht v0.8.3 h1:ceK5ML6s/I8UAcw6veoNsuEHdHvfo88leU/5uWOIFWs= -github.com/libp2p/go-libp2p-kad-dht v0.8.3/go.mod h1:HnYYy8taJWESkqiESd1ngb9XX/XGGsMA5G0Vj2HoSh4= -github.com/libp2p/go-libp2p-kbucket v0.4.2 h1:wg+VPpCtY61bCasGRexCuXOmEmdKjN+k1w+JtTwu9gA= -github.com/libp2p/go-libp2p-kbucket v0.4.2/go.mod h1:7sCeZx2GkNK1S6lQnGUW5JYZCFPnXzAZCCBBS70lytY= 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-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -633,8 +573,6 @@ github.com/libp2p/go-libp2p-mplex v0.2.4/go.mod h1:mI7iOezdWFOisvUwaYd3IDrJ4oVmg github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE= github.com/libp2p/go-libp2p-nat v0.0.6 h1:wMWis3kYynCbHoyKLPBEMu4YRLltbm8Mk08HGSfvTkU= github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw= -github.com/libp2p/go-libp2p-net v0.1.0 h1:3t23V5cR4GXcNoFriNoZKFdUZEUDZgUkvfwkD2INvQE= -github.com/libp2p/go-libp2p-net v0.1.0/go.mod h1:R5VZbutk75tkC5YJJS61OCO1NWoajxYjCEV2RoHh3FY= 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 h1:vqYQWvnIcHpIoWJKC7Al4D6Hgj0H012TuXRhPwSMGpQ= @@ -644,25 +582,15 @@ github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUje github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= -github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= -github.com/libp2p/go-libp2p-peerstore v0.2.3/go.mod h1:K8ljLdFn590GMttg/luh4caB/3g0vKuY01psze0upRw= -github.com/libp2p/go-libp2p-peerstore v0.2.4 h1:jU9S4jYN30kdzTpDAR7SlHUD+meDUjTODh4waLWF1ws= -github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.2.6 h1:2ACefBX23iMdJU9Ke+dcXt3w86MIryes9v7In4+Qq3U= github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= github.com/libp2p/go-libp2p-pubsub v0.3.3 h1:/AzOAmjDc+IJWybEzhYj1UaV1HErqmo4v3pQVepbgi8= github.com/libp2p/go-libp2p-pubsub v0.3.3/go.mod h1:DTMSVmZZfXodB/pvdTGrY2eHPZ9W2ev7hzTH83OKHrI= -github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M= -github.com/libp2p/go-libp2p-record v0.1.2 h1:M50VKzWnmUrk/M5/Dz99qO9Xh4vs8ijsK+7HkJvRP+0= -github.com/libp2p/go-libp2p-record v0.1.2/go.mod h1:pal0eNcT5nqZaTV7UGhqeGqxFgGdsU/9W//C8dqjQDk= -github.com/libp2p/go-libp2p-record v0.1.3 h1:R27hoScIhQf/A8XJZ8lYpnqh9LatJ5YbHs28kCIfql0= -github.com/libp2p/go-libp2p-record v0.1.3/go.mod h1:yNUff/adKIfPnYQXgp6FQmNu3gLJ6EMg7+/vv2+9pY4= -github.com/libp2p/go-libp2p-routing-helpers v0.2.3/go.mod h1:795bh+9YeoFl99rMASoiVgHdi5bjack0N1+AFAdbvBw= github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= @@ -671,7 +599,6 @@ github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncH github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= -github.com/libp2p/go-libp2p-swarm v0.2.7/go.mod h1:ZSJ0Q+oq/B1JgfPHJAT2HTall+xYRNYp1xs4S2FBWKA= github.com/libp2p/go-libp2p-swarm v0.2.8 h1:cIUUvytBzNQmGSjnXFlI6UpoBGsaud82mJPIJVfkDlg= github.com/libp2p/go-libp2p-swarm v0.2.8/go.mod h1:JQKMGSth4SMqonruY0a8yjlPVIkb0mdNSwckW7OYziM= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -757,7 +684,6 @@ github.com/libp2p/go-yamux v1.3.8 h1:aw0ZXyawL//qvrshGT9v/Mc82sKiD6hBYZ6OBHWXe5s github.com/libp2p/go-yamux v1.3.8/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucas-clemente/quic-go v0.16.0/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+LVb8= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= @@ -765,12 +691,8 @@ github.com/magiconair/properties v1.7.4-0.20170902060319-8d7837e64d3c/go.mod h1: github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.7.0 h1:3l11YT8tm9MnwGFQ4kETwkzpAwY2Jt9lCrumCUW4+z4= github.com/manifoldco/promptui v0.7.0/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ= -github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= -github.com/marten-seemann/qtls v0.9.1 h1:O0YKQxNVPaiFgMng0suWEOY2Sb4LT2sRn9Qimq3Z1IQ= -github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.10-0.20170816031813-ad5389df28cd/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -800,7 +722,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.30/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= @@ -871,7 +792,6 @@ github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPw github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= @@ -895,8 +815,6 @@ github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -921,7 +839,6 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= @@ -934,7 +851,6 @@ github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsq github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= 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/paulbellamy/ratecounter v0.2.0 h1:2L/RhJq+HA8gBQImDXtLPrDXK5qAj6ozWVK/zFXVJGs= @@ -964,7 +880,6 @@ github.com/prestonvanloon/go v1.1.7-0.20190722034630-4f2e55fcf87b h1:Bt5PzQCqfP4 github.com/prestonvanloon/go v1.1.7-0.20190722034630-4f2e55fcf87b/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/prestonvanloon/go-recaptcha v0.0.0-20190217191114-0834cef6e8bd h1:/JK1WfWJGBNDKY70uiB53iKKbFqxBx2CuYgj9hK2O70= github.com/prestonvanloon/go-recaptcha v0.0.0-20190217191114-0834cef6e8bd/go.mod h1:VznrsvawieSl6CEevE2+VGbJPfKWUYfwjb00oJxSXvU= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= @@ -976,7 +891,6 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= @@ -984,7 +898,6 @@ github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -1036,30 +949,8 @@ github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I= github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= @@ -1067,8 +958,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= @@ -1108,7 +997,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/supranational/blst v0.1.2-alpha.1.0.20200917144033-cd0847a7580b h1:ofaf5ea+Xq4P7OdOWTwHUuLO/0sjAIoQHiJTDbhjbB4= @@ -1116,7 +1004,6 @@ github.com/supranational/blst v0.1.2-alpha.1.0.20200917144033-cd0847a7580b/go.mo github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= @@ -1131,9 +1018,6 @@ github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= -github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= -github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE= github.com/wealdtech/eth2-signer-api v1.3.0 h1:Fs0GfrdhboBKW7zaMvIvUHJaOB1ibpAmRG3lkB53in4= github.com/wealdtech/eth2-signer-api v1.3.0/go.mod h1:H8OpAoTBl6CaBvZEnhxWDjjWXNc3kwVFKWMAZd6sHlk= github.com/wealdtech/go-bytesutil v1.0.1/go.mod h1:jENeMqeTEU8FNZyDFRVc7KqBdRKSnJ9CCh26TcuNb9s= @@ -1190,7 +1074,6 @@ github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62 github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= @@ -1217,17 +1100,12 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go4.org v0.0.0-20180809161055-417644f6feb5 h1:+hE86LblG4AyDgwMCLTE6FOlM9+qjHSYS+rKqxUVdsM= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1264,7 +1142,6 @@ golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8H golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1289,15 +1166,11 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1318,14 +1191,11 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20170517211232-f52d1811a629/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1340,7 +1210,6 @@ golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1352,7 +1221,6 @@ golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1398,17 +1266,14 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1456,9 +1321,6 @@ gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6d gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.0.0-20170921000349-586095a6e407/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1468,8 +1330,6 @@ google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -1478,9 +1338,6 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/genproto v0.0.0-20170918111702-1e559d0a00ee/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1505,9 +1362,6 @@ google.golang.org/genproto v0.0.0-20200528191852-705c0b31589b/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200730144737-007c33dbd381 h1:Q0pgDmaT3uO0cF7R0ctyAlhLj2I/xJ+FZyDBOZux0xk= google.golang.org/genproto v0.0.0-20200730144737-007c33dbd381/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1579,9 +1433,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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 h1:tmXTu+dfa+d9Evp8NpJdgOy6+rt8/x4yG7qPBrtNfLY= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1615,5 +1466,3 @@ sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnM sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/scripts/apply-all-eth2-k8.sh b/scripts/apply-all-eth2-k8.sh deleted file mode 100755 index dcd97f7f5..000000000 --- a/scripts/apply-all-eth2-k8.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -# Make sure you set your contract and private key path in the configs -kubectl apply -f k8s/priority.yaml -kubectl apply -f k8s/beacon-chain/namespace.yaml -kubectl apply -f k8s/beacon-chain/beacon-config.config.yaml -kubectl apply -f k8s/beacon-chain/beacon-chain.deploy.yaml -kubectl apply -f k8s/beacon-chain/beacon-chain.service.yaml - -kubectl apply -f k8s/beacon-chain/cluster-manager.encrypted_secret.yaml -kubectl apply -f k8s/beacon-chain/cluster-manager.yaml -kubectl apply -f k8s/beacon-chain/validator.deploy.yaml diff --git a/scripts/gcp_startup_script.sh b/scripts/gcp_startup_script.sh deleted file mode 100644 index cf15366ab..000000000 --- a/scripts/gcp_startup_script.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash -: ' -# *** Instructions *** - -# Build beacon chain for linux -bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //beacon-chain - -# Tar the binary -tar czvf /tmp/beacon-chain.tar.gz --directory=bazel-bin/beacon-chain/linux_amd64_stripped beacon-chain - -# Copy to cloud storage -gsutil cp /tmp/beacon-chain.tar.gz gs://prysmaticlabs/beacon-chain-deployment.tar.gz - -# Create template instance -gcloud compute instance-templates create beacon-chain \ - --project=prysmaticlabs \ - --image-family=debian-9 \ - --image-project=debian-cloud \ - --machine-type=g1-small \ - --preemptible \ - --scopes userinfo-email,cloud-platform \ - --metadata app-location=gs://prysmaticlabs/beacon-chain-deployment.tar.gz \ - --metadata-from-file startup-script=scripts/gcp_startup_script.sh \ - --tags beacon-chain - -# Navigate to https://console.cloud.google.com/compute/instanceTemplates/list?project=prysmaticlabs -# and create a new instance group with the template. -' - - - -set -ex - -# Talk to the metadata server to get the project id and location of application binary. -PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google") -DEPLOY_LOCATION=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/app-location" -H "Metadata-Flavor: Google") -EXTERNAL_IP=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" -H "Metadata-Flavor: Google") - -# Install logging monitor. The monitor will automatically pickup logs send to -# syslog. -curl -s "https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh" | bash -service google-fluentd restart & - -# Install dependencies from apt -apt-get update -apt-get install -yq ca-certificates supervisor - -# Get the application tar from the GCS bucket. -gsutil cp $DEPLOY_LOCATION /app.tar -mkdir -p /app -tar xvzf /app.tar -C /app -chmod +x /app/beacon-chain - -# Create a goapp user. The application will run as this user. -getent passwd goapp || useradd -m -d /home/goapp goapp -chown -R goapp:goapp /app - -# Configure supervisor to run the Go app. -cat >/etc/supervisor/conf.d/goapp.conf << EOF -[program:goapp] -directory=/app -command=/app/beacon-chain --p2p-host-ip=${EXTERNAL_IP} --clear-db -autostart=true -autorestart=true -user=goapp -environment=HOME="/home/goapp",USER="goapp" -stdout_logfile=syslog -stderr_logfile=syslog -EOF - -supervisorctl reread -supervisorctl update - -# Application should now be running under supervisor diff --git a/shared/aggregation/attestations/attestations_bench_test.go b/shared/aggregation/attestations/attestations_bench_test.go index 1e85892bb..787b06eb8 100644 --- a/shared/aggregation/attestations/attestations_bench_test.go +++ b/shared/aggregation/attestations/attestations_bench_test.go @@ -34,65 +34,65 @@ func BenchmarkAggregateAttestations_Aggregate(b *testing.B) { }{ { name: "64 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(b, 64, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(64, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 64), + aggtesting.BitlistWithAllBitsSet(64), }, }, { name: "64 attestations with 8 random bits set", inputs: aggtesting.BitlistsWithMultipleBitSet(b, 64, bitlistLen, 8), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 64), + aggtesting.BitlistWithAllBitsSet(64), }, }, { name: "64 attestations with 16 random bits set", inputs: aggtesting.BitlistsWithMultipleBitSet(b, 64, bitlistLen, 16), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 64), + aggtesting.BitlistWithAllBitsSet(64), }, }, { name: "64 attestations with 32 random bits set", inputs: aggtesting.BitlistsWithMultipleBitSet(b, 64, bitlistLen, 32), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 64), + aggtesting.BitlistWithAllBitsSet(64), }, }, { name: "128 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(b, 128, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(128, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 128), + aggtesting.BitlistWithAllBitsSet(128), }, }, { name: "256 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(b, 256, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(256, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 256), + aggtesting.BitlistWithAllBitsSet(256), }, }, { name: "512 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(b, 512, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(512, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 512), + aggtesting.BitlistWithAllBitsSet(512), }, }, { name: "1024 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(b, 1024, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(1024, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(b, 1024), + aggtesting.BitlistWithAllBitsSet(1024), }, }, } for _, tt := range tests { b.Run(tt.name, func(b *testing.B) { - atts := aggtesting.MakeAttestationsFromBitlists(b, tt.inputs) + atts := aggtesting.MakeAttestationsFromBitlists(tt.inputs) b.ResetTimer() for i := 0; i < b.N; i++ { _, err := Aggregate(atts) diff --git a/shared/aggregation/attestations/attestations_test.go b/shared/aggregation/attestations/attestations_test.go index 4c9434a6a..b2bd904ea 100644 --- a/shared/aggregation/attestations/attestations_test.go +++ b/shared/aggregation/attestations/attestations_test.go @@ -131,16 +131,16 @@ func TestAggregateAttestations_Aggregate(t *testing.T) { }, { name: "256 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(t, 256, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(256, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(t, 256), + aggtesting.BitlistWithAllBitsSet(256), }, }, { name: "1024 attestations with single bit set", - inputs: aggtesting.BitlistsWithSingleBitSet(t, 1024, bitlistLen), + inputs: aggtesting.BitlistsWithSingleBitSet(1024, bitlistLen), want: []bitfield.Bitlist{ - aggtesting.BitlistWithAllBitsSet(t, 1024), + aggtesting.BitlistWithAllBitsSet(1024), }, }, { @@ -216,7 +216,7 @@ func TestAggregateAttestations_Aggregate(t *testing.T) { for _, tt := range tests { runner := func() { - got, err := Aggregate(aggtesting.MakeAttestationsFromBitlists(t, tt.inputs)) + got, err := Aggregate(aggtesting.MakeAttestationsFromBitlists(tt.inputs)) require.NoError(t, err) sort.Slice(got, func(i, j int) bool { return got[i].AggregationBits.Bytes()[0] < got[j].AggregationBits.Bytes()[0] diff --git a/shared/aggregation/maxcover_test.go b/shared/aggregation/maxcover_test.go index 84aeb8e60..40a98d79c 100644 --- a/shared/aggregation/maxcover_test.go +++ b/shared/aggregation/maxcover_test.go @@ -73,7 +73,7 @@ func TestMaxCover_MaxCoverCandidates_filter(t *testing.T) { {4, &bitfield.Bitlist{0b00001010, 0b1}, 2, false}, }, args: args{ - covered: aggtesting.BitlistWithAllBitsSet(t, 8), + covered: aggtesting.BitlistWithAllBitsSet(8), }, want: &MaxCoverCandidates{}, }, @@ -254,7 +254,7 @@ func TestMaxCover_MaxCoverCandidates_union(t *testing.T) { cl: MaxCoverCandidates{ {0, &bitfield.Bitlist{0b11111111, 0b1}, 8, false}, }, - want: aggtesting.BitlistWithAllBitsSet(t, 8), + want: aggtesting.BitlistWithAllBitsSet(8), }, { name: "mixed", @@ -319,7 +319,7 @@ func TestMaxCover_MaxCoverCandidates_score(t *testing.T) { {3, &bitfield.Bitlist{0b00000001, 0b1}, 0, false}, {4, &bitfield.Bitlist{0b00011010, 0b1}, 0, false}, }, - uncovered: aggtesting.BitlistWithAllBitsSet(t, 8), + uncovered: aggtesting.BitlistWithAllBitsSet(8), want: &MaxCoverCandidates{ {0, &bitfield.Bitlist{0b00000100, 0b1}, 1, false}, {1, &bitfield.Bitlist{0b00011011, 0b1}, 4, false}, diff --git a/shared/aggregation/testing/bitlistutils.go b/shared/aggregation/testing/bitlistutils.go index 6a192b599..fc8c2b797 100644 --- a/shared/aggregation/testing/bitlistutils.go +++ b/shared/aggregation/testing/bitlistutils.go @@ -11,7 +11,7 @@ import ( ) // BitlistWithAllBitsSet creates list of bitlists with all bits set. -func BitlistWithAllBitsSet(t testing.TB, length uint64) bitfield.Bitlist { +func BitlistWithAllBitsSet(length uint64) bitfield.Bitlist { b := bitfield.NewBitlist(length) for i := uint64(0); i < length; i++ { b.SetBitAt(i, true) @@ -20,7 +20,7 @@ func BitlistWithAllBitsSet(t testing.TB, length uint64) bitfield.Bitlist { } // BitlistsWithSingleBitSet creates list of bitlists with a single bit set in each. -func BitlistsWithSingleBitSet(t testing.TB, n, length uint64) []bitfield.Bitlist { +func BitlistsWithSingleBitSet(n, length uint64) []bitfield.Bitlist { lists := make([]bitfield.Bitlist, n) for i := uint64(0); i < n; i++ { b := bitfield.NewBitlist(length) @@ -48,7 +48,7 @@ func BitlistsWithMultipleBitSet(t testing.TB, n, length, count uint64) []bitfiel } // MakeAttestationsFromBitlists creates list of bitlists from list of attestations. -func MakeAttestationsFromBitlists(t testing.TB, bl []bitfield.Bitlist) []*ethpb.Attestation { +func MakeAttestationsFromBitlists(bl []bitfield.Bitlist) []*ethpb.Attestation { atts := make([]*ethpb.Attestation, len(bl)) for i, b := range bl { atts[i] = ðpb.Attestation{ diff --git a/shared/bls/blst/stub.go b/shared/bls/blst/stub.go index dd578452c..77e2108ac 100644 --- a/shared/bls/blst/stub.go +++ b/shared/bls/blst/stub.go @@ -16,7 +16,7 @@ func (s SecretKey) PublicKey() iface.PublicKey { } // Sign -- stub -func (s SecretKey) Sign(msg []byte) iface.Signature { +func (s SecretKey) Sign(_ []byte) iface.Signature { panic(err) } @@ -39,7 +39,7 @@ func (p PublicKey) Copy() iface.PublicKey { } // Aggregate -- stub -func (p PublicKey) Aggregate(p2 iface.PublicKey) iface.PublicKey { +func (p PublicKey) Aggregate(_ iface.PublicKey) iface.PublicKey { panic(err) } @@ -47,7 +47,7 @@ func (p PublicKey) Aggregate(p2 iface.PublicKey) iface.PublicKey { type Signature struct{} // Verify -- stub -func (s Signature) Verify(pubKey iface.PublicKey, msg []byte) bool { +func (s Signature) Verify(_ iface.PublicKey, _ []byte) bool { panic(err) } diff --git a/shared/bytesutil/bytes.go b/shared/bytesutil/bytes.go index bf63f8734..fbe77241f 100644 --- a/shared/bytesutil/bytes.go +++ b/shared/bytesutil/bytes.go @@ -85,15 +85,6 @@ func ToBytes4(x []byte) [4]byte { return y } -// ToBytes8 is a convenience method for converting a byte slice to a fix -// sized 8 byte array. This method will truncate the input if it is larger -// than 8 bytes. -func ToBytes8(x []byte) [8]byte { - var y [8]byte - copy(y[:], x) - return y -} - // ToBytes32 is a convenience method for converting a byte slice to a fix // sized 32 byte array. This method will truncate the input if it is larger // than 32 bytes. diff --git a/shared/debug/debug.go b/shared/debug/debug.go index 845199cb7..298561ee6 100644 --- a/shared/debug/debug.go +++ b/shared/debug/debug.go @@ -305,32 +305,6 @@ func expandHome(p string) string { return filepath.Clean(p) } -// MigrateFlags sets the global flag from a local flag when it's set. -// This is a temporary function used for migrating old command/flags to the -// new format. -// -// e.g. geth account new --keystore /tmp/mykeystore --lightkdf -// -// is equivalent after calling this method with: -// -// geth --keystore /tmp/mykeystore --lightkdf account new -// -// This allows the use of the existing configuration functionality. -// When all flags are migrated this function can be removed and the existing -// configuration functionality must be changed that is uses local flags -func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error { - return func(ctx *cli.Context) error { - for _, name := range ctx.FlagNames() { - if ctx.IsSet(name) { - if err := ctx.Set(name, ctx.String(name)); err != nil { - return err - } - } - } - return action(ctx) - } -} - // Debug setup and exit functions. // Setup initializes profiling based on the CLI flags. diff --git a/shared/depositutil/BUILD.bazel b/shared/depositutil/BUILD.bazel index 2a0c4ef32..2704ab602 100644 --- a/shared/depositutil/BUILD.bazel +++ b/shared/depositutil/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", "@com_github_prysmaticlabs_go_ssz//:go_default_library", - "@com_github_sirupsen_logrus//:go_default_library", ], ) diff --git a/shared/depositutil/deposit.go b/shared/depositutil/deposit.go index 0d6772021..3153cbb63 100644 --- a/shared/depositutil/deposit.go +++ b/shared/depositutil/deposit.go @@ -3,8 +3,6 @@ package depositutil import ( - "fmt" - "github.com/ethereum/go-ethereum/core/types" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" @@ -17,7 +15,6 @@ import ( "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/hashutil" "github.com/prysmaticlabs/prysm/shared/params" - "github.com/sirupsen/logrus" ) // DepositInput for a given key. This input data can be used to when making a @@ -147,19 +144,3 @@ func GenerateDepositTransaction( } return tx, depositData, nil } - -// LogDepositTransaction outputs a formatted transaction data to the terminal. -func LogDepositTransaction(log *logrus.Entry, tx *types.Transaction) { - log.Info( - "Copy + paste the deposit data below when using the " + - "eth1 deposit contract") - fmt.Printf(` -========================Deposit Data=============================== - -%#x - -===================================================================`, tx.Data()) - fmt.Printf(` -***Enter the above deposit data into step 3 on https://prylabs.net/participate*** -`) -} diff --git a/shared/htrutils/helpers.go b/shared/htrutils/helpers.go index 0bda085b8..1829bbfe8 100644 --- a/shared/htrutils/helpers.go +++ b/shared/htrutils/helpers.go @@ -86,12 +86,12 @@ func Pack(serializedItems [][]byte) ([][]byte, error) { return serializedItems, nil } // We flatten the list in order to pack its items into byte chunks correctly. - orderedItems := []byte{} + var orderedItems []byte for _, item := range serializedItems { orderedItems = append(orderedItems, item...) } numItems := len(orderedItems) - chunks := [][]byte{} + var chunks [][]byte for i := 0; i < numItems; i += bytesPerChunk { j := i + bytesPerChunk // We create our upper bound index of the chunk, if it is greater than numItems, diff --git a/shared/iputils/external_ip.go b/shared/iputils/external_ip.go index 90d62c2fa..fbfc1bf05 100644 --- a/shared/iputils/external_ip.go +++ b/shared/iputils/external_ip.go @@ -65,7 +65,7 @@ func retrieveIPAddrs() ([]net.IP, error) { if err != nil { return nil, err } - ipAddrs := []net.IP{} + var ipAddrs []net.IP for _, iface := range ifaces { if iface.Flags&net.FlagUp == 0 { continue // interface down diff --git a/shared/logutil/stream_test.go b/shared/logutil/stream_test.go index 8b4319871..3f8914c51 100644 --- a/shared/logutil/stream_test.go +++ b/shared/logutil/stream_test.go @@ -39,9 +39,9 @@ type fakeNetConn struct { func (c fakeNetConn) Close() error { return nil } func (c fakeNetConn) LocalAddr() net.Addr { return localAddr } func (c fakeNetConn) RemoteAddr() net.Addr { return remoteAddr } -func (c fakeNetConn) SetDeadline(t time.Time) error { return nil } -func (c fakeNetConn) SetReadDeadline(t time.Time) error { return nil } -func (c fakeNetConn) SetWriteDeadline(t time.Time) error { return nil } +func (c fakeNetConn) SetDeadline(_ time.Time) error { return nil } +func (c fakeNetConn) SetReadDeadline(_ time.Time) error { return nil } +func (c fakeNetConn) SetWriteDeadline(_ time.Time) error { return nil } type testResponseWriter struct { brw *bufio.ReadWriter diff --git a/shared/params/testnet_onyx_config.go b/shared/params/testnet_onyx_config.go index 22d175502..bce7d408a 100644 --- a/shared/params/testnet_onyx_config.go +++ b/shared/params/testnet_onyx_config.go @@ -11,12 +11,6 @@ func UseOnyxNetworkConfig() { OverrideBeaconNetworkConfig(cfg) } -// OnyxConfig returns the configuration to be used in the main network. Currently, Onyx uses the -// unchanged mainnet configuration. -func OnyxConfig() *BeaconChainConfig { - return mainnetBeaconConfig -} - // UseOnyxConfig for beacon chain services. Currently, Onyx uses the unchanged mainnet // configuration. func UseOnyxConfig() { diff --git a/shared/prereq/prereq.go b/shared/prereq/prereq.go index 52eeaa3b8..b96293633 100644 --- a/shared/prereq/prereq.go +++ b/shared/prereq/prereq.go @@ -20,9 +20,9 @@ type platform struct { var ( // execShellOutput has execShellOutputFunc as the default but can be changed for testing purposes. - execShellOutput func(ctx context.Context, command string, args ...string) (string, error) = execShellOutputFunc - runtimeOS = runtime.GOOS - runtimeArch = runtime.GOARCH + execShellOutput = execShellOutputFunc + runtimeOS = runtime.GOOS + runtimeArch = runtime.GOARCH ) // execShellOutputFunc passes a command and args to exec.CommandContext and returns the result as a string diff --git a/shared/promptutil/prompt.go b/shared/promptutil/prompt.go index f0b221455..ce3216000 100644 --- a/shared/promptutil/prompt.go +++ b/shared/promptutil/prompt.go @@ -18,17 +18,6 @@ import ( var au = aurora.NewAurora(true) -// PasswordConfirm defines an enum type that can determine whether or not -// a prompt should confirm a password input. -type PasswordConfirm int - -const ( - // NoConfirmPass enum to indicate to the prompt that confirming the password is not needed. - NoConfirmPass PasswordConfirm = iota - // ConfirmPass enum to indicate to the prompt to confirm the password entered. - ConfirmPass -) - // PasswordReaderFunc takes in a *file and returns a password using the terminal package func passwordReaderFunc(file *os.File) ([]byte, error) { pass, err := terminal.ReadPassword(int(file.Fd())) @@ -36,7 +25,7 @@ func passwordReaderFunc(file *os.File) ([]byte, error) { } // PasswordReader has passwordReaderFunc as the default but can be changed for testing purposes. -var PasswordReader func(file *os.File) ([]byte, error) = passwordReaderFunc +var PasswordReader = passwordReaderFunc // ValidatePrompt requests the user for text and expects the user to fulfill the provided validation function. func ValidatePrompt(r io.Reader, promptText string, validateFunc func(string) error) (string, error) { diff --git a/shared/rand/rand.go b/shared/rand/rand.go index 40c856b3b..81940bed3 100644 --- a/shared/rand/rand.go +++ b/shared/rand/rand.go @@ -40,7 +40,7 @@ type source struct{} var _ mrand.Source64 = (*source)(nil) // Seed does nothing when crypto/rand is used as source. -func (s *source) Seed(seed int64) {} +func (s *source) Seed(_ int64) {} // Int63 returns uniformly-distributed random (as in CSPRNG) int64 value within [0, 1<<63) range. // Panics if random generator reader cannot return data. diff --git a/shared/testutil/block.go b/shared/testutil/block.go index be5006f83..6d136d795 100644 --- a/shared/testutil/block.go +++ b/shared/testutil/block.go @@ -101,7 +101,7 @@ func GenerateFullBlock( } var err error - pSlashings := []*ethpb.ProposerSlashing{} + var pSlashings []*ethpb.ProposerSlashing numToGen := conf.NumProposerSlashings if numToGen > 0 { pSlashings, err = generateProposerSlashings(bState, privs, numToGen) @@ -111,7 +111,7 @@ func GenerateFullBlock( } numToGen = conf.NumAttesterSlashings - aSlashings := []*ethpb.AttesterSlashing{} + var aSlashings []*ethpb.AttesterSlashing if numToGen > 0 { aSlashings, err = generateAttesterSlashings(bState, privs, numToGen) if err != nil { @@ -120,7 +120,7 @@ func GenerateFullBlock( } numToGen = conf.NumAttestations - atts := []*ethpb.Attestation{} + var atts []*ethpb.Attestation if numToGen > 0 { atts, err = GenerateAttestations(bState, privs, numToGen, slot, false) if err != nil { @@ -129,7 +129,8 @@ func GenerateFullBlock( } numToGen = conf.NumDeposits - newDeposits, eth1Data := []*ethpb.Deposit{}, bState.Eth1Data() + var newDeposits []*ethpb.Deposit + eth1Data := bState.Eth1Data() if numToGen > 0 { newDeposits, eth1Data, err = generateDepositsAndEth1Data(bState, numToGen) if err != nil { @@ -138,7 +139,7 @@ func GenerateFullBlock( } numToGen = conf.NumVoluntaryExits - exits := []*ethpb.SignedVoluntaryExit{} + var exits []*ethpb.SignedVoluntaryExit if numToGen > 0 { exits, err = generateVoluntaryExits(bState, privs, numToGen) if err != nil { @@ -355,7 +356,7 @@ func generateAttesterSlashings( // If you request 4 attestations, but there are 8 committees, you will get 4 fully aggregated attestations. func GenerateAttestations(bState *stateTrie.BeaconState, privs []bls.SecretKey, numToGen uint64, slot uint64, randomRoot bool) ([]*ethpb.Attestation, error) { currentEpoch := helpers.SlotToEpoch(slot) - attestations := []*ethpb.Attestation{} + var attestations []*ethpb.Attestation generateHeadState := false bState = bState.Copy() if slot > bState.Slot() { @@ -461,7 +462,7 @@ func GenerateAttestations(bState *stateTrie.BeaconState, privs []bls.SecretKey, bitsPerAtt := committeeSize / uint64(attsPerCommittee) for i := uint64(0); i < committeeSize; i += bitsPerAtt { aggregationBits := bitfield.NewBitlist(committeeSize) - sigs := []bls.Signature{} + var sigs []bls.Signature for b := i; b < i+bitsPerAtt; b++ { aggregationBits.SetBitAt(b, true) sigs = append(sigs, privs[committee[b]].Sign(dataRoot[:])) diff --git a/slasher/db/kv/BUILD.bazel b/slasher/db/kv/BUILD.bazel index 9ae5b5018..72773f2fa 100644 --- a/slasher/db/kv/BUILD.bazel +++ b/slasher/db/kv/BUILD.bazel @@ -62,7 +62,6 @@ go_test( "//slasher/detection/attestations/types:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", - "@com_github_urfave_cli_v2//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", ], ) diff --git a/slasher/db/kv/attester_slashings_test.go b/slasher/db/kv/attester_slashings_test.go index a6f1c6bd6..65216e934 100644 --- a/slasher/db/kv/attester_slashings_test.go +++ b/slasher/db/kv/attester_slashings_test.go @@ -2,7 +2,6 @@ package kv import ( "context" - "flag" "sort" "testing" @@ -10,13 +9,10 @@ import ( "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/slasher/db/types" - "github.com/urfave/cli/v2" ) func TestStore_AttesterSlashingNilBucket(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() as := ðpb.AttesterSlashing{ @@ -48,9 +44,7 @@ func TestStore_AttesterSlashingNilBucket(t *testing.T) { } func TestStore_SaveAttesterSlashing(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() data := ðpb.AttestationData{ @@ -89,9 +83,7 @@ func TestStore_SaveAttesterSlashing(t *testing.T) { } func TestStore_SaveAttesterSlashings(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() ckpt := ðpb.Checkpoint{Root: make([]byte, 32)} @@ -114,9 +106,7 @@ func TestStore_SaveAttesterSlashings(t *testing.T) { } func TestStore_UpdateAttesterSlashingStatus(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() data := ðpb.AttestationData{ @@ -173,9 +163,7 @@ func TestStore_UpdateAttesterSlashingStatus(t *testing.T) { } func TestStore_LatestEpochDetected(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() e, err := db.GetLatestEpochDetected(ctx) diff --git a/slasher/db/kv/benchmark_test.go b/slasher/db/kv/benchmark_test.go index 9abf6c464..da7271f11 100644 --- a/slasher/db/kv/benchmark_test.go +++ b/slasher/db/kv/benchmark_test.go @@ -2,13 +2,11 @@ package kv import ( "context" - "flag" "testing" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types" - "github.com/urfave/cli/v2" ) const ( @@ -18,9 +16,7 @@ const ( func BenchmarkStore_SaveEpochSpans(b *testing.B) { ctx := context.Background() sigBytes := [2]byte{} - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(b, cli.NewContext(&app, set, nil)) + db := setupDB(b) es := &types.EpochStore{} es, err := es.SetValidatorSpan(benchmarkValidator, types.Span{MinSpan: 1, MaxSpan: 2, SigBytes: sigBytes, HasAttested: true}) @@ -38,9 +34,7 @@ func BenchmarkStore_SaveEpochSpans(b *testing.B) { } func BenchmarkStore_EpochSpans(b *testing.B) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(b, cli.NewContext(&app, set, nil)) + db := setupDB(b) ctx := context.Background() sigBytes := [2]byte{} es := &types.EpochStore{} diff --git a/slasher/db/kv/block_header_test.go b/slasher/db/kv/block_header_test.go index 420c03540..e110790ce 100644 --- a/slasher/db/kv/block_header_test.go +++ b/slasher/db/kv/block_header_test.go @@ -2,7 +2,6 @@ package kv import ( "context" - "flag" "testing" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" @@ -11,13 +10,10 @@ import ( "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" - "github.com/urfave/cli/v2" ) func TestNilDBHistoryBlkHdr(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() slot := uint64(1) @@ -31,9 +27,7 @@ func TestNilDBHistoryBlkHdr(t *testing.T) { } func TestSaveHistoryBlkHdr(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() tests := []struct { @@ -65,9 +59,7 @@ func TestSaveHistoryBlkHdr(t *testing.T) { } func TestDeleteHistoryBlkHdr(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() tests := []struct { @@ -103,9 +95,7 @@ func TestDeleteHistoryBlkHdr(t *testing.T) { } func TestHasHistoryBlkHdr(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() tests := []struct { @@ -140,9 +130,7 @@ func TestHasHistoryBlkHdr(t *testing.T) { } func TestPruneHistoryBlkHdr(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() tests := []struct { diff --git a/slasher/db/kv/chain_data_test.go b/slasher/db/kv/chain_data_test.go index b5549f6e3..533f4ed71 100644 --- a/slasher/db/kv/chain_data_test.go +++ b/slasher/db/kv/chain_data_test.go @@ -2,19 +2,15 @@ package kv import ( "context" - "flag" "testing" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" - "github.com/urfave/cli/v2" ) func TestChainHead(t *testing.T) { - app := &cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(app, set, nil)) + db := setupDB(t) ctx := context.Background() tests := []struct { diff --git a/slasher/db/kv/indexed_attestations_test.go b/slasher/db/kv/indexed_attestations_test.go index 5eadd371d..c67435648 100644 --- a/slasher/db/kv/indexed_attestations_test.go +++ b/slasher/db/kv/indexed_attestations_test.go @@ -2,12 +2,10 @@ package kv import ( "context" - "flag" "testing" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/shared/testutil/require" - "github.com/urfave/cli/v2" ) type testStruct struct { @@ -62,9 +60,7 @@ func init() { } func TestHasIndexedAttestation_NilDB(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() hasIdxAtt, err := db.HasIndexedAttestation(ctx, tests[0].idxAtt) @@ -73,9 +69,7 @@ func TestHasIndexedAttestation_NilDB(t *testing.T) { } func TestSaveIndexedAttestation(t *testing.T) { - app := &cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(app, set, nil)) + db := setupDB(t) ctx := context.Background() for _, tt := range tests { @@ -311,9 +305,7 @@ func TestIndexedAttestationsWithPrefix(t *testing.T) { } for _, tt := range prefixTests { t.Run(tt.name, func(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() require.NoError(t, db.SaveIndexedAttestations(ctx, tt.attsInDB), "Save indexed attestation failed") @@ -469,9 +461,7 @@ func TestIndexedAttestationsForTarget(t *testing.T) { } for _, tt := range prefixTests { t.Run(tt.name, func(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() require.NoError(t, db.SaveIndexedAttestations(ctx, tt.attsInDB), "Save indexed attestation failed") @@ -651,9 +641,7 @@ func TestDeleteIndexedAttestation(t *testing.T) { } for _, tt := range deleteTests { t.Run(tt.name, func(t *testing.T) { - app := &cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(app, set, nil)) + db := setupDB(t) ctx := context.Background() require.NoError(t, db.SaveIndexedAttestations(ctx, tt.attsInDB), "Save indexed attestation failed") @@ -678,9 +666,7 @@ func TestDeleteIndexedAttestation(t *testing.T) { } func TestHasIndexedAttestation(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() for _, tt := range tests { @@ -699,9 +685,7 @@ func TestHasIndexedAttestation(t *testing.T) { } func TestPruneHistoryIndexedAttestation(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + db := setupDB(t) ctx := context.Background() for _, tt := range tests { diff --git a/slasher/db/kv/kv_test.go b/slasher/db/kv/kv_test.go index 6058cfc3d..f9c93ddbb 100644 --- a/slasher/db/kv/kv_test.go +++ b/slasher/db/kv/kv_test.go @@ -12,7 +12,6 @@ import ( "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/sirupsen/logrus" - "github.com/urfave/cli/v2" ) func TestMain(m *testing.M) { @@ -22,7 +21,7 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } -func setupDB(t testing.TB, ctx *cli.Context) *Store { +func setupDB(t testing.TB) *Store { randPath, err := rand.Int(rand.Reader, big.NewInt(1000000)) require.NoError(t, err, "Could not generate random file path") p := path.Join(testutil.TempDir(), fmt.Sprintf("/%d", randPath)) diff --git a/slasher/db/kv/proposer_slashings_test.go b/slasher/db/kv/proposer_slashings_test.go index c9f456f20..9ba1238ae 100644 --- a/slasher/db/kv/proposer_slashings_test.go +++ b/slasher/db/kv/proposer_slashings_test.go @@ -2,7 +2,6 @@ package kv import ( "context" - "flag" "reflect" "sort" "testing" @@ -10,14 +9,12 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/slasher/db/types" - "github.com/urfave/cli/v2" "gopkg.in/d4l3k/messagediff.v1" ) func TestStore_ProposerSlashingNilBucket(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() ps := ðpb.ProposerSlashing{ @@ -51,9 +48,8 @@ func TestStore_ProposerSlashingNilBucket(t *testing.T) { } func TestStore_SaveProposerSlashing(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() tests := []struct { @@ -153,9 +149,8 @@ func TestStore_SaveProposerSlashing(t *testing.T) { } func TestStore_UpdateProposerSlashingStatus(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() tests := []struct { @@ -254,9 +249,8 @@ func TestStore_UpdateProposerSlashingStatus(t *testing.T) { } func TestStore_SaveProposerSlashings(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() ps := []*ethpb.ProposerSlashing{ diff --git a/slasher/db/kv/spanner_new.go b/slasher/db/kv/spanner_new.go index a23c82c90..f0546fdd5 100644 --- a/slasher/db/kv/spanner_new.go +++ b/slasher/db/kv/spanner_new.go @@ -45,7 +45,7 @@ func persistFlatSpanMapsOnEviction(db *Store) func(key interface{}, value interf // for slashing detection. // Returns span byte array, and error in case of db error. // returns empty byte array if no entry for this epoch exists in db. -func (db *Store) EpochSpans(ctx context.Context, epoch uint64, fromCache bool) (*types.EpochStore, error) { +func (db *Store) EpochSpans(_ context.Context, epoch uint64, fromCache bool) (*types.EpochStore, error) { // Get from the cache if it exists or is requested, if not, go to DB. if fromCache && db.flatSpanCache.Has(epoch) || db.flatSpanCache.Has(epoch) { spans, _ := db.flatSpanCache.Get(epoch) @@ -73,7 +73,7 @@ func (db *Store) EpochSpans(ctx context.Context, epoch uint64, fromCache bool) ( } // SaveEpochSpans accepts a epoch and span byte array and writes it to disk. -func (db *Store) SaveEpochSpans(ctx context.Context, epoch uint64, es *types.EpochStore, toCache bool) error { +func (db *Store) SaveEpochSpans(_ context.Context, epoch uint64, es *types.EpochStore, toCache bool) error { if len(es.Bytes())%int(types.SpannerEncodedLength) != 0 { return types.ErrWrongSize } diff --git a/slasher/db/kv/spanner_new_test.go b/slasher/db/kv/spanner_new_test.go index 267dacbad..a85ba6052 100644 --- a/slasher/db/kv/spanner_new_test.go +++ b/slasher/db/kv/spanner_new_test.go @@ -3,13 +3,11 @@ package kv import ( "context" "encoding/hex" - "flag" "testing" "github.com/prysmaticlabs/prysm/shared/testutil/require" dbTypes "github.com/prysmaticlabs/prysm/slasher/db/types" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types" - "github.com/urfave/cli/v2" ) type spansTestStruct struct { @@ -54,9 +52,8 @@ func init() { } func TestValidatorSpans_NilDB(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() validatorIdx := uint64(1) @@ -68,9 +65,8 @@ func TestValidatorSpans_NilDB(t *testing.T) { } func TestStore_SaveReadEpochSpans(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range spanNewTests { @@ -100,9 +96,8 @@ func TestStore_SaveReadEpochSpans(t *testing.T) { } func TestStore_SaveEpochSpans_ToCache(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() spansToSave := map[uint64]types.Span{ @@ -129,9 +124,8 @@ func TestStore_SaveEpochSpans_ToCache(t *testing.T) { } func TestStore_SaveEpochSpans_ToDB(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() spansToSave := map[uint64]types.Span{ diff --git a/slasher/db/kv/spanner_test.go b/slasher/db/kv/spanner_test.go index bcb3bb9dd..6425496a1 100644 --- a/slasher/db/kv/spanner_test.go +++ b/slasher/db/kv/spanner_test.go @@ -2,14 +2,12 @@ package kv import ( "context" - "flag" "testing" "time" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types" - "github.com/urfave/cli/v2" ) type spanMapTestStruct struct { @@ -49,9 +47,8 @@ func init() { } func TestValidatorSpanMap_NilDB(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() validatorIdx := uint64(1) @@ -61,9 +58,8 @@ func TestValidatorSpanMap_NilDB(t *testing.T) { } func TestStore_SaveSpans(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range spanTests { @@ -80,9 +76,8 @@ func TestStore_SaveSpans(t *testing.T) { } func TestStore_SaveCachedSpans(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range spanTests { @@ -102,9 +97,8 @@ func TestStore_SaveCachedSpans(t *testing.T) { } func TestStore_DeleteEpochSpans(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() db.spanCacheEnabled = false for _, tt := range spanTests { @@ -126,9 +120,8 @@ func TestStore_DeleteEpochSpans(t *testing.T) { } func TestValidatorSpanMap_DeletesOnCacheSavesToDB(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range spanTests { @@ -182,9 +175,8 @@ func TestValidatorSpanMap_SaveOnEvict(t *testing.T) { } func TestValidatorSpanMap_SaveCachedSpansMaps(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range spanTests { @@ -203,9 +195,8 @@ func TestValidatorSpanMap_SaveCachedSpansMaps(t *testing.T) { } func TestStore_ReadWriteEpochsSpanByValidatorsIndices(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() db.spanCacheEnabled = false @@ -219,7 +210,7 @@ func TestStore_ReadWriteEpochsSpanByValidatorsIndices(t *testing.T) { for _, tt := range spanTests { assert.DeepEqual(t, tt.spanMap, res[tt.epoch], "Unexpected span map") } - db1 := setupDB(t, cli.NewContext(&app, set, nil)) + db1 := setupDB(t) require.NoError(t, db1.SaveEpochsSpanByValidatorsIndices(ctx, res)) res, err = db1.EpochsSpanByValidatorsIndices(ctx, []uint64{1, 2, 3}, 3) require.NoError(t, err) diff --git a/slasher/db/kv/validator_id_pubkey_test.go b/slasher/db/kv/validator_id_pubkey_test.go index c7a2bac96..c1ba52590 100644 --- a/slasher/db/kv/validator_id_pubkey_test.go +++ b/slasher/db/kv/validator_id_pubkey_test.go @@ -2,11 +2,9 @@ package kv import ( "context" - "flag" "testing" "github.com/prysmaticlabs/prysm/shared/testutil/require" - "github.com/urfave/cli/v2" ) type publicKeyTestStruct struct { @@ -34,9 +32,8 @@ func init() { } func TestNilDBValidatorPublicKey(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() validatorID := uint64(1) @@ -47,9 +44,8 @@ func TestNilDBValidatorPublicKey(t *testing.T) { } func TestSavePubKey(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range pkTests { @@ -64,9 +60,8 @@ func TestSavePubKey(t *testing.T) { } func TestDeletePublicKey(t *testing.T) { - app := cli.App{} - set := flag.NewFlagSet("test", 0) - db := setupDB(t, cli.NewContext(&app, set, nil)) + + db := setupDB(t) ctx := context.Background() for _, tt := range pkTests { diff --git a/slasher/db/types/types.go b/slasher/db/types/types.go index 9c248d96d..868d98fd0 100644 --- a/slasher/db/types/types.go +++ b/slasher/db/types/types.go @@ -5,6 +5,7 @@ package types // SlashingStatus enum like structure. type SlashingStatus uint8 +//noinspection GoUnusedConst const ( // Unknown default status in case it is not set Unknown = iota diff --git a/slasher/detection/attestations/mock_spanner.go b/slasher/detection/attestations/mock_spanner.go index c8e87e448..be6547a83 100644 --- a/slasher/detection/attestations/mock_spanner.go +++ b/slasher/detection/attestations/mock_spanner.go @@ -21,7 +21,7 @@ type MockSpanDetector struct{} // If the target epoch is greater than 12, it will "detect" a surrounding vote for target epoch - 1. // Lastly, if it has a target epoch less than 6, it will "detect" a double vote for the target epoch. func (s *MockSpanDetector) DetectSlashingsForAttestation( - ctx context.Context, + _ context.Context, att *ethpb.IndexedAttestation, ) ([]*types.DetectionResult, error) { var detections []*types.DetectionResult @@ -58,21 +58,21 @@ func (s *MockSpanDetector) DetectSlashingsForAttestation( // SpanForEpochByValidator returns the specific min-max span for a // validator index in a given epoch. -func (s *MockSpanDetector) SpanForEpochByValidator(ctx context.Context, valIdx uint64, epoch uint64) (types.Span, error) { +func (s *MockSpanDetector) SpanForEpochByValidator(_ context.Context, _, _ uint64) (types.Span, error) { return types.Span{MinSpan: 0, MaxSpan: 0, SigBytes: [2]byte{}, HasAttested: false}, nil } // ValidatorSpansByEpoch returns a list of all validator spans in a given epoch. -func (s *MockSpanDetector) ValidatorSpansByEpoch(ctx context.Context, epoch uint64) map[uint64]types.Span { +func (s *MockSpanDetector) ValidatorSpansByEpoch(_ context.Context, _ uint64) map[uint64]types.Span { return make(map[uint64]types.Span) } // DeleteValidatorSpansByEpoch mocks the delete spans by epoch function. -func (s *MockSpanDetector) DeleteValidatorSpansByEpoch(ctx context.Context, validatorIdx uint64, epoch uint64) error { +func (s *MockSpanDetector) DeleteValidatorSpansByEpoch(_ context.Context, _, _ uint64) error { return nil } // UpdateSpans is a mock for updating the spans for a given attestation.. -func (s *MockSpanDetector) UpdateSpans(ctx context.Context, att *ethpb.IndexedAttestation) error { +func (s *MockSpanDetector) UpdateSpans(_ context.Context, _ *ethpb.IndexedAttestation) error { return nil } diff --git a/slasher/detection/detect.go b/slasher/detection/detect.go index 5528898e8..164350433 100644 --- a/slasher/detection/detect.go +++ b/slasher/detection/detect.go @@ -86,7 +86,7 @@ func (ds *Service) UpdateSpans(ctx context.Context, att *ethpb.IndexedAttestatio // detectDoubleVote cross references the passed in attestation with the bloom filter maintained // for every epoch for the validator in order to determine if it is a double vote. func (ds *Service) detectDoubleVote( - ctx context.Context, + _ context.Context, possibleAtts []*ethpb.IndexedAttestation, incomingAtt *ethpb.IndexedAttestation, detectionResult *types.DetectionResult, diff --git a/slasher/rpc/server.go b/slasher/rpc/server.go index fb447bcaf..6558d8ae5 100644 --- a/slasher/rpc/server.go +++ b/slasher/rpc/server.go @@ -79,7 +79,7 @@ func (ss *Server) IsSlashableAttestation(ctx context.Context, req *ethpb.Indexed if err != nil { return nil, err } - pubkeys := []bls.PublicKey{} + var pubkeys []bls.PublicKey for _, pkBytes := range pkMap { pk, err := bls.PublicKeyFromBytes(pkBytes) if err != nil { diff --git a/slasher/rpc/server_test.go b/slasher/rpc/server_test.go index 4206c2e37..594e24bb8 100644 --- a/slasher/rpc/server_test.go +++ b/slasher/rpc/server_test.go @@ -154,7 +154,7 @@ func TestServer_IsSlashableAttestationNoUpdate(t *testing.T) { require.NoError(t, err) root, err := helpers.ComputeSigningRoot(savedAttestation.Data, domain) require.NoError(t, err) - sig := []bls.Signature{} + var sig []bls.Signature for _, idx := range savedAttestation.AttestingIndices { validatorSig := keys[idx].Sign(root[:]) sig = append(sig, validatorSig) diff --git a/test/fuzz/BUILD.bazel b/test/fuzz/BUILD.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/fuzz/main.cc b/test/fuzz/main.cc deleted file mode 100644 index e69de29bb..000000000 diff --git a/tools/analyzers/maligned/maligned.go b/tools/analyzers/maligned/maligned.go index cacb428f3..95659f496 100644 --- a/tools/analyzers/maligned/maligned.go +++ b/tools/analyzers/maligned/maligned.go @@ -15,7 +15,7 @@ import ( "strings" ) -func malign(pos token.Pos, str *types.Struct) error { +func malign(_ token.Pos, str *types.Struct) error { wordSize := int64(8) maxAlign := int64(8) switch build.Default.GOARCH { diff --git a/tools/benchmark-files-gen/main.go b/tools/benchmark-files-gen/main.go index 453ec35f0..c288b790c 100644 --- a/tools/benchmark-files-gen/main.go +++ b/tools/benchmark-files-gen/main.go @@ -109,7 +109,7 @@ func generateMarshalledFullStateAndBlock() error { NumAttestations: benchutil.AttestationsPerEpoch / slotsPerEpoch, } - atts := []*ethpb.Attestation{} + var atts []*ethpb.Attestation for i := slotOffset + 1; i < slotsPerEpoch+slotOffset; i++ { attsForSlot, err := testutil.GenerateAttestations(beaconState, privs, attConfig.NumAttestations, i, false) if err != nil { diff --git a/tools/bootnode-query/BUILD.bazel b/tools/bootnode-query/BUILD.bazel deleted file mode 100644 index b879303c2..000000000 --- a/tools/bootnode-query/BUILD.bazel +++ /dev/null @@ -1,23 +0,0 @@ -load("@prysm//tools/go:def.bzl", "go_library") -load("@io_bazel_rules_go//go:def.bzl", "go_binary") - -go_library( - name = "go_default_library", - srcs = ["main.go"], - importpath = "github.com/prysmaticlabs/prysm/tools/bootnode-query", - visibility = ["//visibility:private"], - deps = [ - "//beacon-chain/p2p:go_default_library", - "@com_github_gogo_protobuf//io:go_default_library", - "@com_github_libp2p_go_libp2p//:go_default_library", - "@com_github_libp2p_go_libp2p_host//:go_default_library", - "@com_github_libp2p_go_libp2p_kad_dht//pb:go_default_library", - "@com_github_libp2p_go_libp2p_net//:go_default_library", - ], -) - -go_binary( - name = "bootnode-query", - embed = [":go_default_library"], - visibility = ["//visibility:public"], -) diff --git a/tools/bootnode-query/README.md b/tools/bootnode-query/README.md deleted file mode 100644 index 0fa10ab52..000000000 --- a/tools/bootnode-query/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Bootnode query tool - -To query the test network - -``` -bazel run //tools/bootnode-query -- /ip4/35.224.249.2/tcp/30001/p2p/QmQEe7o6hKJdGdSkJRh7WJzS6xrex5f4w2SPR6oWbJNriw -``` - -This will dial the testnet bootnode and attempt to connect to all of its peers. diff --git a/tools/bootnode-query/main.go b/tools/bootnode-query/main.go deleted file mode 100644 index 53f8adf43..000000000 --- a/tools/bootnode-query/main.go +++ /dev/null @@ -1,94 +0,0 @@ -// Bootstrap / DHT query tool -// -// Usage: bazel run //tools/boostrap-query -- $BOOTNODE_ADDRESS -// -// This tool queries the bootstrap / DHT node for peers then attempts to dial -// and ping each of them. -package main - -import ( - "context" - "log" - "os" - - ggio "github.com/gogo/protobuf/io" - "github.com/libp2p/go-libp2p" - host "github.com/libp2p/go-libp2p-host" - dhtpb "github.com/libp2p/go-libp2p-kad-dht/pb" - net "github.com/libp2p/go-libp2p-net" - "github.com/prysmaticlabs/prysm/beacon-chain/p2p" -) - -const dhtProtocol = "/prysm/0.0.0/dht" - -func main() { - if len(os.Args) == 1 { - log.Fatal("Error: Bootnode address not provided.") - } - - ctx := context.Background() - h, err := libp2p.New(ctx) - if err != nil { - panic(err) - } - - addr := os.Args[1] - pi, err := p2p.MakePeer(addr) - if err != nil { - log.Fatalf("Error: Failed to make peer from string: %v", err) - } - if err := h.Connect(ctx, *pi); err != nil { - log.Fatalf("Error: Failed to create peer from string: %v", err) - } - - s, err := h.NewStream(ctx, pi.ID, dhtProtocol) - if err != nil { - log.Printf("proto = %s", dhtProtocol) - log.Fatalf("Error: Failed to create ProtocolDHT stream: %v", err) - } - - resp := sendMessageAndWait(s, dhtpb.NewMessage(dhtpb.Message_FIND_NODE, []byte{}, 0)) - - log.Printf("Bootstrap DHT node has %d peers\n", len(resp.GetCloserPeers())) - for i, p := range resp.GetCloserPeers() { - log.Printf("Dialing peer %d: %+v\n", i, p.Addresses()) - - if err := pingPeer(ctx, h, &p); err != nil { - log.Printf("Error: unable to ping peer %v\n", err) - } else { - log.Println("OK") - } - } -} - -func pingPeer(ctx context.Context, h host.Host, p *dhtpb.Message_Peer) error { - pi := dhtpb.PBPeerToPeerInfo(*p) - if err := h.Connect(ctx, pi); err != nil { - return err - } - - s, err := h.NewStream(ctx, pi.ID, dhtProtocol) - if err != nil { - return err - } - - // Any response is OK - _ = sendMessageAndWait(s, dhtpb.NewMessage(dhtpb.Message_PING, []byte{}, 0)) - return nil -} - -func sendMessageAndWait(s net.Stream, msg *dhtpb.Message) dhtpb.Message { - r := ggio.NewDelimitedReader(s, 2000000) - w := ggio.NewDelimitedWriter(s) - - if err := w.WriteMsg(msg); err != nil { - log.Fatalf("Error: failed to write message: %v", err) - } - - var resp dhtpb.Message - if err := r.ReadMsg(&resp); err != nil { - log.Fatalf("Error: failed to read message: %v", err) - } - - return resp -} diff --git a/tools/bootnode/BUILD.bazel b/tools/bootnode/BUILD.bazel index 040a85502..b03a20c2c 100644 --- a/tools/bootnode/BUILD.bazel +++ b/tools/bootnode/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//shared/params:go_default_library", "//shared/runutil:go_default_library", "//shared/version:go_default_library", - "@com_github_btcsuite_btcd//btcec:go_default_library", "@com_github_ethereum_go_ethereum//log:go_default_library", "@com_github_ethereum_go_ethereum//p2p/discover:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", @@ -104,7 +103,6 @@ go_test( "//shared/maxprocs:go_default_library", "//shared/testutil/assert:go_default_library", "//shared/testutil/require:go_default_library", - "@com_github_btcsuite_btcd//btcec:go_default_library", "@com_github_ethereum_go_ethereum//p2p/discover:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", "@com_github_libp2p_go_libp2p_core//crypto:go_default_library", diff --git a/tools/bootnode/bootnode.go b/tools/bootnode/bootnode.go index a60f1dc4d..29ab8bbd6 100644 --- a/tools/bootnode/bootnode.go +++ b/tools/bootnode/bootnode.go @@ -22,7 +22,6 @@ import ( "os" "time" - "github.com/btcsuite/btcd/btcec" gethlog "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/enode" @@ -157,7 +156,7 @@ func createListener(ipAddr string, port int, cfg discover.Config) *discover.UDPv return network } -func (h *handler) httpHandler(w http.ResponseWriter, r *http.Request) { +func (h *handler) httpHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) write := func(w io.Writer, b []byte) { if _, err := w.Write(b); err != nil { @@ -241,14 +240,14 @@ func extractPrivateKey() *ecdsa.PrivateKey { if err != nil { panic(err) } - privKey = (*ecdsa.PrivateKey)((*btcec.PrivateKey)(unmarshalledKey.(*crypto.Secp256k1PrivateKey))) + privKey = (*ecdsa.PrivateKey)(unmarshalledKey.(*crypto.Secp256k1PrivateKey)) } else { privInterfaceKey, _, err := crypto.GenerateSecp256k1Key(rand.Reader) if err != nil { panic(err) } - privKey = (*ecdsa.PrivateKey)((*btcec.PrivateKey)(privInterfaceKey.(*crypto.Secp256k1PrivateKey))) + privKey = (*ecdsa.PrivateKey)(privInterfaceKey.(*crypto.Secp256k1PrivateKey)) log.Warning("No private key was provided. Using default/random private key") b, err := privInterfaceKey.Raw() if err != nil { diff --git a/tools/bootnode/bootnode_test.go b/tools/bootnode/bootnode_test.go index dd05b03e5..99ee6253d 100644 --- a/tools/bootnode/bootnode_test.go +++ b/tools/bootnode/bootnode_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/btcsuite/btcd/btcec" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/libp2p/go-libp2p-core/crypto" @@ -69,7 +68,7 @@ func TestPrivateKey_ParsesCorrectly(t *testing.T) { extractedKey := extractPrivateKey() - rawKey := (*ecdsa.PrivateKey)((*btcec.PrivateKey)(privKey.(*crypto.Secp256k1PrivateKey))) + rawKey := (*ecdsa.PrivateKey)(privKey.(*crypto.Secp256k1PrivateKey)) r, s, err := ecdsa.Sign(rand.Reader, extractedKey, []byte{'t', 'e', 's', 't'}) require.NoError(t, err) diff --git a/tools/cluster-pk-manager/server/keyChecker.go b/tools/cluster-pk-manager/server/keyChecker.go index 913702e4b..f25b6221b 100644 --- a/tools/cluster-pk-manager/server/keyChecker.go +++ b/tools/cluster-pk-manager/server/keyChecker.go @@ -10,7 +10,7 @@ type keyChecker struct { db *db } -func newkeyChecker(db *db, beaconRPCAddr string) *keyChecker { +func newkeyChecker(db *db, _ string) *keyChecker { log.Warn("Key checker temporarily disabled during refactor.") return &keyChecker{ diff --git a/tools/contract-addr/main.go b/tools/contract-addr/main.go index 15ddc50ad..f3224a007 100644 --- a/tools/contract-addr/main.go +++ b/tools/contract-addr/main.go @@ -30,7 +30,7 @@ func main() { type handler struct{} -func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { +func (h *handler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { dat, err := ioutil.ReadFile(*address) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/tools/eth1exporter/main.go b/tools/eth1exporter/main.go index 051fe855b..cadef226e 100644 --- a/tools/eth1exporter/main.go +++ b/tools/eth1exporter/main.go @@ -120,7 +120,7 @@ func ToEther(o *big.Int) *big.Float { } // MetricsHTTP - HTTP response handler for /metrics. -func MetricsHTTP(w http.ResponseWriter, r *http.Request) { +func MetricsHTTP(w http.ResponseWriter, _ *http.Request) { var allOut []string total := big.NewFloat(0) for _, v := range allWatching { diff --git a/validator/accounts/v2/accounts_create.go b/validator/accounts/v2/accounts_create.go index 1e8c6e9f7..943d09894 100644 --- a/validator/accounts/v2/accounts_create.go +++ b/validator/accounts/v2/accounts_create.go @@ -69,7 +69,7 @@ func CreateAccount(ctx context.Context, cfg *CreateAccountConfig) error { if !ok { return errors.New("not a derived keymanager") } - startNum := km.NextAccountNumber(ctx) + startNum := km.NextAccountNumber() if cfg.NumAccounts == 1 { if _, _, err := km.CreateAccount(ctx); err != nil { return errors.Wrap(err, "could not create account in wallet") diff --git a/validator/accounts/v2/accounts_create_test.go b/validator/accounts/v2/accounts_create_test.go index e61d41a88..4fe8cdaee 100644 --- a/validator/accounts/v2/accounts_create_test.go +++ b/validator/accounts/v2/accounts_create_test.go @@ -72,7 +72,7 @@ type passwordReader struct { } // Instead of forwarding the read request to terminal.ReadPassword(), we simply provide a canned response. -func (p *passwordReader) passwordReaderFunc(file *os.File) ([]byte, error) { +func (p *passwordReader) passwordReaderFunc(_ *os.File) ([]byte, error) { p.counter-- if p.counter <= 0 { log.Fatalln("Too many password attempts using passwordReaderFunc()") diff --git a/validator/accounts/v2/accounts_import.go b/validator/accounts/v2/accounts_import.go index 1c3c2a636..073e25b3f 100644 --- a/validator/accounts/v2/accounts_import.go +++ b/validator/accounts/v2/accounts_import.go @@ -254,7 +254,7 @@ func importPrivateKeyAsAccount(cliCtx *cli.Context, wallet *wallet.Wallet, keyma return nil } -func readKeystoreFile(ctx context.Context, keystoreFilePath string) (*v2keymanager.Keystore, error) { +func readKeystoreFile(_ context.Context, keystoreFilePath string) (*v2keymanager.Keystore, error) { keystoreBytes, err := ioutil.ReadFile(keystoreFilePath) if err != nil { return nil, errors.Wrap(err, "could not read keystore file") diff --git a/validator/accounts/v2/accounts_list.go b/validator/accounts/v2/accounts_list.go index 83af306b0..3ce0f78ae 100644 --- a/validator/accounts/v2/accounts_list.go +++ b/validator/accounts/v2/accounts_list.go @@ -128,7 +128,7 @@ func listDerivedKeymanagerAccounts( if err != nil { return errors.Wrap(err, "could not fetch validating public keys") } - nextAccountNumber := keymanager.NextAccountNumber(ctx) + nextAccountNumber := keymanager.NextAccountNumber() currentAccountNumber := nextAccountNumber if nextAccountNumber > 0 { currentAccountNumber-- diff --git a/validator/accounts/v2/accounts_list_test.go b/validator/accounts/v2/accounts_list_test.go index 58652578a..19e4d73e3 100644 --- a/validator/accounts/v2/accounts_list_test.go +++ b/validator/accounts/v2/accounts_list_test.go @@ -27,7 +27,7 @@ type mockRemoteKeymanager struct { opts *remote.KeymanagerOpts } -func (m *mockRemoteKeymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte, error) { +func (m *mockRemoteKeymanager) FetchValidatingPublicKeys(_ context.Context) ([][48]byte, error) { return m.publicKeys, nil } diff --git a/validator/accounts/v2/prompt/prompt.go b/validator/accounts/v2/prompt/prompt.go index 7ed0825f2..98ed7194a 100644 --- a/validator/accounts/v2/prompt/prompt.go +++ b/validator/accounts/v2/prompt/prompt.go @@ -25,8 +25,6 @@ const ( SelectAccountsDeletePromptText = "Select the account(s) you would like to delete" // SelectAccountsBackupPromptText -- SelectAccountsBackupPromptText = "Select the account(s) you wish to backup" - // SelectAccountsDepositPromptText -- - SelectAccountsDepositPromptText = "Select the validating public keys you wish to submit deposits for" // SelectAccountsVoluntaryExitPromptText -- SelectAccountsVoluntaryExitPromptText = "Select the account(s) on which you wish to perform a voluntary exit" ) @@ -64,23 +62,6 @@ func InputDirectory(cliCtx *cli.Context, promptText string, flag *cli.StringFlag return fileutil.ExpandPath(inputtedDir) } -// InputWeakPassword from the cli. -func InputWeakPassword(cliCtx *cli.Context, passwordFileFlag *cli.StringFlag, promptText string) (string, error) { - if cliCtx.IsSet(passwordFileFlag.Name) { - passwordFilePathInput := cliCtx.String(passwordFileFlag.Name) - passwordFilePath, err := fileutil.ExpandPath(passwordFilePathInput) - if err != nil { - return "", errors.Wrap(err, "could not determine absolute path of password file") - } - return passwordFilePath, nil - } - walletPasswordFilePath, err := promptutil.PasswordPrompt(promptText, promptutil.NotEmpty) - if err != nil { - return "", fmt.Errorf("could not read account password: %v", err) - } - return walletPasswordFilePath, nil -} - // InputRemoteKeymanagerConfig via the cli. func InputRemoteKeymanagerConfig(cliCtx *cli.Context) (*remote.KeymanagerOpts, error) { addr := cliCtx.String(flags.GrpcRemoteAddressFlag.Name) diff --git a/validator/accounts/v2/testing/mock.go b/validator/accounts/v2/testing/mock.go index 87928e841..98b65aec4 100644 --- a/validator/accounts/v2/testing/mock.go +++ b/validator/accounts/v2/testing/mock.go @@ -56,7 +56,7 @@ func (m *Wallet) SetPassword(newPass string) { } // WriteFileAtPath -- -func (m *Wallet) WriteFileAtPath(ctx context.Context, pathName string, fileName string, data []byte) error { +func (m *Wallet) WriteFileAtPath(_ context.Context, pathName, fileName string, data []byte) error { m.lock.Lock() defer m.lock.Unlock() if m.Files[pathName] == nil { @@ -67,7 +67,7 @@ func (m *Wallet) WriteFileAtPath(ctx context.Context, pathName string, fileName } // ReadFileAtPath -- -func (m *Wallet) ReadFileAtPath(ctx context.Context, pathName string, fileName string) ([]byte, error) { +func (m *Wallet) ReadFileAtPath(_ context.Context, pathName, fileName string) ([]byte, error) { m.lock.RLock() defer m.lock.RUnlock() for f, v := range m.Files[pathName] { @@ -79,14 +79,14 @@ func (m *Wallet) ReadFileAtPath(ctx context.Context, pathName string, fileName s } // ReadEncryptedSeedFromDisk -- -func (m *Wallet) ReadEncryptedSeedFromDisk(ctx context.Context) (io.ReadCloser, error) { +func (m *Wallet) ReadEncryptedSeedFromDisk(_ context.Context) (io.ReadCloser, error) { m.lock.Lock() defer m.lock.Unlock() return ioutil.NopCloser(bytes.NewReader(m.EncryptedSeedFile)), nil } // WriteEncryptedSeedToDisk -- -func (m *Wallet) WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) error { +func (m *Wallet) WriteEncryptedSeedToDisk(_ context.Context, encoded []byte) error { m.lock.Lock() defer m.lock.Unlock() m.EncryptedSeedFile = encoded @@ -94,6 +94,6 @@ func (m *Wallet) WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) e } // InitializeKeymanager -- -func (m *Wallet) InitializeKeymanager(ctx context.Context, skipMnemonicConfirm bool) (v2keymanager.IKeymanager, error) { +func (m *Wallet) InitializeKeymanager(_ context.Context, _ bool) (v2keymanager.IKeymanager, error) { return nil, nil } diff --git a/validator/accounts/v2/wallet/wallet.go b/validator/accounts/v2/wallet/wallet.go index 5d298aef1..61729fb34 100644 --- a/validator/accounts/v2/wallet/wallet.go +++ b/validator/accounts/v2/wallet/wallet.go @@ -55,10 +55,6 @@ var ( ErrNoWalletFound = errors.New( "no wallet found at path, please create a new wallet using `./prysm.sh validator wallet-v2 create`", ) - // ErrWalletExists is an error returned when a wallet already exists in the path provided. - ErrWalletExists = errors.New("you already have a wallet at the specified path. You can " + - "edit your wallet configuration by running ./prysm.sh validator wallet-v2 edit-config", - ) // KeymanagerKindSelections as friendly text. KeymanagerKindSelections = map[v2keymanager.Kind]string{ v2keymanager.Derived: "HD Wallet (Recommended)", @@ -216,7 +212,7 @@ func OpenWalletOrElseCli(cliCtx *cli.Context, otherwise func(cliCtx *cli.Context // OpenWallet instantiates a wallet from a specified path. It checks the // type of keymanager associated with the wallet by reading files in the wallet // path, if applicable. If a wallet does not exist, returns an appropriate error. -func OpenWallet(ctx context.Context, cfg *Config) (*Wallet, error) { +func OpenWallet(_ context.Context, cfg *Config) (*Wallet, error) { exists, err := Exists(cfg.WalletDir) if err != nil { return nil, errors.Wrap(err, CheckExistsErrMsg) @@ -350,7 +346,7 @@ func (w *Wallet) InitializeKeymanager( } // WriteFileAtPath within the wallet directory given the desired path, filename, and raw data. -func (w *Wallet) WriteFileAtPath(ctx context.Context, filePath string, fileName string, data []byte) error { +func (w *Wallet) WriteFileAtPath(_ context.Context, filePath, fileName string, data []byte) error { accountPath := filepath.Join(w.accountsPath, filePath) if err := os.MkdirAll(accountPath, os.ModePerm); err != nil { return errors.Wrapf(err, "could not create path: %s", accountPath) @@ -367,7 +363,7 @@ func (w *Wallet) WriteFileAtPath(ctx context.Context, filePath string, fileName } // ReadFileAtPath within the wallet directory given the desired path and filename. -func (w *Wallet) ReadFileAtPath(ctx context.Context, filePath string, fileName string) ([]byte, error) { +func (w *Wallet) ReadFileAtPath(_ context.Context, filePath, fileName string) ([]byte, error) { accountPath := filepath.Join(w.accountsPath, filePath) if err := os.MkdirAll(accountPath, os.ModePerm); err != nil { return nil, errors.Wrapf(err, "could not create path: %s", accountPath) @@ -389,7 +385,7 @@ func (w *Wallet) ReadFileAtPath(ctx context.Context, filePath string, fileName s // FileNameAtPath return the full file name for the requested file. It allows for finding the file // with a regex pattern. -func (w *Wallet) FileNameAtPath(ctx context.Context, filePath string, fileName string) (string, error) { +func (w *Wallet) FileNameAtPath(_ context.Context, filePath, fileName string) (string, error) { accountPath := filepath.Join(w.accountsPath, filePath) if err := os.MkdirAll(accountPath, os.ModePerm); err != nil { return "", errors.Wrapf(err, "could not create path: %s", accountPath) @@ -408,7 +404,7 @@ func (w *Wallet) FileNameAtPath(ctx context.Context, filePath string, fileName s // ReadKeymanagerConfigFromDisk opens a keymanager config file // for reading if it exists at the wallet path. -func (w *Wallet) ReadKeymanagerConfigFromDisk(ctx context.Context) (io.ReadCloser, error) { +func (w *Wallet) ReadKeymanagerConfigFromDisk(_ context.Context) (io.ReadCloser, error) { configFilePath := filepath.Join(w.accountsPath, KeymanagerConfigFileName) if !fileutil.FileExists(configFilePath) { return nil, fmt.Errorf("no keymanager config file found at path: %s", w.accountsPath) @@ -420,7 +416,7 @@ func (w *Wallet) ReadKeymanagerConfigFromDisk(ctx context.Context) (io.ReadClose // LockWalletConfigFile lock read and write to wallet file in order to prevent // two validators from using the same keys. -func (w *Wallet) LockWalletConfigFile(ctx context.Context) error { +func (w *Wallet) LockWalletConfigFile(_ context.Context) error { fileLock := flock.New(w.configFilePath) locked, err := fileLock.TryLock() if err != nil { @@ -444,7 +440,7 @@ func (w *Wallet) UnlockWalletConfigFile() error { // WriteKeymanagerConfigToDisk takes an encoded keymanager config file // and writes it to the wallet path. -func (w *Wallet) WriteKeymanagerConfigToDisk(ctx context.Context, encoded []byte) error { +func (w *Wallet) WriteKeymanagerConfigToDisk(_ context.Context, encoded []byte) error { configFilePath := filepath.Join(w.accountsPath, KeymanagerConfigFileName) // Write the config file to disk. if err := ioutil.WriteFile(configFilePath, encoded, params.BeaconIoConfig().ReadWritePermissions); err != nil { @@ -456,7 +452,7 @@ func (w *Wallet) WriteKeymanagerConfigToDisk(ctx context.Context, encoded []byte // ReadEncryptedSeedFromDisk reads the encrypted wallet seed configuration from // within the wallet path. -func (w *Wallet) ReadEncryptedSeedFromDisk(ctx context.Context) (io.ReadCloser, error) { +func (w *Wallet) ReadEncryptedSeedFromDisk(_ context.Context) (io.ReadCloser, error) { configFilePath := filepath.Join(w.accountsPath, derived.EncryptedSeedFileName) if !fileutil.FileExists(configFilePath) { return nil, fmt.Errorf("no encrypted seed file found at path: %s", w.accountsPath) @@ -466,7 +462,7 @@ func (w *Wallet) ReadEncryptedSeedFromDisk(ctx context.Context) (io.ReadCloser, // WriteEncryptedSeedToDisk writes the encrypted wallet seed configuration // within the wallet path. -func (w *Wallet) WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) error { +func (w *Wallet) WriteEncryptedSeedToDisk(_ context.Context, encoded []byte) error { seedFilePath := filepath.Join(w.accountsPath, derived.EncryptedSeedFileName) // Write the config file to disk. if err := ioutil.WriteFile(seedFilePath, encoded, params.BeaconIoConfig().ReadWritePermissions); err != nil { @@ -477,7 +473,7 @@ func (w *Wallet) WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) e } // SaveHashedPassword to disk for the wallet. -func (w *Wallet) SaveHashedPassword(ctx context.Context) error { +func (w *Wallet) SaveHashedPassword(_ context.Context) error { hashedPassword, err := bcrypt.GenerateFromPassword([]byte(w.walletPassword), hashCost) if err != nil { return errors.Wrap(err, "could not generate hashed password") diff --git a/validator/accounts/v2/wallet_create_test.go b/validator/accounts/v2/wallet_create_test.go index 848d456a4..9475bb495 100644 --- a/validator/accounts/v2/wallet_create_test.go +++ b/validator/accounts/v2/wallet_create_test.go @@ -31,8 +31,6 @@ import ( const ( walletDirName = "wallet" - passwordDirName = "walletpasswords" - exportDirName = "export" passwordFileName = "password.txt" password = "OhWOWthisisatest42!$" mnemonicFileName = "mnemonic.txt" diff --git a/validator/client/mock_validator.go b/validator/client/mock_validator.go index 9689af7f4..4367a7b87 100644 --- a/validator/client/mock_validator.go +++ b/validator/client/mock_validator.go @@ -110,13 +110,13 @@ func (fv *FakeValidator) UpdateDuties(_ context.Context, slot uint64) error { } // UpdateProtections for mocking. -func (fv *FakeValidator) UpdateProtections(_ context.Context, slot uint64) error { +func (fv *FakeValidator) UpdateProtections(_ context.Context, _ uint64) error { fv.UpdateProtectionsCalled = true return nil } // LogValidatorGainsAndLosses for mocking. -func (fv *FakeValidator) LogValidatorGainsAndLosses(_ context.Context, slot uint64) error { +func (fv *FakeValidator) LogValidatorGainsAndLosses(_ context.Context, _ uint64) error { fv.LogValidatorGainsAndLossesCalled = true return nil } @@ -137,19 +137,19 @@ func (fv *FakeValidator) RolesAt(_ context.Context, slot uint64) (map[[48]byte][ } // SubmitAttestation for mocking. -func (fv *FakeValidator) SubmitAttestation(_ context.Context, slot uint64, pubKey [48]byte) { +func (fv *FakeValidator) SubmitAttestation(_ context.Context, slot uint64, _ [48]byte) { fv.AttestToBlockHeadCalled = true fv.AttestToBlockHeadArg1 = slot } // ProposeBlock for mocking. -func (fv *FakeValidator) ProposeBlock(_ context.Context, slot uint64, pubKey [48]byte) { +func (fv *FakeValidator) ProposeBlock(_ context.Context, slot uint64, _ [48]byte) { fv.ProposeBlockCalled = true fv.ProposeBlockArg1 = slot } // SubmitAggregateAndProof for mocking. -func (fv *FakeValidator) SubmitAggregateAndProof(_ context.Context, slot uint64, pubKey [48]byte) {} +func (fv *FakeValidator) SubmitAggregateAndProof(_ context.Context, _ uint64, _ [48]byte) {} // LogAttestationsSubmitted for mocking. func (fv *FakeValidator) LogAttestationsSubmitted() {} @@ -158,21 +158,21 @@ func (fv *FakeValidator) LogAttestationsSubmitted() {} func (fv *FakeValidator) UpdateDomainDataCaches(context.Context, uint64) {} // BalancesByPubkeys for mocking. -func (fv *FakeValidator) BalancesByPubkeys(ctx context.Context) map[[48]byte]uint64 { +func (fv *FakeValidator) BalancesByPubkeys(_ context.Context) map[[48]byte]uint64 { return fv.Balances } // IndicesToPubkeys for mocking. -func (fv *FakeValidator) IndicesToPubkeys(ctx context.Context) map[uint64][48]byte { +func (fv *FakeValidator) IndicesToPubkeys(_ context.Context) map[uint64][48]byte { return fv.IndexToPubkeyMap } // PubkeysToIndices for mocking. -func (fv *FakeValidator) PubkeysToIndices(ctx context.Context) map[[48]byte]uint64 { +func (fv *FakeValidator) PubkeysToIndices(_ context.Context) map[[48]byte]uint64 { return fv.PubkeyToIndexMap } // PubkeysToStatuses for mocking. -func (fv *FakeValidator) PubkeysToStatuses(ctx context.Context) map[[48]byte]ethpb.ValidatorStatus { +func (fv *FakeValidator) PubkeysToStatuses(_ context.Context) map[[48]byte]ethpb.ValidatorStatus { return fv.PubkeysToStatusesMap } diff --git a/validator/client/multiple_endpoints_grpc_resolver.go b/validator/client/multiple_endpoints_grpc_resolver.go index 5f427ece9..46495ae6e 100644 --- a/validator/client/multiple_endpoints_grpc_resolver.go +++ b/validator/client/multiple_endpoints_grpc_resolver.go @@ -14,7 +14,7 @@ import ( // grpc.WithDefaultServiceConfig("{\"loadBalancingConfig\":[{\"round_robin\":{}}]}") type multipleEndpointsGrpcResolverBuilder struct{} -func (*multipleEndpointsGrpcResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { +func (*multipleEndpointsGrpcResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) { r := &multipleEndpointsGrpcResolver{ target: target, cc: cc, @@ -41,6 +41,6 @@ func (r *multipleEndpointsGrpcResolver) start() { r.cc.UpdateState(resolver.State{Addresses: addrs}) } -func (*multipleEndpointsGrpcResolver) ResolveNow(o resolver.ResolveNowOptions) {} +func (*multipleEndpointsGrpcResolver) ResolveNow(_ resolver.ResolveNowOptions) {} func (*multipleEndpointsGrpcResolver) Close() {} diff --git a/validator/keymanager/v1/direct.go b/validator/keymanager/v1/direct.go index dffae8aff..018b591bd 100644 --- a/validator/keymanager/v1/direct.go +++ b/validator/keymanager/v1/direct.go @@ -40,7 +40,7 @@ func (km *Direct) FetchValidatingKeys() ([][48]byte, error) { } // Sign signs a message for the validator to broadcast. -func (km *Direct) Sign(ctx context.Context, pubKey [48]byte, root [32]byte) (bls.Signature, error) { +func (km *Direct) Sign(_ context.Context, pubKey [48]byte, root [32]byte) (bls.Signature, error) { if secretKey, exists := km.secretKeys[pubKey]; exists { return secretKey.Sign(root[:]), nil } diff --git a/validator/keymanager/v1/remote.go b/validator/keymanager/v1/remote.go index 31d39e5fa..566e1c23f 100644 --- a/validator/keymanager/v1/remote.go +++ b/validator/keymanager/v1/remote.go @@ -155,7 +155,7 @@ func (km *Remote) FetchValidatingKeys() ([][48]byte, error) { } // Sign without protection is not supported by remote keymanagers. -func (km *Remote) Sign(ctx context.Context, pubKey [48]byte, root [32]byte) (bls.Signature, error) { +func (km *Remote) Sign(_ context.Context, _ [48]byte, _ [32]byte) (bls.Signature, error) { return nil, errors.New("remote keymanager does not support unprotected signing") } diff --git a/validator/keymanager/v2/derived/backup.go b/validator/keymanager/v2/derived/backup.go index 8ee25569e..372939b19 100644 --- a/validator/keymanager/v2/derived/backup.go +++ b/validator/keymanager/v2/derived/backup.go @@ -16,7 +16,7 @@ import ( // in the function input, encrypts them using the specified password, // and returns their respective EIP-2335 keystores. func (dr *Keymanager) ExtractKeystores( - ctx context.Context, publicKeys []bls.PublicKey, password string, + _ context.Context, publicKeys []bls.PublicKey, password string, ) ([]*v2keymanager.Keystore, error) { encryptor := keystorev4.New() keystores := make([]*v2keymanager.Keystore, len(publicKeys)) diff --git a/validator/keymanager/v2/derived/derived.go b/validator/keymanager/v2/derived/derived.go index 82ed1794d..935f62ee6 100644 --- a/validator/keymanager/v2/derived/derived.go +++ b/validator/keymanager/v2/derived/derived.go @@ -225,7 +225,7 @@ func UnmarshalOptionsFile(r io.ReadCloser) (*KeymanagerOpts, error) { } // MarshalOptionsFile returns a marshaled options file for a keymanager. -func MarshalOptionsFile(ctx context.Context, opts *KeymanagerOpts) ([]byte, error) { +func MarshalOptionsFile(_ context.Context, opts *KeymanagerOpts) ([]byte, error) { return json.MarshalIndent(opts, "", "\t") } @@ -235,7 +235,7 @@ func (dr *Keymanager) KeymanagerOpts() *KeymanagerOpts { } // NextAccountNumber managed by the derived keymanager. -func (dr *Keymanager) NextAccountNumber(ctx context.Context) uint64 { +func (dr *Keymanager) NextAccountNumber() uint64 { return dr.seedCfg.NextAccount } @@ -257,7 +257,7 @@ func (dr *Keymanager) WriteEncryptedSeedToWallet(ctx context.Context, mnemonic s } // ValidatingAccountNames for the derived keymanager. -func (dr *Keymanager) ValidatingAccountNames(ctx context.Context) ([]string, error) { +func (dr *Keymanager) ValidatingAccountNames(_ context.Context) ([]string, error) { lock.RLock() names := make([]string, len(orderedPublicKeys)) for i, pubKey := range orderedPublicKeys { @@ -345,7 +345,7 @@ func (dr *Keymanager) CreateAccount(ctx context.Context) ([]byte, *pb.Deposit_Da } // Sign signs a message using a validator key. -func (dr *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error) { +func (dr *Keymanager) Sign(_ context.Context, req *validatorpb.SignRequest) (bls.Signature, error) { rawPubKey := req.PublicKey if rawPubKey == nil { return nil, errors.New("nil public key in request") @@ -360,7 +360,7 @@ func (dr *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (b } // FetchValidatingPublicKeys fetches the list of validating public keys from the keymanager. -func (dr *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte, error) { +func (dr *Keymanager) FetchValidatingPublicKeys(_ context.Context) ([][48]byte, error) { lock.RLock() keys := orderedPublicKeys result := make([][48]byte, len(keys)) @@ -370,7 +370,7 @@ func (dr *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte } // FetchWithdrawalPublicKeys fetches the list of withdrawal public keys from keymanager -func (dr *Keymanager) FetchWithdrawalPublicKeys(ctx context.Context) ([][48]byte, error) { +func (dr *Keymanager) FetchWithdrawalPublicKeys(_ context.Context) ([][48]byte, error) { publicKeys := make([][48]byte, 0) for i := uint64(0); i < dr.seedCfg.NextAccount; i++ { withdrawalKeyPath := fmt.Sprintf(WithdrawalKeyDerivationPathTemplate, i) diff --git a/validator/keymanager/v2/direct/BUILD.bazel b/validator/keymanager/v2/direct/BUILD.bazel index e13561f75..c493a0387 100644 --- a/validator/keymanager/v2/direct/BUILD.bazel +++ b/validator/keymanager/v2/direct/BUILD.bazel @@ -38,6 +38,7 @@ go_library( "@com_github_schollz_progressbar_v3//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_wealdtech_go_eth2_wallet_encryptor_keystorev4//:go_default_library", + "@io_opencensus_go//trace:go_default_library", ], ) diff --git a/validator/keymanager/v2/direct/backup.go b/validator/keymanager/v2/direct/backup.go index df8233c0e..d9b3b3570 100644 --- a/validator/keymanager/v2/direct/backup.go +++ b/validator/keymanager/v2/direct/backup.go @@ -16,7 +16,7 @@ import ( // in the function input, encrypts them using the specified password, // and returns their respective EIP-2335 keystores. func (dr *Keymanager) ExtractKeystores( - ctx context.Context, publicKeys []bls.PublicKey, password string, + _ context.Context, publicKeys []bls.PublicKey, password string, ) ([]*v2keymanager.Keystore, error) { lock.Lock() defer lock.Unlock() diff --git a/validator/keymanager/v2/direct/direct.go b/validator/keymanager/v2/direct/direct.go index 78ffa8ee2..f48153b6e 100644 --- a/validator/keymanager/v2/direct/direct.go +++ b/validator/keymanager/v2/direct/direct.go @@ -27,6 +27,7 @@ import ( v2keymanager "github.com/prysmaticlabs/prysm/validator/keymanager/v2" "github.com/sirupsen/logrus" keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" + "go.opencensus.io/trace" ) var ( @@ -110,7 +111,7 @@ func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error) { } // NewInteropKeymanager instantiates a new direct keymanager with the deterministically generated interop keys. -func NewInteropKeymanager(ctx context.Context, offset uint64, numValidatorKeys uint64) (*Keymanager, error) { +func NewInteropKeymanager(_ context.Context, offset, numValidatorKeys uint64) (*Keymanager, error) { k := &Keymanager{ accountsChangedFeed: new(event.Feed), } @@ -153,7 +154,7 @@ func UnmarshalOptionsFile(r io.ReadCloser) (*KeymanagerOpts, error) { } // MarshalOptionsFile returns a marshaled options file for a keymanager. -func MarshalOptionsFile(ctx context.Context, opts *KeymanagerOpts) ([]byte, error) { +func MarshalOptionsFile(_ context.Context, opts *KeymanagerOpts) ([]byte, error) { return json.MarshalIndent(opts, "", "\t") } @@ -337,6 +338,9 @@ func (dr *Keymanager) DeleteAccounts(ctx context.Context, publicKeys [][]byte) e // FetchValidatingPublicKeys fetches the list of public keys from the direct account keystores. func (dr *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte, error) { + ctx, span := trace.StartSpan(ctx, "keymanager.FetchValidatingPublicKeys") + defer span.End() + lock.RLock() keys := orderedPublicKeys result := make([][48]byte, len(keys)) @@ -347,6 +351,9 @@ func (dr *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte // Sign signs a message using a validator key. func (dr *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error) { + ctx, span := trace.StartSpan(ctx, "keymanager.Sign") + defer span.End() + publicKey := req.PublicKey if publicKey == nil { return nil, errors.New("nil public key in request") @@ -421,9 +428,8 @@ func (dr *Keymanager) initializeAccountKeystore(ctx context.Context) error { } func (dr *Keymanager) createAccountsKeystore( - ctx context.Context, - privateKeys [][]byte, - publicKeys [][]byte, + _ context.Context, + privateKeys, publicKeys [][]byte, ) (*v2keymanager.Keystore, error) { encryptor := keystorev4.New() id, err := uuid.NewRandom() diff --git a/validator/keymanager/v2/remote/remote.go b/validator/keymanager/v2/remote/remote.go index 2c71b131f..99d4abfd5 100644 --- a/validator/keymanager/v2/remote/remote.go +++ b/validator/keymanager/v2/remote/remote.go @@ -61,7 +61,7 @@ type Keymanager struct { } // NewKeymanager instantiates a new direct keymanager from configuration options. -func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error) { +func NewKeymanager(_ context.Context, cfg *SetupConfig) (*Keymanager, error) { // Load the client certificates. if cfg.Opts.RemoteCertificate == nil { return nil, errors.New("certificates are required") @@ -134,7 +134,7 @@ func UnmarshalOptionsFile(r io.ReadCloser) (*KeymanagerOpts, error) { } // MarshalOptionsFile for the keymanager. -func MarshalOptionsFile(ctx context.Context, cfg *KeymanagerOpts) ([]byte, error) { +func MarshalOptionsFile(_ context.Context, cfg *KeymanagerOpts) ([]byte, error) { return json.MarshalIndent(cfg, "", "\t") } diff --git a/validator/rpc/health_test.go b/validator/rpc/health_test.go index 818548efb..60aaa9bbc 100644 --- a/validator/rpc/health_test.go +++ b/validator/rpc/health_test.go @@ -16,13 +16,13 @@ type mockSyncChecker struct { syncing bool } -func (m *mockSyncChecker) Syncing(ctx context.Context) (bool, error) { +func (m *mockSyncChecker) Syncing(_ context.Context) (bool, error) { return m.syncing, nil } type mockGenesisFetcher struct{} -func (m *mockGenesisFetcher) GenesisInfo(ctx context.Context) (*ethpb.Genesis, error) { +func (m *mockGenesisFetcher) GenesisInfo(_ context.Context) (*ethpb.Genesis, error) { genesis, err := ptypes.TimestampProto(time.Unix(0, 0)) if err != nil { log.Info(err) diff --git a/validator/rpc/wallet.go b/validator/rpc/wallet.go index 3c7098661..48d3014c0 100644 --- a/validator/rpc/wallet.go +++ b/validator/rpc/wallet.go @@ -34,7 +34,7 @@ const ( // HasWallet checks if a user has created a wallet before as well as whether or not // they have used the web UI before to set a wallet password. -func (s *Server) HasWallet(ctx context.Context, _ *ptypes.Empty) (*pb.HasWalletResponse, error) { +func (s *Server) HasWallet(_ context.Context, _ *ptypes.Empty) (*pb.HasWalletResponse, error) { exists, err := wallet.Exists(s.walletDir) if err != nil { return nil, status.Errorf(codes.Internal, "Could not check if wallet exists: %v", err) @@ -168,7 +168,7 @@ func (s *Server) CreateWallet(ctx context.Context, req *pb.CreateWalletRequest) } // EditConfig allows the user to edit their wallet's keymanageropts. -func (s *Server) EditConfig(ctx context.Context, req *pb.EditWalletConfigRequest) (*pb.WalletResponse, error) { +func (s *Server) EditConfig(_ context.Context, _ *pb.EditWalletConfigRequest) (*pb.WalletResponse, error) { return nil, status.Error(codes.Unimplemented, "Unimplemented") } @@ -226,7 +226,7 @@ func (s *Server) WalletConfig(ctx context.Context, _ *ptypes.Empty) (*pb.WalletR } // GenerateMnemonic creates a new, random bip39 mnemonic phrase. -func (s *Server) GenerateMnemonic(ctx context.Context, _ *ptypes.Empty) (*pb.GenerateMnemonicResponse, error) { +func (s *Server) GenerateMnemonic(_ context.Context, _ *ptypes.Empty) (*pb.GenerateMnemonicResponse, error) { mnemonicRandomness := make([]byte, 32) if _, err := rand.NewGenerator().Read(mnemonicRandomness); err != nil { return nil, status.Errorf( diff --git a/validator/testing/protector_mock.go b/validator/testing/protector_mock.go index c029d9894..04a4bb8cc 100644 --- a/validator/testing/protector_mock.go +++ b/validator/testing/protector_mock.go @@ -18,25 +18,25 @@ type MockProtector struct { } // CheckAttestationSafety returns bool with allow attestation value. -func (mp MockProtector) CheckAttestationSafety(ctx context.Context, attestation *eth.IndexedAttestation) bool { +func (mp MockProtector) CheckAttestationSafety(_ context.Context, _ *eth.IndexedAttestation) bool { mp.VerifyAttestationCalled = true return mp.AllowAttestation } // CommitAttestation returns bool with allow attestation value. -func (mp MockProtector) CommitAttestation(ctx context.Context, attestation *eth.IndexedAttestation) bool { +func (mp MockProtector) CommitAttestation(_ context.Context, _ *eth.IndexedAttestation) bool { mp.CommitAttestationCalled = true return mp.AllowAttestation } // CheckBlockSafety returns bool with allow block value. -func (mp MockProtector) CheckBlockSafety(ctx context.Context, blockHeader *eth.BeaconBlockHeader) bool { +func (mp MockProtector) CheckBlockSafety(_ context.Context, _ *eth.BeaconBlockHeader) bool { mp.VerifyBlockCalled = true return mp.AllowBlock } // CommitBlock returns bool with allow block value. -func (mp MockProtector) CommitBlock(ctx context.Context, blockHeader *eth.SignedBeaconBlockHeader) (bool, error) { +func (mp MockProtector) CommitBlock(_ context.Context, _ *eth.SignedBeaconBlockHeader) (bool, error) { mp.CommitBlockCalled = true return mp.AllowBlock, nil } diff --git a/validator/testing/slasher_mock.go b/validator/testing/slasher_mock.go index 45d75026a..184c12aae 100644 --- a/validator/testing/slasher_mock.go +++ b/validator/testing/slasher_mock.go @@ -21,7 +21,7 @@ type MockSlasher struct { } // IsSlashableAttestation returns slashbale attestation if slash attestation is set to true. -func (ms MockSlasher) IsSlashableAttestation(ctx context.Context, in *eth.IndexedAttestation, opts ...grpc.CallOption) (*slashpb.AttesterSlashingResponse, error) { +func (ms MockSlasher) IsSlashableAttestation(_ context.Context, in *eth.IndexedAttestation, _ ...grpc.CallOption) (*slashpb.AttesterSlashingResponse, error) { ms.IsSlashableAttestationCalled = true if ms.SlashAttestation { @@ -43,7 +43,7 @@ func (ms MockSlasher) IsSlashableAttestation(ctx context.Context, in *eth.Indexe } // IsSlashableAttestationNoUpdate returns slashbale if slash attestation is set to true. -func (ms MockSlasher) IsSlashableAttestationNoUpdate(ctx context.Context, in *eth.IndexedAttestation, opts ...grpc.CallOption) (*slashpb.Slashable, error) { +func (ms MockSlasher) IsSlashableAttestationNoUpdate(_ context.Context, _ *eth.IndexedAttestation, _ ...grpc.CallOption) (*slashpb.Slashable, error) { ms.IsSlashableAttestationNoUpdateCalled = true return &slashpb.Slashable{ Slashable: ms.SlashAttestation, @@ -52,7 +52,7 @@ func (ms MockSlasher) IsSlashableAttestationNoUpdate(ctx context.Context, in *et } // IsSlashableBlock returns proposer slashing if slash block is set to true. -func (ms MockSlasher) IsSlashableBlock(ctx context.Context, in *eth.SignedBeaconBlockHeader, opts ...grpc.CallOption) (*slashpb.ProposerSlashingResponse, error) { +func (ms MockSlasher) IsSlashableBlock(_ context.Context, in *eth.SignedBeaconBlockHeader, _ ...grpc.CallOption) (*slashpb.ProposerSlashingResponse, error) { ms.IsSlashableBlockCalled = true if ms.SlashBlock { slashingBlk, ok := proto.Clone(in).(*eth.SignedBeaconBlockHeader) @@ -73,7 +73,7 @@ func (ms MockSlasher) IsSlashableBlock(ctx context.Context, in *eth.SignedBeacon } // IsSlashableBlockNoUpdate returns slashbale if slash block is set to true. -func (ms MockSlasher) IsSlashableBlockNoUpdate(ctx context.Context, in *eth.BeaconBlockHeader, opts ...grpc.CallOption) (*slashpb.Slashable, error) { +func (ms MockSlasher) IsSlashableBlockNoUpdate(_ context.Context, _ *eth.BeaconBlockHeader, _ ...grpc.CallOption) (*slashpb.Slashable, error) { ms.IsSlashableBlockNoUpdateCalled = true return &slashpb.Slashable{ Slashable: ms.SlashBlock,