When a user enqueues a batch of calls in their account contract, all private functions get processed first, and all public functions get enqueued afterwards. But this can be a problem if one of the private functions enqueues a public call, since it breaks the expected ordering. For instance, if the user creates a batch with:
- Enqueue call to public function
A
- Call private function
privB (which enqueues a call to public function B)
It'd be expected that A gets processed before B. However, since privB is processed first by the account contract, then B is enqueued before A. This can be confusing to the user. I know first-hand because I just lost over an hour trying to debug an issue #1639 caused by this. And to make it more humilliating it was me who wrote the code account contract entrypoint. Oh well.
Self-rant aside, we should tweak the entrypoint so, instead of receiving two arrays of FunctionCalls (one for private, one for public), it receives a single array of FunctionCalls with a flag indicating whether each is private or public. This requires modifying the entrypoint_payload.ts and entrypoint.nr files. We should also update accordingly the pseudocode for the account contract in the Accounts guide in the docs.
When a user enqueues a batch of calls in their account contract, all private functions get processed first, and all public functions get enqueued afterwards. But this can be a problem if one of the private functions enqueues a public call, since it breaks the expected ordering. For instance, if the user creates a batch with:
AprivB(which enqueues a call to public functionB)It'd be expected that
Agets processed beforeB. However, sinceprivBis processed first by the account contract, thenBis enqueued beforeA. This can be confusing to the user. I know first-hand because I just lost over an hour trying to debug an issue #1639 caused by this. And to make it more humilliating it was me who wrote the code account contract entrypoint. Oh well.Self-rant aside, we should tweak the entrypoint so, instead of receiving two arrays of FunctionCalls (one for private, one for public), it receives a single array of FunctionCalls with a flag indicating whether each is private or public. This requires modifying the
entrypoint_payload.tsandentrypoint.nrfiles. We should also update accordingly the pseudocode for the account contract in the Accounts guide in the docs.