Should HyperSDK Programs Prevent Re-Entrancy? #315
Replies: 8 comments 1 reply
-
How OpenZeppelin contracts protects against re-entrancy in the EVM: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fa680739e9c29e18670d44ae47dc1bc49de95629/contracts/security/ReentrancyGuard.sol |
Beta Was this translation helpful? Give feedback.
-
Here are the CosmWASM semantics: |
Beta Was this translation helpful? Give feedback.
-
One of the main cited use cases of re-entrancy is flash loans and it is hard to unbundle this from the re-entrancy. There are other legit re-entrancy use cases, like hooks and such, but on this particular message let's just discuss flashloans: On flashloans Flashloan is a tool, a means to end. Currently flashloan use cases include
The question should not be "do we need flashloans" but "What are the beneficial use cases, and how do we enable them or do we need to enable them"
Both Solana and Osmosis (and other Cosmos SDK chains) prevent re-entrancy. |
Beta Was this translation helpful? Give feedback.
-
For the reference, here is a list of major historical re-entrancy attacks |
Beta Was this translation helpful? Give feedback.
-
Agoric views: https://www.youtube.com/watch?v=38oTyVv_D9I Recommended here: https://twitter.com/364mhz/status/1686483058688749568 |
Beta Was this translation helpful? Give feedback.
-
Solana: https://docs.solana.com/developing/programming-model/calling-between-programs#reentrancy |
Beta Was this translation helpful? Give feedback.
-
Sui example of flash loan with "hot potato" pattern: https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/defi/sources/flash_lender.move
|
Beta Was this translation helpful? Give feedback.
-
May be required for EIP-2535:https://eips.ethereum.org/EIPS/eip-2535 Source: https://twitter.com/neirenoir/status/1686458097022156810 |
Beta Was this translation helpful? Give feedback.
-
Over the last few years, re-entrancy has been used to successfully attack (https://consensys.github.io/smart-contract-best-practices/attacks/reentrancy/) a number of smart contracts (like the DAO on Ethereum).
We have the opportunity to disable re-entrancy altogether while building HyperSDK Programs and are currently in search of good reasons not to do so. Please leave a comment if you have any thoughts!
Related Tweet: https://twitter.com/_patrickogrady/status/1686388809272033282
Beta Was this translation helpful? Give feedback.
All reactions