From 0511e5549883909d03e7a8f84fa9e43f2902f94d Mon Sep 17 00:00:00 2001 From: Alwin Zomotor Date: Tue, 10 Sep 2024 23:46:04 +0200 Subject: [PATCH] chore: removed uneccessary changes Signed-off-by: Alwin Zomotor --- pkg/castor/client.go | 2 +- pkg/castor/entities.go | 21 ++++++++++----------- pkg/ephemeral/spdz.go | 13 ------------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/pkg/castor/client.go b/pkg/castor/client.go index 518db6fc..313686b8 100644 --- a/pkg/castor/client.go +++ b/pkg/castor/client.go @@ -74,7 +74,7 @@ func (c *Client) GetTuples(count int32, tt TupleType, requestID uuid.UUID) ([]by } return nil, fmt.Errorf("getting tuples failed for \"%s\" with response code #%d: %s", req.URL, resp.StatusCode, string(bodyBytes)) } - if err != nil { //|| (int32(len(bodyBytes)) != count*int32(tt.Arity)*2) { + if err != nil { return nil, fmt.Errorf("castor has returned an invalid response body: %s", err) } return bodyBytes, nil diff --git a/pkg/castor/entities.go b/pkg/castor/entities.go index 973da640..d8e34d35 100644 --- a/pkg/castor/entities.go +++ b/pkg/castor/entities.go @@ -47,30 +47,29 @@ type TupleType struct { Name string PreprocessingName string SpdzProtocol SPDZProtocol - Arity int8 } var ( // BitGfp describes the Bits tuple type in the Mudulo a Prime domain. - BitGfp = TupleType{"BIT_GFP", "Bits", SPDZGfp, 1} + BitGfp = TupleType{"BIT_GFP", "Bits", SPDZGfp} // BitGf2n describes the Bits tuple type in the GF(2^n) domain. - BitGf2n = TupleType{"BIT_GF2N", "Bits", SPDZGf2n, 1} + BitGf2n = TupleType{"BIT_GF2N", "Bits", SPDZGf2n} // InputMaskGfp describes the Inputs tuple type in the Mudulo a Prime domain. - InputMaskGfp = TupleType{"INPUT_MASK_GFP", "Inputs", SPDZGfp, 2} + InputMaskGfp = TupleType{"INPUT_MASK_GFP", "Inputs", SPDZGfp} // InputMaskGf2n describes the Inputs tuple type in the GF(2^n) domain. - InputMaskGf2n = TupleType{"INPUT_MASK_GF2N", "Inputs", SPDZGf2n, 2} + InputMaskGf2n = TupleType{"INPUT_MASK_GF2N", "Inputs", SPDZGf2n} // InverseTupleGfp describes the Inverses tuple type in the Mudulo a Prime domain. - InverseTupleGfp = TupleType{"INVERSE_TUPLE_GFP", "Inverses", SPDZGfp, 2} + InverseTupleGfp = TupleType{"INVERSE_TUPLE_GFP", "Inverses", SPDZGfp} // InverseTupleGf2n describes the Inverses tuple type in the GF(2^n) domain. - InverseTupleGf2n = TupleType{"INVERSE_TUPLE_GF2N", "Inverses", SPDZGf2n, 2} + InverseTupleGf2n = TupleType{"INVERSE_TUPLE_GF2N", "Inverses", SPDZGf2n} // SquareTupleGfp describes the Squares tuple type in the Mudulo a Prime domain. - SquareTupleGfp = TupleType{"SQUARE_TUPLE_GFP", "Squares", SPDZGfp, 2} + SquareTupleGfp = TupleType{"SQUARE_TUPLE_GFP", "Squares", SPDZGfp} // SquareTupleGf2n describes the Squares tuple type in the GF(2^n) domain. - SquareTupleGf2n = TupleType{"SQUARE_TUPLE_GF2N", "Squares", SPDZGf2n, 2} + SquareTupleGf2n = TupleType{"SQUARE_TUPLE_GF2N", "Squares", SPDZGf2n} // MultiplicationTripleGfp describes the Triples tuple type in the Mudulo a Prime domain. - MultiplicationTripleGfp = TupleType{"MULTIPLICATION_TRIPLE_GFP", "Triples", SPDZGfp, 3} + MultiplicationTripleGfp = TupleType{"MULTIPLICATION_TRIPLE_GFP", "Triples", SPDZGfp} // MultiplicationTripleGf2n describes the Triples tuple type in the GF(2^n) domain. - MultiplicationTripleGf2n = TupleType{"MULTIPLICATION_TRIPLE_GF2N", "Triples", SPDZGf2n, 3} + MultiplicationTripleGf2n = TupleType{"MULTIPLICATION_TRIPLE_GF2N", "Triples", SPDZGf2n} ) // SupportedTupleTypes is a list of all tuple types supported by the castor client. diff --git a/pkg/ephemeral/spdz.go b/pkg/ephemeral/spdz.go index 913df9e0..0949c34f 100644 --- a/pkg/ephemeral/spdz.go +++ b/pkg/ephemeral/spdz.go @@ -5,7 +5,6 @@ package ephemeral import ( - // "runtime/pprof" "context" "errors" "fmt" @@ -178,17 +177,6 @@ type SPDZEngine struct { // Activate starts a proxy, writes an IP file, start SPDZ execution, unpacks inputs parameters, sends them to the runtime and waits for the response. func (s *SPDZEngine) Activate(ctx *CtxConfig) ([]byte, error) { - // f, errs := os.Create("cpu2.pprof") - // if errs != nil { - // s.logger.Errorw("Error creating cpu profile", GameID, ctx.Act.GameID, "Error", errs) - // return nil, errs - // } - // defer f.Close() - // defer pprof.StopCPUProfile() - // if err := pprof.StartCPUProfile(f); err != nil { - // s.logger.Errorw("Error starting cpu profile", GameID, ctx.Act.GameID, "Error", err) - // } - proxyErrCh := make(chan error, 1) act := ctx.Act err := s.proxy.Run(ctx, proxyErrCh) @@ -325,7 +313,6 @@ func (s *SPDZEngine) startMPC(ctx *CtxConfig) { wg.Add(1) s.StartStreamTuples(terminateStreams, streamErrCh, wg) } - // command := []string{fmt.Sprintf("valgrind --tool=callgrind ./Player-Online.x %s %s -N %s --ip-file-name %s --file-prep-per-thread", fmt.Sprint(s.config.PlayerID), appName, fmt.Sprint(ctx.Spdz.PlayerCount), ipFile)} command := []string{fmt.Sprintf("./Player-Online.x %s %s -N %s --ip-file-name %s --file-prep-per-thread", fmt.Sprint(s.config.PlayerID), appName, fmt.Sprint(ctx.Spdz.PlayerCount), ipFile)} s.logger.Infow("Starting Player-Online.x", GameID, ctx.Act.GameID, "command", command) go func() {