From 56f869937f7e8defc7971a3288727ce03ef4af4c Mon Sep 17 00:00:00 2001 From: hopeyen Date: Tue, 17 Dec 2024 09:56:17 -0800 Subject: [PATCH] chore: logs and comments --- core/meterer/util.go | 4 +--- disperser/apiserver/disperse_blob_v2.go | 3 +-- disperser/apiserver/server_v2_test.go | 4 ---- inabox/deploy/localstack.go | 9 ++++----- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/core/meterer/util.go b/core/meterer/util.go index b8fb77e409..2b75953e8e 100644 --- a/core/meterer/util.go +++ b/core/meterer/util.go @@ -2,7 +2,6 @@ package meterer import ( "context" - "fmt" commonaws "github.com/Layr-Labs/eigenda/common/aws" test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" @@ -13,7 +12,7 @@ import ( func CreateReservationTable(clientConfig commonaws.ClientConfig, tableName string) error { ctx := context.Background() - res, err := test_utils.CreateTable(ctx, clientConfig, tableName, &dynamodb.CreateTableInput{ + _, err := test_utils.CreateTable(ctx, clientConfig, tableName, &dynamodb.CreateTableInput{ AttributeDefinitions: []types.AttributeDefinition{ { AttributeName: aws.String("AccountID"), @@ -41,7 +40,6 @@ func CreateReservationTable(clientConfig commonaws.ClientConfig, tableName strin }, }) - fmt.Printf("Made table %s\n", res) return err } diff --git a/disperser/apiserver/disperse_blob_v2.go b/disperser/apiserver/disperse_blob_v2.go index 9f10ffdf32..7e598f94ee 100644 --- a/disperser/apiserver/disperse_blob_v2.go +++ b/disperser/apiserver/disperse_blob_v2.go @@ -123,7 +123,7 @@ func (s *DispersalServerV2) validateDispersalRequest(ctx context.Context, req *p if err != nil { return api.NewErrorInvalidArg(fmt.Sprintf("invalid blob header: %s", err.Error())) } - // TODO(ian-shim): enable this check for authentication + if blobHeader.PaymentMetadata == (core.PaymentMetadata{}) { return api.NewErrorInvalidArg("payment metadata is required") } @@ -131,7 +131,6 @@ func (s *DispersalServerV2) validateDispersalRequest(ctx context.Context, req *p return api.NewErrorInvalidArg(fmt.Sprintf("authentication failed: %s", err.Error())) } - // TODO(ian-shim): enable this check when we have payment metadata + authentication in disperser client if len(blobHeader.PaymentMetadata.AccountID) == 0 || blobHeader.PaymentMetadata.ReservationPeriod == 0 || blobHeader.PaymentMetadata.CumulativePayment == nil { return api.NewErrorInvalidArg("invalid payment metadata") } diff --git a/disperser/apiserver/server_v2_test.go b/disperser/apiserver/server_v2_test.go index 9653d589c4..fb0449bb7c 100644 --- a/disperser/apiserver/server_v2_test.go +++ b/disperser/apiserver/server_v2_test.go @@ -204,9 +204,7 @@ func TestV2DisperseBlobRequestValidation(t *testing.T) { Data: data, BlobHeader: invalidReqProto, }) - // TODO(hopeyen); re-enable this validation after adding signature verification assert.ErrorContains(t, err, "authentication failed") - // assert.NoError(t, err) // request with invalid payment metadata invalidReqProto = &pbcommonv2.BlobHeader{ @@ -229,9 +227,7 @@ func TestV2DisperseBlobRequestValidation(t *testing.T) { Data: data, BlobHeader: invalidReqProto, }) - // TODO(ian-shim): re-enable this validation after fixing the payment metadata validation assert.ErrorContains(t, err, "invalid payment metadata") - // assert.NoError(t, err) // request with invalid commitment invalidCommitment := commitmentProto diff --git a/inabox/deploy/localstack.go b/inabox/deploy/localstack.go index 62dffaf3c4..040029ceb2 100644 --- a/inabox/deploy/localstack.go +++ b/inabox/deploy/localstack.go @@ -143,20 +143,19 @@ func DeployResources( return err } - v2PaymentName := "e2e_v2" - fmt.Println("Creating payment related tables ---- in localstack") + v2PaymentName := "e2e_v2_" // create payment related tables - err = meterer.CreateReservationTable(cfg, v2PaymentName+"_reservation") + err = meterer.CreateReservationTable(cfg, v2PaymentName+"reservation") if err != nil { fmt.Println("err", err) return err } - err = meterer.CreateOnDemandTable(cfg, v2PaymentName+"_ondemand") + err = meterer.CreateOnDemandTable(cfg, v2PaymentName+"ondemand") if err != nil { fmt.Println("err", err) return err } - err = meterer.CreateGlobalReservationTable(cfg, v2PaymentName+"_global_reservation") + err = meterer.CreateGlobalReservationTable(cfg, v2PaymentName+"global_reservation") if err != nil { fmt.Println("err", err) return err