Skip to content

Commit

Permalink
remove duplicate validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Dec 11, 2024
1 parent 2ba0051 commit 8519bab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion api/clients/disperser_client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (c *disperserClientV2) DisperseBlob(
return nil, [32]byte{}, api.NewErrorInvalidArg(fmt.Sprintf("please configure signer key if you want to use authenticated endpoint %v", err))
}
payment.AccountID = accountId
payment.BinIndex = 0
payment.ReservationPeriod = 0
payment.CumulativePayment = big.NewInt(0)
blobHeader := &corev2.BlobHeader{
BlobVersion: blobVersion,
Expand Down
30 changes: 13 additions & 17 deletions disperser/apiserver/disperse_blob_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,19 @@ func (s *DispersalServerV2) validateDispersalRequest(ctx context.Context, req *p
// }

// handle payments and check rate limits
// if blobHeaderProto.GetPaymentHeader() != nil {
// reservationPeriod := blobHeaderProto.GetPaymentHeader().GetReservationPeriod()
// cumulativePayment := new(big.Int).SetBytes(blobHeaderProto.GetPaymentHeader().GetCumulativePayment())
// accountID := blobHeaderProto.GetPaymentHeader().GetAccountId()

// paymentHeader := core.PaymentMetadata{
// AccountID: accountID,
// ReservationPeriod: reservationPeriod,
// CumulativePayment: cumulativePayment,
// }

// err := s.meterer.MeterRequest(ctx, paymentHeader, blobLength, blobHeader.QuorumNumbers)
// if err != nil {
// return api.NewErrorResourceExhausted(err.Error())
// }
// } else {
// return api.NewErrorInvalidArg("payment header is required")
// reservationPeriod := blobHeaderProto.GetPaymentHeader().GetReservationPeriod()
// cumulativePayment := new(big.Int).SetBytes(blobHeaderProto.GetPaymentHeader().GetCumulativePayment())
// accountID := blobHeaderProto.GetPaymentHeader().GetAccountId()

// paymentHeader := core.PaymentMetadata{
// AccountID: accountID,
// ReservationPeriod: reservationPeriod,
// CumulativePayment: cumulativePayment,
// }

// err := s.meterer.MeterRequest(ctx, paymentHeader, blobLength, blobHeader.QuorumNumbers)
// if err != nil {
// return api.NewErrorResourceExhausted(err.Error())
// }

commitments, err := s.prover.GetCommitmentsForPaddedLength(data)
Expand Down
7 changes: 5 additions & 2 deletions disperser/apiserver/server_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"crypto/rand"
"fmt"
"github.com/prometheus/client_golang/prometheus"
"math/big"
"net"
"testing"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/Layr-Labs/eigenda/common/aws"
"github.com/Layr-Labs/eigenda/common/aws/dynamodb"
"github.com/Layr-Labs/eigenda/common/aws/s3"
Expand Down Expand Up @@ -203,7 +204,9 @@ func TestV2DisperseBlobRequestValidation(t *testing.T) {
Data: data,
BlobHeader: invalidReqProto,
})
assert.ErrorContains(t, err, "authentication failed")
// 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{
Expand Down
1 change: 0 additions & 1 deletion inabox/tests/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ var _ = BeforeSuite(func() {
rpcClient, err = ethrpc.Dial(testConfig.Deployers[0].RPC)
Expect(err).To(BeNil())

// set up thresholds and relay addresses
fmt.Println("Registering blob versions and relays")
relays = testConfig.RegisterBlobVersionAndRelays(ethClient)

Expand Down
4 changes: 2 additions & 2 deletions inabox/tests/integration_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ var _ = Describe("Inabox v2 Integration", func() {
paddedData1 := codec.ConvertByPaddingEmptyByte(data1)
paddedData2 := codec.ConvertByPaddingEmptyByte(data2)

blobStatus1, key1, err := disp.DisperseBlob(ctx, paddedData1, 0, []uint8{0, 1})
blobStatus1, key1, err := disp.DisperseBlob(ctx, paddedData1, 0, []uint8{0, 1}, 0)
Expect(err).To(BeNil())
Expect(key1).To(Not(BeNil()))
Expect(blobStatus1).To(Not(BeNil()))
Expect(*blobStatus1).To(Equal(dispv2.Queued))

blobStatus2, key2, err := disp.DisperseBlob(ctx, paddedData2, 0, []uint8{0})
blobStatus2, key2, err := disp.DisperseBlob(ctx, paddedData2, 0, []uint8{0}, 0)
Expect(err).To(BeNil())
Expect(key2).To(Not(BeNil()))
Expect(blobStatus2).To(Not(BeNil()))
Expand Down

0 comments on commit 8519bab

Please sign in to comment.