Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to go 1.14 #4947

Merged
merged 93 commits into from
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
85a9fad
Update to go 1.14
prestonvanloon Feb 26, 2020
9c6e9bd
Update with fix from https://github.com/bazelbuild/rules_go/pull/2388
prestonvanloon Feb 26, 2020
88616dd
Merge branch 'master' into go-1.14
prestonvanloon Feb 26, 2020
958b92e
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 26, 2020
654922a
Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14
prestonvanloon Feb 26, 2020
72a41c3
Update gRPC
prestonvanloon Feb 26, 2020
0430766
Merge branch 'go-1.14' of github.com:prysmaticlabs/prysm into go-1.14
prestonvanloon Feb 26, 2020
171af45
Update golang.org/x/crypto
prestonvanloon Feb 26, 2020
3830e1a
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
5f923fc
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
061d29d
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
bdeca61
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
75b674c
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
2b06666
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 27, 2020
b86e39a
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 28, 2020
a6c8b0b
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Feb 28, 2020
f3f805f
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 1, 2020
4974563
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
f10dad3
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
813ca38
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
07b887b
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
aa90a20
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
5a0c2dc
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
ff16da2
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 2, 2020
e489400
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
a7163a5
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
e28aaa5
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
b49af6c
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
49daf17
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
364758d
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
5ae56c2
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
76bf55f
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
6710641
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
6373c3a
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
a3af0ef
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 3, 2020
c4b1ae2
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
42cb320
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
acfdb5d
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
192b5ca
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
ed198fd
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
494c0fe
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
d998881
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 4, 2020
e0d39e2
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
5e47083
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
164fc40
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
1498e72
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
92db943
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
8430949
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
29466d5
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
c1d3994
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
5b5b7cd
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 5, 2020
e03d99a
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
1a45c30
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
02ad2dc
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
6c15627
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
3b04368
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
8ec0d43
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
99bcd43
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 6, 2020
36598aa
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 7, 2020
b1f11dc
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 7, 2020
38ad31b
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 7, 2020
6ec9224
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 7, 2020
aebc226
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 7, 2020
2f30880
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
83b65dc
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
13312a1
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
3faba70
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
c78962f
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
d007179
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
481e244
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 8, 2020
c22e09e
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
6d8fb9c
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
759b168
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
d5b5a8d
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
77c8649
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
d51f6f6
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
8ddf80f
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 9, 2020
61454b9
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 10, 2020
d799c90
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 10, 2020
1f94e68
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 10, 2020
ae56840
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 10, 2020
624e201
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 10, 2020
7f2ba4c
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 11, 2020
862928f
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 11, 2020
b9817e0
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 11, 2020
b4f042e
Committing gc_goopts for issue repro
prestonvanloon Mar 11, 2020
4bc9550
Fix race and msan builds
prestonvanloon Mar 13, 2020
1431d13
Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14
prestonvanloon Mar 13, 2020
2f2962b
Merge refs/heads/master into go-1.14
prylabs-bulldozer[bot] Mar 13, 2020
ed128e8
switch to LRU
prestonvanloon Mar 13, 2020
29e16c0
Merge branch 'go-1.14' of github.com:prysmaticlabs/prysm into go-1.14
prestonvanloon Mar 13, 2020
a293f56
Fixed, but dont feel good about this
terencechain Mar 13, 2020
8778096
Switch append ordering
terencechain Mar 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ http_archive(

http_archive(
name = "bazel_gazelle",
sha256 = "86c6d481b3f7aedc1d60c1c211c6f76da282ae197c3b3160f54bd3a8f847896f",
sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.1/bazel-gazelle-v0.19.1.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.1/bazel-gazelle-v0.19.1.tar.gz",
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
],
)

Expand All @@ -75,10 +75,10 @@ http_archive(

http_archive(
name = "io_bazel_rules_go",
sha256 = "e88471aea3a3a4f19ec1310a55ba94772d087e9ce46e41ae38ecebe17935de7b",
sha256 = "e6a6c016b0663e06fa5fccf1cd8152eab8aa8180c583ec20c872f4f9953a7ac5",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.20.3/rules_go-v0.20.3.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.20.3/rules_go-v0.20.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
],
)

Expand Down Expand Up @@ -628,8 +628,9 @@ go_repository(

go_repository(
name = "org_golang_x_crypto",
commit = "4def268fd1a49955bfb3dda92fe3db4f924f2285",
importpath = "golang.org/x/crypto",
sum = "h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=",
version = "v0.0.0-20200221231518-2aa609cf4a9d",
)

go_repository(
Expand Down Expand Up @@ -755,10 +756,12 @@ go_repository(
importpath = "github.com/matttproud/golang_protobuf_extensions",
)

go_repository(
name = "com_github_boltdb_bolt",
commit = "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8", # v1.3.1
importpath = "github.com/boltdb/bolt",
http_archive(
name = "com_github_boltdb_bolt", # v1.3.1
build_file = "//third_party:boltdb/bolt.BUILD",
sha256 = "95dc5842dab55f7519b7002bbec648321277b5d6f0ad59aab509ee59313b6386",
strip_prefix = "bolt-2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8",
urls = ["https://github.com/boltdb/bolt/archive/2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8.tar.gz"],
)

go_repository(
Expand Down Expand Up @@ -1200,8 +1203,9 @@ go_ssz_dependencies()
go_repository(
name = "org_golang_google_grpc",
build_file_proto_mode = "disable",
commit = "1d89a3c832915b2314551c1d2a506874d62e53f7", # v1.22.0
importpath = "google.golang.org/grpc",
sum = "h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=",
version = "v1.27.1",
)

go_repository(
Expand Down
7 changes: 7 additions & 0 deletions beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ go_test(
"service_norace_test.go",
],
embed = [":go_default_library"],
gc_goopts = [
# Go 1.14 enables checkptr by default when building with -race or -msan. There is a pointer
# issue in boltdb, so must disable checkptr at compile time. This flag can be removed once
# the project is migrated to etcd's version of boltdb and the issue has been fixed.
# See: https://github.com/etcd-io/bbolt/issues/187.
"-d=checkptr=0",
],
race = "on",
tags = ["race_on"],
deps = [
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/operations/attestations/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ go_library(
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"//shared/roughtime:go_default_library",
"@com_github_dgraph_io_ristretto//:go_default_library",
"@com_github_hashicorp_golang_lru//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
Expand Down
7 changes: 4 additions & 3 deletions beacon-chain/operations/attestations/prepare_forkchoice.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package attestations

import (
"bytes"
"context"
"errors"
"time"
Expand Down Expand Up @@ -108,22 +109,22 @@ func (s *Service) seen(att *ethpb.Attestation) (bool, error) {
return false, err
}
incomingBits := att.AggregationBits
savedBits, ok := s.forkChoiceProcessedRoots.Get(string(attRoot[:]))
savedBits, ok := s.forkChoiceProcessedRoots.Get(attRoot)
if ok {
savedBitlist, ok := savedBits.(bitfield.Bitlist)
if !ok {
return false, errors.New("not a bit field")
}
if savedBitlist.Len() == incomingBits.Len() {
// Returns true if the node has seen all the bits in the new bit field of the incoming attestation.
if savedBitlist.Contains(incomingBits) {
if bytes.Equal(savedBitlist, incomingBits) || savedBitlist.Contains(incomingBits) {
return true, nil
}
// Update the bit fields by Or'ing them with the new ones.
incomingBits = incomingBits.Or(savedBitlist)
}
}

s.forkChoiceProcessedRoots.Set(string(attRoot[:]), incomingBits, 1 /*cost*/)
s.forkChoiceProcessedRoots.Add(attRoot, incomingBits)
return false, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"reflect"
"sort"
"testing"
"time"

"github.com/gogo/protobuf/proto"
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
Expand Down Expand Up @@ -172,7 +171,7 @@ func TestBatchAttestations_Single(t *testing.T) {
t.Fatal(err)
}

wanted, err := helpers.AggregateAttestations(append(unaggregatedAtts, aggregatedAtts...))
wanted, err := helpers.AggregateAttestations(append(aggregatedAtts, unaggregatedAtts...))
if err != nil {
t.Fatal(err)
}
Expand All @@ -182,7 +181,8 @@ func TestBatchAttestations_Single(t *testing.T) {
t.Fatal(err)
}

if !reflect.DeepEqual(wanted, s.pool.ForkchoiceAttestations()) {
got := s.pool.ForkchoiceAttestations()
if !reflect.DeepEqual(wanted, got) {
t.Error("Did not aggregate and save for batch")
}
}
Expand Down Expand Up @@ -296,8 +296,6 @@ func TestSeenAttestations_PresentInCache(t *testing.T) {
t.Error("Wanted false, got true")
}

time.Sleep(100 * time.Millisecond)

att2 := &ethpb.Attestation{Data: &ethpb.AttestationData{}, Signature: []byte{'A'}, AggregationBits: bitfield.Bitlist{0x17} /* 0b00010111 */}
got, err = s.seen(att2)
if err != nil {
Expand All @@ -307,8 +305,6 @@ func TestSeenAttestations_PresentInCache(t *testing.T) {
t.Error("Wanted false, got true")
}

time.Sleep(100 * time.Millisecond)

att3 := &ethpb.Attestation{Data: &ethpb.AttestationData{}, Signature: []byte{'A'}, AggregationBits: bitfield.Bitlist{0x17} /* 0b00010111 */}
got, err = s.seen(att3)
if err != nil {
Expand Down Expand Up @@ -382,6 +378,5 @@ func TestService_seen(t *testing.T) {
if got != tt.want {
t.Errorf("Test %d failed. Got=%v want=%v", i, got, tt.want)
}
time.Sleep(10) // Sleep briefly for cache to routine to buffer.
}
}
22 changes: 9 additions & 13 deletions beacon-chain/operations/attestations/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package attestations
import (
"context"

"github.com/dgraph-io/ristretto"
lru "github.com/hashicorp/golang-lru"
)

var forkChoiceProcessedRootsSize = int64(1 << 16)
var forkChoiceProcessedRootsSize = 1 << 16

// Service of attestation pool operations.
type Service struct {
ctx context.Context
cancel context.CancelFunc
pool Pool
err error
forkChoiceProcessedRoots *ristretto.Cache
genesisTime uint64
ctx context.Context
cancel context.CancelFunc
pool Pool
err error
forkChoiceProcessedRoots *lru.Cache
genesisTime uint64
}

// Config options for the service.
Expand All @@ -26,11 +26,7 @@ type Config struct {
// NewService instantiates a new attestation pool service instance that will
// be registered into a running beacon node.
func NewService(ctx context.Context, cfg *Config) (*Service, error) {
cache, err := ristretto.NewCache(&ristretto.Config{
NumCounters: forkChoiceProcessedRootsSize,
MaxCost: forkChoiceProcessedRootsSize,
BufferItems: 64,
})
cache, err := lru.New(forkChoiceProcessedRootsSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok to bundle this change in the same PR, perhaps just mention it in the description?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes good idea

if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion proto/beacon/p2p/v1/messages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion proto/beacon/rpc/v1/services.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions proto/beacon/rpc/v1_gateway/services.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions proto/cluster/services.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions third_party/boltdb/bolt.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

# Bolt DB is an archived project which is no longer maintained. As of go 1.14,
# the go compiler adds checkptr to all builds when using -race or -msan. Since
# bolt DB violates this check, we must disable checkptr for this library.
#
# See: https://golang.org/doc/go1.14
# See: https://github.com/etcd-io/bbolt/issues/187

go_library(
name = "go_default_library",
srcs = [
"bolt_386.go",
"bolt_amd64.go",
"bolt_arm.go",
"bolt_arm64.go",
"bolt_linux.go",
"bolt_openbsd.go",
"bolt_ppc64.go",
"bolt_ppc64le.go",
"bolt_s390x.go",
"bolt_unix.go",
"bolt_unix_solaris.go",
"bolt_windows.go",
"boltsync_unix.go",
"bucket.go",
"cursor.go",
"db.go",
"doc.go",
"errors.go",
"freelist.go",
"node.go",
"page.go",
"tx.go",
],
gc_goopts = ["-d=checkptr=0"], # Required due to unsafe pointer usage.
importpath = "github.com/boltdb/bolt",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:solaris": [
"@org_golang_x_sys//unix:go_default_library",
],
"//conditions:default": [],
}),
)

go_test(
name = "go_default_test",
srcs = [
"bucket_test.go",
"cursor_test.go",
"db_test.go",
"freelist_test.go",
"node_test.go",
"page_test.go",
"quick_test.go",
"simulation_test.go",
"tx_test.go",
],
embed = [":go_default_library"],
)