clarinet
clarinet copied to clipboard
Analysis pass for checking SIP functions
This suggestion originates from a discussion in Discord.
can we add checks for sip token transfer functions whether they do a transfer only or more bad things?
If I understand the request correctly, this pass would analyze a contract implementing a SIP, 009 for example, and try to verify statically if it is performing the operations specified in the SIP, and no other unexpected operations.
Correct, when contracts use unguarded traits like sip-9 or sip-10 traits or oracles users can provide implementations that could cause harm to other users or the contract due to as-contract. See also https://github.com/LNow/clarity-notes/blob/main/security/traits.md
One solution is to white list trusted implementations and store them on-chain like the marketplace here: https://github.com/boomcrypto/clarity-mainnet-contracts/blob/main/contracts/SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S/marketplace-v4.clar#L250
The requested analysis in this issue would help developers in detecting bad implementation and users in re-verifying the added contracts by the e.g. marketplace admin.
I like the idea. However if something like this will be implemented, please make it optional and allow user so somehow mark contracts that should not be reported as potentially malicious.
SIP-009 and SIP-010 defines traits and traits only. I can easily imagine a deflationary FT token that burns small % of itself with each transaction. Or NFT that forces you to transfer few STX to contract each time you transfer it to a different wallet in order to increase NFT value. Or FT/NFT that calls different contract to verify that user is allowed to perform transfer or mark it somewhere.
Closing due to lack of activity. If this is still needed, please file a new issue.