diff --git a/WORKSPACE b/WORKSPACE index 4b93f2281e..c438e330ce 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -255,7 +255,7 @@ filegroup( url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz", ) -consensus_spec_version = "v1.5.0" +consensus_spec_version = "v1.6.0-alpha.0" bls_test_version = "v0.1.1" @@ -271,7 +271,7 @@ filegroup( visibility = ["//visibility:public"], ) """, - integrity = "sha256-cI+DJe3BXlZ0lr28w3USi2lnYOUUfdi/YZ3nJuRiiYU=", + integrity = "sha256-W7oKvoM0nAkyitykRxAw6kmCvjYC01IqiNJy0AmCnMM=", url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version, ) @@ -287,7 +287,7 @@ filegroup( visibility = ["//visibility:public"], ) """, - integrity = "sha256-eBLWqO/RdcqsANmA/rwkJ4kI+LCL+Q0RmIDq6z85lYQ=", + integrity = "sha256-ig7/zxomjv6buBWMom4IxAJh3lFJ9+JnY44E7c8ZNP8=", url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version, ) @@ -303,7 +303,7 @@ filegroup( visibility = ["//visibility:public"], ) """, - integrity = "sha256-ab0H0WTzhSwYJ2a+GHVbUMoNRActJw18EmX3o5hhDi0", + integrity = "sha256-mjx+MkXtPhCNv4c4knLYLIkvIdpF7WTjx/ElvGPQzSo=", url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version, ) @@ -318,7 +318,7 @@ filegroup( visibility = ["//visibility:public"], ) """, - integrity = "sha256-Wy3YcJxoXiKQwrGgJecrtjtdokc4X/VUNBmyQXJf0Oc=", + integrity = "sha256-u0RkIZIeGttb3sInR31mO64aBSwxALqO5SYIPlqEvPo=", strip_prefix = "consensus-specs-" + consensus_spec_version[1:], url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version, ) diff --git a/changelog/tt_uni.md b/changelog/tt_uni.md new file mode 100644 index 0000000000..6b87d9a548 --- /dev/null +++ b/changelog/tt_uni.md @@ -0,0 +1,3 @@ +### Changed + +- Update spec tests to v1.6.0-alpha.0 \ No newline at end of file diff --git a/config/params/loader_test.go b/config/params/loader_test.go index 11adb22b61..3a25c7108f 100644 --- a/config/params/loader_test.go +++ b/config/params/loader_test.go @@ -25,6 +25,7 @@ import ( // IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts. var placeholderFields = []string{ "ATTESTATION_DEADLINE", + "BLOB_SCHEDULE", "BLOB_SIDECAR_SUBNET_COUNT_FULU", "EIP6110_FORK_EPOCH", "EIP6110_FORK_VERSION", diff --git a/testing/spectest/general/phase0/bls/BUILD.bazel b/testing/spectest/general/phase0/bls/BUILD.bazel deleted file mode 100644 index dbeeb5bb6b..0000000000 --- a/testing/spectest/general/phase0/bls/BUILD.bazel +++ /dev/null @@ -1,42 +0,0 @@ -load("@prysm//tools/go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - testonly = True, - srcs = [ - "aggregate_test.yaml.go", - "aggregate_verify_test.yaml.go", - "doc.go", - "fast_aggregate_verify_test.yaml.go", - "sign_test.yaml.go", - "verify_test.yaml.go", - ], - importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/general/phase0/bls", - visibility = ["//visibility:public"], -) - -go_test( - name = "go_default_test", - size = "small", - srcs = [ - "aggregate_test.go", - "aggregate_verify_test.go", - "fast_aggregate_verify_test.go", - "sign_test.go", - "verify_test.go", - ], - data = [ - "@consensus_spec_tests_general//:test_data", - ], - embed = [":go_default_library"], - tags = ["spectest"], - deps = [ - "//crypto/bls:go_default_library", - "//crypto/bls/common:go_default_library", - "//encoding/bytesutil:go_default_library", - "//testing/require:go_default_library", - "//testing/spectest/utils:go_default_library", - "//testing/util:go_default_library", - "@com_github_ghodss_yaml//:go_default_library", - ], -) diff --git a/testing/spectest/general/phase0/bls/aggregate_test.go b/testing/spectest/general/phase0/bls/aggregate_test.go deleted file mode 100644 index d37ef34e10..0000000000 --- a/testing/spectest/general/phase0/bls/aggregate_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package bls - -import ( - "encoding/hex" - "path" - "strings" - "testing" - - "github.com/OffchainLabs/prysm/v6/crypto/bls" - "github.com/OffchainLabs/prysm/v6/crypto/bls/common" - "github.com/OffchainLabs/prysm/v6/testing/require" - "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" - "github.com/OffchainLabs/prysm/v6/testing/util" - "github.com/ghodss/yaml" -) - -func TestAggregate(t *testing.T) { - t.Run("blst", testAggregate) -} - -func testAggregate(t *testing.T) { - testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate/bls") - if len(testFolders) == 0 { - t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate/bls") - } - for _, folder := range testFolders { - t.Run(folder.Name(), func(t *testing.T) { - file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) - require.NoError(t, err) - test := &AggregateTest{} - require.NoError(t, yaml.Unmarshal(file, test)) - var sigs []common.Signature - for _, s := range test.Input { - sigBytes, err := hex.DecodeString(s[2:]) - require.NoError(t, err) - sig, err := bls.SignatureFromBytes(sigBytes) - require.NoError(t, err) - sigs = append(sigs, sig) - } - if len(test.Input) == 0 { - if test.Output != "" { - t.Fatalf("Output Aggregate is not of zero length:Output %s", test.Output) - } - return - } - sig := bls.AggregateSignatures(sigs) - if strings.Contains(folder.Name(), "aggregate_na_pubkeys") { - if sig != nil { - t.Errorf("Expected nil signature, received: %v", sig) - } - return - } - outputBytes, err := hex.DecodeString(test.Output[2:]) - require.NoError(t, err) - require.DeepEqual(t, outputBytes, sig.Marshal()) - }) - } -} diff --git a/testing/spectest/general/phase0/bls/aggregate_test.yaml.go b/testing/spectest/general/phase0/bls/aggregate_test.yaml.go deleted file mode 100644 index ef3ae80e6b..0000000000 --- a/testing/spectest/general/phase0/bls/aggregate_test.yaml.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by yaml_to_go. DO NOT EDIT. -// source: aggregate.yaml - -package bls - -type AggregateTest struct { - Input []string `json:"input"` - Output string `json:"output" ssz:"size=96"` -} diff --git a/testing/spectest/general/phase0/bls/aggregate_verify_test.go b/testing/spectest/general/phase0/bls/aggregate_verify_test.go deleted file mode 100644 index 0681c5aab8..0000000000 --- a/testing/spectest/general/phase0/bls/aggregate_verify_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package bls - -import ( - "encoding/hex" - "errors" - "path" - "testing" - - "github.com/OffchainLabs/prysm/v6/crypto/bls" - "github.com/OffchainLabs/prysm/v6/crypto/bls/common" - "github.com/OffchainLabs/prysm/v6/encoding/bytesutil" - "github.com/OffchainLabs/prysm/v6/testing/require" - "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" - "github.com/OffchainLabs/prysm/v6/testing/util" - "github.com/ghodss/yaml" -) - -func TestAggregateVerify(t *testing.T) { - t.Run("blst", testAggregateVerify) -} - -func testAggregateVerify(t *testing.T) { - testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate_verify/bls") - if len(testFolders) == 0 { - t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate_verify/bls") - } - for i, folder := range testFolders { - t.Run(folder.Name(), func(t *testing.T) { - file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) - require.NoError(t, err) - test := &AggregateVerifyTest{} - require.NoError(t, yaml.Unmarshal(file, test)) - pubkeys := make([]common.PublicKey, 0, len(test.Input.Pubkeys)) - msgs := make([][32]byte, 0, len(test.Input.Messages)) - for _, pubKey := range test.Input.Pubkeys { - pkBytes, err := hex.DecodeString(pubKey[2:]) - require.NoError(t, err) - pk, err := bls.PublicKeyFromBytes(pkBytes) - if err != nil { - if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) { - return - } - t.Fatalf("cannot unmarshal pubkey: %v", err) - } - pubkeys = append(pubkeys, pk) - } - for _, msg := range test.Input.Messages { - msgBytes, err := hex.DecodeString(msg[2:]) - require.NoError(t, err) - require.Equal(t, 32, len(msgBytes)) - msgs = append(msgs, bytesutil.ToBytes32(msgBytes)) - } - sigBytes, err := hex.DecodeString(test.Input.Signature[2:]) - require.NoError(t, err) - sig, err := bls.SignatureFromBytes(sigBytes) - if err != nil { - if test.Output == false { - return - } - t.Fatalf("Cannot unmarshal input to signature: %v", err) - } - - verified := sig.AggregateVerify(pubkeys, msgs) - if verified != test.Output { - t.Fatalf("Signature does not match the expected verification output. "+ - "Expected %#v but received %#v for test case %d", test.Output, verified, i) - } - }) - } -} diff --git a/testing/spectest/general/phase0/bls/aggregate_verify_test.yaml.go b/testing/spectest/general/phase0/bls/aggregate_verify_test.yaml.go deleted file mode 100644 index 0c5b0f754f..0000000000 --- a/testing/spectest/general/phase0/bls/aggregate_verify_test.yaml.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by yaml_to_go. DO NOT EDIT. -// source: aggregate_verify.yaml - -package bls - -type AggregateVerifyTest struct { - Input struct { - Pubkeys []string `json:"pubkeys"` - Messages []string `json:"messages"` - Signature string `json:"signature"` - } `json:"input"` - Output bool `json:"output"` -} diff --git a/testing/spectest/general/phase0/bls/doc.go b/testing/spectest/general/phase0/bls/doc.go deleted file mode 100644 index edf459432c..0000000000 --- a/testing/spectest/general/phase0/bls/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package bls includes tests to ensure conformity with the Ethereum BLS cryptography specification. -// See https://github.com/ethereum/consensus-spec-tests/tree/master/tests/general/phase0/bls for details. -package bls diff --git a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go b/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go deleted file mode 100644 index 41f9e0c140..0000000000 --- a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package bls - -import ( - "encoding/hex" - "errors" - "path" - "testing" - - "github.com/OffchainLabs/prysm/v6/crypto/bls" - "github.com/OffchainLabs/prysm/v6/crypto/bls/common" - "github.com/OffchainLabs/prysm/v6/encoding/bytesutil" - "github.com/OffchainLabs/prysm/v6/testing/require" - "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" - "github.com/OffchainLabs/prysm/v6/testing/util" - "github.com/ghodss/yaml" -) - -func TestFastAggregateVerify(t *testing.T) { - t.Run("blst", testFastAggregateVerify) -} - -func testFastAggregateVerify(t *testing.T) { - testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/fast_aggregate_verify/bls") - if len(testFolders) == 0 { - t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/fast_aggregate_verify/bls") - } - for i, folder := range testFolders { - t.Run(folder.Name(), func(t *testing.T) { - file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) - require.NoError(t, err) - test := &FastAggregateVerifyTest{} - require.NoError(t, yaml.Unmarshal(file, test)) - - pubkeys := make([]common.PublicKey, len(test.Input.Pubkeys)) - for j, raw := range test.Input.Pubkeys { - pkBytes, err := hex.DecodeString(raw[2:]) - require.NoError(t, err) - pk, err := bls.PublicKeyFromBytes(pkBytes) - if err != nil { - if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) { - return - } - t.Fatalf("cannot unmarshal pubkey: %v", err) - } - pubkeys[j] = pk - } - - msg := test.Input.Message - // TODO(#7632): Remove when https://github.com/ethereum/consensus-spec-tests/issues/22 is resolved. - if msg == "" { - msg = test.Input.Messages - } - msgBytes, err := hex.DecodeString(msg[2:]) - require.NoError(t, err) - sigBytes, err := hex.DecodeString(test.Input.Signature[2:]) - require.NoError(t, err) - sig, err := bls.SignatureFromBytes(sigBytes) - if err != nil { - if test.Output == false { - return - } - t.Fatalf("Cannot unmarshal input to signature: %v", err) - } - - verified := sig.FastAggregateVerify(pubkeys, bytesutil.ToBytes32(msgBytes)) - if verified != test.Output { - t.Fatalf("Signature does not match the expected verification output. "+ - "Expected %#v but received %#v for test case %d", test.Output, verified, i) - } - t.Log("Success") - }) - } -} diff --git a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.yaml.go b/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.yaml.go deleted file mode 100644 index 38e959449f..0000000000 --- a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.yaml.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by yaml_to_go. DO NOT EDIT. -// source: fast_aggregate_verify.yaml - -package bls - -type FastAggregateVerifyTest struct { - Input struct { - Pubkeys []string `json:"pubkeys"` - Message string `json:"message"` - // TODO(#7632): Remove when https://github.com/ethereum/consensus-spec-tests/issues/22 is resolved. - Messages string `json:"messages"` - Signature string `json:"signature"` - } `json:"input"` - Output bool `json:"output"` -} diff --git a/testing/spectest/general/phase0/bls/sign_test.go b/testing/spectest/general/phase0/bls/sign_test.go deleted file mode 100644 index a17cd6f074..0000000000 --- a/testing/spectest/general/phase0/bls/sign_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package bls - -import ( - "bytes" - "encoding/hex" - "errors" - "path" - "testing" - - "github.com/OffchainLabs/prysm/v6/crypto/bls" - "github.com/OffchainLabs/prysm/v6/crypto/bls/common" - "github.com/OffchainLabs/prysm/v6/testing/require" - "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" - "github.com/OffchainLabs/prysm/v6/testing/util" - "github.com/ghodss/yaml" -) - -func TestSign(t *testing.T) { - t.Run("blst", testSign) -} - -func testSign(t *testing.T) { - testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/sign/bls") - if len(testFolders) == 0 { - t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/sign/bls") - } - for i, folder := range testFolders { - t.Run(folder.Name(), func(t *testing.T) { - file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) - require.NoError(t, err) - test := &SignMsgTest{} - require.NoError(t, yaml.Unmarshal(file, test)) - pkBytes, err := hex.DecodeString(test.Input.Privkey[2:]) - require.NoError(t, err) - sk, err := bls.SecretKeyFromBytes(pkBytes) - if err != nil { - if test.Output == "" && - (errors.Is(err, common.ErrZeroKey) || errors.Is(err, common.ErrSecretUnmarshal)) { - return - } - t.Fatalf("cannot unmarshal secret key: %v", err) - } - msgBytes, err := hex.DecodeString(test.Input.Message[2:]) - require.NoError(t, err) - sig := sk.Sign(msgBytes) - - if !sig.Verify(sk.PublicKey(), msgBytes) { - t.Fatal("could not verify signature") - } - - outputBytes, err := hex.DecodeString(test.Output[2:]) - require.NoError(t, err) - - if !bytes.Equal(outputBytes, sig.Marshal()) { - t.Fatalf("Test Case %d: Signature does not match the expected output. "+ - "Expected %#x but received %#x", i, outputBytes, sig.Marshal()) - } - t.Log("Success") - }) - } -} diff --git a/testing/spectest/general/phase0/bls/sign_test.yaml.go b/testing/spectest/general/phase0/bls/sign_test.yaml.go deleted file mode 100644 index d8d932f867..0000000000 --- a/testing/spectest/general/phase0/bls/sign_test.yaml.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by yaml_to_go. DO NOT EDIT. -// source: sign_msg.yaml - -package bls - -type SignMsgTest struct { - Input struct { - Privkey string `json:"privkey"` - Message string `json:"message"` - } `json:"input"` - Output string `json:"output"` -} diff --git a/testing/spectest/general/phase0/bls/verify_test.go b/testing/spectest/general/phase0/bls/verify_test.go deleted file mode 100644 index 50c22a3b4d..0000000000 --- a/testing/spectest/general/phase0/bls/verify_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package bls - -import ( - "encoding/hex" - "errors" - "path" - "testing" - - "github.com/OffchainLabs/prysm/v6/crypto/bls" - "github.com/OffchainLabs/prysm/v6/crypto/bls/common" - "github.com/OffchainLabs/prysm/v6/testing/require" - "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" - "github.com/OffchainLabs/prysm/v6/testing/util" - "github.com/ghodss/yaml" -) - -func TestVerify(t *testing.T) { - t.Run("blst", testVerify) -} - -func testVerify(t *testing.T) { - testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/verify/bls") - if len(testFolders) == 0 { - t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/verify/bls") - } - for i, folder := range testFolders { - t.Run(folder.Name(), func(t *testing.T) { - file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) - require.NoError(t, err) - test := &VerifyMsgTest{} - require.NoError(t, yaml.Unmarshal(file, test)) - - pkBytes, err := hex.DecodeString(test.Input.Pubkey[2:]) - require.NoError(t, err) - pk, err := bls.PublicKeyFromBytes(pkBytes) - if err != nil { - if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) { - return - } - t.Fatalf("cannot unmarshal pubkey: %v", err) - } - msgBytes, err := hex.DecodeString(test.Input.Message[2:]) - require.NoError(t, err) - - sigBytes, err := hex.DecodeString(test.Input.Signature[2:]) - require.NoError(t, err) - sig, err := bls.SignatureFromBytes(sigBytes) - if err != nil { - if test.Output == false { - return - } - t.Fatalf("Cannot unmarshal input to signature: %v", err) - } - - verified := sig.Verify(pk, msgBytes) - if verified != test.Output { - t.Fatalf("Signature does not match the expected verification output. "+ - "Expected %#v but received %#v for test case %d", test.Output, verified, i) - } - t.Log("Success") - }) - } -} diff --git a/testing/spectest/general/phase0/bls/verify_test.yaml.go b/testing/spectest/general/phase0/bls/verify_test.yaml.go deleted file mode 100644 index 0a317384fe..0000000000 --- a/testing/spectest/general/phase0/bls/verify_test.yaml.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by yaml_to_go. DO NOT EDIT. -// source: verify.yaml - -package bls - -type VerifyMsgTest struct { - Input struct { - Pubkey string `json:"pubkey"` - Message string `json:"message"` - Signature string `json:"signature"` - } `json:"input"` - Output bool `json:"output"` -}