diff --git a/api/clients/accountant.go b/api/clients/accountant.go index 122ec3eea..62ae51813 100644 --- a/api/clients/accountant.go +++ b/api/clients/accountant.go @@ -83,7 +83,7 @@ func (a *accountant) BlobPaymentInfo(ctx context.Context, numSymbols uint64, quo relativeBinRecord.Usage += numSymbols // first attempt to use the active reservation - binLimit := a.reservation.SymbolsPerSec * uint64(a.reservationWindow) + binLimit := a.reservation.SymbolsPerSecond * uint64(a.reservationWindow) if relativeBinRecord.Usage <= binLimit { if err := QuorumCheck(quorumNumbers, a.reservation.QuorumNumbers); err != nil { return 0, big.NewInt(0), err diff --git a/api/clients/accountant_test.go b/api/clients/accountant_test.go index d40f75550..a786aeaae 100644 --- a/api/clients/accountant_test.go +++ b/api/clients/accountant_test.go @@ -19,11 +19,11 @@ const numBins = uint32(3) func TestNewAccountant(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 100, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 100, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(500), @@ -50,11 +50,11 @@ func TestNewAccountant(t *testing.T) { func TestAccountBlob_Reservation(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 200, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 200, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(500), @@ -102,11 +102,11 @@ func TestAccountBlob_Reservation(t *testing.T) { func TestAccountBlob_OnDemand(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 200, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 200, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1500), @@ -161,11 +161,11 @@ func TestAccountBlob_InsufficientOnDemand(t *testing.T) { func TestAccountBlobCallSeries(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 200, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 200, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), @@ -213,11 +213,11 @@ func TestAccountBlobCallSeries(t *testing.T) { func TestAccountBlob_BinRotation(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 1000, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 1000, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), @@ -255,11 +255,11 @@ func TestAccountBlob_BinRotation(t *testing.T) { func TestConcurrentBinRotationAndAccountBlob(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 1000, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 1000, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), @@ -302,11 +302,11 @@ func TestConcurrentBinRotationAndAccountBlob(t *testing.T) { func TestAccountBlob_ReservationWithOneOverflow(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 200, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 200, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), @@ -350,11 +350,11 @@ func TestAccountBlob_ReservationWithOneOverflow(t *testing.T) { func TestAccountBlob_ReservationOverflowReset(t *testing.T) { reservation := &core.ActiveReservation{ - SymbolsPerSec: 1000, - StartTimestamp: 100, - EndTimestamp: 200, - QuorumSplit: []byte{50, 50}, - QuorumNumbers: []uint8{0, 1}, + SymbolsPerSecond: 1000, + StartTimestamp: 100, + EndTimestamp: 200, + QuorumSplits: []byte{50, 50}, + QuorumNumbers: []uint8{0, 1}, } onDemand := &core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), diff --git a/core/chainio.go b/core/chainio.go index 340e9e6b1..b25cfa2a3 100644 --- a/core/chainio.go +++ b/core/chainio.go @@ -107,16 +107,16 @@ type Reader interface { GetAllVersionedBlobParams(ctx context.Context) (map[uint8]*BlobVersionParameters, error) // GetActiveReservations returns active reservations (end timestamp > current timestamp) - GetActiveReservations(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]ActiveReservation, error) + GetActiveReservations(ctx context.Context, accountIDs []string) (map[string]ActiveReservation, error) - // GetActiveReservationByAccount returns active reservation by account ID - GetActiveReservationByAccount(ctx context.Context, blockNumber uint32, accountID string) (ActiveReservation, error) + // GetActiveReservations returns active reservations (end timestamp > current timestamp) + GetActiveReservationByAccount(ctx context.Context, accountID string) (ActiveReservation, error) // GetOnDemandPayments returns all on-demand payments - GetOnDemandPayments(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]OnDemandPayment, error) + GetOnDemandPayments(ctx context.Context, accountIDs []string) (map[string]OnDemandPayment, error) - // GetOnDemandPaymentByAccount returns on-demand payment of an account - GetOnDemandPaymentByAccount(ctx context.Context, blockNumber uint32, accountID string) (OnDemandPayment, error) + // GetOnDemandPayments returns all on-demand payments + GetOnDemandPaymentByAccount(ctx context.Context, accountID string) (OnDemandPayment, error) } type Writer interface { diff --git a/core/data.go b/core/data.go index 430305690..6b0968552 100644 --- a/core/data.go +++ b/core/data.go @@ -9,6 +9,7 @@ import ( commonpb "github.com/Layr-Labs/eigenda/api/grpc/common" "github.com/Layr-Labs/eigenda/common" + paymentvault "github.com/Layr-Labs/eigenda/contracts/bindings/PaymentVault" "github.com/Layr-Labs/eigenda/encoding" "github.com/aws/aws-sdk-go-v2/service/dynamodb/types" "github.com/consensys/gnark-crypto/ecc/bn254" @@ -600,14 +601,7 @@ func ConvertToPaymentMetadata(ph *commonpb.PaymentHeader) *PaymentMetadata { // OperatorInfo contains information about an operator which is stored on the blockchain state, // corresponding to a particular quorum -type ActiveReservation struct { - SymbolsPerSec uint64 // reserve number of symbols per second - StartTimestamp uint64 // Unix timestamp that's valid for basically eternity - EndTimestamp uint64 - - QuorumNumbers []uint8 // allowed quorums - QuorumSplit []byte // ordered mapping of quorum number to payment split; on-chain validation should ensure split <= 100 -} +type ActiveReservation = paymentvault.IPaymentVaultReservation type OnDemandPayment struct { CumulativePayment *big.Int // Total amount deposited by the user diff --git a/core/eth/reader.go b/core/eth/reader.go index 3f47e3c3c..e59eab7d4 100644 --- a/core/eth/reader.go +++ b/core/eth/reader.go @@ -14,6 +14,7 @@ import ( ejectionmg "github.com/Layr-Labs/eigenda/contracts/bindings/EjectionManager" indexreg "github.com/Layr-Labs/eigenda/contracts/bindings/IIndexRegistry" opstateretriever "github.com/Layr-Labs/eigenda/contracts/bindings/OperatorStateRetriever" + paymentvault "github.com/Layr-Labs/eigenda/contracts/bindings/PaymentVault" regcoordinator "github.com/Layr-Labs/eigenda/contracts/bindings/RegistryCoordinator" stakereg "github.com/Layr-Labs/eigenda/contracts/bindings/StakeRegistry" "github.com/Layr-Labs/eigenda/core" @@ -37,6 +38,7 @@ type ContractBindings struct { EigenDAServiceManager *eigendasrvmg.ContractEigenDAServiceManager EjectionManager *ejectionmg.ContractEjectionManager AVSDirectory *avsdir.ContractAVSDirectory + PaymentVault *paymentvault.ContractPaymentVault } type Reader struct { @@ -616,42 +618,119 @@ func (t *Reader) GetAllVersionedBlobParams(ctx context.Context) (map[uint8]*core return res, nil } -func (t *Reader) GetActiveReservations(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]core.ActiveReservation, error) { - // contract is not implemented yet - return map[string]core.ActiveReservation{}, nil +func (t *Reader) GetActiveReservations(ctx context.Context, accountIDs []string) (map[string]core.ActiveReservation, error) { + // map accountIDs to addresses + accountAddresses := make([]gethcommon.Address, len(accountIDs)) + for i, accountID := range accountIDs { + accountAddresses[i] = gethcommon.HexToAddress(accountID) + } + + reservations_map := make(map[string]core.ActiveReservation) + reservations, err := t.bindings.PaymentVault.GetReservations(&bind.CallOpts{ + Context: ctx, + }, accountAddresses) + if err != nil { + return nil, err + } + + // since reservations are returned in the same order as the accountIDs, we can directly map them + for i, reservation := range reservations { + reservations_map[accountIDs[i]] = reservation + } + return reservations_map, nil } -func (t *Reader) GetActiveReservationByAccount(ctx context.Context, blockNumber uint32, accountID string) (core.ActiveReservation, error) { - // contract is not implemented yet - return core.ActiveReservation{}, nil +func (t *Reader) GetActiveReservationByAccount(ctx context.Context, accountID string) (core.ActiveReservation, error) { + reservation, err := t.bindings.PaymentVault.GetReservation(&bind.CallOpts{ + Context: ctx, + }, gethcommon.HexToAddress(accountID)) + if err != nil { + return core.ActiveReservation{}, err + } + return reservation, nil } -func (t *Reader) GetOnDemandPayments(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]core.OnDemandPayment, error) { - // contract is not implemented yet - return map[string]core.OnDemandPayment{}, nil +func (t *Reader) GetOnDemandPayments(ctx context.Context, accountIDs []string) (map[string]core.OnDemandPayment, error) { + // map accountIDs to addresses + accountAddresses := make([]gethcommon.Address, len(accountIDs)) + for i, accountID := range accountIDs { + accountAddresses[i] = gethcommon.HexToAddress(accountID) + } + payments_map := make(map[string]core.OnDemandPayment) + payments, err := t.bindings.PaymentVault.GetOnDemandAmounts(&bind.CallOpts{ + Context: ctx, + }, accountAddresses) + if err != nil { + return nil, err + } + + // since payments are returned in the same order as the accountIDs, we can directly map them + for i, payment := range payments { + payments_map[accountIDs[i]] = core.OnDemandPayment{ + CumulativePayment: payment, + } + } + return payments_map, nil } -func (t *Reader) GetOnDemandPaymentByAccount(ctx context.Context, blockNumber uint32, accountID string) (core.OnDemandPayment, error) { - // contract is not implemented yet - return core.OnDemandPayment{}, nil +func (t *Reader) GetOnDemandPaymentByAccount(ctx context.Context, accountID string) (core.OnDemandPayment, error) { + onDemandPayment, err := t.bindings.PaymentVault.GetOnDemandAmount(&bind.CallOpts{ + Context: ctx, + }, gethcommon.HexToAddress(accountID)) + if err != nil { + return core.OnDemandPayment{}, err + } + return core.OnDemandPayment{ + CumulativePayment: onDemandPayment, + }, nil } func (t *Reader) GetGlobalSymbolsPerSecond(ctx context.Context) (uint64, error) { - // contract is not implemented yet - return 0, nil + globalSymbolsPerSecond, err := t.bindings.PaymentVault.GlobalRateBinInterval(&bind.CallOpts{ + Context: ctx, + }) + if err != nil { + return 0, err + } + return globalSymbolsPerSecond.Uint64(), nil +} + +func (t *Reader) GetGlobalRateBinInterval(ctx context.Context) (uint64, error) { + globalRateBinInterval, err := t.bindings.PaymentVault.GlobalRateBinInterval(&bind.CallOpts{ + Context: ctx, + }) + if err != nil { + return 0, err + } + return globalRateBinInterval.Uint64(), nil } func (t *Reader) GetMinNumSymbols(ctx context.Context) (uint32, error) { - // contract is not implemented yet - return 0, nil + minNumSymbols, err := t.bindings.PaymentVault.MinNumSymbols(&bind.CallOpts{ + Context: ctx, + }) + if err != nil { + return 0, err + } + return uint32(minNumSymbols.Uint64()), nil } func (t *Reader) GetPricePerSymbol(ctx context.Context) (uint32, error) { - // contract is not implemented yet - return 0, nil + pricePerSymbol, err := t.bindings.PaymentVault.PricePerSymbol(&bind.CallOpts{ + Context: ctx, + }) + if err != nil { + return 0, err + } + return uint32(pricePerSymbol.Uint64()), nil } func (t *Reader) GetReservationWindow(ctx context.Context) (uint32, error) { - // contract is not implemented yet - return 0, nil + reservationWindow, err := t.bindings.PaymentVault.ReservationBinInterval(&bind.CallOpts{ + Context: ctx, + }) + if err != nil { + return 0, err + } + return uint32(reservationWindow.Uint64()), nil } diff --git a/core/meterer/meterer.go b/core/meterer/meterer.go index ba1f2cfc6..2c93626c3 100644 --- a/core/meterer/meterer.go +++ b/core/meterer/meterer.go @@ -281,5 +281,5 @@ func (m *Meterer) IncrementGlobalBinUsage(ctx context.Context, symbolsCharged ui // GetReservationBinLimit returns the bin limit for a given reservation func (m *Meterer) GetReservationBinLimit(reservation *core.ActiveReservation) uint64 { - return reservation.SymbolsPerSec * uint64(m.ChainPaymentState.GetReservationWindow()) + return reservation.SymbolsPerSecond * uint64(m.ChainPaymentState.GetReservationWindow()) } diff --git a/core/meterer/meterer_test.go b/core/meterer/meterer_test.go index d4298d601..99ece955e 100644 --- a/core/meterer/meterer_test.go +++ b/core/meterer/meterer_test.go @@ -125,8 +125,8 @@ func setup(_ *testing.M) { now := uint64(time.Now().Unix()) accountID1 = crypto.PubkeyToAddress(privateKey1.PublicKey).Hex() accountID2 = crypto.PubkeyToAddress(privateKey2.PublicKey).Hex() - account1Reservations = core.ActiveReservation{SymbolsPerSec: 100, StartTimestamp: now + 1200, EndTimestamp: now + 1800, QuorumSplit: []byte{50, 50}, QuorumNumbers: []uint8{0, 1}} - account2Reservations = core.ActiveReservation{SymbolsPerSec: 200, StartTimestamp: now - 120, EndTimestamp: now + 180, QuorumSplit: []byte{30, 70}, QuorumNumbers: []uint8{0, 1}} + account1Reservations = core.ActiveReservation{SymbolsPerSecond: 100, StartTimestamp: now + 1200, EndTimestamp: now + 1800, QuorumSplits: []byte{50, 50}, QuorumNumbers: []uint8{0, 1}} + account2Reservations = core.ActiveReservation{SymbolsPerSecond: 200, StartTimestamp: now - 120, EndTimestamp: now + 180, QuorumSplits: []byte{30, 70}, QuorumNumbers: []uint8{0, 1}} account1OnDemandPayments = core.OnDemandPayment{CumulativePayment: big.NewInt(3864)} account2OnDemandPayments = core.OnDemandPayment{CumulativePayment: big.NewInt(2000)} diff --git a/core/meterer/onchain_state.go b/core/meterer/onchain_state.go index 2725ef765..4e2ace64e 100644 --- a/core/meterer/onchain_state.go +++ b/core/meterer/onchain_state.go @@ -107,6 +107,33 @@ func (pcs *OnchainPaymentState) RefreshOnchainPaymentState(ctx context.Context, } // These parameters should be rarely updated, but we refresh them anyway pcs.PaymentVaultParams = paymentVaultParams + + pcs.ReservationsLock.Lock() + accountIDs := make([]string, 0, len(pcs.ActiveReservations)) + for accountID := range pcs.ActiveReservations { + accountIDs = append(accountIDs, accountID) + } + + activeReservations, err := tx.GetActiveReservations(ctx, accountIDs) + if err != nil { + return err + } + pcs.ActiveReservations = activeReservations + pcs.ReservationsLock.Unlock() + + pcs.OnDemandLocks.Lock() + accountIDs = make([]string, 0, len(pcs.OnDemandPayments)) + for accountID := range pcs.OnDemandPayments { + accountIDs = append(accountIDs, accountID) + } + + onDemandPayments, err := tx.GetOnDemandPayments(ctx, accountIDs) + if err != nil { + return err + } + pcs.OnDemandPayments = onDemandPayments + pcs.OnDemandLocks.Unlock() + return nil } @@ -115,7 +142,8 @@ func (pcs *OnchainPaymentState) GetActiveReservationByAccount(ctx context.Contex if reservation, ok := pcs.ActiveReservations[accountID]; ok { return reservation, nil } - res, err := pcs.GetActiveReservationByAccountOnChain(ctx, accountID) + // pulls the chain state + res, err := pcs.tx.GetActiveReservationByAccount(ctx, accountID) if err != nil { return core.ActiveReservation{}, err } @@ -128,11 +156,7 @@ func (pcs *OnchainPaymentState) GetActiveReservationByAccount(ctx context.Contex // GetActiveReservationByAccountOnChain returns on-chain reservation for the given account ID func (pcs *OnchainPaymentState) GetActiveReservationByAccountOnChain(ctx context.Context, accountID string) (core.ActiveReservation, error) { - blockNumber, err := pcs.tx.GetCurrentBlockNumber(ctx) - if err != nil { - return core.ActiveReservation{}, err - } - res, err := pcs.tx.GetActiveReservationByAccount(ctx, blockNumber, accountID) + res, err := pcs.tx.GetActiveReservationByAccount(ctx, accountID) if err != nil { return core.ActiveReservation{}, fmt.Errorf("reservation account not found on-chain: %w", err) } @@ -144,7 +168,8 @@ func (pcs *OnchainPaymentState) GetOnDemandPaymentByAccount(ctx context.Context, if payment, ok := pcs.OnDemandPayments[accountID]; ok { return payment, nil } - res, err := pcs.GetOnDemandPaymentByAccountOnChain(ctx, accountID) + // pulls the chain state + res, err := pcs.tx.GetOnDemandPaymentByAccount(ctx, accountID) if err != nil { return core.OnDemandPayment{}, err } @@ -156,11 +181,7 @@ func (pcs *OnchainPaymentState) GetOnDemandPaymentByAccount(ctx context.Context, } func (pcs *OnchainPaymentState) GetOnDemandPaymentByAccountOnChain(ctx context.Context, accountID string) (core.OnDemandPayment, error) { - blockNumber, err := pcs.tx.GetCurrentBlockNumber(ctx) - if err != nil { - return core.OnDemandPayment{}, err - } - res, err := pcs.tx.GetOnDemandPaymentByAccount(ctx, blockNumber, accountID) + res, err := pcs.tx.GetOnDemandPaymentByAccount(ctx, accountID) if err != nil { return core.OnDemandPayment{}, fmt.Errorf("on-demand not found on-chain: %w", err) } diff --git a/core/meterer/onchain_state_test.go b/core/meterer/onchain_state_test.go index efd7149a6..ae14dc55e 100644 --- a/core/meterer/onchain_state_test.go +++ b/core/meterer/onchain_state_test.go @@ -14,10 +14,10 @@ import ( var ( dummyActiveReservation = core.ActiveReservation{ - SymbolsPerSec: 100, - StartTimestamp: 1000, - EndTimestamp: 2000, - QuorumSplit: []byte{50, 50}, + SymbolsPerSecond: 100, + StartTimestamp: 1000, + EndTimestamp: 2000, + QuorumSplits: []byte{50, 50}, } dummyOnDemandPayment = core.OnDemandPayment{ CumulativePayment: big.NewInt(1000), diff --git a/core/mock/writer.go b/core/mock/writer.go index b700b8cd7..e1350edfe 100644 --- a/core/mock/writer.go +++ b/core/mock/writer.go @@ -218,25 +218,25 @@ func (t *MockWriter) PubkeyHashToOperator(ctx context.Context, operatorId core.O return result.(gethcommon.Address), args.Error(1) } -func (t *MockWriter) GetActiveReservations(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]core.ActiveReservation, error) { +func (t *MockWriter) GetActiveReservations(ctx context.Context, accountIDs []string) (map[string]core.ActiveReservation, error) { args := t.Called() result := args.Get(0) return result.(map[string]core.ActiveReservation), args.Error(1) } -func (t *MockWriter) GetActiveReservationByAccount(ctx context.Context, blockNumber uint32, accountID string) (core.ActiveReservation, error) { +func (t *MockWriter) GetActiveReservationByAccount(ctx context.Context, accountID string) (core.ActiveReservation, error) { args := t.Called() result := args.Get(0) return result.(core.ActiveReservation), args.Error(1) } -func (t *MockWriter) GetOnDemandPayments(ctx context.Context, blockNumber uint32, accountIDs []string) (map[string]core.OnDemandPayment, error) { +func (t *MockWriter) GetOnDemandPayments(ctx context.Context, accountIDs []string) (map[string]core.OnDemandPayment, error) { args := t.Called() result := args.Get(0) return result.(map[string]core.OnDemandPayment), args.Error(1) } -func (t *MockWriter) GetOnDemandPaymentByAccount(ctx context.Context, blockNumber uint32, accountID string) (core.OnDemandPayment, error) { +func (t *MockWriter) GetOnDemandPaymentByAccount(ctx context.Context, accountID string) (core.OnDemandPayment, error) { args := t.Called() result := args.Get(0) return result.(core.OnDemandPayment), args.Error(1) diff --git a/disperser/apiserver/server_test.go b/disperser/apiserver/server_test.go index 83e6273bc..52f61bc1e 100644 --- a/disperser/apiserver/server_test.go +++ b/disperser/apiserver/server_test.go @@ -760,11 +760,11 @@ func newTestServer(transactor core.Writer, testName string) *apiserver.Dispersal CumulativePayment: big.NewInt(3000), }, nil) mockState.On("GetActiveReservationByAccount", tmock.Anything, tmock.Anything).Return(core.ActiveReservation{ - SymbolsPerSec: 2048, - StartTimestamp: 0, - EndTimestamp: math.MaxUint32, - QuorumNumbers: []uint8{0, 1}, - QuorumSplit: []byte{50, 50}, + SymbolsPerSecond: 2048, + StartTimestamp: 0, + EndTimestamp: math.MaxUint32, + QuorumNumbers: []uint8{0, 1}, + QuorumSplits: []byte{50, 50}, }, nil) // append test name to each table name for an unique store table_names := []string{"reservations_server_" + testName, "ondemand_server_" + testName, "global_server_" + testName} diff --git a/test/integration_test.go b/test/integration_test.go index aebb546f4..8699c2cc4 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -223,7 +223,7 @@ func mustMakeDisperser(t *testing.T, cst core.IndexedChainState, store disperser paymentLimit := big.NewInt(512) mockState.On("GetActiveReservationByAccount", mock.Anything, mock.MatchedBy(func(account string) bool { return account == publicKey - })).Return(core.ActiveReservation{SymbolsPerSec: reservationLimit, StartTimestamp: 0, EndTimestamp: math.MaxUint32, QuorumSplit: []byte{50, 50}, QuorumNumbers: []uint8{0, 1}}, nil) + })).Return(core.ActiveReservation{SymbolsPerSecond: reservationLimit, StartTimestamp: 0, EndTimestamp: math.MaxUint32, QuorumSplits: []byte{50, 50}, QuorumNumbers: []uint8{0, 1}}, nil) mockState.On("GetActiveReservationByAccount", mock.Anything, mock.Anything).Return(core.ActiveReservation{}, errors.New("reservation not found")) mockState.On("GetOnDemandPaymentByAccount", mock.Anything, mock.MatchedBy(func(account string) bool {