jarry-xiao / candyland

Proof of concept program for compressing NFTs
GNU Affero General Public License v3.0
111 stars 13 forks source link

Transaction Atomicity Attack Prevention #91

Closed samwise2 closed 2 years ago

samwise2 commented 2 years ago

Summary of Changes:

This PR adds two checks to dispense_nft_sol and dispense_token_sol. These checks ensure that the transaction containing either dispense_nft_sol or idispense_token_sol has only one instruction, and that the instruction is NOT to another instruction which CPI's to GumballMachine. This prevents a malicious user from taking advantage of the atomicity of transactions by trivially executing a failing transaction if they did not mint an NFT with the properties that they desired. More details are annotated in the contract.

jarry-xiao commented 2 years ago

Excellent work 👍