Update to V4 🚀 (#12134)

* Update V3 from V4

* Fix build v3 -> v4

* Update ssz

* Update beacon_chain.pb.go

* Fix formatter import

* Update update-mockgen.sh comment to v4

* Fix conflicts. Pass build and tests

* Fix test
This commit is contained in:
terencechain
2023-03-17 11:52:56 -07:00
committed by GitHub
parent 7d82a0510f
commit d17996f8b0
2182 changed files with 11206 additions and 11241 deletions

View File

@@ -9,7 +9,7 @@ go_library(
"interface.go",
"signature_batch.go",
],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls",
visibility = ["//visibility:public"],
deps = [
"//crypto/bls/blst:go_default_library",

View File

@@ -4,9 +4,9 @@
package bls
import (
"github.com/prysmaticlabs/prysm/v3/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/herumi"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/herumi"
)
// Initialize herumi temporarily while we transition to blst for ethdo.

View File

@@ -3,8 +3,8 @@ package bls
import (
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestDisallowZeroSecretKeys(t *testing.T) {

View File

@@ -14,7 +14,7 @@ go_library(
"signature.go",
"stub.go", # keep
],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls/blst",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst",
visibility = ["//visibility:public"],
deps = [
"//cache/lru:go_default_library",

View File

@@ -5,9 +5,9 @@ package blst_test
import (
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func BenchmarkSignature_Verify(b *testing.B) {

View File

@@ -6,10 +6,10 @@ import (
"fmt"
"github.com/pkg/errors"
lruwrpr "github.com/prysmaticlabs/prysm/v3/cache/lru"
fieldparams "github.com/prysmaticlabs/prysm/v3/config/fieldparams"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
lruwrpr "github.com/prysmaticlabs/prysm/v4/cache/lru"
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
)
var maxKeys = 1000000

View File

@@ -7,10 +7,10 @@ import (
"errors"
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestPublicKeyFromBytes(t *testing.T) {

View File

@@ -6,9 +6,9 @@ import (
"crypto/subtle"
"fmt"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/crypto/rand"
"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/crypto/rand"
blst "github.com/supranational/blst/bindings/go"
)

View File

@@ -8,11 +8,11 @@ import (
"errors"
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestMarshalUnmarshal(t *testing.T) {

View File

@@ -8,9 +8,9 @@ import (
"sync"
"github.com/pkg/errors"
fieldparams "github.com/prysmaticlabs/prysm/v3/config/fieldparams"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/crypto/rand"
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/crypto/rand"
blst "github.com/supranational/blst/bindings/go"
)

View File

@@ -7,9 +7,9 @@ import (
"errors"
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestSignVerify(t *testing.T) {

View File

@@ -3,7 +3,7 @@
package blst
import (
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
)
// This stub file exists until build issues can be resolved for libfuzz.

View File

@@ -7,7 +7,7 @@ go_library(
"error.go",
"interface.go",
],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls/common",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls/common",
visibility = ["//visibility:public"],
deps = ["//config/fieldparams:go_default_library"],
)

View File

@@ -1,6 +1,6 @@
package common
import fieldparams "github.com/prysmaticlabs/prysm/v3/config/fieldparams"
import fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
// ZeroSecretKey represents a zero secret key.
var ZeroSecretKey = [32]byte{}

View File

@@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["interface_mock.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls/common/mock",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls/common/mock",
visibility = ["//visibility:public"],
deps = [
"//crypto/bls/common:go_default_library",

View File

@@ -8,7 +8,7 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
common "github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
common "github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
)
// MockSecretKey is a mock of SecretKey interface.

View File

@@ -5,7 +5,7 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["init.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls/herumi",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls/herumi",
visibility = [
"//crypto/bls:__pkg__",
],

View File

@@ -1,7 +1,7 @@
package bls
import (
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
)
// PublicKey represents a BLS public key.

View File

@@ -7,9 +7,9 @@ import (
"sort"
"testing"
"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
const TestSignature = "test signature"

View File

@@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["utils.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/ecdsa",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/ecdsa",
visibility = ["//visibility:public"],
deps = [
"@com_github_btcsuite_btcd_btcec_v2//:go_default_library",

View File

@@ -9,8 +9,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
gcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestConvertToInterfacePubkey(t *testing.T) {

View File

@@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["hash.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/hash",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/hash",
visibility = ["//visibility:public"],
deps = [
"//encoding/bytesutil:go_default_library",

View File

@@ -10,7 +10,7 @@ import (
"github.com/minio/highwayhash"
"github.com/minio/sha256-simd"
fastssz "github.com/prysmaticlabs/fastssz"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
"golang.org/x/crypto/sha3"
"google.golang.org/protobuf/proto"
)

View File

@@ -5,13 +5,13 @@ import (
"testing"
fuzz "github.com/google/gofuzz"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
"github.com/prysmaticlabs/prysm/v3/crypto/hash"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
pb "github.com/prysmaticlabs/prysm/v3/proto/testing"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/crypto/hash"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
pb "github.com/prysmaticlabs/prysm/v4/proto/testing"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestHash(t *testing.T) {

View File

@@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["hashtree.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/hash/htr",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/hash/htr",
visibility = ["//visibility:public"],
deps = ["@com_github_prysmaticlabs_gohashtree//:go_default_library"],
)

View File

@@ -8,7 +8,7 @@ go_library(
"keystore.go",
"utils.go",
],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/keystore",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/keystore",
visibility = ["//visibility:public"],
deps = [
"//crypto/bls:go_default_library",

View File

@@ -25,8 +25,8 @@ import (
"path/filepath"
"github.com/pborman/uuid"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
"github.com/prysmaticlabs/prysm/v3/io/file"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/io/file"
)
const (

View File

@@ -7,9 +7,9 @@ import (
"testing"
"github.com/pborman/uuid"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestMarshalAndUnmarshal(t *testing.T) {

View File

@@ -34,7 +34,7 @@ import (
"github.com/minio/sha256-simd"
"github.com/pborman/uuid"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/scrypt"

View File

@@ -7,10 +7,10 @@ import (
"testing"
"github.com/pborman/uuid"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func TestStoreAndGetKey(t *testing.T) {

View File

@@ -25,8 +25,8 @@ import (
"fmt"
"time"
"github.com/prysmaticlabs/prysm/v3/crypto/bls"
prysmTime "github.com/prysmaticlabs/prysm/v3/time"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
prysmTime "github.com/prysmaticlabs/prysm/v4/time"
)
func aesCTRXOR(key, inText, iv []byte) ([]byte, error) {

View File

@@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["rand.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/rand",
importpath = "github.com/prysmaticlabs/prysm/v4/crypto/rand",
visibility = ["//visibility:public"],
)

View File

@@ -7,7 +7,7 @@ This limits the scope of code that needs to be hardened.
There are two modes, one for deterministic and another non-deterministic randomness:
1. If deterministic pseudo-random generator is enough, use:
import "github.com/prysmaticlabs/prysm/v3/crypto/rand"
import "github.com/prysmaticlabs/prysm/v4/crypto/rand"
randGen := rand.NewDeterministicGenerator()
randGen.Intn(32) // or any other func defined in math.rand API
@@ -20,7 +20,7 @@ There are two modes, one for deterministic and another non-deterministic randomn
2. For cryptographically secure non-deterministic mode (CSPRNG), use:
import "github.com/prysmaticlabs/prysm/v3/crypto/rand"
import "github.com/prysmaticlabs/prysm/v4/crypto/rand"
randGen := rand.NewGenerator()
randGen.Intn(32) // or any other func defined in math.rand API