rs-soroban-env icon indicating copy to clipboard operation
rs-soroban-env copied to clipboard

Make invoke/call contract require explicit flag to enable reentry

Open leighmcculloch opened this issue 2 years ago • 6 comments

Contracts have access to calling other contracts but we haven't yet implemented things we discussed would help prevent unintentional re-entry.

The idea is that calling a contract should require setting a flag for whether re-entry is allowed. And in this way the possibility for re-entry will be explicitly visible to the developer.

leighmcculloch avatar Aug 16 '22 03:08 leighmcculloch

The host side has disabled reentry. We still need to expose a flag to set it in the host functions and plumb it on the sdk side.

jayz22 avatar Oct 04 '22 15:10 jayz22

Reopened to follow up on: https://github.com/stellar/rs-soroban-env/pull/513#issuecomment-1267220021 cc @leighmcculloch

jayz22 avatar Oct 05 '22 15:10 jayz22

Reentrancy is needed to offer liquidity for flashloans. I like that reentrancy it's by default not allowed... and with a flag whether re-entry is wanted.

esteblock avatar Jun 06 '23 19:06 esteblock

Hello @leighmcculloch @jayz22 @graydon Do you have any update on this?

It's better to leave the possibility wuth an explicit flag, than to not let do reentry at all in Soroban!

esteblock avatar Jun 13 '23 17:06 esteblock

@esteblock We did not have chance to prioritize this. We may consider it in the next phase. This feature has just not been requested much and we felt it could create more footgun if used carelessly. I would like to understand first if there is any other ways to enable the flash loan feature without reentry. If you could provide more details (e.g. code snippet or WIP examples) that would be helpful!

jayz22 avatar Jun 15 '23 16:06 jayz22

Hello, we also need reentrancy feature for our smart-contracts

rudewalt avatar Jul 28 '23 10:07 rudewalt