Skip to content

Commit

Permalink
refactor: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Dec 17, 2024
1 parent 39c9f16 commit 788713f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
29 changes: 1 addition & 28 deletions api/clients/v2/disperser_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package clients
import (
"context"
"fmt"
"math/big"
"sync"

"github.com/Layr-Labs/eigenda/api"
disperser_rpc "github.com/Layr-Labs/eigenda/api/grpc/disperser/v2"
"github.com/Layr-Labs/eigenda/core"
"github.com/Layr-Labs/eigenda/core/meterer"
corev2 "github.com/Layr-Labs/eigenda/core/v2"
dispv2 "github.com/Layr-Labs/eigenda/disperser/common/v2"
"github.com/Layr-Labs/eigenda/encoding"
Expand Down Expand Up @@ -83,27 +81,7 @@ func NewDisperserClient(config *DisperserClientConfig, signer corev2.BlobRequest
if err != nil {
return nil, fmt.Errorf("error getting signer's account ID: %w", err)
}
// accountant = DummyAccountant(accountID)
accountant = &Accountant{
accountID: accountID,
reservation: &core.ReservedPayment{
SymbolsPerSecond: 0,
StartTimestamp: 0,
EndTimestamp: 0,
QuorumNumbers: []uint8{},
QuorumSplits: []byte{},
},
onDemand: &core.OnDemandPayment{
CumulativePayment: big.NewInt(0),
},
reservationWindow: 0,
pricePerSymbol: 0,
minNumSymbols: 0,
binRecords: make([]BinRecord, 3),
usageLock: sync.Mutex{},
cumulativePayment: big.NewInt(0),
numBins: uint32(meterer.MinNumBins),
}
accountant = DummyAccountant(accountID)
}

return &disperserClient{
Expand Down Expand Up @@ -259,28 +237,23 @@ func (c *disperserClient) GetBlobStatus(ctx context.Context, blobKey corev2.Blob
func (c *disperserClient) GetPaymentState(ctx context.Context) (*disperser_rpc.GetPaymentStateReply, error) {
err := c.initOnceGrpcConnection()
if err != nil {
fmt.Println(err.Error())
return nil, api.NewErrorInternal(err.Error())
}

accountID, err := c.signer.GetAccountID()
if err != nil {
fmt.Println(err.Error())
return nil, fmt.Errorf("error getting signer's account ID: %w", err)
}

signature, err := c.signer.SignPaymentStateRequest()
if err != nil {
fmt.Println(err.Error())
return nil, fmt.Errorf("error signing payment state request: %w", err)
}

fmt.Println("build request")
request := &disperser_rpc.GetPaymentStateRequest{
AccountId: accountID,
Signature: signature,
}
fmt.Println("built request", accountID, signature)
return c.client.GetPaymentState(ctx, request)
}

Expand Down
1 change: 0 additions & 1 deletion core/meterer/offchain_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ func (s *OffchainStore) GetLargestCumulativePayment(ctx context.Context, account
return nil, fmt.Errorf("failed to query payments for account: %w", err)
}

fmt.Println("Get largest cumulative payment", payments)
if len(payments) == 0 {
return big.NewInt(0), nil
}
Expand Down
2 changes: 0 additions & 2 deletions core/meterer/onchain_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package meterer

import (
"context"
"fmt"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -145,7 +144,6 @@ func (pcs *OnchainPaymentState) GetReservedPaymentByAccount(ctx context.Context,
pcs.ReservationsLock.Lock()
defer pcs.ReservationsLock.Unlock()
if reservation, ok := (pcs.ReservedPayments)[accountID]; ok {
fmt.Println("found reservation in cache", accountID)
return reservation, nil
}

Expand Down

0 comments on commit 788713f

Please sign in to comment.