From fa8f46356c3ef0d3a6b6246f13f50331c2d1bb56 Mon Sep 17 00:00:00 2001 From: Bharath Date: Fri, 10 Jan 2025 16:18:08 +0530 Subject: [PATCH] add a few debug logs --- grpc/shared/validation.go | 9 +++++---- grpc/shared/validation_test.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/grpc/shared/validation.go b/grpc/shared/validation.go index 30357cb2e..f7464f8d3 100644 --- a/grpc/shared/validation.go +++ b/grpc/shared/validation.go @@ -135,11 +135,11 @@ func unmarshallAllocationTxs(allocation *bundlev1alpha1.Allocation, prevBlockHas processedTxs := types.Transactions{} payload := allocation.GetPayload() - log.Info("Found a potential allocation in the rollup data. Checking if it is valid.") + log.Debug("Found a potential allocation in the rollup data. Checking if it is valid.", "prevBlockHash", common.BytesToHash(prevBlockHash).String(), "auctioneerBech32Address", auctioneerBech32Address) - if !bytes.Equal(payload.PrevRollupBlockHash, prevBlockHash) { + if !bytes.Equal(payload.GetPrevRollupBlockHash(), prevBlockHash) { allocationsWithInvalidPrevBlockHash.Inc(1) - return nil, errors.New("prev block hash do not match in allocation") + return nil, errors.New("prev block hash in allocation does not match the previous block hash") } publicKey := ed25519.PublicKey(allocation.GetPublicKey()) @@ -147,6 +147,7 @@ func unmarshallAllocationTxs(allocation *bundlev1alpha1.Allocation, prevBlockHas if err != nil { return nil, WrapError(err, fmt.Sprintf("failed to encode public key to bech32m address: %s", publicKey)) } + if auctioneerBech32Address != bech32Address { allocationsWithInvalidPubKey.Inc(1) return nil, fmt.Errorf("address in allocation does not match auctioneer address. expected: %s, got: %s", auctioneerBech32Address, bech32Address) @@ -163,7 +164,7 @@ func unmarshallAllocationTxs(allocation *bundlev1alpha1.Allocation, prevBlockHas return nil, fmt.Errorf("signature in allocation does not match the public key") } - log.Info("Allocation is valid. Unmarshalling the transactions in the bundle.") + log.Debug("Allocation is valid. Unmarshalling the transactions in the bundle.") // unmarshall the transactions in the bundle for _, allocationTx := range payload.GetTransactions() { ethtx := new(types.Transaction) diff --git a/grpc/shared/validation_test.go b/grpc/shared/validation_test.go index a917bc2c4..4bf274090 100644 --- a/grpc/shared/validation_test.go +++ b/grpc/shared/validation_test.go @@ -127,7 +127,7 @@ func TestUnmarshallAllocationTxs(t *testing.T) { }, prevBlockHash: []byte("not prev rollup block hash"), expectedOutput: types.Transactions{}, - wantErr: "prev block hash do not match in allocation", + wantErr: "prev block hash in allocation does not match the previous block hash", }, { description: "public key doesn't match",