Description
Refactor the contract to read fractional token balances directly from raw WASM byte slices, skipping expensive Rust struct allocations.
Architecture & Context
For high-frequency queries like balance checks, deserializing host environment data into full Rust structs consumes massive amounts of CPU instructions. Zero-copy deserialization allows the contract to extract exactly the needed bytes directly from memory, drastically lowering gas fees.
Technical Requirements
- Intercept the raw byte payload from the Soroban host environment.
- Implement pointer arithmetic and offset reading in Rust to extract the
i128 balance.
- Ensure all unsafe memory boundaries are heavily documented and proven safe.
Acceptance Criteria
Description
Refactor the contract to read fractional token balances directly from raw WASM byte slices, skipping expensive Rust struct allocations.
Architecture & Context
For high-frequency queries like balance checks, deserializing host environment data into full Rust structs consumes massive amounts of CPU instructions. Zero-copy deserialization allows the contract to extract exactly the needed bytes directly from memory, drastically lowering gas fees.
Technical Requirements
i128balance.Acceptance Criteria