From 82576afaafa26a38551c79fd2988d3633317e07c Mon Sep 17 00:00:00 2001 From: Ian Shim Date: Tue, 19 Mar 2024 22:23:16 -0700 Subject: [PATCH] error context --- core/assignment.go | 2 +- core/thegraph/state.go | 4 ++-- disperser/batcher/encoding_streamer.go | 7 +++++-- disperser/cmd/batcher/main.go | 6 ++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/assignment.go b/core/assignment.go index 46f5abfb01..a0b661dd51 100644 --- a/core/assignment.go +++ b/core/assignment.go @@ -106,7 +106,7 @@ func (c *StdAssignmentCoordinator) GetAssignments(state *OperatorState, blobLeng gammaChunkLength := big.NewInt(int64(info.ChunkLength) * int64((info.ConfirmationThreshold - info.AdversaryThreshold))) denom := new(big.Int).Mul(gammaChunkLength, totalStakes) if denom.Cmp(big.NewInt(0)) == 0 { - return nil, AssignmentInfo{}, fmt.Errorf("gammaChunkLength %d and total stake in quorum %d must be greater than 0", gammaChunkLength, totalStakes) + return nil, AssignmentInfo{}, fmt.Errorf("gammaChunkLength %d and total stake in quorum %d must be greater than 0", gammaChunkLength, quorum) } m := roundUpDivideBig(num, denom) diff --git a/core/thegraph/state.go b/core/thegraph/state.go index bcda049945..acbc848545 100644 --- a/core/thegraph/state.go +++ b/core/thegraph/state.go @@ -123,7 +123,7 @@ func (ics *indexedChainState) GetIndexedOperatorState(ctx context.Context, block } } if len(aggKeys) == 0 { - return nil, errors.New("no aggregate public keys found for any of the specified quorums") + return nil, fmt.Errorf("no aggregate public keys found for any of the specified quorums (%v) at block number %d", quorums, blockNumber) } indexedOperators, err := ics.getRegisteredIndexedOperatorInfo(ctx, uint32(blockNumber)) @@ -149,7 +149,7 @@ func (ics *indexedChainState) GetIndexedOperatorInfoByOperatorId(ctx context.Con ) err := ics.querier.Query(context.Background(), &query, variables) if err != nil { - ics.logger.Error("Error requesting for operator", "err", err) + ics.logger.Error("Error requesting for operator", "err", err, "operatorId", operatorId.Hex(), "blockNumber", blockNumber) return nil, err } diff --git a/disperser/batcher/encoding_streamer.go b/disperser/batcher/encoding_streamer.go index c4bf7d7e75..71d10e259c 100644 --- a/disperser/batcher/encoding_streamer.go +++ b/disperser/batcher/encoding_streamer.go @@ -314,7 +314,6 @@ func (e *EncodingStreamer) RequestEncodingForBlob(ctx context.Context, metadata }, ChunkLength: chunkLength, } - assignments, info, err := e.assignmentCoordinator.GetAssignments(state.OperatorState, blobLength, blobQuorumInfo) if err != nil { e.logger.Error("[RequestEncodingForBlob] error getting assignments", "err", err) @@ -343,7 +342,6 @@ func (e *EncodingStreamer) RequestEncodingForBlob(ctx context.Context, metadata // Execute the encoding requests for ind := range pending { - res := pending[ind] // Create a new context for each encoding request @@ -502,6 +500,7 @@ func (e *EncodingStreamer) CreateBatch() (*batch, error) { for _, quorum := range blobQuorums[blobKey] { quorumPresent[quorum.QuorumID] = true } + // Check if the blob has valid quorums. If any of the quorums are not valid, delete the blobKey for _, quorum := range metadata.RequestMetadata.SecurityParams { _, ok := quorumPresent[quorum.QuorumID] if !ok { @@ -513,6 +512,10 @@ func (e *EncodingStreamer) CreateBatch() (*batch, error) { } } + if len(metadataByKey) == 0 { + return nil, errNoEncodedResults + } + // Transform maps to slices so orders in different slices match encodedBlobs := make([]core.EncodedBlob, len(metadataByKey)) blobHeaders := make([]*core.BlobHeader, len(metadataByKey)) diff --git a/disperser/cmd/batcher/main.go b/disperser/cmd/batcher/main.go index e412714ad0..51e3ed5fff 100644 --- a/disperser/cmd/batcher/main.go +++ b/disperser/cmd/batcher/main.go @@ -190,6 +190,11 @@ func RunBatcher(ctx *cli.Context) error { if err != nil { return err } + sender, err := wallet.SenderAddress(context.Background()) + if err != nil { + return err + } + logger.Info("Initialized Fireblocks wallet", "vaultAccountName", config.FireblocksConfig.VaultAccountName, "address", sender.Hex()) } else if len(config.EthClientConfig.PrivateKeyString) > 0 { privateKey, err := crypto.HexToECDSA(config.EthClientConfig.PrivateKeyString) if err != nil { @@ -207,6 +212,7 @@ func RunBatcher(ctx *cli.Context) error { if err != nil { return err } + logger.Info("Initialized PrivateKey wallet", "address", address.Hex()) } else { return errors.New("no wallet is configured. Either Fireblocks or PrivateKey wallet should be configured") }