chore: compressed repr. should store disc as part of data#2282
chore: compressed repr. should store disc as part of data#2282SwenSchaeferjohann wants to merge 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThe pull request modifies discriminator handling across account interface and compressed/decompressed account data processing. Changes shift from rebuilding account data with explicit discriminator prefixes to incorporating 8-byte discriminators as direct prefixes in hashing and data construction operations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sdk-libs/sdk-types/src/interface/program/compression/pda.rs (1)
142-148:⚠️ Potential issue | 🔴 CriticalInconsistency in
OutAccountInfo.dataformat betweenpda.rsandaccount.rspaths.The data field format is inconsistent across code paths. In
pda.rs(decompression),OutAccountInfo.dataincludes the 8-byte discriminator prefix (disc + borsh), with data_hash calculated over both. However, inaccount.rs(modification viato_account_info()),OutAccountInfo.datacontains only the borsh serialization without the discriminator prefix, and data_hash is calculated on the account object directly.Both paths populate the same
OutAccountInfostructure, so this format mismatch will break downstream consumers. Additionally, the data_hash calculations differ between paths (pda.rs hashes disc+borsh, account.rs hashes account), which could cause validation failures. Updateaccount.rsto mirror the pda.rs layout: include the discriminator prefix in the data field and recalculate data_hash consistently.
Summary by CodeRabbit