Skip to content

Commit

Permalink
add a few debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 committed Jan 10, 2025
1 parent d469e51 commit fa8f463
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions grpc/shared/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,19 @@ 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())
bech32Address, err := EncodeFromPublicKey(addressPrefix, publicKey)
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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion grpc/shared/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit fa8f463

Please sign in to comment.