Skip to content

Conversation

@iuwqyir
Copy link
Contributor

@iuwqyir iuwqyir commented Mar 7, 2025

TL;DR

Improved transaction and log decoding logic by adding fallback mechanisms and validation checks.

What changed?

  • Extracted decoding logic into separate functions decodeLogsIfNeeded and decodeTransactionsIfNeeded
  • Added validation to check if ABI decoding was successful by verifying name and signature fields
  • Implemented fallback to contract service decoding when ABI decoding fails
  • Simplified the main handler logic by consolidating decoding paths

How to test?

  1. Test log decoding with valid ABI:
    • Send request with decode=true and valid event ABI
    • Verify logs are decoded correctly
  2. Test transaction decoding with invalid ABI:
    • Send request with decode=true and invalid function ABI
    • Verify fallback to contract service decoding
  3. Test with decoding disabled:
    • Send request with decode=false
    • Verify raw logs/transactions are returned

Why make this change?

The previous implementation didn't handle ABI decoding failures gracefully. This change ensures more reliable decoding by validating the results and falling back to the contract service when needed, improving the overall robustness of the API.

@iuwqyir iuwqyir mentioned this pull request Mar 7, 2025
Copy link
Contributor Author

iuwqyir commented Mar 7, 2025

@iuwqyir iuwqyir requested a review from a team March 7, 2025 18:39
@iuwqyir iuwqyir marked this pull request as ready for review March 7, 2025 18:39
@iuwqyir iuwqyir requested review from AmineAfia and catalyst17 March 10, 2025 16:06
@iuwqyir iuwqyir changed the base branch from 03-07-fix_signature_handling to graphite-base/170 March 10, 2025 16:09
@iuwqyir iuwqyir force-pushed the 03-07-use_contract_api_as_a_fallback_for_decoding_if_signature_based_fails branch from 12818b5 to e9a8eb5 Compare March 10, 2025 16:09
@iuwqyir iuwqyir changed the base branch from graphite-base/170 to main March 10, 2025 16:09
@iuwqyir iuwqyir force-pushed the 03-07-use_contract_api_as_a_fallback_for_decoding_if_signature_based_fails branch from e9a8eb5 to 7c49c60 Compare March 10, 2025 16:09
@iuwqyir iuwqyir merged commit 0b05930 into main Mar 10, 2025
5 checks passed
@iuwqyir iuwqyir deleted the 03-07-use_contract_api_as_a_fallback_for_decoding_if_signature_based_fails branch March 10, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants