Skip to content

Conversation

ERoydev
Copy link
Collaborator

@ERoydev ERoydev commented Sep 10, 2025

What

When in the client the user needs to deserialize(read) a field, when he reads the blockchain state for a certain account from his anchor deployed program.The dart-renderer should handle fixed-sized fields(arrays, etc..) in the readBorsh methods because it needs to know how much bytes(how long is the field) to take from the buffer to show the correct value.

I tried to handle that in a more abstract way, specifically from the visitors, but I struggled a lot there because the visitor passes recursively and I needed to have all that information in TypeManifest instead of me modifying a specific node. That is why I decided to keep using Aleksandar’s approach for using regex and comments, which i have extended.

Key Changes

  • Added support for fixed/variable-length arrays in readers/writers.
  • Standardized discriminator read/write helpers across accounts and instructions.
  • Expanded BinaryReader/BinaryWriter with array utilities and stricter validation.
  • Improved type manifest parsing with array length and option handling.
  • Refined visitor logic for structs and inline annotations.

@ERoydev ERoydev requested a review from failfmi September 10, 2025 12:54
@ERoydev ERoydev changed the title Fix/deserialization field sizes Support Deserialization of fields when they have fixed-size Sep 10, 2025
* add(typeManifest): Regex handler added for number formats

* add(): NumberTypeNodes return int type with exact rust integer type as a comment

* add(macros): Added formats handling in macros
@ERoydev ERoydev merged commit a7d34d2 into dev Sep 16, 2025
@failfmi failfmi deleted the fix/deserialization-field-sizes branch September 16, 2025 10:15
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.

1 participant