Reentrancy

Hey,
do you guys know if a general Reentrancy is possible in Move?
I know that there is nothing like a fallback function in Move like there was in Solidity/Ethereum.
I was just wondering because I know there are some other possibilities besides the fallback function.
Thanks :slight_smile:

Hi Nutella404,

No that is not possible in Move. The reason is that when each module is published, the bytecode verifier will statically check if all external types and procedure invokation matches their definition site, and abort publishing if such error happens. Thus each procedure is guarenteed to invoke a known, already type-checked procedure store on chain.

Best
Runtian

3 Likes

Hey runtianz1,
which interaction between modules is allowed and which not?
And how can you ensure that 2 modules can not call each other and by accident one drains the other.
Is the reason that the bytecode verifier would abort because of an error? and what type of error would this be?

Thanks for the help

which interaction between modules is allowed and which not?

  • If a module declares public functions, other modules can call those functions
  • If a modules declares struct or resource types, other modules can use those types

These are the only kinds of interactions between modules that are allowed.

And how can you ensure that 2 modules can not call each other and by accident one drains the other.

It’s difficult to answer this question without a more concrete scenario. But as a partial answer: modules are just code; they do not have any state (such as funds that can be drained). Instead, resources hold state, and the code of a module defines what operations are allowed on a resource (e.g., who can withdraw the funds).