Skip to content

Commit

Permalink
minor code improvements
Browse files Browse the repository at this point in the history
wrap error, improved url formatting, orm fix
  • Loading branch information
RensR committed Sep 13, 2023
1 parent 8c2250f commit 0f2e9eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/chains/evm/logpoller/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ func (o *ORM) SelectIndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash
err := q.Select(&logs, `
SELECT * FROM evm_logs
WHERE evm_logs.evm_chain_id = $1
AND tx_hash = $3
AND event_sig = $4
AND tx_hash = $2
AND event_sig = $3
ORDER BY (evm_logs.block_number, evm_logs.log_index)`,
utils.NewBig(o.chainID), txHash.Bytes(), eventSig.Bytes())
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions core/services/ocr2/plugins/ccip/execution_reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,11 @@ func (r *ExecutionReportingPlugin) buildBatch(
continue
}
tokenData = append(tokenData, attestation)
} else {
tokenData = append(tokenData, []byte{})
continue
}

// No token data required
tokenData = append(tokenData, []byte{})
}

// Fee boosting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (usdc *OffchainTokenDataService) IsAttestationComplete(ctx context.Context,
if response.Status == AttestationStatusSuccess {
attestationBytes, err := hex.DecodeString(response.Attestation)
if err != nil {
return false, nil, err
return false, nil, fmt.Errorf("decode response attestation: %w", err)
}
return true, attestationBytes, nil
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func (usdc *OffchainTokenDataService) getAttemptInfoFromCCIPMessageId(ctx contex
}

func (usdc *OffchainTokenDataService) callAttestationApi(ctx context.Context, usdcMessageHash [32]byte) (AttestationResponse, error) {
fullAttestationUrl := fmt.Sprintf("%s/%s/%s/0x%s", usdc.attestationApi, version, attestationPath, hex.EncodeToString(usdcMessageHash[:]))
fullAttestationUrl := fmt.Sprintf("%s/%s/%s/0x%x", usdc.attestationApi, version, attestationPath, usdcMessageHash)
req, err := http.NewRequestWithContext(ctx, "GET", fullAttestationUrl, nil)
if err != nil {
return AttestationResponse{}, err
Expand Down

0 comments on commit 0f2e9eb

Please sign in to comment.