Skip to content

Test/indexer mod coverage - #152

Merged
valoryyaa-byte merged 4 commits into
RWA-ToolKit:mainfrom
jhaydeeee-web:test/indexer-mod-coverage
Jul 28, 2026
Merged

Test/indexer mod coverage#152
valoryyaa-byte merged 4 commits into
RWA-ToolKit:mainfrom
jhaydeeee-web:test/indexer-mod-coverage

Conversation

@jhaydeeee-web

@jhaydeeee-web jhaydeeee-web commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Closes #37
Closes #38
Closes #39
Closes #40

Summary

What was implemented:

  1. Address encoding — address_scval_encodes_account_and_contract: encodes a G-address and a C-address, checks each produces the right ScAddress variant, and round-trips back to the original strkey via address_to_string. Plus address_scval_rejects_invalid_strkey: a garbage string and a malformed C... string both return IndexError::Strkey.
  2. U128/I128 round-trip — scval_u128_and_negative_i128_round_trip: a U128 with hi=1, lo=0 → "18446744073709551616"; an I128 with hi=-1, lo high-bit-set → "-9223372036854775808", pinning the two's-complement reconstruction of the halves.
  3. Struct-of-vec / vec-of-struct — scval_struct_of_vec_and_vec_of_struct: an ScMap with a tags field holding an ScVec → {"tags": ["a","b"]}; and an ScVec of two ScMaps → [{"id":1},{"id":2}], locking both recursive branches of scval_to_json.
  4. Invalid symbol — build_invoke_envelope_rejects_invalid_symbol_instead_of_panicking: a 40-char method name and one with invalid characters ("not a symbol!") both return IndexError::Xdr, confirming the ScSymbol conversion failure is handled as an error, not a panic.

…rkey

address_scval() had no direct coverage of either address-kind branch, nor
of the error path when a strkey is malformed for the branch it's routed
into.
The hi/lo reconstruction in scval_to_json() was only exercised with a
small positive I128 and no U128 case at all. Add a U128 value that
depends on the hi half, and an I128 edge case (hi < 0, lo's high bit
set) to pin the two's-complement combination of the halves.
scval_to_json() recurses on both ScMap and ScVec, but nothing pinned a
map with a vec-valued field or a vec of maps, so a regression in either
recursive branch (e.g. accidentally flattening a nested vec, or losing
struct field names inside an array) wouldn't be caught.
build_invoke_envelope() converts the method name into an ScSymbol via
try_into(), mapping failure to IndexError::Xdr. Nothing exercised that
path, so a future change to error handling there (e.g. an unwrap creeping
in) could turn a bad method name into a panic instead of a normal error.
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@jhaydeeee-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@valoryyaa-byte
valoryyaa-byte merged commit 68b1858 into RWA-ToolKit:main Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants