Skip to content

Commit

Permalink
Merge pull request #305 from onflow/gregor/small-improvements-1
Browse files Browse the repository at this point in the history
General improvements tech-debt
  • Loading branch information
devbugging authored Jun 14, 2024
2 parents 1a81274 + 15b73f5 commit e412885
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ func (b *BlockChainAPI) GetTransactionByBlockNumberAndIndex(
return handleError[*Transaction](b.logger, err)
}

highestIndex := len(block.TransactionHashes) - 1
if index > hexutil.Uint(highestIndex) {
if int(index) >= len(block.TransactionHashes) {
return nil, nil
}

Expand Down
6 changes: 4 additions & 2 deletions services/requester/kms_key_rotation_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func NewKMSKeyRotationSigner(
keys []cloudkms.Key,
logger zerolog.Logger,
) (*KMSKeyRotationSigner, error) {
logger = logger.With().Str("component", "cloud_kms_signer").Logger()

if len(keys) == 0 {
return nil, fmt.Errorf(
"could not create KMS key rotation signer, no KMS keys provided",
Expand All @@ -63,11 +65,11 @@ func NewKMSKeyRotationSigner(
err,
)
}
logger.Info().Str("public-key", kmsSigner.PublicKey().String()).Msg("KMS signer added")

kmsSigners[i] = kmsSigner
}

logger = logger.With().Str("component", "cloud_kms_signer").Logger()

return &KMSKeyRotationSigner{
kmsSigners: kmsSigners,
signersLen: len(kmsSigners),
Expand Down
2 changes: 1 addition & 1 deletion services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (e *EVM) SendRawTransaction(ctx context.Context, data []byte) (common.Hash,
script := e.replaceAddresses(runTxScript)
flowID, err := e.signAndSend(ctx, script, hexEncodedTx)
if err != nil {
e.logger.Error().Err(err).Str("data", string(data)).Msg("failed to send transaction")
e.logger.Error().Err(err).Str("data", string(hexEncodedTx)).Msg("failed to send transaction")
return common.Hash{}, err
}

Expand Down

0 comments on commit e412885

Please sign in to comment.