mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Remove Eth2-Types Dependency in Prysm (#10578)
* replace eth2 types * replace protos * regen proto * replace * gaz * deps * amend * regen proto * mod * gaz * gaz * ensure build * ssz * add dep * no more eth2 types * no more eth2 * remg * all builds * buidl * tidy * clean * fmt * val serv * gaz Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
@@ -34,6 +34,5 @@ go_test(
|
||||
deps = [
|
||||
"//math:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -6,7 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
||||
mathprysm "github.com/prysmaticlabs/prysm/math"
|
||||
)
|
||||
|
||||
func TestSlot_Casting(t *testing.T) {
|
||||
@@ -48,11 +49,11 @@ func TestSlot_Mul(t *testing.T) {
|
||||
{a: 1 << 32, b: 1, res: 1 << 32},
|
||||
{a: 1 << 32, b: 100, res: 429496729600},
|
||||
{a: 1 << 32, b: 1 << 31, res: 9223372036854775808},
|
||||
{a: 1 << 32, b: 1 << 32, res: 0, panicMsg: types.ErrMulOverflow.Error()},
|
||||
{a: 1 << 32, b: 1 << 32, res: 0, panicMsg: mathprysm.ErrMulOverflow.Error()},
|
||||
{a: 1 << 62, b: 2, res: 9223372036854775808},
|
||||
{a: 1 << 62, b: 4, res: 0, panicMsg: types.ErrMulOverflow.Error()},
|
||||
{a: 1 << 62, b: 4, res: 0, panicMsg: mathprysm.ErrMulOverflow.Error()},
|
||||
{a: 1 << 63, b: 1, res: 9223372036854775808},
|
||||
{a: 1 << 63, b: 2, res: 0, panicMsg: types.ErrMulOverflow.Error()},
|
||||
{a: 1 << 63, b: 2, res: 0, panicMsg: mathprysm.ErrMulOverflow.Error()},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -102,7 +103,7 @@ func TestSlot_Div(t *testing.T) {
|
||||
panicMsg string
|
||||
}{
|
||||
{a: 0, b: 1, res: 0},
|
||||
{a: 1, b: 0, res: 0, panicMsg: types.ErrDivByZero.Error()},
|
||||
{a: 1, b: 0, res: 0, panicMsg: mathprysm.ErrDivByZero.Error()},
|
||||
{a: 1 << 32, b: 1 << 32, res: 1},
|
||||
{a: 429496729600, b: 1 << 32, res: 100},
|
||||
{a: 9223372036854775808, b: 1 << 32, res: 1 << 31},
|
||||
@@ -161,9 +162,9 @@ func TestSlot_Add(t *testing.T) {
|
||||
{a: 1 << 32, b: 1, res: 4294967297},
|
||||
{a: 1 << 32, b: 100, res: 4294967396},
|
||||
{a: 1 << 31, b: 1 << 31, res: 4294967296},
|
||||
{a: 1 << 63, b: 1 << 63, res: 0, panicMsg: types.ErrAddOverflow.Error()},
|
||||
{a: 1 << 63, b: 1 << 63, res: 0, panicMsg: mathprysm.ErrAddOverflow.Error()},
|
||||
{a: 1 << 63, b: 1, res: 9223372036854775809},
|
||||
{a: math.MaxUint64, b: 1, res: 0, panicMsg: types.ErrAddOverflow.Error()},
|
||||
{a: math.MaxUint64, b: 1, res: 0, panicMsg: mathprysm.ErrAddOverflow.Error()},
|
||||
{a: math.MaxUint64, b: 0, res: math.MaxUint64},
|
||||
{a: 1 << 63, b: 2, res: 9223372036854775810},
|
||||
}
|
||||
@@ -215,14 +216,14 @@ func TestSlot_Sub(t *testing.T) {
|
||||
panicMsg string
|
||||
}{
|
||||
{a: 1, b: 0, res: 1},
|
||||
{a: 0, b: 1, res: 0, panicMsg: types.ErrSubUnderflow.Error()},
|
||||
{a: 0, b: 1, res: 0, panicMsg: mathprysm.ErrSubUnderflow.Error()},
|
||||
{a: 1 << 32, b: 1, res: 4294967295},
|
||||
{a: 1 << 32, b: 100, res: 4294967196},
|
||||
{a: 1 << 31, b: 1 << 31, res: 0},
|
||||
{a: 1 << 63, b: 1 << 63, res: 0},
|
||||
{a: 1 << 63, b: 1, res: 9223372036854775807},
|
||||
{a: math.MaxUint64, b: math.MaxUint64, res: 0},
|
||||
{a: math.MaxUint64 - 1, b: math.MaxUint64, res: 0, panicMsg: types.ErrSubUnderflow.Error()},
|
||||
{a: math.MaxUint64 - 1, b: math.MaxUint64, res: 0, panicMsg: mathprysm.ErrSubUnderflow.Error()},
|
||||
{a: math.MaxUint64, b: 0, res: math.MaxUint64},
|
||||
{a: 1 << 63, b: 2, res: 9223372036854775806},
|
||||
}
|
||||
@@ -273,7 +274,7 @@ func TestSlot_Mod(t *testing.T) {
|
||||
res types.Slot
|
||||
panicMsg string
|
||||
}{
|
||||
{a: 1, b: 0, res: 0, panicMsg: types.ErrDivByZero.Error()},
|
||||
{a: 1, b: 0, res: 0, panicMsg: mathprysm.ErrDivByZero.Error()},
|
||||
{a: 0, b: 1, res: 0},
|
||||
{a: 1 << 32, b: 1 << 32, res: 0},
|
||||
{a: 429496729600, b: 1 << 32, res: 0},
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
||||
)
|
||||
|
||||
func TestSSZBytes_HashTreeRoot(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
||||
)
|
||||
|
||||
func TestSSZUint64_Limit(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user