diff --git a/app/app.go b/app/app.go index 6ea2c66a3..dfcdf4eac 100644 --- a/app/app.go +++ b/app/app.go @@ -850,13 +850,11 @@ func newETH2Client(ctx context.Context, conf Config, life *lifecycle.Manager, return nil, errors.New("beacon node endpoints empty") } - eth2Cl, err := eth2wrap.NewMultiHTTP(eth2ClientTimeout, conf.BeaconNodeAddrs...) + eth2Cl, err := eth2wrap.NewMultiHTTP(eth2ClientTimeout, [4]byte(forkVersion), conf.BeaconNodeAddrs...) if err != nil { return nil, errors.Wrap(err, "new eth2 http client") } - eth2Cl.SetForkVersion([4]byte(forkVersion)) - if conf.SyntheticBlockProposals { log.Info(ctx, "Synthetic block proposals enabled") eth2Cl = eth2wrap.WithSyntheticDuties(eth2Cl) diff --git a/app/eth2wrap/eth2wrap.go b/app/eth2wrap/eth2wrap.go index d9980670e..eaee5ffd1 100644 --- a/app/eth2wrap/eth2wrap.go +++ b/app/eth2wrap/eth2wrap.go @@ -70,7 +70,7 @@ func WithSyntheticDuties(cl Client) Client { } // NewMultiHTTP returns a new instrumented multi eth2 http client. -func NewMultiHTTP(timeout time.Duration, addresses ...string) (Client, error) { +func NewMultiHTTP(timeout time.Duration, forkVersion [4]byte, addresses ...string) (Client, error) { var clients []Client for _, address := range addresses { address := address // Capture range variable. @@ -93,7 +93,10 @@ func NewMultiHTTP(timeout time.Duration, addresses ...string) (Client, error) { return nil, errors.New("invalid eth2 http service") } - return AdaptEth2HTTP(eth2Http, timeout), nil + adaptedCl := AdaptEth2HTTP(eth2Http, timeout) + adaptedCl.SetForkVersion(forkVersion) + + return adaptedCl, nil }) clients = append(clients, cl) diff --git a/app/eth2wrap/eth2wrap_test.go b/app/eth2wrap/eth2wrap_test.go index 376a3d94b..73e8702b1 100644 --- a/app/eth2wrap/eth2wrap_test.go +++ b/app/eth2wrap/eth2wrap_test.go @@ -4,6 +4,7 @@ package eth2wrap_test import ( "context" + "encoding/hex" "encoding/json" "fmt" "net" @@ -25,6 +26,7 @@ import ( "github.com/obolnetwork/charon/app/errors" "github.com/obolnetwork/charon/app/eth2wrap" "github.com/obolnetwork/charon/app/log" + "github.com/obolnetwork/charon/eth2util" "github.com/obolnetwork/charon/testutil" "github.com/obolnetwork/charon/testutil/beaconmock" ) @@ -169,7 +171,7 @@ func TestErrors(t *testing.T) { ctx := context.Background() t.Run("network dial error", func(t *testing.T) { - cl, err := eth2wrap.NewMultiHTTP(time.Hour, "localhost:22222") + cl, err := eth2wrap.NewMultiHTTP(time.Hour, [4]byte{}, "localhost:22222") require.NoError(t, err) _, err = cl.SlotsPerEpoch(ctx) @@ -184,7 +186,7 @@ func TestErrors(t *testing.T) { })) t.Run("http timeout", func(t *testing.T) { - cl, err := eth2wrap.NewMultiHTTP(time.Millisecond, srv.URL) + cl, err := eth2wrap.NewMultiHTTP(time.Millisecond, [4]byte{}, srv.URL) require.NoError(t, err) _, err = cl.SlotsPerEpoch(ctx) @@ -197,7 +199,7 @@ func TestErrors(t *testing.T) { ctx, cancel := context.WithCancel(ctx) cancel() - cl, err := eth2wrap.NewMultiHTTP(time.Millisecond, srv.URL) + cl, err := eth2wrap.NewMultiHTTP(time.Millisecond, [4]byte{}, srv.URL) require.NoError(t, err) _, err = cl.SlotsPerEpoch(ctx) @@ -249,7 +251,7 @@ func TestCtxCancel(t *testing.T) { bmock, err := beaconmock.New() require.NoError(t, err) - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, bmock.Address()) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, [4]byte{}, bmock.Address()) require.NoError(t, err) cancel() // Cancel context before calling method. @@ -308,7 +310,7 @@ func TestOneError(t *testing.T) { bmock.Address(), // Valid } - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, addresses...) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, [4]byte{}, addresses...) require.NoError(t, err) eth2Resp, err := eth2Cl.Spec(ctx, ð2api.SpecOpts{}) @@ -339,7 +341,7 @@ func TestOneTimeout(t *testing.T) { bmock.Address(), // Valid } - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Minute, addresses...) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Minute, [4]byte{}, addresses...) require.NoError(t, err) eth2Resp, err := eth2Cl.Spec(ctx, ð2api.SpecOpts{}) @@ -362,7 +364,7 @@ func TestOnlyTimeout(t *testing.T) { defer srv.Close() defer cancel() // Cancel the context before stopping the server. - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Minute, srv.URL) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Minute, [4]byte{}, srv.URL) require.NoError(t, err) // Start goroutine that is blocking trying to create the client. @@ -424,7 +426,7 @@ func TestLazy(t *testing.T) { httputil.NewSingleHostReverseProxy(target).ServeHTTP(w, r) })) - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, srv1.URL, srv2.URL) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, [4]byte{}, srv1.URL, srv2.URL) require.NoError(t, err) // Both proxies are disabled, so this should fail. @@ -449,3 +451,71 @@ func TestLazy(t *testing.T) { require.Equal(t, srv2.URL, eth2Cl.Address()) } + +func TestLazyDomain(t *testing.T) { + tests := []struct { + name string + in string + expErr string + expRes string + }{ + { + name: "mainnet fork", + in: eth2util.Mainnet.GenesisForkVersionHex[2:], + expRes: "040000008c6ebbceb21209e6af5ab7db4a3027998c412c0eb0e15fbc1ee75617", + }, + { + name: "goerli fork", + in: eth2util.Goerli.GenesisForkVersionHex[2:], + expRes: "04000000628941ef21d1fe8c7134720add10bb91e3b02c007e0046d2472c6695", + }, + { + name: "gnosis fork", + in: eth2util.Gnosis.GenesisForkVersionHex[2:], + expRes: "04000000398beb768264920602d7d79f88da05cac0550ae4108753fd846408b5", + }, + { + name: "sepolia fork", + in: eth2util.Sepolia.GenesisForkVersionHex[2:], + expRes: "040000007191d9b3c210dbffc7810b6ccb436c1b3897b6772452924b20f6f5f2", + }, + { + name: "holesky fork", + in: eth2util.Holesky.GenesisForkVersionHex[2:], + expRes: "040000002b3e2c2d17a0d820f3099580a72d1bc743b17616ff7851f32aa303ad", + }, + { + name: "unknown fork", + in: "00000001", + expErr: "beacon api domain: get domain: compute domain: invalid fork hash: no capella fork for specified fork", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ctx := context.Background() + + bmock, err := beaconmock.New() + require.NoError(t, err) + + target := testutil.MustParseURL(t, bmock.Address()) + + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + httputil.NewSingleHostReverseProxy(target).ServeHTTP(w, r) + })) + + forkVersionHex, err := hex.DecodeString(test.in) + require.NoError(t, err) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, [4]byte(forkVersionHex), srv.URL) + require.NoError(t, err) + + voluntaryExitDomain := eth2p0.DomainType{0x04, 0x00, 0x00, 0x00} + f, err := eth2Cl.Domain(ctx, voluntaryExitDomain, testutil.RandomEpoch()) + + if test.expErr != "" { + require.ErrorContains(t, err, test.expErr) + } else { + require.Equal(t, test.expRes, hex.EncodeToString(f[:])) + } + }) + } +} diff --git a/app/log/loki/lokipb/v1/loki.pb.go b/app/log/loki/lokipb/v1/loki.pb.go index 1cfc95fab..4b6d54ab0 100644 --- a/app/log/loki/lokipb/v1/loki.pb.go +++ b/app/log/loki/lokipb/v1/loki.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: app/log/loki/lokipb/v1/loki.proto @@ -231,7 +231,7 @@ func file_app_log_loki_lokipb_v1_loki_proto_rawDescGZIP() []byte { } var file_app_log_loki_lokipb_v1_loki_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_app_log_loki_lokipb_v1_loki_proto_goTypes = []interface{}{ +var file_app_log_loki_lokipb_v1_loki_proto_goTypes = []any{ (*PushRequest)(nil), // 0: app.log.loki.lokipb.v1.PushRequest (*Stream)(nil), // 1: app.log.loki.lokipb.v1.Stream (*Entry)(nil), // 2: app.log.loki.lokipb.v1.Entry @@ -254,7 +254,7 @@ func file_app_log_loki_lokipb_v1_loki_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_app_log_loki_lokipb_v1_loki_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*PushRequest); i { case 0: return &v.state @@ -266,7 +266,7 @@ func file_app_log_loki_lokipb_v1_loki_proto_init() { return nil } } - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_app_log_loki_lokipb_v1_loki_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Stream); i { case 0: return &v.state @@ -278,7 +278,7 @@ func file_app_log_loki_lokipb_v1_loki_proto_init() { return nil } } - file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_app_log_loki_lokipb_v1_loki_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Entry); i { case 0: return &v.state diff --git a/app/peerinfo/peerinfopb/v1/peerinfo.pb.go b/app/peerinfo/peerinfopb/v1/peerinfo.pb.go index fed649b52..daaa60454 100644 --- a/app/peerinfo/peerinfopb/v1/peerinfo.pb.go +++ b/app/peerinfo/peerinfopb/v1/peerinfo.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: app/peerinfo/peerinfopb/v1/peerinfo.proto @@ -156,7 +156,7 @@ func file_app_peerinfo_peerinfopb_v1_peerinfo_proto_rawDescGZIP() []byte { } var file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_app_peerinfo_peerinfopb_v1_peerinfo_proto_goTypes = []interface{}{ +var file_app_peerinfo_peerinfopb_v1_peerinfo_proto_goTypes = []any{ (*PeerInfo)(nil), // 0: app.peerinfo.peerinfopb.v1.PeerInfo (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp } @@ -176,7 +176,7 @@ func file_app_peerinfo_peerinfopb_v1_peerinfo_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*PeerInfo); i { case 0: return &v.state @@ -189,7 +189,7 @@ func file_app_peerinfo_peerinfopb_v1_peerinfo_proto_init() { } } } - file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_app_peerinfo_peerinfopb_v1_peerinfo_proto_msgTypes[0].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/app/protonil/testdata/v1/test.pb.go b/app/protonil/testdata/v1/test.pb.go index 624281052..8b50c2d1b 100644 --- a/app/protonil/testdata/v1/test.pb.go +++ b/app/protonil/testdata/v1/test.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: app/protonil/testdata/v1/test.proto @@ -469,7 +469,7 @@ func file_app_protonil_testdata_v1_test_proto_rawDescGZIP() []byte { } var file_app_protonil_testdata_v1_test_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_app_protonil_testdata_v1_test_proto_goTypes = []interface{}{ +var file_app_protonil_testdata_v1_test_proto_goTypes = []any{ (*M1)(nil), // 0: app.protonil.testdata.v1.M1 (*M2)(nil), // 1: app.protonil.testdata.v1.M2 (*M3)(nil), // 2: app.protonil.testdata.v1.M3 @@ -503,7 +503,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_app_protonil_testdata_v1_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*M1); i { case 0: return &v.state @@ -515,7 +515,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return nil } } - file_app_protonil_testdata_v1_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*M2); i { case 0: return &v.state @@ -527,7 +527,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return nil } } - file_app_protonil_testdata_v1_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*M3); i { case 0: return &v.state @@ -539,7 +539,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return nil } } - file_app_protonil_testdata_v1_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*M4); i { case 0: return &v.state @@ -551,7 +551,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return nil } } - file_app_protonil_testdata_v1_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MaxIndex); i { case 0: return &v.state @@ -563,7 +563,7 @@ func file_app_protonil_testdata_v1_test_proto_init() { return nil } } - file_app_protonil_testdata_v1_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_app_protonil_testdata_v1_test_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Attack); i { case 0: return &v.state @@ -576,9 +576,9 @@ func file_app_protonil_testdata_v1_test_proto_init() { } } } - file_app_protonil_testdata_v1_test_proto_msgTypes[0].OneofWrappers = []interface{}{} - file_app_protonil_testdata_v1_test_proto_msgTypes[1].OneofWrappers = []interface{}{} - file_app_protonil_testdata_v1_test_proto_msgTypes[5].OneofWrappers = []interface{}{} + file_app_protonil_testdata_v1_test_proto_msgTypes[0].OneofWrappers = []any{} + file_app_protonil_testdata_v1_test_proto_msgTypes[1].OneofWrappers = []any{} + file_app_protonil_testdata_v1_test_proto_msgTypes[5].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/cluster/manifestpb/v1/manifest.pb.go b/cluster/manifestpb/v1/manifest.pb.go index 54393c1ba..aa6b000c1 100644 --- a/cluster/manifestpb/v1/manifest.pb.go +++ b/cluster/manifestpb/v1/manifest.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: cluster/manifestpb/v1/manifest.proto @@ -669,7 +669,7 @@ func file_cluster_manifestpb_v1_manifest_proto_rawDescGZIP() []byte { } var file_cluster_manifestpb_v1_manifest_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_cluster_manifestpb_v1_manifest_proto_goTypes = []interface{}{ +var file_cluster_manifestpb_v1_manifest_proto_goTypes = []any{ (*Cluster)(nil), // 0: cluster.manifestpb.v1.Cluster (*Mutation)(nil), // 1: cluster.manifestpb.v1.Mutation (*SignedMutation)(nil), // 2: cluster.manifestpb.v1.SignedMutation @@ -701,7 +701,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_cluster_manifestpb_v1_manifest_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Cluster); i { case 0: return &v.state @@ -713,7 +713,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Mutation); i { case 0: return &v.state @@ -725,7 +725,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*SignedMutation); i { case 0: return &v.state @@ -737,7 +737,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SignedMutationList); i { case 0: return &v.state @@ -749,7 +749,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Operator); i { case 0: return &v.state @@ -761,7 +761,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Validator); i { case 0: return &v.state @@ -773,7 +773,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ValidatorList); i { case 0: return &v.state @@ -785,7 +785,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*LegacyLock); i { case 0: return &v.state @@ -797,7 +797,7 @@ func file_cluster_manifestpb_v1_manifest_proto_init() { return nil } } - file_cluster_manifestpb_v1_manifest_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_cluster_manifestpb_v1_manifest_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*Empty); i { case 0: return &v.state diff --git a/cmd/dkg.go b/cmd/dkg.go index aec0ae49d..062cf0b21 100644 --- a/cmd/dkg.go +++ b/cmd/dkg.go @@ -46,6 +46,8 @@ this command at the same time.`, bindPublishFlags(cmd.Flags(), &config) bindShutdownDelayFlag(cmd.Flags(), &config.ShutdownDelay) + cmd.Flags().DurationVar(&config.Timeout, "timeout", 1*time.Minute, "Timeout for the DKG process, should be increased if DKG times out.") + return cmd } diff --git a/cmd/exit.go b/cmd/exit.go index 95fe72983..08edfa8f6 100644 --- a/cmd/exit.go +++ b/cmd/exit.go @@ -146,8 +146,8 @@ func bindExitFlags(cmd *cobra.Command, config *exitConfig, flags []exitCLIFlag) } } -func eth2Client(ctx context.Context, u []string, timeout time.Duration) (eth2wrap.Client, error) { - cl, err := eth2wrap.NewMultiHTTP(timeout, u...) +func eth2Client(ctx context.Context, u []string, timeout time.Duration, forkVersion [4]byte) (eth2wrap.Client, error) { + cl, err := eth2wrap.NewMultiHTTP(timeout, forkVersion, u...) if err != nil { return nil, err } diff --git a/cmd/exit_broadcast.go b/cmd/exit_broadcast.go index bc89a537c..2c5006275 100644 --- a/cmd/exit_broadcast.go +++ b/cmd/exit_broadcast.go @@ -82,13 +82,11 @@ func runBcastFullExit(ctx context.Context, config exitConfig) error { ctx = log.WithCtx(ctx, z.Str("validator", validator.String())) - eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout) + eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout, [4]byte(cl.GetForkVersion())) if err != nil { return errors.Wrap(err, "cannot create eth2 client for specified beacon node") } - eth2Cl.SetForkVersion([4]byte(cl.GetForkVersion())) - var fullExit eth2p0.SignedVoluntaryExit maybeExitFilePath := strings.TrimSpace(config.ExitFromFilePath) diff --git a/cmd/exit_broadcast_internal_test.go b/cmd/exit_broadcast_internal_test.go index aa03508dd..c96e01ac2 100644 --- a/cmd/exit_broadcast_internal_test.go +++ b/cmd/exit_broadcast_internal_test.go @@ -99,11 +99,9 @@ func testRunBcastFullExitCmdFlow(t *testing.T, fromFile bool) { require.NoError(t, beaconMock.Close()) }() - eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second) + eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second, [4]byte(lock.ForkVersion)) require.NoError(t, err) - eth2Cl.SetForkVersion([4]byte(lock.ForkVersion)) - handler, addLockFiles := obolapimock.MockServer(false, eth2Cl) srv := httptest.NewServer(handler) addLockFiles(lock) diff --git a/cmd/exit_fetch_internal_test.go b/cmd/exit_fetch_internal_test.go index 0e39784d6..ce5367f9b 100644 --- a/cmd/exit_fetch_internal_test.go +++ b/cmd/exit_fetch_internal_test.go @@ -83,11 +83,9 @@ func Test_runFetchExitFullFlow(t *testing.T) { require.NoError(t, beaconMock.Close()) }() - eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second) + eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second, [4]byte(lock.ForkVersion)) require.NoError(t, err) - eth2Cl.SetForkVersion([4]byte(lock.ForkVersion)) - handler, addLockFiles := obolapimock.MockServer(false, eth2Cl) srv := httptest.NewServer(handler) addLockFiles(lock) diff --git a/cmd/exit_list.go b/cmd/exit_list.go index a5ec19555..2fbed42b2 100644 --- a/cmd/exit_list.go +++ b/cmd/exit_list.go @@ -75,7 +75,7 @@ func listActiveVals(ctx context.Context, config exitConfig) ([]string, error) { return nil, errors.Wrap(err, "could not load cluster-lock.json") } - eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout) + eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout, [4]byte{}) // fine to avoid initializing a fork version, we're just querying the BN if err != nil { return nil, errors.Wrap(err, "cannot create eth2 client for specified beacon node") } diff --git a/cmd/exit_sign.go b/cmd/exit_sign.go index e687b802d..5fc0d92c6 100644 --- a/cmd/exit_sign.go +++ b/cmd/exit_sign.go @@ -154,13 +154,11 @@ func runSignPartialExit(ctx context.Context, config exitConfig) error { } } - eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout) + eth2Cl, err := eth2Client(ctx, config.BeaconNodeEndpoints, config.BeaconNodeTimeout, [4]byte(cl.GetForkVersion())) if err != nil { return errors.Wrap(err, "cannot create eth2 client for specified beacon node") } - eth2Cl.SetForkVersion([4]byte(cl.GetForkVersion())) - if !config.ExpertMode { rawValData, err := eth2Cl.Validators(ctx, valAPICallOpts) if err != nil { diff --git a/cmd/exit_sign_internal_test.go b/cmd/exit_sign_internal_test.go index dc925edb8..74fd679ec 100644 --- a/cmd/exit_sign_internal_test.go +++ b/cmd/exit_sign_internal_test.go @@ -181,11 +181,9 @@ func runSubmitPartialExitFlowTest(t *testing.T, useValIdx bool, expertMode bool, require.NoError(t, beaconMock.Close()) }() - eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second) + eth2Cl, err := eth2Client(ctx, []string{beaconMock.Address()}, 10*time.Second, [4]byte(lock.ForkVersion)) require.NoError(t, err) - eth2Cl.SetForkVersion([4]byte(lock.ForkVersion)) - handler, addLockFiles := obolapimock.MockServer(false, eth2Cl) srv := httptest.NewServer(handler) addLockFiles(lock) diff --git a/cmd/testbeacon.go b/cmd/testbeacon.go index 1139cd7a5..a261faf5c 100644 --- a/cmd/testbeacon.go +++ b/cmd/testbeacon.go @@ -29,8 +29,10 @@ type testBeaconConfig struct { type testCaseBeacon func(context.Context, *testBeaconConfig, string) testResult const ( - thresholdBeaconPeersAvg = 20 - thresholdBeaconPeersBad = 5 + thresholdBeaconMeasureAvg = 40 * time.Millisecond + thresholdBeaconMeasureBad = 100 * time.Millisecond + thresholdBeaconPeersAvg = 50 + thresholdBeaconPeersBad = 20 ) func newTestBeaconCmd(runFunc func(context.Context, io.Writer, testBeaconConfig) error) *cobra.Command { @@ -259,9 +261,9 @@ func beaconPingMeasureTest(ctx context.Context, _ *testBeaconConfig, target stri return failedTestResult(testRes, errors.New("status code %v", z.Int("status_code", resp.StatusCode))) } - if firstByte > thresholdMeasureBad { + if firstByte > thresholdBeaconMeasureBad { testRes.Verdict = testVerdictBad - } else if firstByte > thresholdMeasureAvg { + } else if firstByte > thresholdBeaconMeasureAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood diff --git a/cmd/testpeers.go b/cmd/testpeers.go index e8cdd5a94..4cf443669 100644 --- a/cmd/testpeers.go +++ b/cmd/testpeers.go @@ -45,10 +45,14 @@ type testPeersConfig struct { type testCasePeer func(context.Context, *testPeersConfig, host.Host, p2p.Peer) testResult const ( - thresholdMeasureAvg = 200 * time.Millisecond - thresholdMeasureBad = 500 * time.Millisecond - thresholdLoadAvg = 200 * time.Millisecond - thresholdLoadBad = 500 * time.Millisecond + thresholdMeasureAvg = 50 * time.Millisecond + thresholdMeasureBad = 240 * time.Millisecond + thresholdLoadAvg = 50 * time.Millisecond + thresholdLoadBad = 240 * time.Millisecond + thresholdPeersMeasureAvg = 50 * time.Millisecond + thresholdPeersMeasureBad = 240 * time.Millisecond + thresholdPeersLoadAvg = 50 * time.Millisecond + thresholdPeersLoadBad = 240 * time.Millisecond ) func newTestPeersCmd(runFunc func(context.Context, io.Writer, testPeersConfig) error) *cobra.Command { @@ -524,9 +528,9 @@ func peerPingMeasureTest(ctx context.Context, _ *testPeersConfig, tcpNode host.H return testRes } - if result.RTT > thresholdMeasureBad { + if result.RTT > thresholdPeersMeasureBad { testRes.Verdict = testVerdictBad - } else if result.RTT > thresholdMeasureAvg { + } else if result.RTT > thresholdPeersMeasureAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood @@ -570,9 +574,9 @@ func peerPingLoadTest(ctx context.Context, conf *testPeersConfig, tcpNode host.H highestRTT = val.RTT } } - if highestRTT > thresholdLoadBad { + if highestRTT > thresholdPeersLoadBad { testRes.Verdict = testVerdictBad - } else if highestRTT > thresholdLoadAvg { + } else if highestRTT > thresholdPeersLoadAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood diff --git a/core/corepb/v1/consensus.pb.go b/core/corepb/v1/consensus.pb.go index f7314f248..82ceec09a 100644 --- a/core/corepb/v1/consensus.pb.go +++ b/core/corepb/v1/consensus.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: core/corepb/v1/consensus.proto @@ -457,7 +457,7 @@ func file_core_corepb_v1_consensus_proto_rawDescGZIP() []byte { } var file_core_corepb_v1_consensus_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_core_corepb_v1_consensus_proto_goTypes = []interface{}{ +var file_core_corepb_v1_consensus_proto_goTypes = []any{ (*QBFTMsg)(nil), // 0: core.corepb.v1.QBFTMsg (*ConsensusMsg)(nil), // 1: core.corepb.v1.ConsensusMsg (*SniffedConsensusMsg)(nil), // 2: core.corepb.v1.SniffedConsensusMsg @@ -491,7 +491,7 @@ func file_core_corepb_v1_consensus_proto_init() { } file_core_corepb_v1_core_proto_init() if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_consensus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_consensus_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*QBFTMsg); i { case 0: return &v.state @@ -503,7 +503,7 @@ func file_core_corepb_v1_consensus_proto_init() { return nil } } - file_core_corepb_v1_consensus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_consensus_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ConsensusMsg); i { case 0: return &v.state @@ -515,7 +515,7 @@ func file_core_corepb_v1_consensus_proto_init() { return nil } } - file_core_corepb_v1_consensus_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_consensus_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*SniffedConsensusMsg); i { case 0: return &v.state @@ -527,7 +527,7 @@ func file_core_corepb_v1_consensus_proto_init() { return nil } } - file_core_corepb_v1_consensus_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_consensus_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SniffedConsensusInstance); i { case 0: return &v.state @@ -539,7 +539,7 @@ func file_core_corepb_v1_consensus_proto_init() { return nil } } - file_core_corepb_v1_consensus_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_consensus_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*SniffedConsensusInstances); i { case 0: return &v.state diff --git a/core/corepb/v1/core.pb.go b/core/corepb/v1/core.pb.go index 277454808..7b472d6fd 100644 --- a/core/corepb/v1/core.pb.go +++ b/core/corepb/v1/core.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: core/corepb/v1/core.proto @@ -285,7 +285,7 @@ func file_core_corepb_v1_core_proto_rawDescGZIP() []byte { } var file_core_corepb_v1_core_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_core_corepb_v1_core_proto_goTypes = []interface{}{ +var file_core_corepb_v1_core_proto_goTypes = []any{ (*Duty)(nil), // 0: core.corepb.v1.Duty (*UnsignedDataSet)(nil), // 1: core.corepb.v1.UnsignedDataSet (*ParSignedDataSet)(nil), // 2: core.corepb.v1.ParSignedDataSet @@ -310,7 +310,7 @@ func file_core_corepb_v1_core_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_core_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Duty); i { case 0: return &v.state @@ -322,7 +322,7 @@ func file_core_corepb_v1_core_proto_init() { return nil } } - file_core_corepb_v1_core_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_core_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*UnsignedDataSet); i { case 0: return &v.state @@ -334,7 +334,7 @@ func file_core_corepb_v1_core_proto_init() { return nil } } - file_core_corepb_v1_core_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_core_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ParSignedDataSet); i { case 0: return &v.state @@ -346,7 +346,7 @@ func file_core_corepb_v1_core_proto_init() { return nil } } - file_core_corepb_v1_core_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_core_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ParSignedData); i { case 0: return &v.state diff --git a/core/corepb/v1/parsigex.pb.go b/core/corepb/v1/parsigex.pb.go index 229f06e05..aa767fd59 100644 --- a/core/corepb/v1/parsigex.pb.go +++ b/core/corepb/v1/parsigex.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: core/corepb/v1/parsigex.proto @@ -109,7 +109,7 @@ func file_core_corepb_v1_parsigex_proto_rawDescGZIP() []byte { } var file_core_corepb_v1_parsigex_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_core_corepb_v1_parsigex_proto_goTypes = []interface{}{ +var file_core_corepb_v1_parsigex_proto_goTypes = []any{ (*ParSigExMsg)(nil), // 0: core.corepb.v1.ParSigExMsg (*Duty)(nil), // 1: core.corepb.v1.Duty (*ParSignedDataSet)(nil), // 2: core.corepb.v1.ParSignedDataSet @@ -131,7 +131,7 @@ func file_core_corepb_v1_parsigex_proto_init() { } file_core_corepb_v1_core_proto_init() if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_parsigex_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_parsigex_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*ParSigExMsg); i { case 0: return &v.state diff --git a/core/corepb/v1/priority.pb.go b/core/corepb/v1/priority.pb.go index b04b912d8..e40e12cc8 100644 --- a/core/corepb/v1/priority.pb.go +++ b/core/corepb/v1/priority.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: core/corepb/v1/priority.proto @@ -389,7 +389,7 @@ func file_core_corepb_v1_priority_proto_rawDescGZIP() []byte { } var file_core_corepb_v1_priority_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_core_corepb_v1_priority_proto_goTypes = []interface{}{ +var file_core_corepb_v1_priority_proto_goTypes = []any{ (*PriorityResult)(nil), // 0: core.corepb.v1.PriorityResult (*PriorityMsg)(nil), // 1: core.corepb.v1.PriorityMsg (*PriorityTopicProposal)(nil), // 2: core.corepb.v1.PriorityTopicProposal @@ -422,7 +422,7 @@ func file_core_corepb_v1_priority_proto_init() { } file_core_corepb_v1_core_proto_init() if !protoimpl.UnsafeEnabled { - file_core_corepb_v1_priority_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_priority_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*PriorityResult); i { case 0: return &v.state @@ -434,7 +434,7 @@ func file_core_corepb_v1_priority_proto_init() { return nil } } - file_core_corepb_v1_priority_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_priority_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*PriorityMsg); i { case 0: return &v.state @@ -446,7 +446,7 @@ func file_core_corepb_v1_priority_proto_init() { return nil } } - file_core_corepb_v1_priority_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_priority_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*PriorityTopicProposal); i { case 0: return &v.state @@ -458,7 +458,7 @@ func file_core_corepb_v1_priority_proto_init() { return nil } } - file_core_corepb_v1_priority_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_priority_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*PriorityTopicResult); i { case 0: return &v.state @@ -470,7 +470,7 @@ func file_core_corepb_v1_priority_proto_init() { return nil } } - file_core_corepb_v1_priority_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_core_corepb_v1_priority_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*PriorityScoredResult); i { case 0: return &v.state diff --git a/core/parsigex/parsigex.go b/core/parsigex/parsigex.go index a207358e8..4e0a5e5fc 100644 --- a/core/parsigex/parsigex.go +++ b/core/parsigex/parsigex.go @@ -29,7 +29,7 @@ func Protocols() []protocol.ID { func NewParSigEx(tcpNode host.Host, sendFunc p2p.SendFunc, peerIdx int, peers []peer.ID, verifyFunc func(context.Context, core.Duty, core.PubKey, core.ParSignedData) error, - gaterFunc core.DutyGaterFunc, + gaterFunc core.DutyGaterFunc, p2pOpts ...p2p.SendRecvOption, ) *ParSigEx { parSigEx := &ParSigEx{ tcpNode: tcpNode, @@ -41,7 +41,14 @@ func NewParSigEx(tcpNode host.Host, sendFunc p2p.SendFunc, peerIdx int, peers [] } newReq := func() proto.Message { return new(pbv1.ParSigExMsg) } - p2p.RegisterHandler("parsigex", tcpNode, protocolID2, newReq, parSigEx.handle) + p2p.RegisterHandler( + "parsigex", + tcpNode, + protocolID2, + newReq, + parSigEx.handle, + p2pOpts..., + ) return parSigEx } diff --git a/core/scheduler/scheduler_test.go b/core/scheduler/scheduler_test.go index ad127481f..cfba66143 100644 --- a/core/scheduler/scheduler_test.go +++ b/core/scheduler/scheduler_test.go @@ -41,7 +41,7 @@ func TestIntegration(t *testing.T) { t.Fatal("BEACON_URL env var not set") } - eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second*2, beaconURL) + eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second*2, [4]byte{}, beaconURL) require.NoError(t, err) // Use random actual mainnet validators diff --git a/dkg/dkg.go b/dkg/dkg.go index eba70dfa7..7a8189c60 100644 --- a/dkg/dkg.go +++ b/dkg/dkg.go @@ -46,6 +46,7 @@ type Config struct { P2P p2p.Config Log log.Config ShutdownDelay time.Duration + Timeout time.Duration KeymanagerAddr string KeymanagerAuthToken string @@ -190,7 +191,7 @@ func Run(ctx context.Context, conf Config) (err error) { sigLock, sigDepositData, sigValidatorRegistration, - }) + }, conf.Timeout) // Register Frost libp2p handlers peerMap := make(map[peer.ID]cluster.NodeIdx) diff --git a/dkg/dkg_test.go b/dkg/dkg_test.go index 013124c68..f175da525 100644 --- a/dkg/dkg_test.go +++ b/dkg/dkg_test.go @@ -148,6 +148,7 @@ func testDKG(t *testing.T, def cluster.Definition, dir string, p2pKeys []*k1.Pri }, ShutdownDelay: 1 * time.Second, PublishTimeout: 30 * time.Second, + Timeout: 8 * time.Second, } allReceivedKeystores := make(chan struct{}) // Receives struct{} for each `numNodes` keystore intercepted by the keymanager server @@ -633,6 +634,7 @@ func getConfigs(t *testing.T, def cluster.Definition, keys []*k1.PrivateKey, dir }, TCPNodeCallback: tcpNodeCallback, }, + Timeout: 8 * time.Second, } require.NoError(t, os.MkdirAll(conf.DataDir, 0o755)) diff --git a/dkg/dkgpb/v1/bcast.pb.go b/dkg/dkgpb/v1/bcast.pb.go index 8f198ada3..2b31dc35e 100644 --- a/dkg/dkgpb/v1/bcast.pb.go +++ b/dkg/dkgpb/v1/bcast.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: dkg/dkgpb/v1/bcast.proto @@ -237,7 +237,7 @@ func file_dkg_dkgpb_v1_bcast_proto_rawDescGZIP() []byte { } var file_dkg_dkgpb_v1_bcast_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_dkg_dkgpb_v1_bcast_proto_goTypes = []interface{}{ +var file_dkg_dkgpb_v1_bcast_proto_goTypes = []any{ (*BCastSigRequest)(nil), // 0: dkg.dkgpb.v1.BCastSigRequest (*BCastSigResponse)(nil), // 1: dkg.dkgpb.v1.BCastSigResponse (*BCastMessage)(nil), // 2: dkg.dkgpb.v1.BCastMessage @@ -259,7 +259,7 @@ func file_dkg_dkgpb_v1_bcast_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_bcast_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_bcast_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*BCastSigRequest); i { case 0: return &v.state @@ -271,7 +271,7 @@ func file_dkg_dkgpb_v1_bcast_proto_init() { return nil } } - file_dkg_dkgpb_v1_bcast_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_bcast_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*BCastSigResponse); i { case 0: return &v.state @@ -283,7 +283,7 @@ func file_dkg_dkgpb_v1_bcast_proto_init() { return nil } } - file_dkg_dkgpb_v1_bcast_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_bcast_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*BCastMessage); i { case 0: return &v.state diff --git a/dkg/dkgpb/v1/frost.pb.go b/dkg/dkgpb/v1/frost.pb.go index 0a96fc856..84e3f2028 100644 --- a/dkg/dkgpb/v1/frost.pb.go +++ b/dkg/dkgpb/v1/frost.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: dkg/dkgpb/v1/frost.proto @@ -489,7 +489,7 @@ func file_dkg_dkgpb_v1_frost_proto_rawDescGZIP() []byte { } var file_dkg_dkgpb_v1_frost_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_dkg_dkgpb_v1_frost_proto_goTypes = []interface{}{ +var file_dkg_dkgpb_v1_frost_proto_goTypes = []any{ (*FrostMsgKey)(nil), // 0: dkg.dkgpb.v1.FrostMsgKey (*FrostRound1Casts)(nil), // 1: dkg.dkgpb.v1.FrostRound1Casts (*FrostRound1Cast)(nil), // 2: dkg.dkgpb.v1.FrostRound1Cast @@ -518,7 +518,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_frost_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*FrostMsgKey); i { case 0: return &v.state @@ -530,7 +530,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*FrostRound1Casts); i { case 0: return &v.state @@ -542,7 +542,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*FrostRound1Cast); i { case 0: return &v.state @@ -554,7 +554,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*FrostRound1P2P); i { case 0: return &v.state @@ -566,7 +566,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*FrostRound1ShamirShare); i { case 0: return &v.state @@ -578,7 +578,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*FrostRound2Casts); i { case 0: return &v.state @@ -590,7 +590,7 @@ func file_dkg_dkgpb_v1_frost_proto_init() { return nil } } - file_dkg_dkgpb_v1_frost_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_frost_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*FrostRound2Cast); i { case 0: return &v.state diff --git a/dkg/dkgpb/v1/nodesigs.pb.go b/dkg/dkgpb/v1/nodesigs.pb.go index 217d2f7b5..c76d912c8 100644 --- a/dkg/dkgpb/v1/nodesigs.pb.go +++ b/dkg/dkgpb/v1/nodesigs.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: dkg/dkgpb/v1/nodesigs.proto @@ -104,7 +104,7 @@ func file_dkg_dkgpb_v1_nodesigs_proto_rawDescGZIP() []byte { } var file_dkg_dkgpb_v1_nodesigs_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_dkg_dkgpb_v1_nodesigs_proto_goTypes = []interface{}{ +var file_dkg_dkgpb_v1_nodesigs_proto_goTypes = []any{ (*MsgNodeSig)(nil), // 0: dkg.dkgpb.v1.MsgNodeSig } var file_dkg_dkgpb_v1_nodesigs_proto_depIdxs = []int32{ @@ -121,7 +121,7 @@ func file_dkg_dkgpb_v1_nodesigs_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_nodesigs_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MsgNodeSig); i { case 0: return &v.state diff --git a/dkg/dkgpb/v1/sync.pb.go b/dkg/dkgpb/v1/sync.pb.go index 7346446c2..53d1a1e2f 100644 --- a/dkg/dkgpb/v1/sync.pb.go +++ b/dkg/dkgpb/v1/sync.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: dkg/dkgpb/v1/sync.proto @@ -200,7 +200,7 @@ func file_dkg_dkgpb_v1_sync_proto_rawDescGZIP() []byte { } var file_dkg_dkgpb_v1_sync_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_dkg_dkgpb_v1_sync_proto_goTypes = []interface{}{ +var file_dkg_dkgpb_v1_sync_proto_goTypes = []any{ (*MsgSync)(nil), // 0: dkg.dkgpb.v1.MsgSync (*MsgSyncResponse)(nil), // 1: dkg.dkgpb.v1.MsgSyncResponse (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp @@ -221,7 +221,7 @@ func file_dkg_dkgpb_v1_sync_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_dkg_dkgpb_v1_sync_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_sync_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*MsgSync); i { case 0: return &v.state @@ -233,7 +233,7 @@ func file_dkg_dkgpb_v1_sync_proto_init() { return nil } } - file_dkg_dkgpb_v1_sync_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_dkg_dkgpb_v1_sync_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*MsgSyncResponse); i { case 0: return &v.state diff --git a/dkg/exchanger.go b/dkg/exchanger.go index a2e002dd2..378597468 100644 --- a/dkg/exchanger.go +++ b/dkg/exchanger.go @@ -6,6 +6,7 @@ import ( "context" "slices" "sync" + "time" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" @@ -55,7 +56,7 @@ type exchanger struct { sigDatasChan chan map[core.PubKey][]core.ParSignedData } -func newExchanger(tcpNode host.Host, peerIdx int, peers []peer.ID, vals int, sigTypes []sigType) *exchanger { +func newExchanger(tcpNode host.Host, peerIdx int, peers []peer.ID, vals int, sigTypes []sigType, timeout time.Duration) *exchanger { // Partial signature roots not known yet, so skip verification in parsigex, rather verify before we aggregate. noopVerifier := func(ctx context.Context, duty core.Duty, key core.PubKey, data core.ParSignedData) error { return nil @@ -82,7 +83,7 @@ func newExchanger(tcpNode host.Host, peerIdx int, peers []peer.ID, vals int, sig ex := &exchanger{ // threshold is len(peers) to wait until we get all the partial sigs from all the peers per DV sigdb: parsigdb.NewMemDB(len(peers), noopDeadliner{}), - sigex: parsigex.NewParSigEx(tcpNode, p2p.Send, peerIdx, peers, noopVerifier, dutyGaterFunc), + sigex: parsigex.NewParSigEx(tcpNode, p2p.Send, peerIdx, peers, noopVerifier, dutyGaterFunc, p2p.WithSendTimeout(timeout), p2p.WithReceiveTimeout(timeout)), sigTypes: st, sigData: dataByPubkey{ store: sigTypeStore{}, diff --git a/dkg/exchanger_internal_test.go b/dkg/exchanger_internal_test.go index d91b06726..aece6c7be 100644 --- a/dkg/exchanger_internal_test.go +++ b/dkg/exchanger_internal_test.go @@ -7,6 +7,7 @@ import ( "reflect" "sync" "testing" + "time" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" @@ -89,7 +90,7 @@ func TestExchanger(t *testing.T) { } for i := 0; i < nodes; i++ { - ex := newExchanger(hosts[i], i, peers, dvs, expectedSigTypes) + ex := newExchanger(hosts[i], i, peers, dvs, expectedSigTypes, 8*time.Second) exchangers = append(exchangers, ex) } diff --git a/testutil/integration/nightly_dkg_test.go b/testutil/integration/nightly_dkg_test.go index ef7b04974..ee8a4cc3d 100644 --- a/testutil/integration/nightly_dkg_test.go +++ b/testutil/integration/nightly_dkg_test.go @@ -92,6 +92,7 @@ func TestLongWaitDKG(t *testing.T) { TestConfig: dkg.TestConfig{ Def: &def, }, + Timeout: 10 * time.Minute, } windowTicker := time.NewTicker(window) @@ -291,6 +292,7 @@ func TestDKGWithHighValidatorsAmt(t *testing.T) { TestConfig: dkg.TestConfig{ Def: &def, }, + Timeout: 10 * time.Minute, } dir := t.TempDir()