aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

Consider allowing for calling of standard contract functions as internal

Open benesjan opened this issue 1 year ago • 0 comments

It's common that we have a function which is desirable to be executed both standalone (as an entrypoint) and from another function without additional kernel iteration (inlined function). We currently don't support this by macros and the only way how to achieve this is to have an internal function which is called by a wrapper entrypoint function and in the body of another function.

E.g.:

    #[private]
    fn wrapper_entrypoin() {
        _internal_function(to)
    }

    #[private]
    #[internal]
    fn _internal_function -> {
        ...
    }

    #[private]
    fn arbitrary_function_calling_the_internal_one() {
        // some code
        _internal_function()
        // some more code
    }

As Nico pointed out we would essentially want to introduce Solidity's public function and we currently only have Solidity's external and private.

Look for TODO(#9180) for where this would be desired.

benesjan avatar Oct 11 '24 13:10 benesjan