Lightprotocol / light-protocol

The ZK Compression Protocol For Solana
https://www.zkcompression.com
GNU General Public License v3.0
157 stars 27 forks source link

feat: Add `constraint =` attribute to `#[light_accounts]` macro #1217

Closed vadorovsky closed 2 weeks ago

vadorovsky commented 2 weeks ago

Similarly to Anchor's constraint = attribute, it can be used to ensure constraints for the given accounts. The constraint can use both regular and compressed accounts.

The most common use-case for it is ensuring the equality of public keys across regular and compressed accounts for security checks.

DNS example is updated to use it for ensuring that compressed NameRecord accounts can be modified only by original signers, with constraint = record.owner == signer.key().